Une des possibilit�s des servlet est de travailler sur le PathInfo.

Tu d�clares une servlet http://monservuer/servlet/getFile

Une requ�te de type
http://monservuer/servlet/getFile/undossier/unfichier.ext
appellera ta servlet getFile avec comme PathInfo "/undossier/unfichier.ext".
Tu peux alors r�pondre a cette requ�te comme bon te semble :-)

getPathInfo

public java.lang.String getPathInfo()

Returns any extra path information associated with the URL the client sent
when it made this request. The extra path information follows the servlet
path (the URI of the URL) but precedes the query string. This method returns
null if there was no extra path information. 
The information this method returns is the same as the value of the CGI
variable PATH_INFO.

Returns:
a String specifying extra path information that comes after the servlet path
but before the query string in the request URL; or null if the URL does not
have any extra path information

--------------------------------------------------------------------
Erik Mazoyer, Chef de projet
HyperOffice
6, rue Jacques Daguerre - 92565 Rueil-Malmaison Cedex
T�l. 01 41 96 96 76
Fax 01 41 96 96 77
M�l  [EMAIL PROTECTED] 

-----Message d'origine-----
De: Jerome Moliere [mailto:[EMAIL PROTECTED]]
Date: lundi 18 f�vrier 2002 16:44
�: [EMAIL PROTECTED]
Objet: Re: Servlet - JSP / Controle d'acces aux fichier




Olivier Dedieu wrote:

> Salut,
> 
> Deux petites questions li�es � la s�curit�s dans les appli Web bas�es
> sur les servlets (et JSP).
> 
> 1. Existe-t-il un moyen standard (J2EE) qui permet de controler
>    l'acces aux fichiers. En gros, j'aimerai que le serveur HTTP ou le
>    servlet container m'interroge pour savoir si il a le droit de
>    renvoyer le fichier (images, PDF, ...) qui vient de lui �tre
>    requet�.
cela ressemble fortement a un filtre non ?

je testerai avec ca, puisque tu peux mapper un ou n filtre vers 
n'importe quelle URL...probleme, comment le greffer dans Apache (trivial 
dans tomcat)...

Jerome

Répondre à