我有两台服务器,一台(本地)和另一台(通过 vpn 远程调用)。
两者都部署了相同的应用程序。
我停止了vpn来调用本地的,所以他们之间没有干扰。
我试图在 doFilter 方法中获取 servletFilter 中的参数。
本地在我的电脑上:weblogic server 11g
远程是通过vpn:weblogic enterprise manager
在第一种情况下,httpServletRequest.getParameter 返回 post 请求的预期值。
第二个为空。
我发送到以下网址:
http://mydomain/myapp/faces/login-return.jspx
发送请求的html表单:
<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>
我的 servlet 过滤器中的代码:
if (isSessionControlRequiredForThisResource(httpServletRequest, getLoginPage())) {
if(httpServletRequest.getParameter("param1") != null) {
httpServletRequest.getSession().setAttribute("param1", httpServletRequest.getParameter("param1"));
}
我们将不胜感激
最佳答案
问题在于,服务器期待的是 https 调用而不是 http。
因此,当我将调用协议(protocol)更改为 https 时,它开始像魅力一样收集请求参数!
关于java - httpServletRequest.getParameter 返回 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23768735/