0

I develop a CRUD Spring, Servlet/JSP application. I will develop a desktop Swing application with same functionality. My question is that possible to communicate and resuse servlets on swing application (not applet)?

Gok Demir
  • 1,414
  • 4
  • 19
  • 39

3 Answers3

4

Yes, by making http requests. You can do them with multiple tools. Two of them:

  • new URL(..).openConnection()
  • apache http components
  • since you tagged spring, if you are using it with swing, you can use its RestTemplate. It's used to invoke restful services. You can expose your logic as restful services through the servlets (or spring-mvc), and consume them with RestTemplate
Community
  • 1
  • 1
Bozho
  • 554,002
  • 136
  • 1,025
  • 1,121
2

The Rest idea above is pretty good. In fact, by using Spring and it's proxies, you could use any kind of webservices (RESTFul or WSDL), and Spring would make it transparent for you.

Please check some examples in the Spring manual. Take a look at how to create proxies using service interfaces.

Best regards.

ThiagoUriel
  • 115
  • 6
1

since its all via HTTP, and mechanism as suggested above can work. Or you can even open bytestream to the server and read/write using that stream.

Akshat
  • 4,095
  • 4
  • 23
  • 27