You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/10/04 00:29:20 UTC

DO NOT REPLY [Bug 23605] New: - sub-applications and prefix servlet-mapping do not work

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23605>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23605

sub-applications and prefix servlet-mapping do not work

           Summary: sub-applications and prefix servlet-mapping do not work
           Product: Struts
           Version: Nightly Build
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Controller
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: dheydt01@sprintspectrum.com


This is to propose a small patch that will make prefix servlet-mapping 
("/do/*") work with sub-applications. Struts 1.1 has a known and stated issue 
in that it supports only an extension mapped action servlet ("*.do") when using 
sub applications. Not sure if this would constitute a bug fix or an enhancement 
request.

Motivation: We have a large legacy app that that uses prefix mapping and that 
we recently brought in under Struts. We cannot change all the URLs from prefix 
to extension mapping, yet we want to take advantage of the sub application 
feature in parts of the app.

The attached patch is based on the Struts 1.2 nightly build and fixes the 
following:

1. ModuleUtils.getModuleName() does not detect the module

SYMPTOM: On a request like "http://host:port/webapp/do/module1/action" the 
ModuleUtils.getModuleName() does not detect the module and returns an empty 
string instead.
CAUSE: getModuleName() assumes the servlet is extension mapped and uses 
request.getServletPath() to get to the request path.
FIX: use not only request.getServletPath() but also request.getPathInfo() to 
determine the module prefix.

2. RequestProcessor.processPath() does not strip off the module prefix

SYMPTOM: On a request like "http://host:port/webapp/do/module1/action" the 
method returns “/module1/action” instead of “/action” as the path.
CAUSE: There are two if/else branches in the method, one for prefix mapped 
servlets and one for extension mapped servlets. The code to strip off the 
module name is only in one branch but should be in both.
FIX: Essentially, take the code that strips of the module name out of the if-
else branch so it is executed regardless of whether the servlet is extension 
mapped or prefix mapped. (Prerequesite to this fix is fix #1 above.)

3. TagUtils.getActionMappingURL() puts the module prefix into the wrong position

SYMPTOM: <html:form> tag will produce a submit URL of 
action="/switchaction/module1/do/action1"
when the correct URL would be 
action="/switchaction/do/module1/action1"
CAUSE: The code puts the module prefix always at the beginning on the buffer, 
followed by the remaining components of the path.
FIX: Instead of putting the module prefix always at the beginning of the 
buffer, put the module prefix to where it always immediately precedes the 
action name.


The attached patch is based on the Oct 1 nightly build and the following file 
versions:
- ModuleUtils.java,v 1.4
- RequestProcessor.java,v 1.36
- TagUtils.java,v 1.26

It has been tested and appears to work fine.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org