RE: Runtime created files not accessible.Please help.

2008-04-24 Thread Caldarale, Charles R
> From: Andreas [mailto:[EMAIL PROTECTED] 
> Subject: Re: Runtime created files not accessible.Please help.
> 
> By the way, do the newly created files have to be in some 
> place specific for tomcat to "see" them???

Not in particular, as long as the path used to retrieve the files is
known either to the webapp servlets, or is directly referenceable via
the webapp URL.

You might want to install Tomcat in a location that does not includes
spaces in the path - that can lead to a great deal of confusion.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Runtime created files not accessible.Please help.

2008-04-24 Thread Andreas
By the way, do the newly created files have to be in some place specific for 
tomcat to "see" them???



- Original Message - 
From: "Andreas" <[EMAIL PROTECTED]>

To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 11:05 PM
Subject: Re: Runtime created files not accessible.Please help.



Hello Marcus, Hello all.

Thank you very for ur help,although i dont seem to get any solution and 
it's just completely frustrating...


Marcus, when you say regular servlet you mean..?? simple JSP ?
I am not sure I got it.

Coz I also tested through a simple JSP and I got the same problems...

Best Regards,

Andreas.

- Original Message - 
From: "Milanez, Marcus" <[EMAIL PROTECTED]>

To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 5:33 PM
Subject: RES: Runtime created files not accessible.Please help.



Andreas,

Can you read the created files/folder using a regular servlet? If you
can do it so, I would advice you to dispatch download requests to this
servlet, read the requested file and then write it in response.
Something like this (in your doPost or doGet):

response.setContentType("application/x-msdownload");

String filePath = getServletContext().getRealPath("/") +
"your-correct-path" + request.getParameter("fileName");

File requestedFile = new File(filePath);

response.addHeader("Content-Disposition", "attachment;
filename=" + requestedFile.getName());

if (!requestedFile.exists()) {
logger.error("file doesnt exist : " + filePath);
}

ServletOutputStream out = null;
RandomAccessFile inputFile = null;

try {
inputFile = new RandomAccessFile(requestedFile,
"r");

Long contentLength =
Long.valueOf(inputFile.length());

response.setContentLength(contentLength.intValue());

out = response.getOutputStream();

byte[] buffer = new byte[4096];
int read = 0;
int totalRead = 0;

try {
while ((read = inputFile.read(buffer)) >
0) {
out.write(buffer, 0, read);
totalRead += read;
out.flush();
}
} catch (EOFException e) {
out.flush();
out.close();
} finally {

if (out != null) {
out.flush();
out.close();
}
if (inputFile != null) {
inputFile.close();
}
}


} catch (IOException e) {
logger.error(e.getMessage(), e);
} finally {
filePath = null;
requestedFile = null;
out = null;
inputFile = null;
}

I hope it helps you finding a way to solve your problem...

Yours,

Marcus Milanez

-----Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 11:14
Para: Tomcat Users List
Assunto: Re: Runtime created files not accessible.Please help.

mmm, I am not sure i got what you mean by "listed", but I will try to
describe to you the situation.

catalina home:  C:\Program Files\Apache Software Foundation\Tomcat 6.0
my project folder:   C:\Program Files\Apache Software Foundation\Tomcat
6.0\PROTEUS_9
(i build-deploy-run it through NetBeans 6.0.1)

web folder of project(containing pages) : C:\Program Files\Apache
Software Foundation\Tomcat 6.0\PROTEUS_9\web

usersessions folder:  C:\Program Files\Apache Software Foundation\Tomcat
6.0\PROTEUS_9\web\UserSessions

an istance of a created folder at runtime is this: C:\Program
Files\Apache Software Foundation\Tomcat
6.0\PROTEUS_9\web\UserSessions\admin_Thu_Apr_24_00.30.09_2008

and here is where i put everything the user downloads or creates,  so
that he will b able to retrieve it after the end of session.

If by chance you would like to warn me for the dots '.' in the path name
or the capital letters , I could say tha I have tried to create simple
path names without any dots or special characters and i had the same
problem.

Thnx so much.

Andreas.

- Original Message -
From: "Milanez, Marcus" <[EMAIL PROTECTED]>
To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:44 PM
Subject: RES: Runtime created files not accessible.Please help.



Could you please list the part of your code where you list the created
files? Where are they located, inside your webapp folder?

Yours,

Marcus Milanez

-----Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 10:39
Para: Tomcat Users List
Assunto: Re: Runtime created files not accessible.Please help.

Hello and many thnx for interest and help.

Yes, I do see the folders/files created by Java code during runtime with
file viewers, they seem all fine.

But tomcat won't open/see them, and even if i try to put the URL in my
browser I get HTTP Status 404.

The code is pretty much basic, Java.IO , FileReader/Writer and so on.

Tell me  please if i can be more specific or I should post something
more.

Thanx a lot,

Best Regards,

Andreas, Greece.

- Original Message -
From: "Milanez, Marcus" <[EMAIL PROTECTED]>
To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:28 PM
Subject: RES: Runtim

Re: Runtime created files not accessible.Please help.

2008-04-24 Thread Andreas

Hello Marcus, Hello all.

Thank you very for ur help,although i dont seem to get any solution and it's 
just completely frustrating...


Marcus, when you say regular servlet you mean..?? simple JSP ?
I am not sure I got it.

Coz I also tested through a simple JSP and I got the same problems...

Best Regards,

Andreas.

- Original Message - 
From: "Milanez, Marcus" <[EMAIL PROTECTED]>

To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 5:33 PM
Subject: RES: Runtime created files not accessible.Please help.



Andreas,

Can you read the created files/folder using a regular servlet? If you
can do it so, I would advice you to dispatch download requests to this
servlet, read the requested file and then write it in response.
Something like this (in your doPost or doGet):

response.setContentType("application/x-msdownload");

String filePath = getServletContext().getRealPath("/") +
"your-correct-path" + request.getParameter("fileName");

File requestedFile = new File(filePath);

response.addHeader("Content-Disposition", "attachment;
filename=" + requestedFile.getName());

if (!requestedFile.exists()) {
logger.error("file doesnt exist : " + filePath);
}

ServletOutputStream out = null;
RandomAccessFile inputFile = null;

try {
inputFile = new RandomAccessFile(requestedFile,
"r");

Long contentLength =
Long.valueOf(inputFile.length());

response.setContentLength(contentLength.intValue());

out = response.getOutputStream();

byte[] buffer = new byte[4096];
int read = 0;
int totalRead = 0;

try {
while ((read = inputFile.read(buffer)) >
0) {
out.write(buffer, 0, read);
totalRead += read;
out.flush();
}
} catch (EOFException e) {
out.flush();
out.close();
} finally {

if (out != null) {
out.flush();
out.close();
}
if (inputFile != null) {
inputFile.close();
}
}


} catch (IOException e) {
logger.error(e.getMessage(), e);
} finally {
filePath = null;
requestedFile = null;
out = null;
inputFile = null;
}

I hope it helps you finding a way to solve your problem...

Yours,

Marcus Milanez

-Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 11:14
Para: Tomcat Users List
Assunto: Re: Runtime created files not accessible.Please help.

mmm, I am not sure i got what you mean by "listed", but I will try to
describe to you the situation.

catalina home:  C:\Program Files\Apache Software Foundation\Tomcat 6.0
my project folder:   C:\Program Files\Apache Software Foundation\Tomcat
6.0\PROTEUS_9
(i build-deploy-run it through NetBeans 6.0.1)

web folder of project(containing pages) : C:\Program Files\Apache
Software Foundation\Tomcat 6.0\PROTEUS_9\web

usersessions folder:  C:\Program Files\Apache Software Foundation\Tomcat
6.0\PROTEUS_9\web\UserSessions

an istance of a created folder at runtime is this: C:\Program
Files\Apache Software Foundation\Tomcat
6.0\PROTEUS_9\web\UserSessions\admin_Thu_Apr_24_00.30.09_2008

and here is where i put everything the user downloads or creates,  so
that he will b able to retrieve it after the end of session.

If by chance you would like to warn me for the dots '.' in the path name
or the capital letters , I could say tha I have tried to create simple
path names without any dots or special characters and i had the same
problem.

Thnx so much.

Andreas.

- Original Message -
From: "Milanez, Marcus" <[EMAIL PROTECTED]>
To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:44 PM
Subject: RES: Runtime created files not accessible.Please help.



Could you please list the part of your code where you list the created
files? Where are they located, inside your webapp folder?

Yours,

Marcus Milanez

-----Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 10:39
Para: Tomcat Users List
Assunto: Re: Runtime created files not accessible.Please help.

Hello and many thnx for interest and help.

Yes, I do see the folders/files created by Java code during runtime with
file viewers, they seem all fine.

But tomcat won't open/see them, and even if i try to put the URL in my
browser I get HTTP Status 404.

The code is pretty much basic, Java.IO , FileReader/Writer and so on.

Tell me  please if i can be more specific or I should post something
more.

Thanx a lot,

Best Regards,

Andreas, Greece.

- Original Message -
From: "Milanez, Marcus" <[EMAIL PROTECTED]>
To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:28 PM
Subject: RES: Runtime created files not accessible.Please help.


Hi Andreas,

We do pretty much the same here and it is working fine. Could you please
post some parts of your code, so that we can see how you specify your
physical folders? Can you see the folders/files created using a file
viewer ?

Yours,

Marcus Milanez

-Mensagem original-
De:

Re: Runtime created files not accessible.Please help.

2008-04-24 Thread Piller Sébastien

Hello,

personnally, I noticed that there is a delay between the creation of a 
folder/file and the moment where this folder/file is available in my 
webapp...


I don't know why, but seems to be related to tomcat


Andreas a écrit :
mmm, I am not sure i got what you mean by "listed", but I will try to 
describe to you the situation.


catalina home:  C:\Program Files\Apache Software Foundation\Tomcat 6.0
my project folder:   C:\Program Files\Apache Software 
Foundation\Tomcat 6.0\PROTEUS_9

(i build-deploy-run it through NetBeans 6.0.1)

web folder of project(containing pages) : C:\Program Files\Apache 
Software Foundation\Tomcat 6.0\PROTEUS_9\web


usersessions folder:  C:\Program Files\Apache Software 
Foundation\Tomcat 6.0\PROTEUS_9\web\UserSessions


an istance of a created folder at runtime is this: C:\Program 
Files\Apache Software Foundation\Tomcat 
6.0\PROTEUS_9\web\UserSessions\admin_Thu_Apr_24_00.30.09_2008


and here is where i put everything the user downloads or creates,  so 
that he will b able to retrieve it after the end of session.


If by chance you would like to warn me for the dots '.' in the path 
name or the capital letters , I could say tha I have tried to create 
simple path names without

any dots or special characters and i had the same problem.

Thnx so much.

Andreas.

- Original Message - From: "Milanez, Marcus" 
<[EMAIL PROTECTED]>

To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:44 PM
Subject: RES: Runtime created files not accessible.Please help.



Could you please list the part of your code where you list the created
files? Where are they located, inside your webapp folder?

Yours,

Marcus Milanez

-Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 10:39
Para: Tomcat Users List
Assunto: Re: Runtime created files not accessible.Please help.

Hello and many thnx for interest and help.

Yes, I do see the folders/files created by Java code during runtime with
file viewers, they seem all fine.

But tomcat won't open/see them, and even if i try to put the URL in my
browser I get HTTP Status 404.

The code is pretty much basic, Java.IO , FileReader/Writer and so on.

Tell me  please if i can be more specific or I should post something
more.

Thanx a lot,

Best Regards,

Andreas, Greece.

- Original Message -
From: "Milanez, Marcus" <[EMAIL PROTECTED]>
To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:28 PM
Subject: RES: Runtime created files not accessible.Please help.


Hi Andreas,

We do pretty much the same here and it is working fine. Could you please
post some parts of your code, so that we can see how you specify your
physical folders? Can you see the folders/files created using a file
viewer ?

Yours,

Marcus Milanez

-Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 10:22
Para: users@tomcat.apache.org
Assunto: Runtime created files not accessible.Please help.

Hello everyone!

I have developed a jsf(java server faces) web application running on
tomcat 6.0 .

Maybe my questions will be a bit naive, but i kindly ask for your help
since i am not able to find solution myself.

The problem is this:

My web server needs to create new folders and write files in the folders
so that the end user will b able to download later.
The files I download or I create though, and save in my new folders
created at runtime, are not available for tomcat...
I get HTTP Status 404 , and I am unable to open them at runtime back
from the local disk.

So, what should I do to make the newly created folders and files
instantly available in Tomcat without restarting???
And what is the proper place for someone to put his application folder??

Thank you very much for your help...


Andreas, Greece.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Runtime created files not accessible.Please help.

2008-04-24 Thread Andreas
mmm, I am not sure i got what you mean by "listed", but I will try to 
describe to you the situation.


catalina home:  C:\Program Files\Apache Software Foundation\Tomcat 6.0
my project folder:   C:\Program Files\Apache Software Foundation\Tomcat 
6.0\PROTEUS_9

(i build-deploy-run it through NetBeans 6.0.1)

web folder of project(containing pages) : C:\Program Files\Apache Software 
Foundation\Tomcat 6.0\PROTEUS_9\web


usersessions folder:  C:\Program Files\Apache Software Foundation\Tomcat 
6.0\PROTEUS_9\web\UserSessions


an istance of a created folder at runtime is this: C:\Program Files\Apache 
Software Foundation\Tomcat 
6.0\PROTEUS_9\web\UserSessions\admin_Thu_Apr_24_00.30.09_2008


and here is where i put everything the user downloads or creates,  so that 
he will b able to retrieve it after the end of session.


If by chance you would like to warn me for the dots '.' in the path name or 
the capital letters , I could say tha I have tried to create simple path 
names without

any dots or special characters and i had the same problem.

Thnx so much.

Andreas.

- Original Message - 
From: "Milanez, Marcus" <[EMAIL PROTECTED]>

To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:44 PM
Subject: RES: Runtime created files not accessible.Please help.



Could you please list the part of your code where you list the created
files? Where are they located, inside your webapp folder?

Yours,

Marcus Milanez

-Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 10:39
Para: Tomcat Users List
Assunto: Re: Runtime created files not accessible.Please help.

Hello and many thnx for interest and help.

Yes, I do see the folders/files created by Java code during runtime with
file viewers, they seem all fine.

But tomcat won't open/see them, and even if i try to put the URL in my
browser I get HTTP Status 404.

The code is pretty much basic, Java.IO , FileReader/Writer and so on.

Tell me  please if i can be more specific or I should post something
more.

Thanx a lot,

Best Regards,

Andreas, Greece.

- Original Message -
From: "Milanez, Marcus" <[EMAIL PROTECTED]>
To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:28 PM
Subject: RES: Runtime created files not accessible.Please help.


Hi Andreas,

We do pretty much the same here and it is working fine. Could you please
post some parts of your code, so that we can see how you specify your
physical folders? Can you see the folders/files created using a file
viewer ?

Yours,

Marcus Milanez

-Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 10:22
Para: users@tomcat.apache.org
Assunto: Runtime created files not accessible.Please help.

Hello everyone!

I have developed a jsf(java server faces) web application running on
tomcat 6.0 .

Maybe my questions will be a bit naive, but i kindly ask for your help
since i am not able to find solution myself.

The problem is this:

My web server needs to create new folders and write files in the folders
so that the end user will b able to download later.
The files I download or I create though, and save in my new folders
created at runtime, are not available for tomcat...
I get HTTP Status 404 , and I am unable to open them at runtime back
from the local disk.

So, what should I do to make the newly created folders and files
instantly available in Tomcat without restarting???
And what is the proper place for someone to put his application folder??

Thank you very much for your help...


Andreas, Greece.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Runtime created files not accessible.Please help.

2008-04-24 Thread Andreas

Hello and many thnx for interest and help.

Yes, I do see the folders/files created by Java code during runtime with 
file viewers, they seem all fine.


But tomcat won't open/see them, and even if i try to put the URL in my 
browser I get HTTP Status 404.


The code is pretty much basic, Java.IO , FileReader/Writer and so on.

Tell me  please if i can be more specific or I should post something more.

Thanx a lot,

Best Regards,

Andreas, Greece.

- Original Message - 
From: "Milanez, Marcus" <[EMAIL PROTECTED]>

To: "Tomcat Users List" 
Sent: Thursday, April 24, 2008 4:28 PM
Subject: RES: Runtime created files not accessible.Please help.


Hi Andreas,

We do pretty much the same here and it is working fine. Could you please
post some parts of your code, so that we can see how you specify your
physical folders? Can you see the folders/files created using a file
viewer ?

Yours,

Marcus Milanez

-Mensagem original-
De: Andreas [mailto:[EMAIL PROTECTED]
Enviada em: quinta-feira, 24 de abril de 2008 10:22
Para: users@tomcat.apache.org
Assunto: Runtime created files not accessible.Please help.

Hello everyone!

I have developed a jsf(java server faces) web application running on
tomcat 6.0 .

Maybe my questions will be a bit naive, but i kindly ask for your help
since i am not able to find solution myself.

The problem is this:

My web server needs to create new folders and write files in the folders
so that the end user will b able to download later.
The files I download or I create though, and save in my new folders
created at runtime, are not available for tomcat...
I get HTTP Status 404 , and I am unable to open them at runtime back
from the local disk.

So, what should I do to make the newly created folders and files
instantly available in Tomcat without restarting???
And what is the proper place for someone to put his application folder??

Thank you very much for your help...


Andreas, Greece.

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]