@FormParam convert to Spring MVC
jax-rs, spring
Solution
- `@FormParam` -> `@RequestParam`
- `Response.ok` -> `ResponseEntity.ok`
@PostMapping(value = "/add")
public ResponseEntity receive(@RequestParam("id") String id) {
return ResponseEntity.ok().build();
}
Problem
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: - Which annotation can I use in place of `@FormParam`? - What can I use in place of `Response.ok().build()`? Thank you