You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Nandana Mihindukulasooriya <na...@gmail.com> on 2010/07/22 19:52:56 UTC

JAX-RS HTTP POST missing parameters

Hi,
  I have a JAX-RS service (Apache CXF 2.2.9) and I do a HTTP POST to invoke
the service. I used the jetty-maven-plugin (7.1.5.v20100705) with
"jetty:run-war" option for testing and everything works fine there. But when
I deploy the war in Apache Tomcat 5.5.28 / 6.0.26 and use the same client to
invoke the service, the parameters are not present in the request. Method
signature looks like something this.

    @POST
    @GET
    @Produces("application/x-www-form-urlencoded")
    @Consumes("application/x-www-form-urlencoded")
    public Response getInfo(@Context HttpServletRequest request) {
    ....
    }

  I debugged the service in Tomcat and if I check at CXFServlet
(AbstractHTTPServlet) level and do a request.getParameter(), I can access
the parameter and everything works as expected too. But if I don't do that
and catch the request at the service level inside above mentioned method and
do request.getParameter(), I get a null.

  What can be the possible reason for this ?

Best Regards,
Nandana

Re: JAX-RS HTTP POST missing parameters

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

Can you please try using
(MultivaluedMap<String, String> map)
(without @Context)


instead of HttpServletRequest request

and see if this map is populated ?
Sergey

On Thu, Jul 22, 2010 at 6:52 PM, Nandana Mihindukulasooriya <
nandana.cse@gmail.com> wrote:

> Hi,
>  I have a JAX-RS service (Apache CXF 2.2.9) and I do a HTTP POST to invoke
> the service. I used the jetty-maven-plugin (7.1.5.v20100705) with
> "jetty:run-war" option for testing and everything works fine there. But
> when
> I deploy the war in Apache Tomcat 5.5.28 / 6.0.26 and use the same client
> to
> invoke the service, the parameters are not present in the request. Method
> signature looks like something this.
>
>    @POST
>    @GET
>    @Produces("application/x-www-form-urlencoded")
>    @Consumes("application/x-www-form-urlencoded")
>    public Response getInfo(@Context HttpServletRequest request) {
>    ....
>    }
>
>  I debugged the service in Tomcat and if I check at CXFServlet
> (AbstractHTTPServlet) level and do a request.getParameter(), I can access
> the parameter and everything works as expected too. But if I don't do that
> and catch the request at the service level inside above mentioned method
> and
> do request.getParameter(), I get a null.
>
>  What can be the possible reason for this ?
>
> Best Regards,
> Nandana
>