tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john S <email2jo...@gmail.com>
Subject Re: Problem Reading Property files
Date Tue, 26 May 2009 18:48:42 GMT
I placed under WEB-INF itself. I created a directory called config adn
placed the abc.props and abc.log under it.

Whether i need to configure them in the web.xml? or should i remove it from
there.

Because wen i removed the init param, there is no change i am getting the
same error......not able to find the abc.props or abc.log files
.........FILENOTFOUNDEXCEPTION.

Just want to know where should i specify them.

On Tue, May 26, 2009 at 2:34 PM, Juha Laiho <Juha.Laiho@iki.fi> wrote:

> john S wrote:
> > Actually, I am not sure where to place and configure the property
> > files (*SERVLET ARGS*) in tomcat.
>
> If it's ok for you to have the files deployed along with your application,
> then I'd like to propose the following:
> Place the files within /WEB-INF/ directory in your web application.
> You could also create a subdirectory within /WEB-INF/ to contain
> just these files, such as /WEB-INF/config/ .
>
> Then read the files with getResourceAsStream method of ServletContext,
> and process the stream to get the data you need. This way is specified
> by the Servlet specification, so is portable across different containers.
>
>
> Files places within /WEB-INF/ cannot be accessed by direct browser
> requests, so they are safe from prying eyes.
>
> The other way would be to place the configuration files outside
> your web application. For this you'll likely want to split the
> "root" directory for the files from the file names (and possibly
> directory hierarchy underneath the "root") so that the placement
> underneath the "root" is dictated by the application, but the "root"
> location is set from outside the application. For this there is no
> standard way, but you could use a Java system property (specified
> with "-Dprop_name=value" on the JVM command line), or Tomcat context
> parameters, to set the root directory. The placement underneath the
> root would still be as it is now. Then in your code you'd concatenate
> the "root" location with the file path/name from web.xml and process
> the files as such.
>
> --
>  ..Juha
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message