我需要从HttpServletRequest
获取用户名和密码来处理基本认证。我所拥有的是CXF
端点和基本auth拦截器。该HttpServletRequest
我得到这样的:从HttpServletRequest获取用户名和密码
public void handleMessage(Message message)
throws Fault {
HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
}
当我试着调试代码,我看到:
request.getAuthType() is null
request.getRemoteUser() is null
的用户名和密码,我从肥皂UI的请求发送。所以问题是我如何能够从请求中获取用户名和密码?
编辑
标题是这样的:
POST http://localhost:8011/GradIrelandUserRegistration HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
Authorization: Basic UGF1bGl1czpQYXVsaXVzMTIz
Content-Length: 3170
Host: localhost:8011
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
他们说,授权是基本的,但为什么叫request.getAuthType()
被返回null?
您是否检查过标题或参数? – heikkim 2012-07-30 08:31:58
我编辑了问题 – 2012-07-30 08:34:52