4

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

user2228656
  • 317
  • 1
  • 3
  • 7

3 Answers3

22

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

Youans
  • 4,801
  • 1
  • 31
  • 57
2

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)

TheArchitect
  • 2,161
  • 1
  • 12
  • 16
1

if you are using @FormParam. Also make sure INPUT HTML types are using name= not id=.

shreyansh jogi
  • 2,082
  • 12
  • 20