restjakarta-eeweb-serviceshttp-status-code-404

404 Error with Java EE Web service GET request with decimal point in parameter value


I've created a Java stateless session bean to provide RESTful services to clients, and I get a 404 Not Found erorr when I pass in a parameter with a decimal point (specifically a longitude, e.g. 150.318232). The service works fine if the value passed in is an integer.

Below is a snippet of the code from the relevant method - it was originally generated using the Netbeans wizards.

@GET
    @Produces({"application/json"}) //, "application/xml"

    public MessagesConverter get(@QueryParam("start")
                                 @DefaultValue("0")
                                int start,
                                 ......

                                @QueryParam("longitude")
                                 @DefaultValue("-123456789")
                                long searchPointLongitude,
      ......

I've tried encoding the URL such that the periods / dots are submitted as hex codes, but this still doesn't seem to rectify the problem.

Any help would be appreciated.

Cheers,

Jin


Solution

  • Well in your example your argument is a long - which I assume is what you are trying to use for that query param. But the param you pass in is a double or float, not a long.