简体   繁体   中英

How to map long REST urls in struts2 - using struts2 rest plugin

I've been learning to use struts2 rest plugin from a past few days. But no-where I found how to map long rest URLs.

For eg If I want to map an URL like below :

/profiles/user-test/orders/64/item/4

where

username is user-test
order id is 64
item id is 4

How can I map something like this to a struts2 action ?

All I found on internet is just a single level being edited/displayed etc. But if I want to display something on multiple-level - then how to proceed ? Please guide.

You can do it with Advanced Wildcard Mappings , without the REST plugin:

/profiles/user-test/orders/64/item/4

username is user-test

order id is 64

item id is 4

The action configuration needed for this example would be:

<action name="/profiles/{username}/orders/{order}/item/{item}" class="fooBarAction">
    <result>fooBar.jsp</result>
</action>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM