i have application on url "http://game.appspot.com/". i need to call a servlet from this base root,it means that relative path to call the servlet should be "/" , but it is not working when i do :
<url-pattern>/</url-pattern>
in my web.xml file , and i can' t leave it empty like :
<url-pattern></url-pattern>
because there is an error when i am tryiing to deploy it to google app engine.
what should i do?
thank you!
There appears to be an older way of doing this with a welcome file servlet hack:
From http://www.coderanch.com/t/359995/Servlets/java/Servlets-Mapping-root-path-exclusively:
<servlet>
<description></description>
<display-name>test</display-name>
<servlet-name>test</servlet-name>
<servlet-class>Test</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>*.html</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
If you use index.html
you'll need to have index.html
on disk, even as a 0-byte file, in order for the servlet to get executed. I'd recommend setting the url-pattern to some other file extension, maybe *.xyz and then have a 0 byte index.xyz on disk associated with your servlet (I haven't tested that but it should work).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With