Re: Re: Re: Re: Re: Jetty as file server

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Jetty as file server

John Slave
>You will write a properties file which will have in it a list of the files to be
>served.

yes, ok

>Will you be stopping and re-starting Jetty each time this list changes, or do
>you want Jetty to track changes in the properties file dynamically?

do i need to stop jetty each time? Cannot do it dinamically modifying context runtime?

>How do people know that a new file is ready to be requested? Is there some index
>page which is also changed?

This is not a problem. I don't need it...


>Or do you want the Jetty-generated directory listing to be visible. but only
>showing the files which are available?

The visibility is not important. However it's important to not sharing entire directories for security reasons.

>BTW, which OS are you running on? Linux may offer an opportunity of doing what
>you need without any changes to Jetty.

I need to embed this behaviour in a java project. It should be platform independent...To do that i used (with success) jaminid to build
such fileserver on it by the way it has problem in shutdown...it leaves a socket opened...)


Chris Haynes


Thanks in advance
John Slave



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Jetty as file server

Chris Haynes
Right, next question:

Are the files to be served in one, known directory, or are they potentially in
directories all over the system (as in the http://minishare.sourceforge.net you
referred to)?

Chris


----- Original Message -----
From: "John Slave" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, October 08, 2005 4:59 PM
Subject: [Jetty-support] Re: Re: Re: Re: Re: Jetty as file server


> >You will write a properties file which will have in it a list of the files to
> >be served.
>
> yes, ok
>
>>Will you be stopping and re-starting Jetty each time this list changes, or do
>>you want Jetty to track changes in the properties file dynamically?
>
> do i need to stop jetty each time? Cannot do it dinamically modifying context
> runtime?
>
>>How do people know that a new file is ready to be requested? Is there some
>>index page which is also changed?
>
> This is not a problem. I don't need it...
>
>
>>Or do you want the Jetty-generated directory listing to be visible. but only
>>showing the files which are available?
>
> The visibility is not important. However it's important to not sharing entire
> directories for security reasons.
>
>>BTW, which OS are you running on? Linux may offer an opportunity of doing what
>>you need without any changes to Jetty.
>
> I need to embed this behaviour in a java project. It should be platform
> independent...To do that i used (with success) jaminid to build
> such fileserver on it by the way it has problem in shutdown...it leaves a
> socket opened...)
>
>
> Chris Haynes
>
>
> Thanks in advance
> John Slave
>





-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Jetty as file server

John Slave
In reply to this post by John Slave
>Right, next question:

>Are the files to be served in one, known directory, or are they potentially in
>directories all over the system (as in the http://minishare.sourceforge.net you
>referred to)?


They are in directories all over the system.
Is all this possible?


>Chris

Yours faithfully
John Slave



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: Jetty as file server

Chris Haynes
Yes, but you will need to write some Java.

The way I would do what you want is to extend the default ResourceHandler. I
would have a 'properties' file somewhere in which the keys are the names of the
files to be served and the values are the full paths to these files. Each time a
request arrives you first check to see if the resource file has been changed
(lastModified). If it has, re-load it. Now if the requested file name is one of
the resource keys, you ask the Resource Handler toserve the file for you.

I've not looked into the existing Jetty code to see how much you would have to
change.  I've done something similar before, which took about 100 lines of code.
It might be possible to do it in less.

Others might have other ideas of how to do it - but it's unlikely that there is
a way to do it with no coding whatsoever - because, apart from anything else,
your requirements means that the system must break out of the normal security
barrier given by a context.

Chris Haynes


----- Original Message -----
From: "John Slave" <[hidden email]>
To: <[hidden email]>
Sent: Saturday, October 08, 2005 5:50 PM
Subject: [Jetty-support] Re: Re: Re: Re: Re: Jetty as file server


> >Right, next question:
>
>>Are the files to be served in one, known directory, or are they potentially in
>>directories all over the system (as in the http://minishare.sourceforge.net 
>>you referred to)?
>
>
> They are in directories all over the system.
> Is all this possible?
>
>
>>Chris
>
> Yours faithfully
> John Slave





-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Jetty as file server

Greg Wilkins-5
In reply to this post by John Slave

John,

You have two approaches possible - as outlined by the responses by Eric and Chris.

you can use the normal file serving capability of Jetty (ResourceHandler or Default Servlet)
and the implement a security mechanism (another handler or a filter) to make sure only the
resources you want served are served.


OR

You can extend the file serving capability of Jetty (ResourceHandler or Default Servlet)
so that you modify the mapping of URIs to files - so that your files are found and only
your files are found.


As your files may come from all over the file system, then the second approach is
probably best.   You should just need to implement the getResource method to
perform the mapping that you want.

cheers





-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support