users@jersey.java.net

[Jersey] POST with no argument

From: Robert DiFalco <robert.difalco_at_gmail.com>
Date: Fri, 13 Dec 2013 20:18:29 -0800

I'm back with more questions found while upgrading from 1.9 to 2.4.1. I
don't know if this is a client or a server issue.

But if I perform a POST with no PathParam but with a QueryParam then the
QueryParam will be overwritten with null. For example:

    @Path( "/footest" )
    @POST
    public void badlyDesignedPostOperation(
        @QueryParam( "foo") String foo,
        @Context UriInfo uriInfo ) throws Exception {
            System.out.println( "foo=" + foo );
    }


Now the test code:

    resource().path( "/footest?foo=notnull" ).method( "POST" );

Instead of "notnull" the output will be null because null with overwrite
the QueryParameter. I'm guess POST was implemented to always think a
parameter was being sent so it ends up overwriting the query parameter as a
path parameter.

Is this expected?