本文整理匯總了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);
}