Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Embedded Jetty Servlet 3.0

This example project might help...

https://github.com/jetty-project/embedded-servlet-3.0

Look at the src/test/java/com/company/foo/EmbedMe.java for an example on how to setup the server configuration for various Servlet 3.x features.

Also note, you should update your connector configuration.
Apache with mod_ajp (and Jetty with Ajp13Socket) is discouraged.  Use Apache with mod_proxy (and Jetty with standard connectors).
The mod_proxy configuration is much better supported and maintained, both at the Apache side, and at the Jetty side. (plus you'll see a performance boost)


--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Mon, Dec 2, 2013 at 6:47 AM, Ramirez, Edwin <edwin.ramirez@xxxxxxxx> wrote:
Hello,

I have created a simple application with Jetty embedded (see code below), and I would like to programatically setup the servlet version to 3.  In particular, I would like to use the multipart features in HttpServletRequest such as getParts(), in order to read uploaded files.

...
    void JettyStartup(TreeMap conf) {
        Server server = new Server();

        Ajp13SocketConnector ajp = new Ajp13SocketConnector();
        ajp.setPort(conf.getInt("Listener.service.port"));
        ajp.setHost("localhost");

        server.addConnector(ajp);

        JettyHandler jh = new JettyHandler();
        jh.conf = conf;
        server.setHandler(jh);
        try {
            server.start();
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
...

public class JettyHandler extends AbstractHandler {
 public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response)
        throws IOException, ServletException
    {
        ...
        request.getParts();
        ...
    }
}


Thank you.

Edwin S. Ramirez
Senior Developer, Information Technology
Mount Sinai Medical Center
 
875 Avenue of the Americas (6th Ave.)
New York, NY 10001
 

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top