Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

web.xml deployment Problem

Elikster

2004-05-15

Replies:

Hello Folks,

 Got a problem which I been trying to figure out how to resolve this issue. One of the guys have a virtualhost and he put his web.xml in his WEB-INF directory. However, he could not get the url to work like this:

http://kinnierconsulting.com/Controller?GotoPage=home&hasFlash=true&isFirst=true

It works with this: http://kinnierconsulting.com/servlet/Controller?GotoPage=home&hasFlash=true&isFirst=true

So...how do I get his url to work by invoking the servlet without the /servlet/* in it?

It is setup with 1.3.29 with Tomcat 4.1.30.

Server XML:

<Server port="8005" shutdown="SHUTDOWN" debug="0">
<!-- Define the Tomcat Stand-Alone Service -->
    <Service name="Tomcat-Standalone">
    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8080" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" useURIValidationHack="false" disableUploadTimeout="true"/>

-->

<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector" port="8009" minProcessors="5" maxProcessors="75" enableLookups="true" redirectPort="8443" acceptCount="10" debug="0" connectionTimeout="0" useURIValidationHack="false" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Standalone" defaultHost="localhost" debug="0">
    <!-- Global logger unless overridden at lower levels -->
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
    <Realm className="org.apache.catalina.realm.MemoryRealm"/>
    <!-- Define the default virtual host -->
    <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true"/>
    <Host name="www.kinnierconsulting.com">
    <Alias>kinnierconsulting.com</Alias>
    <Context path="" docBase="/home/kinncons/public_html" reloadable="true" debug="0"/>
    <Context path="/manager" docBase="/usr/local/jakarta/jakarta-tomcat-4.1.30/server/webapps/manager" debug="0" privileged="true"/>
    </Host>
</Engine>
</Service>
</Server>

  His web.xml is defined as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>
  <servlet>
    <servlet-name>
       snoop
    </servlet-name>
    <servlet-class>
       SnoopServlet
    </servlet-class>
  </servlet>

  <servlet>
   <servlet-name>
      servletToJsp
   </servlet-name>
   <servlet-class>
      servletToJsp
   </servlet-class>
  </servlet>

  <servlet>
    <servlet-name>
       Controller
    </servlet-name>
    <servlet-class>
       Controller
    </servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>
       invoker
    </servlet-name>
    <url-pattern>
       /servlet/*
    </url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>
       snoop
    </servlet-name>
    <url-pattern>
       /snoop
    </url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>
       snoop
    </servlet-name>
    <url-pattern>
       /snoop/*
    </url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>
       snoop
    </servlet-name>
    <url-pattern>
       *.snp
    </url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>
       servletToJsp
    </servlet-name>
    <url-pattern>
       /servletToJsp
    </url-pattern>
  </servlet-mapping>

  <servlet-mapping>
    <servlet-name>
          Controller
    </servlet-name>
    <url-pattern>
          /Controller
    </url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>
          index.html
    </welcome-file>
  </welcome-file-list>

  <security-constraint>
   <web-resource-collection>
     <web-resource-name>Protected Area</web-resource-name>
     <!-- Define the context-relative URL(s) to be protected -->
     <url-pattern>/jsp/security/protected/*</url-pattern>
     <!-- If you list http methods, only those methods are protected -->
     <http-method>DELETE</http-method>
     <http-method>GET</http-method>
     <http-method>POST</http-method>
     <http-method>PUT</http-method>
   </web-resource-collection>
   <auth-constraint>
     <!-- Anyone with one of the listed roles may access this area -->
     <role-name>tomcat</role-name>
     <role-name>role1</role-name>
   </auth-constraint>
  </security-constraint>

  <!-- Default login configuration uses BASIC authentication -->

  <login-config>
   <auth-method>BASIC</auth-method>
   <realm-name>Example Basic Authentication Area</realm-name>
  </login-config>


  <!-- Form-based login is enabled by default. If you wish to
     try Basic authentication, comment out the <login-config>
     section below and uncomment the one above.
  <login-config>
   <auth-method>FORM</auth-method>
   <realm-name>Example Form-Based Authentication Area</realm-name>
   <form-login-config>
    <form-login-page>/jsp/security/login/login.jsp</form-login-page>
    <form-error-page>/jsp/security/login/error.jsp</form-error-page>
   </form-login-config>
  </login-config>
  -->

 I made a comment to him about the invoker part in his web.xml being defined as /servlet which make it work as it is, but he want it as what he wanted.
--
Best regards,
Elikster                   mailto:elik@(protected)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.