axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barlotta, Timothy - Arlington, VA - Contractor" <Timothy.Barlo...@usps.gov>
Subject RE: Configuration setup with web.xml
Date Mon, 11 Oct 2004 15:53:41 GMT
Not really a question for the Axis forum but:

If you have a servlet filter and are trying to pass in whether you want
it on or not, the code would go in the init method.
	public void init(FilterConfig config) throws ServletException {
		if(log.isDebugEnabled()) {
			log.debug("init");
		}
		fc = config;
		// get init paramters
		String s = fc.getInitParameter("enabled");
		if(s==null) {
			enabled = true;
		}
		else if(s.equalsIgnoreCase("false")) {
			enabled = false;
		}

		if(log.isDebugEnabled()) {
			if(enabled) {
				log.debug("SecureFilter:enabled");
			}
			else {
				log.debug("SecureFilter:disabled");
			}
		}
	}

web.xml snippet
	<filter>
		<filter-name>SecureFilter</filter-name>
	
<filter-class>com.usps.wws.filter.SecureFilter</filter-class>

		<init-param>
			<param-name>enabled</param-name>
			<param-value>false</param-value>
		</init-param>
	</filter>

Servlet itself:
would be similar do it in the init method (except ServletConfig is past
in).

Tim


> -----Original Message-----
> From: Hubble, Christopher [mailto:CHRISTOPHER.L.HUBBLE@saic.com] 
> Sent: Monday, October 11, 2004 11:43 AM
> To: axis-user@ws.apache.org
> Subject: Configuration setup with web.xml
> 
> 
> How do I define something in the web.xml file and read it 
> into my program?
> 
> Chris
> 

Mime
View raw message