[ 
https://issues.apache.org/struts/browse/STR-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42776
 ] 

Lars Beuster commented on STR-3117:
-----------------------------------

Let's say I have an action servlet mapping "/main/*". In my struts-config I 
have an entry like
<action...>
    <forward name="success" path="/action" />
</action> 

If I enter the original PerformForward I get to the point

        // uri is still "/action"
        if (uri.startsWith("/")) {
            uri = resolveModuleRelativePath(forwardConfig, servletContext, 
request);
        }

With the original impl my request is forwarded to "/action" (or 
"/module/action") with leads nowhere. 

If I use an actionId for my forward I have the following situation: 
- RequestUtils.actionIdURL() resolves the id, adds a the prefix to the path: 
/main/action
- resolveModuleRelativePath() adds the module: /module/main/action
-> prefix and module are in the wrong order

My overridden method simply has to add the prefix to the path:
- look if I have an action mapping in my current module for "/action"
- if not then return
- add the module
- if I have an action servlet prefix mapping (startsWith "/" & endsWith ("/*")) 
then add the prefix
-> this doesn't work for actionIds

This works fine for me and also deals with modules (but not with actionIds) but 
I don't think it's the best way. Unfortunately prefix mapping and modules are 
not really supported together (I read the doc), so it's necessary to override a 
few classes in Struts to bring them together.

Another important change to support prefix mapping and modules was 
TagUtils.getActionMappingURL(...) where prefix and modules are added to the 
path in the wrong order:
/module/prefix/action instead of /prefix/module/action. 




> PerformForward.methods: private -> protected
> --------------------------------------------
>
>                 Key: STR-3117
>                 URL: https://issues.apache.org/struts/browse/STR-3117
>             Project: Struts 1
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.3.9
>            Reporter: Lars Beuster
>            Assignee: Paul Benedict
>            Priority: Minor
>             Fix For: 1.3.10
>
>
> The methods in chain.commands.servlet.PerformForward are private. To extend 
> PerformInclude to make it easier to deal with prefix matching in the action 
> servlet (e.g. "/main/*" instead of "*.do") it would be nice if I could 
> override resolveModuleRelativePath().
> With the overridden method I could omit the action servlet prefix in the 
> whole struts-config.xml:
> <action...>
>     old: <forward name="success" path="/main/anotherAction" module="..."/>
>     new: <forward name="success" path="/anotherAction" module="..."/>
> </action>
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to