Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@FormParam convert to Spring MVC

Tags:

spring

jax-rs

I am using the latest version of Spring. I have to integrate with a third party server of company A. Now, company A has given me this code:

Path("/user")
public class CallBacks {

    String hostDB="jdbc:mysql://localhost:3306/matchmove";
    String username="root";
    String password="password";

      @POST
      @Path("/add")
    //  @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
      public Response receive(
        @FormParam("id") String id,
        @FormParam("amount") String amount,
        @FormParam("asset_code") String assetCode,
        @FormParam("asset_issuer") String assetIssuer,
        @FormParam("memo") String memo) throws NumberFormatException, SQLException {

return Response.ok().build();
}

I want to use Spring as the rest of my project is in Spring! Can some one please advice on the following:

  1. Which annotation can I use in place of @FormParam?
  2. What can I use in place of Response.ok().build()?

Thank you

like image 597
TimeToCodeTheRoad Avatar asked May 09 '17 09:05

TimeToCodeTheRoad


1 Answers

  • @FormParam -> @RequestParam
  • Response.ok -> ResponseEntity.ok

@PostMapping(value = "/add")
public ResponseEntity receive(@RequestParam("id") String id) {
    return ResponseEntity.ok().build();
}
like image 171
Paul Samsotha Avatar answered Sep 21 '22 09:09

Paul Samsotha