httpportletconnection.java

来自「RESIN 3.2 最新源码」· Java 代码 · 共 798 行 · 第 1/2 页

JAVA
798
字号
    // XXX:    if (request.isSecure())      return appendUrlPrefix(request, buf);    else      throw new PortletSecurityException("cannot make url secure");  }  public boolean handleConstraintFailure( Constraint constraint,                                           int failureCode )    throws IOException  {    if (failureCode == Constraint.SC_FORBIDDEN) {      _httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN);    }    else {      _httpResponse.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE);    }    return true;  }  public boolean handleException(Exception exception)  {    return false;  }    /**   * Return true if the connection can guarantee integrity    * (preventing data tampering in the communication process).   */  public boolean canGuaranteeIntegrity()  {    return isSecure();  }  /**   * Return true if the connection can guarantee confidentiality (preventing   * reading while in transit).   */  public boolean canGuaranteeConfidentiality()  {    return isSecure();  }  /**   * Attributes for the connection are HttpServletRequest attributes.   */  public Object getAttribute(String name)  {    return _httpRequest.getAttribute(name);  }  /**   * Attributes for the connection are HttpServletRequest attributes.   */  public void setAttribute(String name, Object o)  {    _httpRequest.setAttribute(name,o);  }  /**   * Attributes for the connection are HttpServletRequest attributes.   */  public void removeAttribute(String name)  {    _httpRequest.removeAttribute(name);  }  /**   * Attributes for the connection are HttpServletRequest attributes.   */  public Enumeration getAttributeNames()  {    return _httpRequest.getAttributeNames();  }  public PortletSession getPortletSession(boolean create)  {    if (_portletSession != null)      return _portletSession;    HttpSession httpSession = _httpRequest.getSession(create);    if (httpSession != null) {      // XXX: pool these      _portletSession = new HttpPortletSession();      _portletSession.start(_portletContext, httpSession);    }    return _portletSession;  }  public String getScheme()  {    return _httpRequest.getScheme();  }  public String getServerName()  {    return _httpRequest.getServerName();  }  public int getServerPort()  {    return _httpRequest.getServerPort();  }  public String getContextPath()  {    return _httpRequest.getContextPath();  }  public String getAuthType()  {    String authType = _httpRequest.getAuthType();        if (authType == null)      return null;    else if (authType == HttpServletRequest.BASIC_AUTH)      return PortletRequest.BASIC_AUTH;    /** XXX: bug in caucho impl of jsdk    else if (authType == HttpServletRequest.CLIENT_CERT_AUTH)      return PortletRequest.CLIENT_CERT_AUTH;      */    else if (authType == HttpServletRequest.DIGEST_AUTH)      return PortletRequest.DIGEST_AUTH;    else if (authType == HttpServletRequest.FORM_AUTH)      return PortletRequest.FORM_AUTH;    else if (authType.equals(HttpServletRequest.BASIC_AUTH))      return PortletRequest.BASIC_AUTH;    else if (authType.equals("CLIENT_CERT")) // XXX: bug in caucho impl of jsdk      return PortletRequest.CLIENT_CERT_AUTH;    else if (authType.equals(HttpServletRequest.DIGEST_AUTH))      return PortletRequest.DIGEST_AUTH;    else if (authType.equals(HttpServletRequest.FORM_AUTH))      return PortletRequest.FORM_AUTH;    else      return authType;  }  public boolean isSecure()  {    return _httpRequest.isSecure();  }  public String getRequestedSessionId()  {    return _httpRequest.getRequestedSessionId();  }  public boolean isRequestedSessionIdValid()  {    return _httpRequest.isRequestedSessionIdValid();  }  public String getRemoteUser()  {    return _httpRequest.getRemoteUser();  }  public Principal getUserPrincipal()  {    return _httpRequest.getUserPrincipal();  }  public boolean isUserInRole(String role)  {    return _httpRequest.isUserInRole(role);  }  public String getProperty(String propertyName)  {    return _httpRequest.getHeader(propertyName);  }  public Enumeration getProperties(String propertyName)  {    return _httpRequest.getHeaders(propertyName);  }  public Enumeration getPropertyNames()  {    return _httpRequest.getHeaderNames();  }  public String getSubmitContentType()  {    return _httpRequest.getContentType();  }  public int getSubmitContentLength()  {    return _httpRequest.getContentLength();  }  public InputStream getSubmitInputStream()    throws IOException  {    return _httpRequest.getInputStream();  }  public void setSubmitCharacterEncoding(String enc)    throws UnsupportedEncodingException, IllegalStateException  {    _httpRequest.setCharacterEncoding(enc);  }  public String getSubmitCharacterEncoding()  {    return _httpRequest.getCharacterEncoding();  }  public BufferedReader getSubmitReader()    throws UnsupportedEncodingException, IOException  {    return _httpRequest.getReader();  }  /**   * A path with a schem is encoded only.   *   * A relative location (does not start with slash) is resolved relative to   * the servlet path and then encoded.     *   * An absolute url (begins with slash) is resolved relative to    * the context path and then encoded.   */  public String encodeURL(String location)  {    int slash = location.indexOf('/');    int colon = location.indexOf(':');    if (colon == -1 || slash < colon ) {      String scheme = _httpRequest.getScheme();      String serverName = _httpRequest.getServerName();      int port = _httpRequest.getServerPort();      if (port == 80 && scheme.equals("http"))        port = -1;      if (port == 443 && scheme.equals("https"))        port = -1;      String contextPath = (String) _httpRequest.getAttribute("javax.servlet.include.context_path");      String servletPath = null;      if (contextPath == null) {        contextPath = _httpRequest.getContextPath();        servletPath = _httpRequest.getServletPath();      }      StringBuffer buf = new StringBuffer();      buf.append(scheme);      buf.append("://");      buf.append(serverName);      if (port > 0) {        buf.append(':');        buf.append(port);      }      buf.append(contextPath);      if ( slash != 0 ) {        if (servletPath == null)          servletPath = (String) _httpRequest.getAttribute("javax.servlet.include.servlet_path");        buf.append(servletPath);        buf.append('/');        buf.append(location);      }      else {        buf.append(location);      }          location = buf.toString();    }    return _httpResponse.encodeURL(location);  }  public void sendRedirect(String location)    throws IOException  {    String url = _httpResponse.encodeRedirectURL(location);    _httpResponse.sendRedirect(url);  }  public void setProperty(String name, String value)  {    _httpResponse.setHeader(name, value);  }  public void addProperty(String name, String value)  {    _httpResponse.addHeader(name, value);  }  public void setContentType(String contentType)  {    _isContentTypeEstablished = true;    _httpResponse.setContentType(contentType);  }  /**    * Return the content type established with setContentType(), or null if   * setContentType() has not been called.   */   public String getContentType()  {    if (_isContentTypeEstablished)      return _httpResponse.getContentType();    else      return null;  }  public void setLocale(Locale locale)  {    _isLocaleEstablished = true;    _httpResponse.setLocale(locale);  }  /**   * Return the Locale established with setLocale(), or null if setLocale()   * has not been called.   */  public Locale getLocale()  {    if (_isLocaleEstablished)      return _httpResponse.getLocale();    else      return null;  }  public void setBufferSize(int size)  {    _httpResponse.setBufferSize(size);  }  public int getBufferSize()  {    return _httpResponse.getBufferSize();  }  public void flushBuffer()     throws IOException  {    _httpResponse.flushBuffer();  }  public void resetBuffer()  {    _httpResponse.resetBuffer();  }  public void reset()  {    _httpResponse.reset();  }  public boolean isCommitted()  {    return _httpResponse.isCommitted();  }  public OutputStream getOutputStream()     throws IOException  {    return _httpResponse.getOutputStream();  }  public String getCharacterEncoding()  {    return _httpResponse.getCharacterEncoding();  }  public void setCharacterEncoding(String enc)     throws UnsupportedEncodingException  {    _httpResponse.setCharacterEncoding(enc);  }  public PrintWriter getWriter()     throws IOException  {    return _httpResponse.getWriter();  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?