mapování servletu na url, která jsou podmnožinou mapovaných url jiného servletu
Martin Kuba
makub na ics.muni.cz
Pondělí Listopad 23 17:30:37 CET 2009
Tomas Vojtech napsal(a):
> Zamýšleno tím bylo to, že všechny požadavky budou obslouženy servletem
> cgw kromě těch s url /interconnect/session/*, které půjdou na servlet
> sessions.
> Problém ale je ten, že požadavky s url /interconnect/session/* jdou na
> oba. Nejdříve se zavolá sessions servlet a potom cgw. Na pořadí mapování
> servletů nezáleží... Zkouším to na tomcatu 6.0.20.
To je proti Servlet API Specification 2.4. Zavolat se má jenom jeden. Cituji:
Upon receipt of a client request, the Web container determines the Web application
to which to forward it. The Web application selected must have the the longest
context path that matches the start of the request URL. The matched part of the URL
is the context path when mapping to servlets.
The Web container next must locate the servlet to process the request using
the path mapping procedure described below.
The path used for mapping to a servlet is the request URL from the request
object minus the context path and the path parameters. The URL path mapping
rules below are used in order. The first successful match is used with no further
matches attempted:
1. The container will try to find an exact match of the path of the request to the
path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix. This is done
by stepping down the path tree a directory at a time, using the ’/’ character as
a path separator. The longest match determines the servlet selected.
3. If the last segment in the URL path contains an extension (e.g. .jsp), the serv-
let container will try to match a servlet that handles requests for the extension.
An extension is defined as the part of the last segment after the last ’.’ char-
acter.
4. If neither of the previous three rules result in a servlet match, the container will
attempt to serve content appropriate for the resource requested. If a "default"
servlet is defined for the application, it will be used.
The container must use case-sensitive string comparisons for matching.
SRV.11.2 Specification of Mappings
In the Web application deployment descriptor, the following syntax is used to define
mappings:
• A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used
for path mapping.
• A string beginning with a ‘*.’ prefix is used as an extension mapping.
• A string containing only the ’/’ character indicates the "default" servlet of
the application. In this case the servlet path is the request URI minus the con-
text path and the path info is null.
• All other strings are used for exact matches only.
Makub
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno Martin Kuba
Institute of Computer Science email: makub na ics.muni.cz
Masaryk University http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ mobil: +420-603-533775
--------------------------------------------------------------
------------- další část ---------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5262 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://amaio.cz/pipermail/konference/attachments/20091123/290a40d5/attachment.bin>
Další informace o konferenci Konference