[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [jetty-dev] How do I set a ServletContext attribute ?
|
Thank Jan.
----- Original Message -----
From: "Jan Bartel" <janb@xxxxxxxxxxx>
To: "Jean-Marc Strydom" <j-ms@xxxxxxxxxxxxx>; "Jetty @ Eclipse developer
discussion list" <jetty-dev@xxxxxxxxxxx>
Sent: Friday, May 22, 2009 1:32 AM
Subject: Re: [jetty-dev] How do I set a ServletContext attribute ?
Jean-Marc,
For both jetty6.x and jetty7.x it is:
For context attributes:
webappcontext.setAttribute(String, Object);
For context init params:
webappcontext.setInitParameter(String,String);
cheers
Jan
Jean-Marc Strydom wrote:
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
------------------------------------------------------------------------
_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev
--
Jan Bartel, Webtide LLC | janb@xxxxxxxxxxx | http://www.webtide.com
--------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.339 / Virus Database: 270.12.36/2126 - Release Date: 05/21/09
06:22:00