You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lars Beuster (JIRA)" <ji...@apache.org> on 2007/12/04 10:03:33 UTC

[jira] Created: (STR-3117) PerformForward.methods: private -> protected

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
            Priority: Minor


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.


[jira] Commented: (STR-3117) PerformForward.methods: private -> protected

Posted by "Lars Beuster (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (STR-3117) PerformForward.methods: private -> protected

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42780 ] 

Paul Benedict commented on STR-3117:
------------------------------------

It sounds like you have a pretty good handle on the situation! Rather than exposing the method, I'd rather go for the full solution and allow Struts to correctly deal with modules and servlet prefix mapping. Got any time to help develop a patch? Very cool issue reporting.

> 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.


[jira] Commented: (STR-3117) PerformForward.methods: private -> protected

Posted by "Lars Beuster (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42784 ] 

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

Cool issue? Paul, have a look at this:
https://issues.apache.org/struts/browse/STR-2239
;)

Since I have different applications that all use prefix mapping I think I'm a good candidate (but I have no *.do-apps) to help you. I've already found (and fixed for me) a few places that needs to :

- TagUtils.getActionMappingURL()
    * see last comment yesterday
- ModuleUtils.getModuleName():
    * if we have a prefix we need request.getPathInfo() instead of request.getServletPath()
- PerformForward?

Another place that probably needs a fix is
- RequestUtils.actionIdURL() that adds the mapping but forgets the module (see resolveModuleRelativePath()), so you get /prefix/action

Currently I don't use actionIds - I'm not quite sure if I known what actionIds are ;).

I think at least the 3 mentioned Utils-classes should have a complete closer look. And a few handy methods like
- isPrefixMapping()
- getPrefix()
- isStarDoMapping() - (there's room for name improvement)
would be nice.

I'm looking forward removing my Struts-hacks...

Regards
Lars


> 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.


[jira] Issue Comment Edited: (STR-3117) PerformForward.methods: private -> protected

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42772 ] 

paul4christ79 edited comment on STR-3117 at 12/4/07 9:56 PM:
-------------------------------------------------------------

I do not object to the change. But can you explain how changing the access modifier allows to omit the servlet prefix? Got any sample code to share?

      was (Author: paul4christ79):
    I do not object to the change. But can you explain how changing the access modifer allows you omit the servlet prefix? Got any sample code to share?
  
> 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.


[jira] Updated: (STR-3117) PerformForward.methods: private -> protected

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/STR-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated STR-3117:
-------------------------------

    Fix Version/s:     (was: 1.3.10)
                   Pending Review

> 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: Pending Review
>
>
> 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.


[jira] Issue Comment Edited: (STR-3117) PerformForward.methods: private -> protected

Posted by "Lars Beuster (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42784 ] 

lars edited comment on STR-3117 at 12/6/07 2:25 AM:
------------------------------------------------------------

Cool issue? Paul, have a look at this:
https://issues.apache.org/struts/browse/STR-2239
;)

Since I have different applications that all use prefix mapping I think I'm a good candidate (but I have no *.do-apps) to help you. I've already found (and fixed for me) a few places that needs attention:

- TagUtils.getActionMappingURL()
    * see last comment yesterday
- ModuleUtils.getModuleName():
    * if we have a prefix we need request.getPathInfo() instead of request.getServletPath()
- PerformForward?

Another place that probably needs a fix is
- RequestUtils.actionIdURL() that adds the mapping but forgets the module (see resolveModuleRelativePath()), so you get /prefix/action

Currently I don't use actionIds - I'm not quite sure if I known what actionIds are ;).

I think at least the 3 mentioned Utils-classes should have a complete closer look. And a few handy methods like
- isPrefixMapping()
- getPrefix()
- isStarDoMapping() - (there's room for name improvement)
would be nice.

I'm looking forward removing my Struts-hacks...

Regards
Lars


      was (Author: lars):
    Cool issue? Paul, have a look at this:
https://issues.apache.org/struts/browse/STR-2239
;)

Since I have different applications that all use prefix mapping I think I'm a good candidate (but I have no *.do-apps) to help you. I've already found (and fixed for me) a few places that needs to :

- TagUtils.getActionMappingURL()
    * see last comment yesterday
- ModuleUtils.getModuleName():
    * if we have a prefix we need request.getPathInfo() instead of request.getServletPath()
- PerformForward?

Another place that probably needs a fix is
- RequestUtils.actionIdURL() that adds the mapping but forgets the module (see resolveModuleRelativePath()), so you get /prefix/action

Currently I don't use actionIds - I'm not quite sure if I known what actionIds are ;).

I think at least the 3 mentioned Utils-classes should have a complete closer look. And a few handy methods like
- isPrefixMapping()
- getPrefix()
- isStarDoMapping() - (there's room for name improvement)
would be nice.

I'm looking forward removing my Struts-hacks...

Regards
Lars

  
> 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.


[jira] Updated: (STR-3117) PerformForward.methods: private -> protected

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/STR-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Benedict updated STR-3117:
-------------------------------

    Fix Version/s: 1.3.10
         Assignee: Paul Benedict

> 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.


[jira] Commented: (STR-3117) PerformForward.methods: private -> protected

Posted by "Paul Benedict (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/STR-3117?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42772 ] 

Paul Benedict commented on STR-3117:
------------------------------------

I do not object to the change. But can you explain how changing the access modifer allows you omit the servlet prefix? Got any sample code to share?

> 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.