tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Download file Problem - 404 error
Date Wed, 01 Feb 2006 13:11:15 GMT
I've done code similar to this. Yore can go one of two ways:

1) Store your properties file in WEB- INF/classes and then call 
propFile.load(this.getClass().getClassLoader().getResourceAsStream("application.properties''));

2) Store the properties file anywhere in the webapp and call
propFile.load 
(request.getSession().getServletContext().getResourceAsStream( "/[webapp 
rel path]/application.properties"));

I think No. 1 would be preferable as it doesn't require a request object 
and can exist anywhere in code.

-- David

DEEPA M N wrote:
> Hi,
>   wen i checked the log file, i think the error might be in the line of the code.
>   root = propFile.getProperty("app.directory");
>    
>   This code should be able to download the files from the server. so i m using application.properties
where
>   app.directory="D:\\temp\\files\\"
>    
>   I doubt because of this line am i not able to run the appln. Pls let me know where
should i place this application.properties file.
>    
>   Regards
>   deepa
>    
>   Here is a code snnipet:
>   String JAVA_HOME = "application.properties";
>  // Get a handle on the properties file
>  try{
>  in = new FileInputStream(JAVA_HOME);
>  propFile = new Properties();
>  propFile.load(in);
>  }
>  catch (IOException ignore){}
>  separator = "/";
>  // Get the directory from the application.properties file
>  // e.g. C:\\Temp\\Files\\
>  root = propFile.getProperty("app.directory");
>    
>   Deepa
>   
>  }
>
>
>
> 				
> ---------------------------------
>  Jiyo cricket on Yahoo! India cricket
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message