You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Philip Lorenz (JIRA)" <ji...@apache.org> on 2007/02/05 18:02:16 UTC

[jira] Created: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

Restful2ActionMapper does not set parameters/ActionName correctly
-----------------------------------------------------------------

                 Key: WW-1706
                 URL: https://issues.apache.org/struts/browse/WW-1706
             Project: Struts 2
          Issue Type: Bug
          Components: Dispatch
    Affects Versions: 2.0.5
            Reporter: Philip Lorenz


Restful2ActionMapper does not seem to treat REST URLs correctly.

Replacing
String params = actionName.substring(0, actionSlashPos);
at line 146 (Restful2ActionMapper.java) with
String params = actionName.substring(actionSlashPos + 1);

and
mapping.setName(actionName.substring(actionSlashPos+1));
at line 177 with
mapping.setName(actionName.substring(0, actionSlashPos));

will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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


[jira] Commented: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

Posted by "vijayck@techmahindra.com (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42185 ] 

vijayck@techmahindra.com commented on WW-1706:
----------------------------------------------

Hi Philp,

I am facing the same problem with Restful2ActionMapper which u had faced few months before..

i have a struts blog.xml which have the settings for Restful2..

<struts>
	<constant name="struts.objectFactory" value="spring" />
	<constant name="struts.devMode" value="true" />
	<constant name="struts.enable.SlashesInActionNames" value="true"/> 
	<constant name="struts.mapper.class" value="restful2" />
	
	
	<package name="blog" extends="struts-default" namespace="/blog">
	
		<action name="editBlogEntryForm/*" method="view" class="editBlogFormAction">
			<result name="success" type="tiles">blog.blogedit</result>
		 </action>
		
			
	</package>
</struts>

When i try acess the URL http://localhost/app/blog/title/BlogTitle/editBlogEntryForm.action
OR http://localhost/app/blog/editBlogEntryForm/title/BlogTitle.action  it is throwing an error

Could you please help me in this regards.

how did u fix the problem you had.

Thanks and Regards,
Vijay.C.K

--
This message was sent on behalf of vijayck@techmahindra.com at openSubscriber.com
http://www.opensubscriber.com/message/issues@struts.apache.org/5981431.html


> Restful2ActionMapper does not set parameters/ActionName correctly
> -----------------------------------------------------------------
>
>                 Key: WW-1706
>                 URL: https://issues.apache.org/struts/browse/WW-1706
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch
>    Affects Versions: 2.0.6
>            Reporter: Philip Lorenz
>            Assignee: Don Brown
>
> Restful2ActionMapper does not seem to treat REST URLs correctly.
> Replacing
> String params = actionName.substring(0, actionSlashPos);
> at line 146 (Restful2ActionMapper.java) with
> String params = actionName.substring(actionSlashPos + 1);
> and
> mapping.setName(actionName.substring(actionSlashPos+1));
> at line 177 with
> mapping.setName(actionName.substring(0, actionSlashPos));
> will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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


[jira] Updated: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

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

Ted Husted updated WW-1706:
---------------------------

    Fix Version/s: 2.0.7

> Restful2ActionMapper does not set parameters/ActionName correctly
> -----------------------------------------------------------------
>
>                 Key: WW-1706
>                 URL: https://issues.apache.org/struts/browse/WW-1706
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch
>    Affects Versions: 2.0.6
>            Reporter: Philip Lorenz
>             Fix For: 2.0.7
>
>
> Restful2ActionMapper does not seem to treat REST URLs correctly.
> Replacing
> String params = actionName.substring(0, actionSlashPos);
> at line 146 (Restful2ActionMapper.java) with
> String params = actionName.substring(actionSlashPos + 1);
> and
> mapping.setName(actionName.substring(actionSlashPos+1));
> at line 177 with
> mapping.setName(actionName.substring(0, actionSlashPos));
> will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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


[jira] Commented: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

Posted by "Don Brown (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40900 ] 

Don Brown commented on WW-1706:
-------------------------------

To add to that further, what I've done is to use wildcards to set the value.  For example:

<action name="*/*" class="{1}Action">
  <param name="id">{2}</action>
  ...
</action>

This would let me match a url like:

http://domain.com/products/books/category/novels/book/LearnJava

with an Action:

public class BookAction {
  public void setId(int id) {...}
  public void setProducts(String productType) {...}
  public void setCategory(String categoryName) {...}
  ...
}

and also use this Action mapping for all my core entities (the class value is the Spring bean name).



> Restful2ActionMapper does not set parameters/ActionName correctly
> -----------------------------------------------------------------
>
>                 Key: WW-1706
>                 URL: https://issues.apache.org/struts/browse/WW-1706
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch
>    Affects Versions: 2.0.6
>            Reporter: Philip Lorenz
>         Assigned To: Don Brown
>
> Restful2ActionMapper does not seem to treat REST URLs correctly.
> Replacing
> String params = actionName.substring(0, actionSlashPos);
> at line 146 (Restful2ActionMapper.java) with
> String params = actionName.substring(actionSlashPos + 1);
> and
> mapping.setName(actionName.substring(actionSlashPos+1));
> at line 177 with
> mapping.setName(actionName.substring(0, actionSlashPos));
> will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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


[jira] Commented: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

Posted by "Shane Frensley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_42205 ] 

Shane Frensley commented on WW-1706:
------------------------------------

Hi Vijay.C.K,

Could it be that you have specified a method in your action definition?

<action name="editBlogEntryForm/*" method="view" class="editBlogFormAction">

normall I see this action mapper without a method specified:

<action name="editBlogEntryForm/*" class="editBlogFormAction">

The Restul2ActionMapper will determine the method for you. In this case:

http://localhost/app/blog/title/BlogTitle/editBlogEntryForm.action

I believe it's going to call execute() since it doesnt end with a slash as documented by the examples in the javadoc.

a url like:

http://localhost/app/blog/title/BlogTitle/editBlogEntryForm/.action

will call index().

Seems quirky, but that's the way it's documented.  

See the javadoc as the methods are also different according to the HTTP method used as well.



> Restful2ActionMapper does not set parameters/ActionName correctly
> -----------------------------------------------------------------
>
>                 Key: WW-1706
>                 URL: https://issues.apache.org/struts/browse/WW-1706
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch
>    Affects Versions: 2.0.6
>            Reporter: Philip Lorenz
>            Assignee: Don Brown
>
> Restful2ActionMapper does not seem to treat REST URLs correctly.
> Replacing
> String params = actionName.substring(0, actionSlashPos);
> at line 146 (Restful2ActionMapper.java) with
> String params = actionName.substring(actionSlashPos + 1);
> and
> mapping.setName(actionName.substring(actionSlashPos+1));
> at line 177 with
> mapping.setName(actionName.substring(0, actionSlashPos));
> will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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


[jira] Updated: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

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

Philip Lorenz updated WW-1706:
------------------------------

    Affects Version/s:     (was: 2.0.5)
                       2.0.6

> Restful2ActionMapper does not set parameters/ActionName correctly
> -----------------------------------------------------------------
>
>                 Key: WW-1706
>                 URL: https://issues.apache.org/struts/browse/WW-1706
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch
>    Affects Versions: 2.0.6
>            Reporter: Philip Lorenz
>
> Restful2ActionMapper does not seem to treat REST URLs correctly.
> Replacing
> String params = actionName.substring(0, actionSlashPos);
> at line 146 (Restful2ActionMapper.java) with
> String params = actionName.substring(actionSlashPos + 1);
> and
> mapping.setName(actionName.substring(actionSlashPos+1));
> at line 177 with
> mapping.setName(actionName.substring(0, actionSlashPos));
> will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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


[jira] Resolved: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

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

Don Brown resolved WW-1706.
---------------------------

       Resolution: Not A Problem
    Fix Version/s:     (was: 2.0.8)
         Assignee: Don Brown

Drew is correct - the last value should be the unique identifier, with the previous value pairs indicating qualifying information such as the book category.  This feature does need better documentation, which I'll try to schedule.

> Restful2ActionMapper does not set parameters/ActionName correctly
> -----------------------------------------------------------------
>
>                 Key: WW-1706
>                 URL: https://issues.apache.org/struts/browse/WW-1706
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch
>    Affects Versions: 2.0.6
>            Reporter: Philip Lorenz
>         Assigned To: Don Brown
>
> Restful2ActionMapper does not seem to treat REST URLs correctly.
> Replacing
> String params = actionName.substring(0, actionSlashPos);
> at line 146 (Restful2ActionMapper.java) with
> String params = actionName.substring(actionSlashPos + 1);
> and
> mapping.setName(actionName.substring(actionSlashPos+1));
> at line 177 with
> mapping.setName(actionName.substring(0, actionSlashPos));
> will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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


[jira] Commented: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

Posted by "Drew Kutcharian (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-1706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40843 ] 

Drew Kutcharian commented on WW-1706:
-------------------------------------

I dont think this is a bug. I think it's working right. According to REST, the last part of the the URI should be the resource.
So this works to spec:

http://domain.com/param1/value1/param2/value2/action

for example:

http://domain.com/products/books/category/novels/book/LearnJava

That's more like how Ruby + Rails works.

Just my 2 cents.

> Restful2ActionMapper does not set parameters/ActionName correctly
> -----------------------------------------------------------------
>
>                 Key: WW-1706
>                 URL: https://issues.apache.org/struts/browse/WW-1706
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch
>    Affects Versions: 2.0.6
>            Reporter: Philip Lorenz
>             Fix For: 2.0.8
>
>
> Restful2ActionMapper does not seem to treat REST URLs correctly.
> Replacing
> String params = actionName.substring(0, actionSlashPos);
> at line 146 (Restful2ActionMapper.java) with
> String params = actionName.substring(actionSlashPos + 1);
> and
> mapping.setName(actionName.substring(actionSlashPos+1));
> at line 177 with
> mapping.setName(actionName.substring(0, actionSlashPos));
> will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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


[jira] Updated: (WW-1706) Restful2ActionMapper does not set parameters/ActionName correctly

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

Ted Husted updated WW-1706:
---------------------------

    Fix Version/s:     (was: 2.0.7)
                   2.0.8

Making these changes causes the test suite to fail. Apparently, during the URL tag test. This is a new or updated test, and so it may have changed since this patch was suggested. 

I'll push it over to 2.0.8 for now, until we have a chance to see what is going wrong. 


> Restful2ActionMapper does not set parameters/ActionName correctly
> -----------------------------------------------------------------
>
>                 Key: WW-1706
>                 URL: https://issues.apache.org/struts/browse/WW-1706
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch
>    Affects Versions: 2.0.6
>            Reporter: Philip Lorenz
>             Fix For: 2.0.8
>
>
> Restful2ActionMapper does not seem to treat REST URLs correctly.
> Replacing
> String params = actionName.substring(0, actionSlashPos);
> at line 146 (Restful2ActionMapper.java) with
> String params = actionName.substring(actionSlashPos + 1);
> and
> mapping.setName(actionName.substring(actionSlashPos+1));
> at line 177 with
> mapping.setName(actionName.substring(0, actionSlashPos));
> will perform the expected behaviour of setting the ActionName to view and setting the parameter uploadId to 5 for the following URL (view/uploadId/5).

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