Reputation: 30885
i need to direct url in my web server to be :
http://localhost:8080/console/myws/mymethod
i have servlet class called MyServlet with some methods ( that in the end are web services converted with JAXWS) how can i map this servlet to be in the tomcat server if it possible without changing the servlet class name:
http://localhost:8080/console/myws/mymethod
here is my web.xml configuration i just can't make it work. i define console to be my Context root without the "/" just console
<listener>
<listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>jax-ws</servlet-name>
<servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jax-ws</servlet-name>
<url-pattern>/myws/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
90
</session-timeout>
</session-config>
also how can i debug the configuration in tomcat to check what i did wrong ?
Upvotes: 0
Views: 280
Reputation: 1108632
Assuming that /console
is the context path and the /mymethod
is the path info, then you need to map the servlet on /myws/*
.
<servlet-mapping>
<servlet-name>yourServletName</servlet-name>
<url-pattern>/myws/*</url-pattern>
</servlet-mapping>
The servlet class and name is totally independent from the URL pattern you choose, so you don't need to change it as well at all.
Upvotes: 2