httpobjects is available in maven central
org.httpobjects httpobjects 0.9.0 org.httpobjects.servlet httpobjects-servlet 0.9.0 org.httpobjects.jetty httpobjects-jetty-7-and-8 0.9.0 org.httpobjects.jetty httpobjects-jetty-6 0.9.0 org.httpobjects.netty httpobjects-netty 0.9.0
Yes. First, include the servlet implementation
org.httpobjects.servlet httpobjects-servlet 0.9.0
Then:
Yes. Choose one of the following:
org.httpobjects.jetty httpobjects-jetty-7-and-8 0.9.0 org.httpobjects.jetty httpobjects-jetty-6 0.9.0
And then launch the server:
/** * Java */ import org.httpobjects.*; import org.httpobjects.jetty.HttpObjectsJettyHandler; public class Example { public static void main(String[] args){ HttpObject speaker = new HttpObject("/speak"){ @Override public Response get(Request req) { return OK(Html("Hello World")); } }; HttpObjectsJettyHandler.launchServer(8080, speaker); } }
/** * Scala */ import org.httpobjects.jetty.HttpObjectsJettyHandler import org.httpobjects._ import org.httpobjects.DSL._ object Example { def main(args: Array[String]) { HttpObjectsJettyHandler.launchServer(8080, new HttpObject("/speak"){ override def get(request:Request) = OK(Html("Hello World")) } ) } }
Yes. There is a sample netty implementation that you can either use as-is or modify to fit into your existing netty.
org.httpobjects.netty httpobjects-netty 0.9.0
/** * Java */ import org.httpobjects.*; import org.httpobjects.netty.HttpobjectsNettySupport; public class Example { public static void main(String[] args){ HttpObject speaker = new HttpObject("/speak"){ @Override public Response get(Request req) { return OK(Html("Hello World")); } }; HttpobjectsNettySupport.serve(port, Arrays.asList(speaker)); } }