In ASP, there\'s request.form and request.queryString attributes, but in Java. It seems like we have only one collection, which can be accessed via
HttpServletRequest.getMethod():
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. Same as the value of the CGI variable REQUEST_METHOD.
All you need to do is this:
boolean isPost = "POST".equals(request.getMethod());
Also I'm really confused on why you wouldn't simply use request.getParameter("somename") to retrieve values sent as request parameters. This method returns the parameter regardless of whether the request was sent via a GET or a POST:
Request parameters are extra information sent with the request. For HTTP servlets, parameters are contained in the query string or posted form data.
It's a heck of a lot simpler than trying to parse getQueryString() yourself.