📄 portletrequestimpl.java
字号:
public java.util.Map getParameterMap() { hasReader = true; return portalParameters.getParameterMap(getHttpServletRequest(), getQueryString()); } /** * Returns a boolean indicating whether this request was made * using a secure channel between client and the portal, such as HTTPS. * * @return true, if the request was made using a secure channel. */ public boolean isSecure() { return this.getHttpServletRequest().isSecure(); } /** * Stores an attribute in this request. * <p/> * <p>Attribute names should follow the same conventions as * package names. Names beginning with <code>java.*</code>, * <code>javax.*</code>, and <code>com.sun.*</code> are * reserved for use by Sun Microsystems. * <br> If the value passed into this method is <code>null</code>, * the effect is the same as calling {@link #removeAttribute}. * * @param name a <code>String</code> specifying * the name of the attribute * @param o the <code>Object</code> to be stored * @throws IllegalArgumentException if name is <code>null</code>. */ public void setAttribute(String name, Object o) { if (name == null) throw new IllegalArgumentException("name is NULL"); if (o == null) { this.removeAttribute(name); } else { this.getHttpServletRequest().setAttribute(name, o); } } /** * Removes an attribute from this request. This method is not * generally needed, as attributes only persist as long as the request * is being handled. * <p/> * <p>Attribute names should follow the same conventions as * package names. Names beginning with <code>java.*</code>, * <code>javax.*</code>, and <code>com.sun.*</code> are * reserved for use by Sun Microsystems. * * @param name a <code>String</code> specifying * the name of the attribute to be removed * @throws IllegalArgumentException if name is <code>null</code>. */ public void removeAttribute(String name) { if (name == null) throw new IllegalArgumentException("name is NULL"); this.getHttpServletRequest().removeAttribute(name); } /** * Returns the session ID indicated in the client request. * This session ID may not be a valid one, it may be an old * one that has expired or has been invalidated. * If the client request * did not specify a session ID, this method returns * <code>null</code>. * * @return a <code>String</code> specifying the session * ID, or <code>null</code> if the request did * not specify a session ID * @see #isRequestedSessionIdValid */ public String getRequestedSessionId() { return this.getHttpServletRequest().getRequestedSessionId(); } /** * Checks whether the requested session ID is still valid. * * @return <code>true</code> if this * request has an id for a valid session * in the current session context; * <code>false</code> otherwise * @see #getRequestedSessionId * @see #getPortletSession */ public boolean isRequestedSessionIdValid() { return this.getHttpServletRequest().isRequestedSessionIdValid(); } /** * Returns the portal preferred content type for the response. * <p/> * The content type only includes the MIME type, not the * character set. * <p/> * Only content types that the portlet has defined in its * deployment descriptor are valid return values for * this method call. If the portlet has defined * <code>'*'</code> or <code>'* / *'</code> as supported content * types, these may also be valid return values. * * @return preferred MIME type of the response */ public String getResponseContentType() { SortedSet types = (SortedSet) getAttribute(SportletProperties.PORTLET_MIMETYPES); if ((types == null) || (types.isEmpty())) return null; return (String) types.first(); } /** * Gets a list of content types which the portal accepts for the response. * This list is ordered with the most preferable types listed first. * <p/> * The content type only includes the MIME type, not the * character set. * <p/> * Only content types that the portlet has defined in its * deployment descriptor are valid return values for * this method call. If the portlet has defined * <code>'*'</code> or <code>'* / *'</code> as supported content * types, these may also be valid return values. * * @return ordered list of MIME types for the response */ public java.util.Enumeration getResponseContentTypes() { SortedSet types = (SortedSet) getAttribute(SportletProperties.PORTLET_MIMETYPES); if (types == null) types = new TreeSet(); return new Enumerator(types); } /** * Returns the preferred Locale in which the portal will accept content. * The Locale may be based on the Accept-Language header of the client. * * @return the prefered Locale in which the portal will accept content. */ public java.util.Locale getLocale() { Locale locale = (Locale) this.getPortletSession(true).getAttribute(User.LOCALE, PortletSession.APPLICATION_SCOPE); if (locale != null) return locale; User user = (User) this.getHttpServletRequest().getAttribute(SportletProperties.PORTLET_USER); if (user != null) { String loc = (String) user.getAttribute(User.LOCALE); if (loc != null) { locale = new Locale(loc, "", ""); this.getPortletSession(true).setAttribute(User.LOCALE, locale, PortletSession.APPLICATION_SCOPE); return locale; } } locale = this.getHttpServletRequest().getLocale(); if (locale != null) return locale; return Locale.ENGLISH; } /** * Returns an Enumeration of Locale objects indicating, in decreasing * order starting with the preferred locale in which the portal will * accept content for this request. * The Locales may be based on the Accept-Language header of the client. * * @return an Enumeration of Locales, in decreasing order, in which * the portal will accept content for this request */ public java.util.Enumeration getLocales() { return this.getHttpServletRequest().getLocales(); } /** * Returns the name of the scheme used to make this request. * For example, <code>http</code>, <code>https</code>, or <code>ftp</code>. * Different schemes have different rules for constructing URLs, * as noted in RFC 1738. * * @return a <code>String</code> containing the name * of the scheme used to make this request */ public String getScheme() { return this.getHttpServletRequest().getScheme(); } /** * Returns the host name of the server that received the request. * * @return a <code>String</code> containing the name * of the server to which the request was sent */ public String getServerName() { return this.getHttpServletRequest().getServerName(); } /** * Returns the port number on which this request was received. * * @return an integer specifying the port number */ public int getServerPort() { return this.getHttpServletRequest().getServerPort(); } public int getContentLength() { if (included) return 0; return this.getHttpServletRequest().getContentLength(); } public String getProtocol() { return null; } public String getRemoteAddr() { return null; } public String getRemoteHost() { return null; } public String getRealPath(String s) { return null; } public StringBuffer getRequestURL() { return null; } public String getCharacterEncoding() { return null; } public void setCharacterEncoding(String s) throws UnsupportedEncodingException { // do nothing } public String getContentType() { if (included) return null; return this.getHttpServletRequest().getContentType(); } public String getQueryString() { if (included) { return (String) super.getAttribute("javax.servlet.include.query_string"); } return super.getQueryString(); } public String getPathInfo() { String cmd = (String) getAttribute("org.gridsphere.tomcat_hack"); if (cmd != null) return cmd; if (included) { return (String) super.getAttribute("javax.servlet.include.path_info"); } return super.getPathInfo(); } public String getRequestURI() { if (included) return (String) super.getAttribute("javax.servlet.include.request_uri"); //return (attr != null) ? attr : super.getRequestURI(); return super.getRequestURI(); } public String getServletPath() { if (included) return (String) super.getAttribute("javax.servlet.include.servlet_path"); //return (attr != null) ? attr : super.getServletPath(); return super.getServletPath(); } public String getPathTranslated() { return super.getPathTranslated(); } public ServletInputStream getInputStream() throws IOException { if (included) return null; ServletInputStream stream = getHttpServletRequest().getInputStream(); hasReader = true; return stream; } public BufferedReader getReader() throws IOException { if (included) return null; hasReader = true; return getHttpServletRequest().getReader(); } private HttpServletRequest getHttpServletRequest() { return (HttpServletRequest) super.getRequest(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -