httpServletRequest.getParameter returns null

GingerHead picture GingerHead · May 20, 2014 · Viewed 8.4k times · Source

I have two servers one (local) and the other (remote calling through vpn).

On both, the same application is deployed.

I stop the vpn to call the local one, so no interference between them.

I am trying to get the param in the servletFilter in doFilter method.

The local is on my pc : weblogic server 11g
The remote is through vpn: weblogic enterprise manager

In the first case httpServletRequest.getParameter returns the expected value of a post request.

In the second gets null.

I am sending to the following url:

http://mydomain/myapp/faces/login-return.jspx

the html form that sends the rquest:

<html>

    <body>
          <form  action="https://mydomain/myapp/faces/login-return.jspx"  method="post">
            <input type="hidden" name="param1" value="value1"  />
            <input type="hidden" name="param2" value="value2"  />
            <input type="submit" name="submit" value="Send to server" />
        </form>
    </body>
</html> 

The code in my servlet filter:

    if (isSessionControlRequiredForThisResource(httpServletRequest, getLoginPage())) {

        if(httpServletRequest.getParameter("param1") != null) {
            httpServletRequest.getSession().setAttribute("param1", httpServletRequest.getParameter("param1"));

        }

any help would be approciated

Answer

GingerHead picture GingerHead · May 24, 2014

The problem was that, the server was expecting https calls and not http.

So when I changed my calling protocol to https it started to gather the request parameters like a charm!