Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

REST based Java application

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How feasible is it to make a simple REST-based Java applications that works with both browsers and a desktop (Swing) front end? Is this a thing?

Many thanks
J
 
Saloon Keeper
Posts: 7184
166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's done all the time :-) In the simplest of cases, you'd use the JAX-RS API to create REST WS running on your choice of servlet container (Tomcat, Jetty, you name it). The kind of client(s) (browser, desktop app, mobile app, other web apps) wouldn't matter much.
 
Jason de Vere
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Moores wrote:It's done all the time :-) In the simplest of cases, you'd use the JAX-RS API to create REST WS running on your choice of servlet container (Tomcat, Jetty, you name it). The kind of client(s) (browser, desktop app, mobile app, other web apps) wouldn't matter much.



Can it be done with Spring?
 
Saloon Keeper
Posts: 13427
303
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes it can, but personally I feel plain JAX-RS is much more elegant for creating a simple REST API.

Why don't you give it a try?
 
Sheriff
Posts: 22512
122
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've worked with both JAX-RS and Spring MVC as part of Spring Boot, and I don't have a real preference. In their basic forms they look very alike. I've done a migration from Java EE (so also JAX-RS) to Spring Boot, and it was mostly changing annotations.

For the Swing client you can also choose between the two. JAX-RS has a client API as well, and Spring Boot of course as its classes like RestTemplate.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic