/**
   * Set the request that we are wrapping.
   *
   * @param request The new wrapped request
   */
  public void setRequest(ServletRequest request) {

    super.setRequest(request);

    // Initialize the attributes for this request
    synchronized (attributes) {
      attributes.clear();
      Enumeration names = request.getAttributeNames();
      while (names.hasMoreElements()) {
        String name = (String) names.nextElement();
        Object value = request.getAttribute(name);
        attributes.put(name, value);
      }
    }
  }
示例#2
0
 public ServletRequestWrapper(ServletRequest request) {
   setRequest(request);
 }