jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@pivolis.com>
Subject RE: init parameters
Date Fri, 19 Sep 2003 08:09:24 GMT
Hi,

If you want to set init parameters in your web.xml, you have to put them
under the servlet redirector definition (and not under your servlet).

You can also call config.setInitParameter() from your testXXX() method
(this is provided by Cactus for testing and is not part of the Servlet
API).

-Vincent

> -----Original Message-----
> From: Geise, Torsten [mailto:Torsten.Geise@ee-consultants.de]
> Sent: 19 September 2003 08:27
> To: cactus-user@jakarta.apache.org
> Subject: init parameters
> 
> Hi folks,
> 
> how can i use my init parameters from web.xml. If i came to my
testcase,
> i have to do an instantiation for my servlet under test. But no
> initparameters was set to this new servlet from web.xml.
> I debuged the testcase and found my initparameters under:
> ServletTestCase.config.originalConfig.config.parent.children.<entry of
> ServletRedirector>.next.value. For instance you can see the
> config-initparameter for struts.
> 
> this= com.bmw.ibs.rss.utcsa.commands.anmeldung.GetAnmeldungCommandTest
> (ID=90)
> 	clientDelegate=
> org.apache.cactus.internal.client.WebClientTestCaseDelegate  (ID=220)
> 	config= org.apache.cactus.server.ServletConfigWrapper  (ID=123)
> 		ajc$JPF= org.aspectj.runtime.reflect.Factory  (ID=237)
> 
> class$org$apache$cactus$server$AbstractServletConfigWrapper=
> java.lang.Class
(org.apache.cactus.server.AbstractServletConfigWrapper)
> (ID=122)
> 		getInitParameter$ajcjp3=
> org.aspectj.runtime.reflect.JoinPointImpl$StaticPartImpl  (ID=238)
> 		setInitParameter$ajcjp1=
> org.aspectj.runtime.reflect.JoinPointImpl$StaticPartImpl  (ID=239)
> 		setServletName$ajcjp2=
> org.aspectj.runtime.reflect.JoinPointImpl$StaticPartImpl  (ID=240)
> 		initParameters= java.util.Hashtable  (ID=241)
> 		originalConfig=
> org.apache.catalina.core.StandardWrapperFacade  (ID=244)
> 			config= org.apache.catalina.core.StandardWrapper
> (ID=100)
> 				ADD_CHILD_EVENT= "addChild"
> 				ADD_MAPPER_EVENT= "addMapper"
> 				ADD_VALVE_EVENT= "addValve"
> 				info=
> "org.apache.catalina.core.StandardWrapper/1.0"
> 				REMOVE_CHILD_EVENT= "removeChild"
> 				REMOVE_MAPPER_EVENT= "removeMapper"
> 				REMOVE_VALVE_EVENT= "removeValve"
> 				sm=
> org.apache.catalina.util.StringManager  (ID=253)
> 				START_EVENT= "start"
> 				STOP_EVENT= "stop"
> 				available= 0
> 				children= java.util.HashMap  (ID=257)
> 				cluster= null
> 				countAllocated= 1
> 				debug= 0
> 				debug= 0
> 				facade=
> org.apache.catalina.core.StandardWrapperFacade  (ID=244)
> 				instance=
> org.apache.cactus.server.ServletTestRedirector  (ID=96)
> 				instancePool= null
> 				instanceSupport=
> org.apache.catalina.util.InstanceSupport  (ID=258)
> 				jspFile= null
> 				lifecycle=
> org.apache.catalina.util.LifecycleSupport  (ID=260)
> 				listeners= java.util.ArrayList  (ID=261)
> 				loader= null
> 				loadOnStartup= -1
> 				logger= null
> 				manager= null
> 				mapper= null
> 				mapperClass= null
> 				mappers= java.util.HashMap  (ID=263)
> 				maxInstances= 20
> 				name= "ServletRedirector"
> 				nInstances= 0
> 				parameters= java.util.HashMap  (ID=265)
> 				parent=
> org.apache.catalina.core.StandardContext  (ID=106)
> 					ADD_CHILD_EVENT= "addChild"
> 					ADD_MAPPER_EVENT= "addMapper"
> 					ADD_VALVE_EVENT= "addValve"
> 					info=
> "org.apache.catalina.core.StandardContext/1.0"
> 					REMOVE_CHILD_EVENT=
> "removeChild"
> 					REMOVE_MAPPER_EVENT=
> "removeMapper"
> 					REMOVE_VALVE_EVENT=
> "removeValve"
> 					sm=
> org.apache.catalina.util.StringManager  (ID=253)
> 					START_EVENT= "start"
> 					STOP_EVENT= "stop"
> 					applicationListeners=
> java.lang.String[0]  (ID=271)
> 					applicationListenersObjects=
> java.lang.Object[0]  (ID=272)
> 					applicationParameters=
> org.apache.catalina.deploy.ApplicationParameter[0]  (ID=274)
> 					available= true
> 					cachingAllowed= true
> 					charsetMapper=
> org.apache.catalina.util.CharsetMapper  (ID=276)
> 					charsetMapperClass=
> "org.apache.catalina.util.CharsetMapper"
> 					children= java.util.HashMap
> (ID=279)
> 						emptyHashIterator=
> java.util.HashMap$EmptyHashIterator  (ID=213)
> 						ENTRIES= 2
> 						KEYS= 0
> 						serialVersionUID=
> 362498820763181265
> 						VALUES= 1
> 						count= 6
> 						entrySet= null
> 						keySet= null
> 						keySet= null
> 						loadFactor= 0.75
> 						modCount= 6
> 						table=
> java.util.HashMap$Entry[11]  (ID=334)
> 							[0]= null
> 							[1]=
> java.util.HashMap$Entry  (ID=337)
> 							[2]= null
> 							[3]=
> java.util.HashMap$Entry  (ID=340)
> 								hash=
> 568868699
> 								key=
> "ServletRedirectorSecure"
> 								next=
> java.util.HashMap$Entry  (ID=345)
> 
> hash= -1422950858
> 
> key= "action"
> 
> next= null
> 
> value= org.apache.catalina.core.StandardWrapper  (ID=348)
> 
> ADD_CHILD_EVENT= "addChild"
> 
> ADD_MAPPER_EVENT= "addMapper"
> 
> ADD_VALVE_EVENT= "addValve"
> 
> info= "org.apache.catalina.core.StandardWrapper/1.0"
> 
> REMOVE_CHILD_EVENT= "removeChild"
> 
> REMOVE_MAPPER_EVENT= "removeMapper"
> 
> REMOVE_VALVE_EVENT= "removeValve"
> 
> sm= org.apache.catalina.util.StringManager  (ID=253)
> 
> START_EVENT= "start"
> 
> STOP_EVENT= "stop"
> 
> available= 0
> 
> children= java.util.HashMap  (ID=349)
> 
> cluster= null
> 
> countAllocated= 0
> 
> debug= 0
> 
> debug= 0
> 
> facade= org.apache.catalina.core.StandardWrapperFacade  (ID=350)
> 
> instance= com.bmw.utcj2ee.framework.webcontroller.UTCActionServlet
> (ID=351)
> 
> instancePool= null
> 
> instanceSupport= org.apache.catalina.util.InstanceSupport  (ID=352)
> 
> jspFile= null
> 
> lifecycle= org.apache.catalina.util.LifecycleSupport  (ID=353)
> 
> listeners= java.util.ArrayList  (ID=354)
> 
> loader= null
> 
> loadOnStartup= 2
> 
> logger= null
> 
> manager= null
> 
> mapper= null
> 
> mapperClass= null
> 
> mappers= java.util.HashMap  (ID=355)
> 
> maxInstances= 20
> 
> name= "action"
> 
> nInstances= 0
> 
> parameters= java.util.HashMap  (ID=356)
> 
> emptyHashIterator= java.util.HashMap$EmptyHashIterator  (ID=213)
> 
> ENTRIES= 2
> 
> KEYS= 0
> 
> serialVersionUID= 362498820763181265
> 
> VALUES= 1
> 
> count= 26
> 
> entrySet= null
> 
> keySet= java.util.HashMap$1  (ID=361)
> 
> keySet= null
> 
> loadFactor= 0.75
> 
> modCount= 28
> 
> table= java.util.HashMap$Entry[47]  (ID=365)
> 
> [0]= null
> 
> [1]= java.util.HashMap$Entry  (ID=366)
> 
> [2]= java.util.HashMap$Entry  (ID=367)
> 
> [3]= java.util.HashMap$Entry  (ID=368)
> 
> hash= -1354792126
> 
> key= "config"
> 
> next= null
> 
> value= "/WEB-INF/struts-config.xml"
> 
> [4]= null
> <snip/>
> 
> Thanks for any hints.
> 
> Torsten
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



Mime
View raw message