public class VibeServlet
extends HttpServlet
HttpServletRequest and HttpServletResponse
into ServerHttpExchange. You need to configure this servlet and
provide your action to receive ServerHttpExchange by overriding
httpAction() like the following usage. When you configure
servlet, you must set asyncSupported to
true.
ServletRegistration.Dynamic reg = context.addServlet(VibeServlet.class.getName(), new VibeServlet() {
@Override
protected Action<ServerHttpExchange> httpAction() {
return server.httpAction();
}
});
reg.setAsyncSupported(true);
reg.addMapping("/vibe");
With CDI, the following usage is also available.
@WebServlet(value = "/vibe", asyncSupported = true)
public class MyVibeServlet extends VibeServlet {
@Inject
private Server server;
@Override
protected Action<ServerHttpExchange> httpAction() {
return server.httpAction();
}
}
| Constructor and Description |
|---|
VibeServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected |
httpAction()
An
Action to consume ServerHttpExchange. |
protected void |
service(HttpServletRequest req,
HttpServletResponse resp) |
protected void service(HttpServletRequest req,
HttpServletResponse resp)
protectedhttpAction()
Action to consume ServerHttpExchange. By default, it
throws IllegalStateException so you should provide your action by
overriding it.Copyright 2014, The Vibe Project