本文整理汇总了Java中javax.servlet.http.HttpServletRequestWrapper.getRequest方法的典型用法代码示例。如果您正苦于以下问题:Java HttpServletRequestWrapper.getRequest方法的具体用法?Java HttpServletRequestWrapper.getRequest怎么用?Java HttpServletRequestWrapper.getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.servlet.http.HttpServletRequestWrapper
的用法示例。
在下文中一共展示了HttpServletRequestWrapper.getRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHttpServletRequest
import javax.servlet.http.HttpServletRequestWrapper; //导入方法依赖的package包/类
public HttpServletRequest getHttpServletRequest(PortletRequest portletRequest) {
HttpServletRequest httpServletRequest = PortalUtil.getHttpServletRequest(portletRequest);
// If the request object is a wrapper that handles special namespacing considerations for portlet session
// attributes, then get the inner-most wrapped request. This will ensure that the following call to
// LoginUtil.login(...) will be able to work with a session that has an attribute map shared by the portal.
if (httpServletRequest.getClass().getName().equals(NAMESPACE_SERVLET_REQUEST_FQCN)) {
while (httpServletRequest instanceof HttpServletRequestWrapper) {
HttpServletRequestWrapper httpServletRequestWrapper = (HttpServletRequestWrapper) httpServletRequest;
httpServletRequest = (HttpServletRequest) httpServletRequestWrapper.getRequest();
}
}
return httpServletRequest;
}
示例2: validatePossibleAuthenticationResponse
import javax.servlet.http.HttpServletRequestWrapper; //导入方法依赖的package包/类
/**
* Handling the (possible) response
*/
@Override
protected boolean validatePossibleAuthenticationResponse(final HttpServletRequest request, final HttpServletResponse response, final String pathRequested) throws IOException { // Check
// for
// certificates
// in
// the
// request
// attributes
final X509Certificate certificateArray[] = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate");
if ((certificateArray != null) && (certificateArray.length > 0)) {
boolean failed = Boolean.FALSE;
for (int n = 0; n < certificateArray.length; n++) {
try {
certificateArray[n].checkValidity();
} catch (final Throwable err) {
failed = Boolean.TRUE;
}
}
if (!failed) {
final AuthenticationPrincipal principal = realm.retrieveUser(certificateArray[0].getSubjectDN().getName());
if (principal != null) {
principal.setAuthType(HttpServletRequest.CLIENT_CERT_AUTH);
if (request instanceof WinstoneRequest) {
((WinstoneRequest) request).setRemoteUser(principal);
} else if (request instanceof HttpServletRequestWrapper) {
final HttpServletRequestWrapper wrapper = (HttpServletRequestWrapper) request;
if (wrapper.getRequest() instanceof WinstoneRequest) {
((WinstoneRequest) wrapper.getRequest()).setRemoteUser(principal);
} else {
ClientcertAuthenticationHandler.logger.warn("Request type invalid - can't set authenticated user in request class: {}", wrapper.getRequest().getClass().getName());
}
} else {
ClientcertAuthenticationHandler.logger.warn("Request type invalid - can't set authenticated user in request class: {}", request.getClass().getName());
}
}
}
}
return Boolean.TRUE;
}
示例3: popWrapper
import javax.servlet.http.HttpServletRequestWrapper; //导入方法依赖的package包/类
public void popWrapper()
{
HttpServletRequestWrapper wrapper=(HttpServletRequestWrapper)getRequest();
HttpServletRequest request=(HttpServletRequest)wrapper.getRequest();
setRequest(request);
}