users@jersey.java.net

_at_FormParam, _at_Context HttpContext and _at_Context HttpServletRequest

From: Alexandru Popescu ☀ <the.mindstorm.mailinglist_at_gmail.com>
Date: Tue, 30 Mar 2010 12:45:31 +0300

Hi all,

I am not really sure if it is something wrong with the below code or
just something I don't understand:

    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response mset(@Context HttpContext httpContext,
@FormParam("nx") String nx) {
        Form form= httpContext.getRequest().getFormParameters();

        assertNotEmpty(form); // <== this FAILS, even if I'm 100% form
data is submitted
    }


    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response mset(@Context HttpServletRequest request,
@FormParam("nx") String nx) {
        Map params= request.getParameterMap();

        assertNotEmpty(form); // <== this FAILS, even if I'm 100% form
data is submitted
    }


For both above cases, if I'm using @FormParam-s the form parameters
are correctly retrieved. The problem I'm trying to solve is that
my service is not aware beforehand of all form parameters so it needs
to retrieve all of them.


For current code I am using Grizzly 1.9.18 with the following setup:

SelectorThread threadSelector =
GrizzlyWebContainerFactory.create(BASE_URI, initParams);


Any ideas what I'm doing wrong?

Many thanks in advance,

:- alex