Embedding jetty is very much like the setup via the jetty.xml files. So if you take a look at how you set it up in the xml approach you'll easily see how it gets getup in embedded mode.
http://wiki.eclipse.org/Jetty/Tutorial/Session_Clustering That isn't strictly what your looking for but between that and looking at the jetty*.xml files in the etc dir of the distribution you should be able to piece out what you need to do. feel free to follow up as needed cheers, jesse -- jesse mcconnell [email protected] On Sat, Mar 12, 2011 at 02:09, David Tanzer <[email protected]> wrote: > Hello, > > I am trying to implement a simple servlet which uses a HTTP session in > an embedded jetty container. To start jetty I use the following code: > > Server server = new Server(12043); > ServletContextHandler handler = new > ServletContextHandler(ServletContextHandler.SESSIONS); > handler.setContextPath("/"); > server.setHandler(handler); > ServletHolder holder = new ServletHolder(new BaseServlet()); > handler.addServlet(holder, "/*"); > server.start(); > server.join(); > > The servlet acquires a session with > > HttpSession session = request.getSession(true); > > and stores some data in it. Upon the next request it gets the session > with the following code: > > HttpSession session = request.getSession(false); > > and there the session is always null. I did not find any information on > the internet about this particular problem. I have also experimented > with setting a SessionManager or SessionIdManager, but that did not seem > to change anything. > > Kind Regards, > David > > _______________________________________________ > jetty-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/jetty-users > _______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
