(i don't think this made it through the first time i sent it, so i'm trying again. apologies if you get this twice.)


i'm getting some weird problems with url rewriting in a
struts 1.2.4 webapp.

specifically, the urls generated by the form, link, and
rewrite tags have an extra "/" prepended to them.

struts is mapped like so in web.xml:

   <servlet-mapping>
     <servlet-name>action</servlet-name>
     <url-pattern>/console/*</url-pattern>
   </servlet-mapping>

here are examples of what's happening:

   source: <html:rewrite page="/chandler.css"/>
   output: //chandler.css

   source: <html:link page="/console/user/list">
   output: <a href="//console/user/list">

   source: <html:form action="/user/create">
   output: <form name="userForm" method="post"
                 action="//console/user/create">

i don't have any modules configured in struts-xml. here's
the mapping for the page that generates the above output:

     <action path="/user/list"
             type="org.osaf.chandler.server.web.UserAction"
             name="userForm"
             scope="request"
             validate="false"
             parameter="list">
       <forward name="ok" path="user.list"/>
     </action>

and here's the mapping for the action pointed to by the form:

     <action path="/user/create"
             type="org.osaf.chandler.server.web.UserAction"
             name="userForm"
             scope="request"
             validate="true"
             input="/console/user/list"
             parameter="create">
       <forward name="failure" path="/console/user/list"/>
       <forward name="success" path="/console/user/list"
                redirect="true"/>
     </action>

i've attached the full web.xml and struts-config.xml, in
case something non-obvious is throwing me off.

thanks!

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
         version="2.4">
  <display-name>Chandler Sharing Server</display-name>
  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
    <param-value>MessageResources</param-value>
  </context-param>
  <filter>
    <filter-name>webdavlog</filter-name>
    <filter-class>org.apache.slide.webdav.filter.LogFilter</filter-class>
    <init-param>
      <param-name>logFormat</param-name>
      <param-value>%T, %t, %P, %m, %s "%l", %i, %p</param-value>
    </init-param>
    <init-param>
      <param-name>outputToConsole</param-name>
      <param-value>false</param-value>
    </init-param>
    <init-param>
      <param-name>outputToServletLog</param-name>
      <param-value>true</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>webdavlog</filter-name>
    <servlet-name>webdav</servlet-name>
  </filter-mapping>
  <servlet>
    <servlet-name>webdav</servlet-name>
    <servlet-class>org.apache.slide.webdav.WebdavServlet</servlet-class>
    <init-param>
      <param-name>domain</param-name>
      <param-value>/WEB-INF/Domain.xml</param-value>
    </init-param>
    <init-param>
      <param-name>namespace</param-name>
      <param-value>chandler</param-value>
    </init-param>
    <init-param>
      <param-name>scope</param-name>
      <param-value/>
    </init-param>
    <init-param>
      <param-name>depth-limit</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>default-mime-type</param-name>
      <param-value>application/octet-stream</param-value>
    </init-param>
    <init-param>
      <param-name>default-servlet</param-name>
      <param-value>false</param-value>
    </init-param>
    <init-param>
      <param-name>directory-browsing</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>directory-browsing-hide-acl</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>directory-browsing-hide-locks</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>optimizePropfindOutput</param-name>
      <param-value>true</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>extendedAllprop</param-name>
      <param-value>false</param-value>
    </init-param>
    <init-param>
      <param-name>lockdiscoveryIncludesPrincipalURL</param-name>
      <param-value>false</param-value>
    </init-param>
    <init-param>
      <param-name>updateLastModified</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    <security-role-ref>
      <role-name>root</role-name>
      <role-link>root</role-link>
    </security-role-ref>
    <security-role-ref>
      <role-name>user</role-name>
      <role-link>user</role-link>
    </security-role-ref>
  </servlet>
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>convertNull</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/share/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>/console/*</url-pattern>
  </servlet-mapping>
  <jsp-config>
    <taglib>
      <taglib-uri>html</taglib-uri>
      <taglib-location>/WEB-INF/tld/struts-html-el.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>logic</taglib-uri>
      <taglib-location>/WEB-INF/tld/struts-logic-el.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>tiles</taglib-uri>
      <taglib-location>/WEB-INF/tld/struts-tiles-el.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>c</taglib-uri>
      <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>fmt</taglib-uri>
      <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>fn</taglib-uri>
      <taglib-location>/WEB-INF/tld/fn.tld</taglib-location>
    </taglib>
  </jsp-config>
  <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/error</location>
  </error-page>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>shared files</web-resource-name>
      <url-pattern>/share/*</url-pattern>
      <http-method>COPY</http-method>
      <http-method>DELETE</http-method>
      <http-method>GET</http-method>
      <http-method>HEAD</http-method>
      <http-method>LOCK</http-method>
      <http-method>MKCOL</http-method>
      <http-method>MOVE</http-method>
      <http-method>OPTIONS</http-method>
      <http-method>POST</http-method>
      <http-method>PROPFIND</http-method>
      <http-method>PROPPATCH</http-method>
      <http-method>PUT</http-method>
      <http-method>UNLOCK</http-method>
      <http-method>VERSION-CONTROL</http-method>
      <http-method>REPORT</http-method>
      <http-method>CHECKIN</http-method>
      <http-method>CHECKOUT</http-method>
      <http-method>UNCHECKOUT</http-method>
      <http-method>MKWORKSPACE</http-method>
      <http-method>UPDATE</http-method>
      <http-method>LABEL</http-method>
      <http-method>MERGE</http-method>
      <http-method>BASELINE-CONTROL</http-method>
      <http-method>MKACTIVITY</http-method>
      <http-method>ACL</http-method>
      <http-method>SEARCH</http-method>
      <http-method>BIND</http-method>
      <http-method>UNBIND</http-method>
      <http-method>REBIND</http-method>
      <http-method>SUBSCRIBE</http-method>
      <http-method>UNSUBSCRIBE</http-method>
      <http-method>POLL</http-method>
      <http-method>NOTIFY</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>root</role-name>
      <role-name>user</role-name>
    </auth-constraint>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>admin console</web-resource-name>
      <url-pattern>/console/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>root</role-name>
      <role-name>user</role-name>
    </auth-constraint>
  </security-constraint>
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Chandler Server</realm-name>
  </login-config>
  <security-role>
    <role-name>root</role-name>
  </security-role>
  <security-role>
    <role-name>user</role-name>
  </security-role>
</web-app>

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

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd";>

<struts-config>

  <form-beans>
    <form-bean name="userForm"
               type="org.apache.struts.validator.DynaValidatorForm">
      <form-property name="user" type="org.osaf.chandler.server.model.User"/>
      <form-property name="password" type="java.lang.String"/>
      <form-property name="confirm" type="java.lang.String"/>
      <form-property name="username" type="java.lang.String"/>
    </form-bean>
  </form-beans>

  <global-exceptions>
    <exception type="java.lang.Throwable" key="ignore"
               handler="org.osaf.chandler.server.web.ChandlerExceptionHandler"/>
  </global-exceptions>

  <global-forwards type="org.apache.struts.action.ActionForward">
    <forward name="error" path="/console/error" redirect="false"/>
  </global-forwards>

  <action-mappings>
    <action path="/error"
            type="org.osaf.chandler.server.web.ErrorAction">
      <forward name="error.general" path="page.error.general"
               redirect="false"/>
      <forward name="error.connect" path="page.error.connect"
               redirect="false"/>
      <forward name="error.notfound" path="page.error.notfound"
               redirect="false"/>
    </action>

    <action path="/user"
            type="org.osaf.chandler.server.web.UserAction"
            name="userForm"
            scope="request"
            validate="false"
            parameter="view">
      <forward name="ok" path="user.view"/>
    </action>

    <action path="/user/update"
            type="org.osaf.chandler.server.web.UserAction"
            name="userForm"
            scope="request"
            validate="true"
            input="/console/user"
            parameter="update">
      <forward name="cancel" path="/console/user/list" redirect="true"/>
      <forward name="failure" path="/console/user"/>
      <forward name="success" path="/console/user/list" redirect="true"/>
    </action>

    <action path="/user/remove"
            type="org.osaf.chandler.server.web.UserAction"
            parameter="remove">
      <forward name="success" path="/console/user/list" redirect="true"/>
    </action>

    <action path="/user/list"
            type="org.osaf.chandler.server.web.UserAction"
            name="userForm"
            scope="request"
            validate="false"
            parameter="list">
      <forward name="ok" path="user.list"/>
    </action>

    <action path="/user/create"
            type="org.osaf.chandler.server.web.UserAction"
            name="userForm"
            scope="request"
            validate="true"
            input="/console/user/list"
            parameter="create">
      <forward name="failure" path="/console/user/list"/>
      <forward name="success" path="/console/user/list" redirect="true"/>
    </action>
  </action-mappings>

  <controller nocache="true"
              processorClass="org.springframework.web.struts.DelegatingTilesRequestProcessor"/>

  <message-resources parameter="MessageResources" null="false"/>    

  <plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-config"
                  value="/WEB-INF/tiles-config.xml"/>
    <set-property property="definitions-parser-validate"
                  value="true"/>
  </plug-in>

  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
                  value="/WEB-INF/validator-rules.xml
                         ,/WEB-INF/validation.xml"/>
    <set-property property="stopOnFirstError" value="false"/>
  </plug-in>

  <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
    <set-property property="contextConfigLocation"
                  value="/WEB-INF/applicationContext.xml
                         ,/WEB-INF/action-servlet.xml"/>
  </plug-in>
</struts-config>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to