You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "victorsosa (JIRA)" <ji...@apache.org> on 2016/01/07 18:12:39 UTC

[jira] [Commented] (WW-3262) improve wildcard to support regular expressions

    [ https://issues.apache.org/jira/browse/WW-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15087713#comment-15087713 ] 

victorsosa commented on WW-3262:
--------------------------------

Base on the JSR-339

Template parameters can optionally specify the regular expression used to match their values.  The default value matches any text and terminates at the end of a path segment but other values can be used to alter this behavior, e.g.:

@Path("widgets/{path:.+}")

public class Widget {

...

}

In the above example the Widgetresource class will be matched for any request whose path starts with
widgets and contains at least one more path segment; the value of the path parameter will be the request
path following widgets.   E.g.   given the request path widgets/small/a the value of path would be small/a.


Shouldn't this b implemented as part of the REST plugin???



> improve wildcard to support regular expressions
> -----------------------------------------------
>
>                 Key: WW-3262
>                 URL: https://issues.apache.org/jira/browse/WW-3262
>             Project: Struts 2
>          Issue Type: Improvement
>    Affects Versions: 2.1.8
>            Reporter: musachy
>             Fix For: 3.0
>
>
> The regular expressions will follow the syntax of JAX-RS. They can be like {PARAM_NAME} or {PARAM_NAME:REGEX}. For example:
>        <package name="regex" extends="struts-default" namespace="/">
> 		<action name="/{bio:.+}/test/{name}" class="org.apache.struts2.showcase.UITagExample">
> 			<result>/tags/ui/example.jsp</result>
> 		</action>
> 	</package>
> 	
> 	<package name="regex2" extends="struts-default" namespace="/superurl">
> 		<action name="/{bio:.+}/test/{name}" class="org.apache.struts2.showcase.UITagExample">
> 			<result>/tags/ui/example.jsp</result>
> 		</action>
> 		<action name="/{bio:.+}/test2/{name}" class="org.apache.struts2.showcase.UITagExample">
> 			<result>/tags/ui/{1}.jsp</result>
> 		</action>
> 	</package>



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)