Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] How do I set a ServletContext attribute ?

Hi
 
I am new to Jetty.  I am currently involved in moving a webapp to run under embedded Jetty but need to set a ServletContext attribute at startup.  I am using the following code to invoke Jetty:
 

Server server = new Server();

Connector connector = new SelectChannelConnector();

connector.setPort(port);

server.setConnectors(new Connector[] { connector });

WebAppContext webappcontext = new WebAppContext();

webappcontext.setContextPath("/myapp");

webappcontext.setWar("./");

server.setHandler(webappcontext);

server.start();

While this is very easy to setup, I don't see any way of getting the ServletContext in the class that invokes Jetty (which appears to be possible in Jetty6).  I have looked through various examples on the net but they all refer to Jetty6. How can I do this in Jetty7?

 

Regards

Jean-Marc


Back to the top