Browse Source

修改命名

pull/1/head
richie 6 years ago
parent
commit
b02c16a046
  1. 2
      plugin.xml
  2. 6
      src/main/java/com/fr/plugin/demo/web/request/DemoRequestHandlerBridge.java
  3. 3
      src/main/java/com/fr/plugin/demo/web/request/DemoURLAliasBridge.java
  4. 34
      src/main/java/com/fr/plugin/demo/web/request/handler/PrivateHttpHandler.java
  5. 4
      src/main/java/com/fr/plugin/demo/web/request/handler/PublicHttpHandler.java

2
plugin.xml

@ -15,5 +15,5 @@
<HttpHandlerProvider class="com.fr.plugin.demo.web.request.DemoRequestHandlerBridge"/>
<URLAliasProvider class="com.fr.plugin.demo.web.request.DemoURLAliasBridge"/>
</extra-decision>
<function-recorder class="com.fr.plugin.demo.web.request.handler.DemoHttpHandler"/>
<function-recorder class="com.fr.plugin.demo.web.request.handler.PublicHttpHandler"/>
</plugin>

6
src/main/java/com/fr/plugin/demo/web/request/DemoRequestHandlerBridge.java

@ -2,14 +2,16 @@ package com.fr.plugin.demo.web.request;
import com.fr.decision.fun.impl.AbstractHttpHandlerProvider;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.plugin.demo.web.request.handler.DemoHttpHandler;
import com.fr.plugin.demo.web.request.handler.PrivateHttpHandler;
import com.fr.plugin.demo.web.request.handler.PublicHttpHandler;
public class DemoRequestHandlerBridge extends AbstractHttpHandlerProvider {
@Override
public BaseHttpHandler[] registerHandlers() {
return new BaseHttpHandler[]{
new DemoHttpHandler()
new PublicHttpHandler(),
new PrivateHttpHandler()
};
}
}

3
src/main/java/com/fr/plugin/demo/web/request/DemoURLAliasBridge.java

@ -8,7 +8,8 @@ public class DemoURLAliasBridge extends AbstractURLAliasProvider {
@Override
public URLAlias[] registerAlias() {
return new URLAlias[] {
URLAliasFactory.createPluginAlias("/demo/text", "/demo/simple", true)
URLAliasFactory.createPluginAlias("/demo/simple/text", "/demo/text", true),
URLAliasFactory.createPluginAlias("/demo/simple/abc", "/demo/abc", false)
};
}
}

34
src/main/java/com/fr/plugin/demo/web/request/handler/PrivateHttpHandler.java

@ -0,0 +1,34 @@
package com.fr.plugin.demo.web.request.handler;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.third.springframework.web.bind.annotation.RequestMethod;
import com.fr.web.utils.WebUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
public class PrivateHttpHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
return RequestMethod.GET;
}
@Override
public String getPath() {
return "/demo/abc";
}
@Override
public boolean isPublic() {
return false;
}
@Override
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception {
PrintWriter writer = WebUtils.createPrintWriter(res);
writer.println("Hello, I am a private request.");
writer.flush();
writer.close();
}
}

4
src/main/java/com/fr/plugin/demo/web/request/handler/DemoHttpHandler.java → src/main/java/com/fr/plugin/demo/web/request/handler/PublicHttpHandler.java

@ -12,7 +12,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
@EnableMetrics
public class DemoHttpHandler extends BaseHttpHandler {
public class PublicHttpHandler extends BaseHttpHandler {
@Override
public RequestMethod getMethod() {
@ -33,7 +33,7 @@ public class DemoHttpHandler extends BaseHttpHandler {
@Focus(id = "com.fr.plugin.demo.web.request", text = "", source = Original.PLUGIN)
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception {
PrintWriter writer = WebUtils.createPrintWriter(res);
writer.println("Hello, I am a test.");
writer.println("Hello, I am a public request.");
writer.flush();
writer.close();
}
Loading…
Cancel
Save