Need to implement RESTful web services in Struts2 and Spring

I am currently working on a web application based on Strtus2, Spring, open JPA and LDAP.

Now the client wants us to develop a RESTful api for this system so that other websites or applications can integrate with it.

This task has been assigned to me and I obviously don't know where to start.

I did my research and found out that there is a plugin struts2-rest

and there are several different ways for Spring.

Moreover, most of the examples I've seen use Maven, but our project doesn't use that.

So, I just need a guide to start this thing.

+3


source to share


1 answer


In Struts2, you can implement RESTful api via struts2-rest-plugin. The starting point is the REST Plugin .

Customization

Assuming you have a regular Struts 2 application, all you need to do for this REST demo is to add the following two plugins:

Struts 2 Rest Plugin
Struts 2 Convention Plugin

      

Note. You can download banners for these plugins from Maven Central Configuration (struts.xml)

Simply removing a plugin into your application may not create exactly the desired effect. There are several considerations. the first consideration is whether you want any non-RESTful url to coexist with your RESTful url. We will show two configurations. first assumes that all you want to do is REST. The second assumes that you want to store a different non-RESTful url in the same Struts 2 application.




At Home, in the Struts2 files, you will find everything you need to start developing a Struts2 application.

Resources:

+4


source







All Articles