tomcat - Mapping servlet to both mydomain/myservlet/ and mydomain/myservlet/index.html -


i have servlet, myservlet, in web.xml file under servlet-mapping have mapped url-pattern, index.html. requests http://mydomain/myservlet/index.html invoke servlet fine. requests http://mydomain/myservlet/ invoke pop-up login window. tried pattern /* instead, destroyed path stylesheets etc, , if put these in top level cause problems local hard-coded files.

is there way use urlrewritefilter (or else) incoming request http://mydomain/myservlet or http://mydomain/myservlet/ remaps http://mydomain/myservlet/index.html nothing else touched?

(i'm testing servlet on tomcat on local machine, although it's being deployed on old sun webserver.)

i think should trick:

<?xml version="1.0" encoding="utf-8"?> <!doctype urlrewrite public "-//tuckey.org//dtd urlrewrite 3.0//en" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">  <urlrewrite>     <rule>         <from>^/myservlet[/]{0,1}$</from>         <to>/myservlet/index.html</to>     </rule> </urlrewrite> 

the [/]{0,1} part doing [/]? signify 0 or 1 match in regex, using ? qualifier not work in url rewrite filter.


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -