How to Strtus2-Rest plugin could create /user/{id}/{branch} URL Pattern

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Strtus2-Rest plugin could create /user/{id}/{branch} URL Pattern

M Huzaifah
Dear All,

i’am stuck how to create /user/{id}/{branch}/{xx} URL Pattern using Struts-convention and Struts2-rest plugin.
there is a way to make it done?

I knew it can be done by using advance wildcard in our struts xml as mention in here https://struts.apache.org/core-developers/wildcard-mappings.html <https://struts.apache.org/core-developers/wildcard-mappings.html>
i would better to use Annotation in our Action Class like this code below:

@ParentPackage("baseapp")
@Namespace("/api/test/{id}/{branch}")
public class UserApi implements ModelDriven<Object> {
       
        private String id;
        private String branch;
        Object resposeModel;

        //our setter-getter, index, show, etc method

        @Override
        public Object getModel() {
                // TODO Auto-generated method stub
                return resposeModel;
        }


}

Regards,,,…..
Reply | Threaded
Open this post in threaded view
|

Re: How to Strtus2-Rest plugin could create /user/{id}/{branch} URL Pattern

Lukasz Lenart
niedz., 12 maj 2019 o 07:49 M Huzaifah <[hidden email]> napisał(a):
>
> Dear All,
>
> i’am stuck how to create /user/{id}/{branch}/{xx} URL Pattern using Struts-convention and Struts2-rest plugin.
> there is a way to make it done?

The REST plugin doesn't support such configuration now, you can try to
play with RestfulMapper instead

https://struts.apache.org/core-developers/restful-action-mapper.html


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]