General discussion


Writing To A Protected Directory

By elias_barreto ·
I am trying to write a file to a protected directory on a file server in java. My code looks like this:

HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
PrintWriter out = httpResponse.getWriter();

File write = new File("\\\\" + fname);
OutputStream fileOut = new FileOutputStream(write);

I am getting a handle invalid error. Then it says file can't be found. If I write to a public folder, the file gets written to just fine. How would I provide the credentials (username and password) so that I can write the file to the directory?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Related Discussions

Related Forums