odnoklassniki/one-nio

Http paramers parse error

vlad-bondarenko opened this issue · 2 comments

Hi!

Create web app and use code:
@path("/organization")
public Response organization(Request request, HttpSession session) throws IOException {
Response response;
try {
if (request.getMethod() == Request.METHOD_GET) {
String name = request.getParameter("name");
String legalName = request.getParameter("legal_name");
String region = request.getParameter("region");
String locality = request.getParameter("locality");
String address = request.getParameter("address");

Method request.getParameter(String s) return wrong value.

Thanks.

The right way to use getParameter is to write

String name = request.getParameter("name=");

The idea of the method was to return the value after the given prefix, so = was intentional.
I know this looks a bit ugly to developers accustomed to Servlet API etc. Probably I'd better switch back to the "traditional" API, but I need to leave this until the next major release not to break backward compatibility.

Thanks.