Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jersey should not consume any form parameter. exception

I am building rest webservice using jersey, when I add this function i got this exception, but when i remove it, the server works very good.

Customer.orderWeb(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String), should not consume any form parameter.

the code is

@Path("orderWeb/{customerID}/{restaurantID}/{IDs}/{numbers}/{descriptions}/{addressID}")
    @GET
    @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN,
            MediaType.TEXT_HTML, MediaType.TEXT_XML })
    @Consumes({ MediaType.TEXT_PLAIN, MediaType.TEXT_PLAIN,
            MediaType.TEXT_PLAIN })
    public String orderWeb(@FormParam("customerID") String customerID,
            @FormParam("restaurantID") String restaurantID,
            @FormParam("IDs") String IDs, @FormParam("numbers") String numbers,
            @FormParam("descriptions") String descriptions,
            @FormParam("addressID") String customerAddress) {
        return "WSSSSSSSSSSSSSSSSSS";
    }

it is weird because I always use path like that path. i dont know what am i doing wrong

like image 525
user2228656 Avatar asked Nov 29 '22 08:11

user2228656


2 Answers

Use @QueryParam with @GET and @FormParam with @POST

like image 146
Youans Avatar answered Dec 04 '22 16:12

Youans


Not sure what you got fixed from the approved answer, but since I'm not seeing the answer FYI you should use @PathParam to capture path segments (not @FormParam which is to capture POST data)

like image 28
TheArchitect Avatar answered Dec 04 '22 16:12

TheArchitect