Instead there is a method in the servlet context : getRealPath(String 
relativefilename) -> then you can open a "normal" fileoutputstream.

-----Original Message-----
From: tamir [mailto:[EMAIL PROTECTED]]
Sent: 24 June 2002 11:31
To: 'Tomcat Users List'
Subject: RE: Can servlet write to file in /WEB-INF?


Hi,
Making URLConnection to a directory under WEB-INF, is the same like writing
this url in the explorer.
However, You can't go directly to any directory under WEB-INF in that way,
which justifies your failure of
writing to this directory.

You can write to files in this directory, if you don't use URLConnection.
That's what I think
Tamir

-----Original Message-----
From: john-paul delaney [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 22, 2002 10:48 AM
To: TC user list
Subject: Can servlet write to file in /WEB-INF?


I was trying to see if I could write to a file in the /WEB-INF directory but
I couldn't get it to work - is there a problem with a servlet writing to
this directory or is it just me (again ;( ) ?

thanks
/j-p.

URL url = context.getResource("/contextTest.txt");
URLConnection con = url.openConnection();
con.setDoOutput(true);
OutputStream out = con.getOutputStream();
PrintWriter pw = new PrintWriter(new OutputStreamWriter(out));
pw.println("foo");
pw.close();
out.close();



-----------------------
 JUSTATEST Art Online
  www.justatest.com




--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

**** DISCLAIMER **** 
"This e-mail and any attachments thereto may contain information 
which is confidential and/or protected by intellectual property 
rights and are intended for the sole use of the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, 
total or partial reproduction, communication or distribution in any form) 
by persons other than the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either 
by telephone or by e-mail and delete the material from any computer. 
Thank you for your cooperation."


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to