<servlet-mapping>All URL patterns must begin with / (slash).
<servlet-name>MySerlvet</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
Case 1 : Match URL path
http://gigadot.net/mywebapp/api Matched
http://gigadot.net/mywebapp/api?query=document Matched
http://gigadot.net/mywebapp/api/resource Matched
http://gigadot.net/mywebapp/api/resource/file.txt Matched
http://gigadot.net/mywebapp/directory/api Does not Matched
Note :
Case 2 : Match extension
http://gigadot.net/mywebapp/api.action Matched
http://gigadot.net/mywebapp/dictionaty/api.action Matched
http://gigadot.net/mywebapp/resources/files.action?query=item Matched
http://gigadot.net/mywebapp/api.resource.action Matched
http://gigadot.net/mywebapp/directory/api.ACTION Does notMatched
http://gigadot.net/mywebapp/directory/api.actionist Does notMatched
Note:
Case 3 : Default servlet
It matches every request if no other url-pattern defined in web.xml matches. The servlet mapped to this pattern is called the default servlet. It is used explicitly to ensure that any malformed URL is handled rather than throwing an error.
No comments:
Post a Comment