Hello André,

André Warnier wrote
> 
> - you need to tell your webapp where the uploaded files should be
> stored/retrieved
> - you cannot do it via an "alias" under Tomcat < v7 
> 

Exactly.


André Warnier wrote
> 
> - so instead of an alias, do it via a property in a properties file, which
> your webapp would read. This is (almost) a "pure java" solution, which
> would work under any servlet container of any version.
> 

I wish I knew how to do that and yes, I'm interested in an (almost) "pure
Java" solution.



May I precise what I did and what already works with Tomcat7:

1) When a user uploads a file to the server running Tomcat, I store the
file, for example, in a directory: "/home/d1/"

2) In a JSP, this user can view the list of the "n" files he uploaded:
--------------------------------------------------------------------------------------
< a href="/an_alias_1/file_1.txt"> file_1.txt < /a>
...
< a href="/an_alias_1/file_n.txt"> file_n.txt < /a>
--------------------------------------------------------------------------------------

3) In Tomcat7, I used the "aliases" properties of the "Context" element in
"META-INF/context.xml" to ("magically" to me :/), let Tomcat map these
addresses:
--------------------------------------------------------------------------------------
/an_alias_1/file_1.txt
...
/an_alias_1/file_n.txt
--------------------------------------------------------------------------------------
to their real addresses on the  filesystem:
--------------------------------------------------------------------------------------
/home/d1/file_1.txt 
...
/home/d1/file_n.txt 
--------------------------------------------------------------------------------------
so that the user could click on one of these links and retrieve/view the
corresponding resource.

Of course, I read carefully what you wrote, it looks like I'm really missing
something important because I have absolutely no idea how to "implement" the
same mechanism using a properties file as you suggest...
Would you be so very kind to to explain a bit more?

Thank you and best regards.

--
View this message in context: 
http://tomcat.10.n6.nabble.com/Tomcat6-Context-aliases-tp4678430p4686704.html
Sent from the Tomcat - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to