我正在使用Axis2作为移动应用程序的REST Web服务,我正在编写一个安全处理程序,进入Axis2 IN流程的自定义阶段,我遇到一些麻烦从请求中获取POST参数;我可以在使用GET方法时成功检索这些参数,但在POST情况下,我得到的只是空值。 任何帮助都非常感谢
这是我的代码段:
public InvocationResponse invoke(MessageContext mc) throws AxisFault {
AxisMessage axisMessage = mc.getAxisMessage();
System.out.println("***SecurityHandler Starting***");
HttpServletRequest req =(HttpServletRequest)mc.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
System.out.println("Method : "+req.getMethod());
String username = req.getParameter(ARG_LOGIN);
System.out.println("User login : "+ username);// User login : null
}
答案 0 :(得分:0)
HttpServletRequest obj = (HttpServletRequest)msgContext .
getProperty("transport.http.servletRequest");
if (obj != null) {
System.out.println("Method :"+ obj.getMethod());
System.out.println("Content-type :" +obj.getContentType());
System.out.println("Content-length :"+obj.getContentLength());
System.out.println("Remote addtress"+obj.getSession().getLastAccessedTime());
}
查看这篇文章[1]
[1] http://vvratha.blogspot.com/2013/08/extracting-http-level-information-in.html