001: /*
002: * Copyright 2002-2007 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.springframework.web.context.request;
018:
019: import java.security.Principal;
020: import java.util.Locale;
021: import java.util.Map;
022:
023: /**
024: * Generic interface for a web request. Mainly intended for generic web
025: * request interceptors, giving them access to general request metadata,
026: * not for actual handling of the request.
027: *
028: * @author Juergen Hoeller
029: * @since 2.0
030: * @see WebRequestInterceptor
031: */
032: public interface WebRequest extends RequestAttributes {
033:
034: /**
035: * Return the request parameter of the given name, or <code>null</code> if none.
036: * <p>Retrieves the first parameter value in case of a multi-value parameter.
037: * @see javax.servlet.http.HttpServletRequest#getParameter(String)
038: */
039: String getParameter(String paramName);
040:
041: /**
042: * Return the request parameter values for the given parameter name,
043: * or <code>null</code> if none.
044: * <p>A single-value parameter will be exposed as an array with a single element.
045: * @see javax.servlet.http.HttpServletRequest#getParameterValues(String)
046: */
047: String[] getParameterValues(String paramName);
048:
049: /**
050: * Return a immutable Map of the request parameters, with parameter names as map keys
051: * and parameter values as map values. The map values will be of type String array.
052: * <p>A single-value parameter will be exposed as an array with a single element.
053: * @see javax.servlet.http.HttpServletRequest#getParameterMap()
054: */
055: Map getParameterMap();
056:
057: /**
058: * Return the primary Locale for this request.
059: * @see javax.servlet.http.HttpServletRequest#getLocale()
060: */
061: Locale getLocale();
062:
063: /**
064: * Return the context path for this request
065: * (usually the base path that the current web application is mapped to).
066: * @see javax.servlet.http.HttpServletRequest#getContextPath()
067: */
068: String getContextPath();
069:
070: /**
071: * Return the remote user for this request, if any.
072: * @see javax.servlet.http.HttpServletRequest#getRemoteUser()
073: */
074: String getRemoteUser();
075:
076: /**
077: * Return the user principal for this request, if any.
078: * @see javax.servlet.http.HttpServletRequest#getUserPrincipal()
079: */
080: Principal getUserPrincipal();
081:
082: /**
083: * Determine whether the user is in the given role for this request.
084: * @see javax.servlet.http.HttpServletRequest#isUserInRole(String)
085: */
086: boolean isUserInRole(String role);
087:
088: /**
089: * Return whether this request has been sent over a secure transport
090: * mechanism (such as SSL).
091: * @see javax.servlet.http.HttpServletRequest#isSecure()
092: */
093: boolean isSecure();
094:
095: /**
096: * Get a short description of this request,
097: * typically containing request URI and session id.
098: * @param includeClientInfo whether to include client-specific
099: * information such as session id and user name
100: */
101: String getDescription(boolean includeClientInfo);
102:
103: }
|