javax.servlet.http.HttpServletRequestWrapper.getRequest()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中javax.servlet.http.HttpServletRequestWrapper.getRequest()方法的一些代码示例,展示了HttpServletRequestWrapper.getRequest()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpServletRequestWrapper.getRequest()方法的具体详情如下:
包路径:javax.servlet.http.HttpServletRequestWrapper
类名称:HttpServletRequestWrapper
方法名:getRequest

HttpServletRequestWrapper.getRequest介绍

[英]The default behavior of this method is to return getRequestURI() on the wrapped request object.
[中]此方法的默认行为是在包装的请求对象上返回getRequestURI()。

代码示例

代码示例来源:origin: spring-projects/spring-framework

@Override
public HttpServletRequest getRequest() {
  return (HttpServletRequest) super.getRequest();
}

代码示例来源:origin: org.springframework/spring-web

@Override
public HttpServletRequest getRequest() {
  return (HttpServletRequest) super.getRequest();
}

代码示例来源:origin: cloudfoundry/uaa

@Override
public ServletRequest getRequest() {
  return super.getRequest();
}

代码示例来源:origin: spring-projects/spring-framework

private static RequestFacade getRequestFacade(HttpServletRequest request) {
  if (request instanceof RequestFacade) {
    return (RequestFacade) request;
  }
  else if (request instanceof HttpServletRequestWrapper) {
    HttpServletRequestWrapper wrapper = (HttpServletRequestWrapper) request;
    HttpServletRequest wrappedRequest = (HttpServletRequest) wrapper.getRequest();
    return getRequestFacade(wrappedRequest);
  }
  else {
    throw new IllegalArgumentException("Cannot convert [" + request.getClass() +
        "] to org.apache.catalina.connector.RequestFacade");
  }
}

代码示例来源:origin: org.springframework/spring-web

private static RequestFacade getRequestFacade(HttpServletRequest request) {
  if (request instanceof RequestFacade) {
    return (RequestFacade) request;
  }
  else if (request instanceof HttpServletRequestWrapper) {
    HttpServletRequestWrapper wrapper = (HttpServletRequestWrapper) request;
    HttpServletRequest wrappedRequest = (HttpServletRequest) wrapper.getRequest();
    return getRequestFacade(wrappedRequest);
  }
  else {
    throw new IllegalArgumentException("Cannot convert [" + request.getClass() +
        "] to org.apache.catalina.connector.RequestFacade");
  }
}

代码示例来源:origin: perwendel/spark

@Override
public ServletInputStream getInputStream() throws IOException {
  HttpServletRequest request = (HttpServletRequest) super.getRequest();
  // disable stream cache for chunked transfer encoding
  String transferEncoding = request.getHeader("Transfer-Encoding");
  if ("chunked".equals(transferEncoding)) {
    return super.getInputStream();
  }
  // disable stream cache for multipart/form-data file upload
  // -> upload might be very large and might lead to out-of-memory error if we try to cache the bytes
  String contentType = request.getHeader("Content-Type");
  if (contentType != null && contentType.startsWith("multipart/form-data")) {
    return super.getInputStream();
  }
  if (cachedBytes == null) {
    cacheInputStream();
  }
  return new CachedServletInputStream();
}

代码示例来源:origin: Atmosphere/atmosphere

HttpServletRequest hsr = HttpServletRequestWrapper.class.cast(b.request);
while (hsr instanceof HttpServletRequestWrapper) {
  hsr = (HttpServletRequest) ((HttpServletRequestWrapper) hsr).getRequest();
  o = attributeWithoutException(hsr, s);
  if (o == null || String.class.isAssignableFrom(o.getClass())) {

代码示例来源:origin: paoding-code/paoding-rose

/**
 * 取出包装在里面的PortalRequest
 * 
 * @param request
 * @return
 */
public static PortalRequest unwrapPortalRequest(HttpServletRequest request) {
  do {
    if (request instanceof PortalRequest) {
      return (PortalRequest) request;
    } else if (request instanceof HttpServletRequestWrapper) {
      request = (HttpServletRequest) ((HttpServletRequestWrapper) request).getRequest();
    } else {
      return null;
    }
  } while (true);
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

public static void logRequestWrappers(HttpServletRequest request) {
  HttpServletRequest tempRequest = request;
  while (true) {
    if (_log.isInfoEnabled()) {
      Class<?> clazz = tempRequest.getClass();
      _log.info("Request class " + clazz.getName());
    }
    if (tempRequest instanceof HttpServletRequestWrapper) {
      HttpServletRequestWrapper requestWrapper =
        (HttpServletRequestWrapper)tempRequest;
      tempRequest = (HttpServletRequest)requestWrapper.getRequest();
    }
    else {
      break;
    }
  }
}

代码示例来源:origin: paoding-code/paoding-rose

/**
 * Clean up any resources used by the given multipart request (if any).
 * 
 * @see MultipartResolver#cleanupMultipart
 */
protected void cleanupMultipart(Invocation inv) {
  HttpServletRequest src = inv.getRequest();
  while (src != null && !(src instanceof MultipartHttpServletRequest)
      && src instanceof HttpServletRequestWrapper) {
    src = (HttpServletRequest) ((HttpServletRequestWrapper) src).getRequest();
  }
  if (src instanceof MultipartHttpServletRequest) {
    final MultipartHttpServletRequest request = (MultipartHttpServletRequest) src;
    MultipartCleanup multipartCleaner = inv.getMethod().getAnnotation(
        MultipartCleanup.class);
    if (multipartCleaner == null
        || multipartCleaner.after() == MultipartCleanup.After.CONTROLLER_INVOCATION) {
      multipartResolver.cleanupMultipart(request);
    } else {
      inv.addAfterCompletion(new AfterCompletion() {
        @Override
        public void afterCompletion(Invocation inv, Throwable ex) throws Exception {
          ModuleEngine.this.multipartResolver.cleanupMultipart(request);
        }
      });
    }
  }
}

代码示例来源:origin: webx/citrus

HttpServletRequest wrappedRequest = (HttpServletRequest) wrapper.getRequest();
boolean[] filtering = null;

代码示例来源:origin: webx/citrus

HttpServletRequest wrappedRequest = (HttpServletRequest) wrapper.getRequest();
boolean[] filtering = null;

代码示例来源:origin: webx/citrus

HttpServletRequest wrappedRequest = (HttpServletRequest) wrapper.getRequest();
boolean isMultipart = false;

代码示例来源:origin: webx/citrus

HttpServletRequest wrappedRequest = (HttpServletRequest) wrapper.getRequest();
boolean isMultipart = false;

代码示例来源:origin: OpenNMS/opennms

/** {@inheritDoc} */
@Override
public void removeAttribute(String name) {
  super.getRequest().removeAttribute(name);
}

代码示例来源:origin: FastBootWeixin/FastBootWeixin

/**
 * 为了应对多重包装RequestAttributeChangeIgnoringWrapper导致的属性设置无效,这里简单的这样处理了一下
 * @param request
 * @param wxRequest
 */
public static void setWxRequestToRequest(HttpServletRequest request, WxRequest wxRequest) {
  ServletRequest servletRequest = request;
  while (servletRequest instanceof HttpServletRequestWrapper) {
    servletRequest = ((HttpServletRequestWrapper) servletRequest).getRequest();
  }
  servletRequest.setAttribute(WX_REQUEST_ATTRIBUTE, wxRequest);
}

代码示例来源:origin: paoding-code/paoding-rose

requestWrapper = (HttpServletRequestWrapper) innerRequest;
innerRequest = (HttpServletRequest) ((HttpServletRequestWrapper) innerRequest)
    .getRequest();

代码示例来源:origin: OpenNMS/opennms

/** {@inheritDoc} */
@Override
public void setCharacterEncoding(String enc) throws UnsupportedEncodingException {
  super.getRequest().setCharacterEncoding(enc);
}

代码示例来源:origin: OpenNMS/opennms

/** {@inheritDoc} */
@Override
public String getCharacterEncoding() {
  return super.getRequest().getCharacterEncoding();
}

代码示例来源:origin: net.sourceforge.stripes/stripes

/** Get the parameter map from the request that is wrapped by the {@link StripesRequestWrapper}. */
@SuppressWarnings("unchecked")
Map<String, String[]> getParameterMap() {
  return request == null ? Collections.emptyMap() : request.getRequest().getParameterMap();
}

相关文章

HttpServletRequestWrapper类方法