richie
6 years ago
6 changed files with 75 additions and 13 deletions
@ -0,0 +1,15 @@
|
||||
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; |
||||
|
||||
public class DemoRequestHandlerBridge extends AbstractHttpHandlerProvider { |
||||
@Override |
||||
public BaseHttpHandler[] registerHandlers() { |
||||
|
||||
return new BaseHttpHandler[]{ |
||||
new DemoHttpHandler() |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.plugin.demo.web.request; |
||||
|
||||
import com.fr.decision.fun.impl.AbstractURLAliasProvider; |
||||
import com.fr.decision.webservice.url.alias.URLAlias; |
||||
import com.fr.decision.webservice.url.alias.URLAliasFactory; |
||||
|
||||
public class DemoURLAliasBridge extends AbstractURLAliasProvider { |
||||
@Override |
||||
public URLAlias[] registerAlias() { |
||||
return new URLAlias[] { |
||||
URLAliasFactory.createPluginAlias("/demo/text", "/demo/simple", true) |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.plugin.demo.web.request.handler; |
||||
|
||||
import com.fr.decision.fun.impl.BaseHttpHandler; |
||||
import com.fr.intelli.record.Focus; |
||||
import com.fr.intelli.record.Original; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
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; |
||||
|
||||
@EnableMetrics |
||||
public class DemoHttpHandler extends BaseHttpHandler { |
||||
|
||||
@Override |
||||
public RequestMethod getMethod() { |
||||
return RequestMethod.GET; |
||||
} |
||||
|
||||
@Override |
||||
public String getPath() { |
||||
return "/demo/text"; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isPublic() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
@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.flush(); |
||||
writer.close(); |
||||
} |
||||
} |
Loading…
Reference in new issue