Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Init parameters

 
Karim zibari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Servlet and application context init parameters are read when the container first loads. They cannot be set during deployment. But this is not the behavior I get when I try to change the init parameters during deployment. I can actually change them and the changes show up when I retreive them from within my servlets.

Many thanks
Karim
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you could tell us where the magic setInitParameter is, we might tell you that you are right Are you using some third-party library, or a wrapper around ServletConfig ? This is not supposed to be part of the servlet spec.
[ January 31, 2006: Message edited by: Satou kurinosuke ]
 
Karim zibari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

there is no magic setInitParameter! Maybe I didn't put my question right. What I mean is that I changed the init parameters in the DD file by hand. And the changes showd up the servlets at deployment time.

Many thanks
Karim
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the misunderstanding.
Of course, you can change them by hand, in web.xml, as long as the container has not read it, i.e before deployment.
 
Karim zibari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but that's my problem. After the web.xml is loaded by the container, I manually change the init parameter. then I check if the new values can be accessed by my servlet. And they are. This is my problem.

Karim
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What server are you using ?

In Tomcat, there is an Automatic Application Deployment :
http://www.jajakarta.org/tomcat/tomcat5.0/ja/docs/tomcat-docs/config/host.html

I didn't know either that it could reload when web.xml was updated !
[ January 31, 2006: Message edited by: Satou kurinosuke ]
 
Karim zibari
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using Tomcat 5.0.28.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So your local host (the default in Tomcat) probably has autoDeploy set to true.

They cannot be set during deployment.

This is true as far as the servlet spec is concerned.
The auto update feature is a container specific functionality.
[ January 31, 2006: Message edited by: Satou kurinosuke ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic