Best Solution for Web Service Rest

Asked

Viewed 167 times

0

I wanted to implement a Web Service that would provide data to mobile platforms (Android and iOS), someone knows the best service I can use for such?

I’d rather it be something open source.

I was doing some research and found Resteasy and Jboss, but since I know nothing I would like to start with a good solution (great growth potential).

  • However I also found -> Java Restful Plugin for Eclipse

  • I really like Jersey, already took a look at it?

2 answers

2

Spark
Very simple to use

public static void main(String...args) {
   get("/umPath", (req, res) -> {
       //Regra de negocio
       return "resultado"
   });
}

Springboot
Also very simple, but unlike Spark, a controller should be created and annotated with @Restcontroller

@ResController
@EnableAutoConfiguration
public class UmaClasseController {

    @RequestMapping("/umPath")
    @ResponseBody
    String ola() {
        //Regra de negocio
        return "Resultado";
    }

    public static void main(String[] args) throws Exception {
        SpringApplication.run(UmaClasseController.class, args);
    }
}

The good thing about Spring is that if you put the return type as an object or an object collection it already serializes to JSON.

Jersey
It’s also good, but requires some settings, and can be used along with Springboot, annotated with @Component.

2


Pedro Simões, technically the ASP.NET Web Api is Open Source. In this case you can use the VS Code or the VS 2015 Community, as for tutorials for ASP.NET Web Api, you find them very easy on Google.

If you liked the above mentioned tools and want to use something that has its origins in the Open Source world, you can think about Nodejs with Expressjs, but for that, you may need the Nodejs Tools to VS

Follow a short guide on Restful API using Expressjs: https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4

And in case you liked what you saw, you might even consider reading about the Edgejs and bring the two worlds together.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.