You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Raigedas (JIRA)" <ji...@apache.org> on 2011/03/14 09:15:29 UTC
[jira] Created: (WW-3590) REST service actions and "normal" actions
in the same web application (patch)
REST service actions and "normal" actions in the same web application (patch)
-----------------------------------------------------------------------------
Key: WW-3590
URL: https://issues.apache.org/jira/browse/WW-3590
Project: Struts 2
Issue Type: Improvement
Components: Plugin - REST
Affects Versions: 2.2.1.1
Environment: N/A
Reporter: Raigedas
Priority: Minor
Fix For: 2.2.2
Attachments: rest namespace patch.txt
Problem.
i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
java.lang.NoSuchMethodException <...> MyActionName.index().
i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
<constant name="struts.mapper.class"
value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
<constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
but this does not solves the proble. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
Solution.
i suggest to implement conditional enabling of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
<constant name="struts.rest.namespace" value="/rest" />
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Resolved: (WW-3590) REST service actions and "normal"
actions in the same web application (patch)
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart resolved WW-3590.
-------------------------------
Resolution: Fixed
> REST service actions and "normal" actions in the same web application (patch)
> -----------------------------------------------------------------------------
>
> Key: WW-3590
> URL: https://issues.apache.org/jira/browse/WW-3590
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - REST
> Affects Versions: 2.2.1.1
> Environment: N/A
> Reporter: Raigedas
> Assignee: Lukasz Lenart
> Priority: Minor
> Labels: namespaces, patch, rest
> Fix For: 2.2.2
>
> Attachments: rest namespace patch.txt
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> Problem.
> i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
> but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
> java.lang.NoSuchMethodException <...> MyActionName.index().
> i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
> <constant name="struts.mapper.class"
> value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
> <constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
> but this does not solves the problem. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
> Solution.
> i suggest to implement conditional enabling (based on the namespace of the request) of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
> <constant name="struts.rest.namespace" value="/rest" />
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (WW-3590) REST service actions and "normal" actions
in the same web application (patch)
Posted by "Raigedas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Raigedas updated WW-3590:
-------------------------
Attachment: rest namespace patch.txt
> REST service actions and "normal" actions in the same web application (patch)
> -----------------------------------------------------------------------------
>
> Key: WW-3590
> URL: https://issues.apache.org/jira/browse/WW-3590
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - REST
> Affects Versions: 2.2.1.1
> Environment: N/A
> Reporter: Raigedas
> Priority: Minor
> Fix For: 2.2.2
>
> Attachments: rest namespace patch.txt
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> Problem.
> i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
> but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
> java.lang.NoSuchMethodException <...> MyActionName.index().
> i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
> <constant name="struts.mapper.class"
> value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
> <constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
> but this does not solves the proble. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
> Solution.
> i suggest to implement conditional enabling of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
> <constant name="struts.rest.namespace" value="/rest" />
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (WW-3590) REST service actions and "normal"
actions in the same web application (patch)
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006360#comment-13006360 ]
Lukasz Lenart commented on WW-3590:
-----------------------------------
What was wrong with PrefixBasedActionMapper ?
> REST service actions and "normal" actions in the same web application (patch)
> -----------------------------------------------------------------------------
>
> Key: WW-3590
> URL: https://issues.apache.org/jira/browse/WW-3590
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - REST
> Affects Versions: 2.2.1.1
> Environment: N/A
> Reporter: Raigedas
> Priority: Minor
> Labels: namespaces, patch, rest
> Fix For: 2.2.2
>
> Attachments: rest namespace patch.txt
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> Problem.
> i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
> but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
> java.lang.NoSuchMethodException <...> MyActionName.index().
> i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
> <constant name="struts.mapper.class"
> value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
> <constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
> but this does not solves the problem. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
> Solution.
> i suggest to implement conditional enabling (based on the namespace of the request) of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
> <constant name="struts.rest.namespace" value="/rest" />
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Assigned: (WW-3590) REST service actions and "normal"
actions in the same web application (patch)
Posted by "Lukasz Lenart (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart reassigned WW-3590:
---------------------------------
Assignee: Lukasz Lenart
> REST service actions and "normal" actions in the same web application (patch)
> -----------------------------------------------------------------------------
>
> Key: WW-3590
> URL: https://issues.apache.org/jira/browse/WW-3590
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - REST
> Affects Versions: 2.2.1.1
> Environment: N/A
> Reporter: Raigedas
> Assignee: Lukasz Lenart
> Priority: Minor
> Labels: namespaces, patch, rest
> Fix For: 2.2.2
>
> Attachments: rest namespace patch.txt
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> Problem.
> i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
> but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
> java.lang.NoSuchMethodException <...> MyActionName.index().
> i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
> <constant name="struts.mapper.class"
> value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
> <constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
> but this does not solves the problem. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
> Solution.
> i suggest to implement conditional enabling (based on the namespace of the request) of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
> <constant name="struts.rest.namespace" value="/rest" />
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (WW-3590) REST service actions and "normal"
actions in the same web application (patch)
Posted by "Raigedas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13006389#comment-13006389 ]
Raigedas commented on WW-3590:
------------------------------
hello,
it is not anything wrong with PrefixBasedActionMapper. but it is not enought. ActionMapper only determines mapping between request and action (that is - creates a ActionMapping object). but regardless of what action has been found, rest plugin still provides the same execution mechanism. the configuration found in rest plugin (struts-plugn.xml file) confirms this:
<bean type="com.opensymphony.xwork2.ActionProxyFactory" name="rest" class="org.apache.struts2.rest.RestActionProxyFactory"/>
<constant name="struts.actionProxyFactory" value="rest"/>
my solution checks the namespace first, then:
* either allows execution in the rest-plugin-way
* or provides default execution mechanism by calling super method.
> REST service actions and "normal" actions in the same web application (patch)
> -----------------------------------------------------------------------------
>
> Key: WW-3590
> URL: https://issues.apache.org/jira/browse/WW-3590
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - REST
> Affects Versions: 2.2.1.1
> Environment: N/A
> Reporter: Raigedas
> Priority: Minor
> Labels: namespaces, patch, rest
> Fix For: 2.2.2
>
> Attachments: rest namespace patch.txt
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> Problem.
> i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
> but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
> java.lang.NoSuchMethodException <...> MyActionName.index().
> i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
> <constant name="struts.mapper.class"
> value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
> <constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
> but this does not solves the problem. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
> Solution.
> i suggest to implement conditional enabling (based on the namespace of the request) of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
> <constant name="struts.rest.namespace" value="/rest" />
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Updated: (WW-3590) REST service actions and "normal" actions
in the same web application (patch)
Posted by "Raigedas (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WW-3590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Raigedas updated WW-3590:
-------------------------
Labels: namespaces patch rest (was: )
Description:
Problem.
i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
java.lang.NoSuchMethodException <...> MyActionName.index().
i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
<constant name="struts.mapper.class"
value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
<constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
but this does not solves the problem. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
Solution.
i suggest to implement conditional enabling (based on the namespace of the request) of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
<constant name="struts.rest.namespace" value="/rest" />
was:
Problem.
i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
java.lang.NoSuchMethodException <...> MyActionName.index().
i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
<constant name="struts.mapper.class"
value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
<constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
but this does not solves the proble. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
Solution.
i suggest to implement conditional enabling of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
<constant name="struts.rest.namespace" value="/rest" />
> REST service actions and "normal" actions in the same web application (patch)
> -----------------------------------------------------------------------------
>
> Key: WW-3590
> URL: https://issues.apache.org/jira/browse/WW-3590
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - REST
> Affects Versions: 2.2.1.1
> Environment: N/A
> Reporter: Raigedas
> Priority: Minor
> Labels: namespaces, patch, rest
> Fix For: 2.2.2
>
> Attachments: rest namespace patch.txt
>
> Original Estimate: 10m
> Remaining Estimate: 10m
>
> Problem.
> i would like to expand my existing webapp by adding RESTful ws. i do not want to create a separate webapp which would serve solely as web service.
> but as soon as i add REST plugin to th classpath of my struts2 based webapp, all actions (which worked correctly before) stop working and i get errors:
> java.lang.NoSuchMethodException <...> MyActionName.index().
> i thought that it could be solved by reconfiguring "ActionMapper"s. i configured that in this way:
> <constant name="struts.mapper.class"
> value="org.apache.struts2.dispatcher.mapper.PrefixBasedActionMapper"/>
> <constant name="struts.mapper.prefixMapping" value="/ws/rest:rest,:struts"/>
> but this does not solves the problem. "normal" actions throw "Cannot handle CGLIB enhanced proxies with multiple callbacks"..
> Solution.
> i suggest to implement conditional enabling (based on the namespace of the request) of the REST plugin. this can be done by changing RestActionProxyFactory class a little bit. my solution (see the patch) adds a "namespace" property (with setter only). that property has default value or can have injected a config value named "struts.rest.namespace". the default value is "/" which means that after update the functionality of the plugin will remain the same unless one adds a config like:
> <constant name="struts.rest.namespace" value="/rest" />
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira