📄 request.java
字号:
* @param authType The authType to set. */ public void setAuthType(String authType) { _authType = authType; } /* ------------------------------------------------------------ */ /** * @param cookies The cookies to set. */ public void setCookies(Cookie[] cookies) { _cookies = cookies; } /* ------------------------------------------------------------ */ /** * @param method The method to set. */ public void setMethod(String method) { _method = method; } /* ------------------------------------------------------------ */ /** * @param pathInfo The pathInfo to set. */ public void setPathInfo(String pathInfo) { _pathInfo = pathInfo; } /* ------------------------------------------------------------ */ /** * @param protocol The protocol to set. */ public void setProtocol(String protocol) { _protocol = protocol; } /* ------------------------------------------------------------ */ /** * @param requestedSessionId The requestedSessionId to set. */ public void setRequestedSessionId(String requestedSessionId) { _requestedSessionId = requestedSessionId; } /* ------------------------------------------------------------ */ /** * @return Returns the sessionManager. */ public SessionManager getSessionManager() { return _sessionManager; } /* ------------------------------------------------------------ */ /** * @param sessionManager The sessionManager to set. */ public void setSessionManager(SessionManager sessionManager) { _sessionManager = sessionManager; } /* ------------------------------------------------------------ */ /** * @param requestedSessionIdCookie The requestedSessionIdCookie to set. */ public void setRequestedSessionIdFromCookie(boolean requestedSessionIdCookie) { _requestedSessionIdFromCookie = requestedSessionIdCookie; } /* ------------------------------------------------------------ */ /** * @param session The session to set. */ public void setSession(HttpSession session) { _session = session; } /* ------------------------------------------------------------ */ /** * @param scheme The scheme to set. */ public void setScheme(String scheme) { _scheme = scheme; } /* ------------------------------------------------------------ */ /** * @param queryString The queryString to set. */ public void setQueryString(String queryString) { _queryString = queryString; } /* ------------------------------------------------------------ */ /** * @param requestURI The requestURI to set. */ public void setRequestURI(String requestURI) { _requestURI = requestURI; } /* ------------------------------------------------------------ */ /** * Sets the "context path" for this request * @see HttpServletRequest#getContextPath */ public void setContextPath(String contextPath) { _contextPath = contextPath; } /* ------------------------------------------------------------ */ /** * @param servletPath The servletPath to set. */ public void setServletPath(String servletPath) { _servletPath = servletPath; } /* ------------------------------------------------------------ */ /** * @param name The servletName to set. */ public void setServletName(String name) { _servletName = name; } /* ------------------------------------------------------------ */ /** * @param userPrincipal The userPrincipal to set. */ public void setUserPrincipal(Principal userPrincipal) { _userPrincipal = userPrincipal; } /* ------------------------------------------------------------ */ /** * @param context */ public void setContext(SContext context) { _context=context; } /* ------------------------------------------------------------ */ /** * @return The current {@link SContext context} used for this request, or <code>null</code> if {@link #setContext} has not yet * been called. */ public SContext getContext() { return _context; } /* ------------------------------------------------------------ */ /** * Reconstructs the URL the client used to make the request. The returned URL contains a * protocol, server name, port number, and, but it does not include a path. * <p> * Because this method returns a <code>StringBuffer</code>, not a string, you can modify the * URL easily, for example, to append path and query parameters. * * This method is useful for creating redirect messages and for reporting errors. * * @return "scheme://host:port" */ public StringBuffer getRootURL() { StringBuffer url = new StringBuffer(48); synchronized (url) { String scheme = getScheme(); int port = getServerPort(); url.append(scheme); url.append("://"); url.append(getServerName()); if (port > 0 && ((scheme.equalsIgnoreCase("http") && port != 80) || (scheme.equalsIgnoreCase("https") && port != 443))) { url.append(':'); url.append(port); } return url; } } /* ------------------------------------------------------------ */ /* */ public Attributes getAttributes() { if (_attributes==null) _attributes=new AttributesMap(); return _attributes; } /* ------------------------------------------------------------ */ /* */ public void setAttributes(Attributes attributes) { _attributes=attributes; } /* ------------------------------------------------------------ */ public Continuation getContinuation() { return _continuation; } /* ------------------------------------------------------------ */ public Continuation getContinuation(boolean create) { if (_continuation==null && create) _continuation=getConnection().getConnector().newContinuation(); return _continuation; } /* ------------------------------------------------------------ */ void setContinuation(Continuation cont) { _continuation=cont; } /* ------------------------------------------------------------ */ /** * @return Returns the parameters. */ public MultiMap getParameters() { return _parameters; } /* ------------------------------------------------------------ */ /** * @param parameters The parameters to set. */ public void setParameters(MultiMap parameters) { _parameters= (parameters==null)?_baseParameters:parameters; if (_paramsExtracted && _parameters==null) throw new IllegalStateException(); } /* ------------------------------------------------------------ */ public String toString() { return getMethod()+" "+_uri+" "+getProtocol()+"\n"+ _connection.getRequestFields().toString(); } /* ------------------------------------------------------------ */ public static Request getRequest(HttpServletRequest request) { if (request instanceof Request) return (Request) request; while (request instanceof ServletRequestWrapper) request = (HttpServletRequest)((ServletRequestWrapper)request).getRequest(); if (request instanceof Request) return (Request) request; return HttpConnection.getCurrentConnection().getRequest(); } /* ------------------------------------------------------------ */ public void addEventListener(final EventListener listener) { if (listener instanceof ServletRequestAttributeListener) _requestAttributeListeners= LazyList.add(_requestAttributeListeners, listener); } /* ------------------------------------------------------------ */ public void removeEventListener(final EventListener listener) { _requestAttributeListeners= LazyList.remove(_requestAttributeListeners, listener); } /* ------------------------------------------------------------ */ /** * @param requestListeners {@link LazyList} of {@link ServletRequestListener}s */ public void setRequestListeners(Object requestListeners) { _requestListeners=requestListeners; } /* ------------------------------------------------------------ */ /** * @return {@link LazyList} of {@link ServletRequestListener}s */ public Object takeRequestListeners() { final Object listeners=_requestListeners; _requestListeners=null; return listeners; } /* ------------------------------------------------------------ */ public void saveNewSession(Object key,HttpSession session) { if (_savedNewSessions==null) _savedNewSessions=new HashMap(); _savedNewSessions.put(key,session); } /* ------------------------------------------------------------ */ public HttpSession recoverNewSession(Object key) { if (_savedNewSessions==null) return null; return (HttpSession) _savedNewSessions.get(key); } /* ------------------------------------------------------------ */ /** * @return Returns the userRealm. */ public UserRealm getUserRealm() { return _userRealm; } /* ------------------------------------------------------------ */ /** * @param userRealm The userRealm to set. */ public void setUserRealm(UserRealm userRealm) { _userRealm = userRealm; } /* ------------------------------------------------------------ */ public String getQueryEncoding() { return _queryEncoding; } /* ------------------------------------------------------------ */ /** Set the character encoding used for the query string. * This call will effect the return of getQueryString and getParamaters. * It must be called before any geParameter methods. * * The request attribute "org.mortbay.jetty.Request.queryEncoding" * may be set as an alternate method of calling setQueryEncoding. * * @param queryEncoding */ public void setQueryEncoding(String queryEncoding) { _queryEncoding=queryEncoding; _queryString=null; } /* ------------------------------------------------------------ */ public void setRoleMap(Map map) { _roleMap=map; } /* ------------------------------------------------------------ */ public Map getRoleMap() { return _roleMap; } /* ------------------------------------------------------------ */ public ServletContext getServletContext() { return _context; } /* ------------------------------------------------------------ */ public ServletResponse getServletResponse() { return _connection.getResponse(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -