[
https://issues.apache.org/jira/browse/WW-2842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909250#action_12909250
]
T Venkateswarlu-MXPG83 commented on WW-2842:
--------------------------------------------
Hi..
Please help me to solve the wildcard mappings issue in struts2.2.1.
i am trying to use wildcards with struts2.2.1
i am using code below :
in struts.xml
<constant name="struts.enable.SlashesInActionNames" value="true" />
<constant name="struts.mapper.alwaysSelectFullNamespace" value="false"/>
<constant name="struts.patternMatcher" value="regex" />
<package name="regex" extends="struts-default">
<action name="/{param1}/Contact/{param2}" method="index"
class="com.mot.presence.ContactController ">
<param name="param1">{1}</param>
<param name="param2">{0}</param>
</action>
</package>
in struts.properties
struts.mapper.class=org.apache.struts2.dispatcher.mapper.RestfulActionMa
pper
struts.enable.DynamicMethodInvocation = false
struts.enable.SlashesInActionNames = true
struts.patternMatcher= regex
struts.mapper.alwaysSelectFullNamespace = false
in action...
public class ContactController extends ActionSupport implements
ModelDriven<Object>, Validateable{
@Action(("/{param1}/Contact/{param2}"))
public HttpHeaders index() {
--------..............
return new DefaultHttpHeaders("index");
}
when i try to access with url :
http://localhost/context/Admin/Contact/admin.com
some times getting resource not available and some times getting no
action mapping for /Admin and some times no action mapping for
/Contact...
Please help what i am doing wrong....
Thanks in advance...
--- Venkatt
> Wildcards in namespace maps url values to controller parameters
> ---------------------------------------------------------------
>
> Key: WW-2842
> URL: https://issues.apache.org/jira/browse/WW-2842
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - REST
> Reporter: Leonard Broman
> Priority: Minor
> Fix For: Future
>
> Attachments: rest plugin convention fix.zip
>
>
> Implement wildcard functionality in namespace declaration to be able to map
> URL values to controller properties, or more appropriately, push them to the
> value stack.
> This has been discussed lightly on the user mailing list and there is a short
> notice on the jroller blog by Don Brown
> http://www.jroller.com/mrdon/entry/struts_2_rest_todos .
> Simple example:
> We may want to map a nice and clean url: GET /report/lbroman/2008/january
> To a ReportController where the values lbroman, 2008, january will be set on
> properties on the Controller.
> Using the @Namespace annotation, a namespace declaration like
> "/report/{user}/{year}/{month}" will use the wildcard mapping to map
> "lbroman", "2008", "january" to setUser(), setYear() and setMonth()
> respectively.
> Note that this overrides the default setId() for the first parameter.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.