UserServiceLegacy does not see parameters in the body

Our application was working against OpenFire using the UserService v1.3.2. Our application would NOT pass the parameter variables via the query string (URL), but would instead include them in the body. Not sure why this decision was made (before my time) - but that is what our application does. And reading through the HttpServletRequest, this is okay. getParameter() says:

“For HTTP servlets, parameters are contained in the query string or posted form data.”

We recently updated our OpenFire to 3.10.2; and got the UserService v2.0.2 to go with that. I see the UserService changes and the restAPI, etc. But I also saw where it included the UserServiceLegacy module that implements the same type of functionality we used before, but a little different implementation. See the end of this post for code comparison.

What we found was that it appears if values were passed in the body, they were already consumed prior to userServiceRequest() getting called. We added a bunch of debugging and found that we could do a getReader() without throwing an error saying it was in a bad state.

We ended up changing our side so that it sends the parameters as a query string and that works. But I am still confused why the unchanged UserServiceLegacy() does not support values in the body and the previous one did. I am not a Java programmer.

Thanks - Scott

The previous code looked like:

@Override

protected void doGet(HttpServletRequest request, HttpServletResponse response)

        throws ServletException, IOException

{

:

String secret = request.getParameter(“secret”);

:

}

Where the new UserServiceLegacy uses (I corrected the spelling of userSerivce…):

@Context

private HttpServletRequest request;

@Context

private HttpServletResponse response;

:

@POST

@Path("/userservice")

public void userServicePostRequest() throws IOException {

userServiceRequest();

}

@GET

@Path("/userservice")

public Response userServiceRequest() throws IOException {

:

String secret = request.getParameter(“secret”);

:

}