You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Parsons Technical Services <pa...@earthlink.net> on 2004/03/18 00:30:13 UTC

A plan to access files outside the context/Tomcat?

I have a need to place and get, image files, to and from a directory outside
of the context and outside of Tomcat.

My plan is this:

Have an upload page to allow user to select local file on client and upload
to server. This is the same tactic as the manager is using with war files.

The folder will have rights set to allow read/write by Tomcat user.

This part, I think, will be staight forward. OK so far??

Next to retrieve the image and serve it back to the client is a little more
involved.

The plan:

Servlet to accept all request for the /context/pics/* .

Servlet reads file from directory and writes it out to the Servlet output
stream.

Am I nuts or is this a feasible plan?

Just need to know if I am going in the right direction and if anyone has any
code snippets of the servlet writes.

As for the file I/O I have that covered I think.

Any/all comments welcome.




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


Re: A plan to access files outside the context/Tomcat?

Posted by Parsons Technical Services <pa...@earthlink.net>.
Adrian,

Am running in standalone. Currently on 4.1.29 but production will be 5.0.19.

But will keep it in mind. If my app goes public I may need to set up Apache
to do virtual hosting.

Kumar,

I had considered that, but am running on MySQL and wanted to keep the
database as simple as possible(for my own sanity). Might change my mind.
OK, I just did a little reading and this sounds like an idea I can work
with.
So go ahead and send me both if you don't mind. Just in case. I am on Linux.


Thanks for the feed back. Additional comments welcome.

Doug


----- Original Message ----- 
From: "Adrian Lanning" <al...@hotmail.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, March 17, 2004 6:52 PM
Subject: Re: A plan to access files outside the context/Tomcat?


> Sounds like a workable solution.  Are you using apache or some other
> front-end to Tomcat?  If so then you can use an alias to serve up the
images
> rather than serve them up manually with your servlet.  I've done it both
> ways in content management systems I've made and letting apache do it
saves
> a class or two...
>
> Actually you might be able to let Tomcat do it for you if you set up a
> connector to listen on port 80.  I've never used Tomcat alone so don't
have
> any experience doing it that way.
>
> Adrian Lanning
>
> ----- Original Message ----- 
> From: "Parsons Technical Services" <pa...@earthlink.net>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Wednesday, March 17, 2004 6:30 PM
> Subject: A plan to access files outside the context/Tomcat?
>
>
> > I have a need to place and get, image files, to and from a directory
> outside
> > of the context and outside of Tomcat.
> >
> > My plan is this:
> >
> > Have an upload page to allow user to select local file on client and
> upload
> > to server. This is the same tactic as the manager is using with war
files.
> >
> > The folder will have rights set to allow read/write by Tomcat user.
> >
> > This part, I think, will be staight forward. OK so far??
> >
> > Next to retrieve the image and serve it back to the client is a little
> more
> > involved.
> >
> > The plan:
> >
> > Servlet to accept all request for the /context/pics/* .
> >
> > Servlet reads file from directory and writes it out to the Servlet
output
> > stream.
> >
> > Am I nuts or is this a feasible plan?
> >
> > Just need to know if I am going in the right direction and if anyone has
> any
> > code snippets of the servlet writes.
> >
> > As for the file I/O I have that covered I think.
> >
> > Any/all comments welcome.
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



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


Re: A plan to access files outside the context/Tomcat?

Posted by Adrian Lanning <al...@hotmail.com>.
Sounds like a workable solution.  Are you using apache or some other
front-end to Tomcat?  If so then you can use an alias to serve up the images
rather than serve them up manually with your servlet.  I've done it both
ways in content management systems I've made and letting apache do it saves
a class or two...

Actually you might be able to let Tomcat do it for you if you set up a
connector to listen on port 80.  I've never used Tomcat alone so don't have
any experience doing it that way.

Adrian Lanning

----- Original Message ----- 
From: "Parsons Technical Services" <pa...@earthlink.net>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, March 17, 2004 6:30 PM
Subject: A plan to access files outside the context/Tomcat?


> I have a need to place and get, image files, to and from a directory
outside
> of the context and outside of Tomcat.
>
> My plan is this:
>
> Have an upload page to allow user to select local file on client and
upload
> to server. This is the same tactic as the manager is using with war files.
>
> The folder will have rights set to allow read/write by Tomcat user.
>
> This part, I think, will be staight forward. OK so far??
>
> Next to retrieve the image and serve it back to the client is a little
more
> involved.
>
> The plan:
>
> Servlet to accept all request for the /context/pics/* .
>
> Servlet reads file from directory and writes it out to the Servlet output
> stream.
>
> Am I nuts or is this a feasible plan?
>
> Just need to know if I am going in the right direction and if anyone has
any
> code snippets of the servlet writes.
>
> As for the file I/O I have that covered I think.
>
> Any/all comments welcome.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

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