javax.servlet.http

Interface HttpServletRequest

All Superinterfaces:
ServletRequest
Known Subinterfaces:
HttpScriptRequest, MultipartHttpServletRequest
Known Implementing Classes:
AbstractHttpServletRequestWrapper, AbstractHttpServletRequestWrapper23, AbstractMultipartHttpServletRequest, CosMultipartHttpServletRequest, DefaultMultipartHttpServletRequest, HttpServletRequestWrapper, HttpServletRequestWrapper, MultiPartRequestWrapper, PortletServletRequest, StrutsRequestWrapper

public interface HttpServletRequest
extends ServletRequest

HttpServletRequest encapsulates client request data.

URI

The servlet engine splits the URI into three useful sections: the context path (application prefix), the servlet path, and the path info.

For example, given an application prefix of '/myapp', the api /myapp/dir/test.jsp/data will be split as follows:

/myapp/dir/test.jsp/datagetRequestURI()
/myappgetContextPath()
/dir/test.jspgetServletPath()
/datagetPathInfo()

Useful headers

User-AgentString describing the browser's version

CGI equivalents

AUTH_TYPEgetAuthType()
CONTENT_TYPEgetContentType()
CONTENT_LENGTHgetContentLength()
PATH_INFOgetPathInfo()
PATH_TRANSLATEDgetPathTranslated()
QUERY_STRINGgetQueryString()
REMOTE_ADDRgetRemoteAddr()
REMOTE_HOSTgetRemoteHost()
REMOTE_USERgetRemoteUser()
REQUEST_METHODgetMethod()
SCRIPT_NAMEgetServletPath()
SERVER_NAMEgetServerName()
SERVER_PROTOCOLgetProtocol()
SERVER_PORTgetServerPort()

Form data

For form data, see ServletRequest.getParameter()

Field Summary

static String
BASIC_AUTH
String identifier for basic authentication.
static String
CLIENT_CERT_AUTH
String identifier for client cert authentication.
static String
DIGEST_AUTH
String identifier for digest authenciation.
static String
FORM_AUTH
String identifier for form authenciation.

Method Summary

String
getAuthType()
Returns the auth type, i.e.
String
getContextPath()
Returns the part of the URI corresponding to the application's prefix.
Cookie[]
getCookies()
Returns an array of all cookies sent by the client.
long
getDateHeader(String name)
Converts a date header to milliseconds since the epoch.
String
getHeader(String name)
Returns the first value for a request header.
Enumeration<E>
getHeaderNames()
Returns an enumeration of all headers sent by the client.
Enumeration<E>
getHeaders(String name)
Returns all the values for a request header.
int
getIntHeader(String name)
Converts a header value to an integer.
String
getMethod()
Returns the HTTP method, e.g.
String
getPathInfo()
Returns the URI part after the selected servlet and null if there is no suffix.
String
getPathTranslated()
Returns the physical path name for the path info.
String
getQueryString()
Returns the request's query string.
String
getRemoteUser()
Returns the remote user if authenticated.
String
getRequestURI()
Returns the entire request URI
StringBuffer
getRequestURL()
Reconstructs the URL the client used for the request.
String
getRequestedSessionId()
Returns the session id.
String
getServletPath()
Returns the URI part corresponding to the selected servlet.
HttpSession
getSession()
Returns the current session, creating one if necessary.
HttpSession
getSession(boolean create)
Returns a session.
Principal
getUserPrincipal()
Returns the equivalent principal object for the authenticated user.
boolean
isRequestedSessionIdFromCookie()
Returns true if the session came from a cookie.
boolean
isRequestedSessionIdFromURL()
Returns true if the session came URL-encoding.
boolean
isRequestedSessionIdFromUrl()
Deprecated.
boolean
isRequestedSessionIdValid()
Returns true if the session is valid.
boolean
isUserInRole(String role)
Returns true if the user is in the given role.

Methods inherited from interface javax.servlet.ServletRequest

getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocalName, getLocalPort, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding

Field Details

BASIC_AUTH

public static final String BASIC_AUTH
String identifier for basic authentication. Value "BASIC".
Field Value:
"BASIC"
Usages and Demos :

View More Examples of HttpServletRequest.BASIC_AUTH
   1:     public String getAuthType() {
   2:         return javax.servlet.http.HttpServletRequest.BASIC_AUTH;
   3:     }
   4:     
   5:     public String toString() {

View Full Code Here
   1:     {
   2:         return HttpServletRequest.BASIC_AUTH;
   3:     }
   4: 
   5:     public LuteceUser login( String strUserName, String strUserPassword, HttpServletRequest request )

View Full Code Here
   1:     {
   2:         return HttpServletRequest.BASIC_AUTH;
   3:     }
   4: 
   5:     public LuteceUser login( String strUserName, String strUserPassword, HttpServletRequest request )

View Full Code Here
   1:     {
   2:         return HttpServletRequest.BASIC_AUTH;
   3:     }
   4: 
   5:     public AdminUser login( String strAccessCode, String strUserPassword, HttpServletRequest request )

View Full Code Here
   1:     {
   2:         return HttpServletRequest.BASIC_AUTH;
   3:     }
   4: 
   5:     public AdminUser login( String strAccessCode, String strUserPassword, HttpServletRequest request )

View Full Code Here

CLIENT_CERT_AUTH

public static final String CLIENT_CERT_AUTH
String identifier for client cert authentication. Value "CLIENT_CERT".
Field Value:
"CLIENT_CERT"
Usages and Demos :

View More Examples of HttpServletRequest.CLIENT_CERT_AUTH
   1:         {
   2:             request.setAuthType(javax.servlet.http.HttpServletRequest.CLIENT_CERT_AUTH);
   3:             request.setUserPrincipal(user);
   4:         }

View Full Code Here

DIGEST_AUTH

public static final String DIGEST_AUTH
String identifier for digest authenciation. Value "DIGEST".
Field Value:
"DIGEST"
Usages and Demos :

View More Examples of HttpServletRequest.DIGEST_AUTH
   1:     public String getAuthType() {
   2:         return HttpServletRequest.DIGEST_AUTH;
   3:     }
   4:     
   5:     protected HashMap parseAuthentication(String authorization) {

View Full Code Here

FORM_AUTH

public static final String FORM_AUTH
String identifier for form authenciation. Value "FORM".
Field Value:
"FORM"
Usages and Demos :

View More Examples of HttpServletRequest.FORM_AUTH
   1:     public String getAuthType() {
   2:         return HttpServletRequest.FORM_AUTH;
   3:     }
   4:     
   5:     public java.lang.String getLoginErrorPage() {

View Full Code Here
   1:     {
   2:         return HttpServletRequest.FORM_AUTH;
   3:     }
   4: 
   5:     public String getLoginPage()

View Full Code Here
   1:     {
   2:         return HttpServletRequest.FORM_AUTH;
   3:     }
   4: 
   5:     public String getLoginPage()

View Full Code Here

Method Details

getAuthType

public String getAuthType()
Returns the auth type, i.e. BASIC, CLIENT-CERT, DIGEST, or FORM.
Usages and Demos :

View More Examples of getAuthType()
   1: {
   2:   public void service (HttpServletRequest request,
   3:                          HttpServletResponse response)  throws
   4:         ...
   5:       request.getRemoteHost () + "<br>" + "Authentication Scheme: " +
   6:       request.getAuthType() + "<br>" + "<hr><p>";
   7:     out.println (content);
   8:     Enumeration names = request.getHeaderNames ();
   9:     while (names.hasMoreElements ())

View Full Code Here
   1: {
   2:     private HttpServletRequest servletRequest = null;
   3:     private PortletRequest portletRequest = null;
   4:         ...
   5:     
   6:     public PortletRequestFilter(HttpServletRequest servletRequest,
   7:                                 PortletRequest portletRequest)
   8:         ...
   9:     
  10:     public void setServletRequest(HttpServletRequest servletRequest)
  11:     {
  12:         ...
  13:     {
  14:         return servletRequest.getAuthType();

View Full Code Here
   1: 
   2:     public static void printAllRequestInfo (HttpServletRequest req, BCategory logger) {
   3:         showGeneral(req, logger);
   4:         ...
   5:     
   6:     public static void showGeneral (HttpServletRequest req, BCategory logger) {
   7:         logger.debug(0, "General Request Info:");
   8:         ...
   9:         logger.debug(1, "Scheme:"+req.getScheme());
  10:         logger.debug(1, "AuthType:"+req.getAuthType());
  11:         logger.debug(1, "IsSecure:"+req.isSecure());
  12:         ...
  13:     
  14:     public static void showHeader (HttpServletRequest req, BCategory logger) {

View Full Code Here
   1: 
   2:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
   3: 
   4:         ...
   5:         String expectedResult = null;
   6:         String result = request.getAuthType();
   7: 
   8:         ...
   9:             out.println( "HttpServletRequestWrapperGetAuthTypeTest test FAILED<BR>" );
  10:             out.println( "    HttpServletRequestWrapper.getAuthType() returned incorrect result <BR>" );
  11:             out.println( "     Expected value -> " + expectedResult + " <BR>" );

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6: public class MockCacheRequest implements HttpServletRequest {
   7: 
   8:         ...
   9:     private HttpServletRequest request;
  10: 
  11:         ...
  12:     public String getAuthType() {
  13:         return request.getAuthType();

View Full Code Here

getContextPath

public String getContextPath()
Returns the part of the URI corresponding to the application's prefix. The first part of the URI selects applications (ServletContexts).

getContextPath() is /myapp for the uri /myapp/servlet/Hello,

Usages and Demos :

View More Examples of getContextPath()
   1: public class DefineCookies extends HttpServlet {
   2:   public void doGet(HttpServletRequest request,
   3:                     HttpServletResponse response)
   4:         ...
   5:     String cookieDisplayPage =
   6:       request.getContextPath() + "/forEach/cookie-loop-jr.jsp";
   7:     response.sendRedirect(cookieDisplayPage);
   8:   }
   9: }

View Full Code Here
   1: import javax.servlet.ServletResponse;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:         }
   6:         if (req instanceof HttpServletRequest) {
   7:         ...
   8:             HttpServletRequest httpRequest = (HttpServletRequest)req;
   9:             String path = httpRequest.getRequestURI();
  10:         ...
  11:             if (path == null || path.equals(httpRequest.getContextPath()) ||

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: 
   6:         HttpServletRequest request = (HttpServletRequest) req;
   7:         HttpServletResponse response = (HttpServletResponse) resp;
   8:         ...
   9:                 rreq.getRoller().commit();
  10:                 RequestUtil.deleteCookie(response, c, request.getContextPath());
  11:             } 
  12:         ...
  13:                                           loginCookie,
  14:                                           request.getContextPath());

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: public class HttpServletRequestWrapper extends ServletRequestWrapper implements
   6:     HttpServletRequest
   7: {
   8:         ...
   9: 
  10:     private transient HttpServletRequest request;
  11: 
  12:         ...
  13:     {
  14:         return request != null ? request.getContextPath() : "";

View Full Code Here
   1: 
   2:     public void doGet(HttpServletRequest request, HttpServletResponse response)
   3:         throws IOException, ServletException {
   4:         ...
   5:         request.setAttribute("original.context_path",
   6:                              request.getContextPath());
   7:         request.setAttribute("original.servlet_path",
   8:                              request.getServletPath());
   9:         request.setAttribute("original.path_info",

View Full Code Here

getCookies

public Cookie[] getCookies()
Returns an array of all cookies sent by the client.
Usages and Demos :

View More Examples of getCookies()
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     protected ActionForward _perform (ActionMapping mapping, ActionForm form,
   6:         HttpServletRequest request, HttpServletResponse response, ActionForward
   7:         actionForward, XDebug xdebug) throws Exception {
   8:         ...
   9: 
  10:     private void initializeForm(HttpServletRequest request, XDebug xdebug) throws SigPathDatabaseException {
  11:         HttpSession session = request.getSession(true);
  12:         ...
  13:         Authenticate authenticate = new Authenticate (request.getCookies(),

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     protected ActionForward _perform (ActionMapping mapping, ActionForm form,
   6:         HttpServletRequest request, HttpServletResponse response, ActionForward
   7:         actionForward, XDebug xdebug) throws Exception {
   8:         ...
   9: 
  10:     private void authenticateUser(org.sigpath.form.Login form, HttpServletRequest request,
  11:                 HttpServletResponse response, XDebug xdebug)
  12:         ...
  13:         xdebug.logMsg (this, "User ID:  "+form.getUsername());
  14:         Authenticate authenticate = new Authenticate (request.getCookies(),

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     protected ActionForward _perform (ActionMapping mapping, ActionForm form,
   6:         HttpServletRequest request, HttpServletResponse response,
   7:         ActionForward actionForward, XDebug xdebug) throws Exception {
   8:         ...
   9:     private void updateReviewItem (SpecifyPendingReview reviewForm,
  10:         HttpServletRequest request, XDebug xdebug)
  11:         throws SigPathDatabaseException {
  12:         ...
  13: 
  14:         Authenticate authenticate = new Authenticate (request.getCookies(), xdebug);

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     protected ActionForward _perform(ActionMapping mapping, ActionForm form,
   6:     HttpServletRequest request, HttpServletResponse response, ActionForward
   7:     actionForward, XDebug xdebug) throws Exception
   8:         ...
   9:     private ActionForward createNewReview(SpecifyDescription descForm,
  10:     HttpServletRequest request, HttpSession session, XDebug xdebug)
  11:   throws SigPathDatabaseException
  12:         ...
  13:         String description = descForm.getDescription();
  14:         Authenticate authenticate = new Authenticate(request.getCookies(), xdebug);

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     protected ActionForward _perform
   6:         (ActionMapping mapping, ActionForm form, HttpServletRequest request,
   7:         HttpServletResponse response, ActionForward actionForward, XDebug xdebug)
   8:         ...
   9:             xdebug.logMsg(this, "Starting SaveXML");
  10:             Authenticate authenticate = new Authenticate (request.getCookies(),xdebug);
  11:         User user = authenticate.getUser();
  12:         ...
  13: 
  14:     private void saveReaction(HttpServletRequest request, User user, XDebug xdebug)

View Full Code Here

getDateHeader

public long getDateHeader(String name)
Converts a date header to milliseconds since the epoch.

 long mod = request.getDateHeader("If-Modified-Since");
 
Parameters:
name - the header name
Returns:
the header value converted to an date
Usages and Demos :

View More Examples of getDateHeader(String name)
   1: 
   2: package tests.javax_servlet_http.HttpServletRequest;
   3: 
   4:         ...
   5: import javax.servlet.http.HttpServletRequest;
   6: import javax.servlet.http.HttpServletResponse;
   7:         ...
   8: 
   9:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
  10: 
  11:         ...
  12:         PrintWriter out = response.getWriter();
  13:         long result = request.getDateHeader( "If-Modified-Since" );

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     
   6:     public static void sendFile(HttpServletRequest aRequest, HttpServletResponse aResponse, String aFileName, String aMimeType, boolean enableCaching) throws OaseException {
   7:         InputStream is = null;
   8:         ...
   9:                     boolean notModified = false;
  10:                     long lastMod = aRequest.getDateHeader("If-Modified-Since");
  11:                         notModified = true;

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6: public class MockCacheRequest implements HttpServletRequest {
   7: 
   8:         ...
   9:     private HttpServletRequest request;
  10: 
  11:         ...
  12:     public long getDateHeader(String arg0) {
  13:         return request.getDateHeader(arg0);

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: public class HttpServletRequestWrapper extends ServletRequestWrapper implements
   6:     HttpServletRequest
   7: {
   8:         ...
   9: 
  10:     private transient HttpServletRequest request;
  11: 
  12:         ...
  13:     {
  14:         return request != null ? request.getDateHeader(name) : -1;

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6: public class RequestWrapper implements HttpServletRequest {
   7: 
   8:         ...
   9:     HttpServletRequest wrappedRequest;
  10:     
  11:         ...
  12:     public long getDateHeader(String arg0) {
  13:         return wrappedRequest.getDateHeader(arg0);

View Full Code Here

getHeader

public String getHeader(String name)
Returns the first value for a request header.

Corresponds to CGI's HTTP_*

 String userAgent = request.getHeader("User-Agent");
 
Parameters:
name - the header name
Returns:
the header value
Usages and Demos :

View More Examples of getHeader(String name)
   1:       throws ServletException, IOException {
   2:     HttpServletRequest req = (HttpServletRequest)request;
   3:     HttpServletResponse res = (HttpServletResponse)response;
   4:         ...
   5: 
   6:   private boolean isGzipSupported(HttpServletRequest req) {
   7:     String browserEncodings =
   8:         ...
   9:       req.getHeader("Accept-Encoding");
  10:     return((browserEncodings != null) &&

View Full Code Here
   1: import java.security.cert.CertificateFactory;
   2: import javax.servlet.http.HttpServletRequest;
   3: import com.sun.appserv.ProxyHandler;
   4:         ...
   5:     public X509Certificate[] getSSLClientCertificateChain(
   6:                         HttpServletRequest request)
   7:             throws CertificateException {
   8:         ...
   9: 
  10:         String clientCert = request.getHeader("Proxy-auth-cert");
  11:         if (clientCert != null) {
  12:         ...
  13: 
  14:     public int getSSLKeysize(HttpServletRequest request) {

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: public class HttpServletRequestWrapper extends ServletRequestWrapper implements
   6:     HttpServletRequest
   7: {
   8:         ...
   9: 
  10:     private transient HttpServletRequest request;
  11: 
  12:         ...
  13:     {
  14:         return request != null ? request.getHeader(name) : null;

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6:     private final HttpServletRequest request;
   7: 
   8:         ...
   9: 
  10:     public HTTPQuery(ServletConfig servletConfig, HttpServletRequest request,
  11:             boolean isPost) throws UnsupportedEncodingException {
  12:         ...
  13:     public String getAccept() {
  14:         return request.getHeader("Accept");

View Full Code Here
   1: import javax.servlet.http.HttpServlet;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:             SOAPMessage saajResponse = response.getSaajMessage();
   6:             String[] headerValues = saajResponse.getMimeHeaders().getHeader(RESPONSE_HEADER_NAME);
   7:             assertNotNull("Response has no header", headerValues);
   8:         ...
   9: 
  10:         protected void doPost(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
  11:                 throws ServletException, IOException {
  12:         ...
  13:                 assertEquals("Invalid header value received on server side", REQUEST_HEADER_VALUE,
  14:                         httpServletRequest.getHeader(REQUEST_HEADER_NAME));

View Full Code Here

getHeaderNames

public Enumeration<E> getHeaderNames()
Returns an enumeration of all headers sent by the client.
Usages and Demos :

View More Examples of getHeaderNames()
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import java.util.Enumeration;
   4:         ...
   5: {
   6:     private HttpServletRequest p_request;
   7: 
   8:         ...
   9:     public RequestHeaderMap( HttpServletRequest request )
  10:     {
  11:         ...
  12:     {
  13:         return p_request.getHeaderNames();

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import java.util.Enumeration;
   4:         ...
   5: {
   6:     private HttpServletRequest p_request;
   7: 
   8:         ...
   9:     public RequestHeaderValuesMap( HttpServletRequest request )
  10:     {
  11:         ...
  12:     {
  13:         return p_request.getHeaderNames();

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5: {
   6:     private final HttpServletRequest _httpServletRequest;
   7: 
   8:         ...
   9:     RequestHeaderMap(HttpServletRequest httpServletRequest)
  10:     {
  11:         ...
  12:     {
  13:         return _httpServletRequest.getHeaderNames();

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5: {
   6:     private final HttpServletRequest _httpServletRequest;
   7:     private final Map                _valueCache = new HashMap();
   8:         ...
   9: 
  10:     RequestHeaderValuesMap(HttpServletRequest httpServletRequest)
  11:     {
  12:         ...
  13:     {
  14:         return _httpServletRequest.getHeaderNames();

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6: public class MockCacheRequest implements HttpServletRequest {
   7: 
   8:         ...
   9:     private HttpServletRequest request;
  10: 
  11:         ...
  12:     public Enumeration getHeaderNames() {
  13:         return request.getHeaderNames();

View Full Code Here

getHeaders

public Enumeration<E> getHeaders(String name)
Returns all the values for a request header. In some rare cases, like cookies, browsers may return multiple headers.
Parameters:
name - the header name
Returns:
an enumeration of the header values.
Usages and Demos :

View More Examples of getHeaders(String name)
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import java.util.Enumeration;
   4:         ...
   5: {
   6:     private HttpServletRequest p_request;
   7: 
   8:         ...
   9:     public RequestHeaderValuesMap( HttpServletRequest request )
  10:     {
  11:         ...
  12:     {
  13:         return p_request.getHeaders( name );

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5: public class SavedRequest extends BaseProtocolRequest implements
   6:     HttpServletRequest, Serializable
   7: {
   8:         ...
   9: 
  10:     public void setSavedRequest(HttpServletRequest request)
  11:     {
  12:         ...
  13:             name = (String) e.nextElement();
  14:             for (Enumeration r = request.getHeaders(name); r.hasMoreElements();)

View Full Code Here
   1: import java.util.Set;
   2: import javax.servlet.http.HttpServletRequest;
   3: import org.apache.commons.chain.web.MapEntry;
   4:         ...
   5: 
   6:     public ServletHeaderValuesMap(HttpServletRequest request) {
   7:         this.request = request;
   8:         ...
   9: 
  10:     private HttpServletRequest request = null;
  11: 
  12:         ...
  13:             key = (String) keys.nextElement();
  14:             set.add(new MapEntry(key, request.getHeaders(key), false));

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6: public class MockCacheRequest implements HttpServletRequest {
   7: 
   8:         ...
   9:     private HttpServletRequest request;
  10: 
  11:         ...
  12:     public Enumeration getHeaders(String arg0) {
  13:         return request.getHeaders(arg0);

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: public class HttpServletRequestWrapper extends ServletRequestWrapper implements
   6:     HttpServletRequest
   7: {
   8:         ...
   9: 
  10:     private transient HttpServletRequest request;
  11: 
  12:         ...
  13:     {
  14:         return request != null ? request.getHeaders(name) : null;

View Full Code Here

getIntHeader

public int getIntHeader(String name)
Converts a header value to an integer.
Parameters:
name - the header name
Returns:
the header value converted to an integer
Usages and Demos :

View More Examples of getIntHeader(String name)
   1: 
   2: package tests.javax_servlet_http.HttpServletRequest;
   3: 
   4:         ...
   5: import javax.servlet.http.HttpServletRequest;
   6: import javax.servlet.http.HttpServletResponse;
   7:         ...
   8: 
   9:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
  10: 
  11:         ...
  12:             String param = "MyNonIntHeader";
  13:             int result = request.getIntHeader( param );

View Full Code Here
   1: 
   2: package tests.javax_servlet_http.HttpServletRequest;
   3: 
   4:         ...
   5: import javax.servlet.http.HttpServletRequest;
   6: import javax.servlet.http.HttpServletResponse;
   7:         ...
   8: 
   9:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
  10:         PrintWriter out = response.getWriter();
  11:         ...
  12:         try {
  13:             int result = request.getIntHeader( param );

View Full Code Here
   1: 
   2: package tests.javax_servlet_http.HttpServletRequest;
   3: 
   4:         ...
   5: import javax.servlet.http.HttpServletRequest;
   6: import javax.servlet.http.HttpServletResponse;
   7:         ...
   8: 
   9:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException, NumberFormatException {
  10: 
  11:         ...
  12:         try {
  13:             int testInt = request.getIntHeader( param );

View Full Code Here
   1: 
   2: package tests.javax_servlet_http.HttpServletRequest;
   3: 
   4:         ...
   5: import javax.servlet.http.HttpServletRequest;
   6: import javax.servlet.http.HttpServletResponse;
   7:         ...
   8: 
   9:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException, NumberFormatException {
  10: 
  11:         ...
  12:         try {
  13:             int testInt = request.getIntHeader( param );

View Full Code Here
   1: 
   2: package tests.javax_servlet_http.HttpServletRequest;
   3: 
   4:         ...
   5: import javax.servlet.http.HttpServletRequest;
   6: import javax.servlet.http.HttpServletResponse;
   7:         ...
   8: 
   9:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException, NumberFormatException {
  10: 
  11:         ...
  12:         try {
  13:             int testInt = request.getIntHeader( param );

View Full Code Here

getMethod

public String getMethod()
Returns the HTTP method, e.g. "GET" or "POST"

Equivalent to CGI's REQUEST_METHOD

Usages and Demos :

View More Examples of getMethod()
   1: public class ShowRequestHeaders extends HttpServlet {
   2:   public void doGet(HttpServletRequest request,
   3:                     HttpServletResponse response)
   4:         ...
   5:                 "<B>Request Method: </B>" +
   6:                 request.getMethod() + "<BR>\n" +
   7:                 "<B>Request URI: </B>" +
   8:                 request.getRequestURI() + "<BR>\n" +
   9:                 "<B>Request Protocol: </B>" +

View Full Code Here
   1: public class ShowRequestHeaders extends HttpServlet {
   2:   public void doGet(HttpServletRequest request,
   3:                     HttpServletResponse response)
   4:         ...
   5:                 "<B>Request Method: </B>" +
   6:                 request.getMethod() + "<BR>\n" +
   7:                 "<B>Request URI: </B>" +
   8:                 request.getRequestURI() + "<BR>\n" +
   9:                 "<B>Request Protocol: </B>" +

View Full Code Here
   1: import javax.servlet.jsp.tagext.*;
   2: import javax.servlet.http.HttpServletRequest;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
   7: 
   8:         ...
   9:       out.print("<form");
  10:       out.print("  method=\"" + request.getMethod() + "\"");
  11:       out.println("  action=\"" + action + "\">");

View Full Code Here
   1: import javax.servlet.jsp.tagext.*;
   2: import javax.servlet.http.HttpServletRequest;
   3: import java.io.IOException;
   4:         ...
   5: 
   6:     HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
   7: 
   8:         ...
   9:       out.print("<form");
  10:       out.print("  method=\"" + request.getMethod() + "\"");
  11:       out.println("  action=\"" + action + "\">");

View Full Code Here
   1: import javax.servlet.*;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5:     PortalContainer.setInstance(pcontainer) ;
   6:     HttpServletRequest httpRequest = (HttpServletRequest) request ;
   7:     HttpSession session = httpRequest.getSession() ; 
   8:         ...
   9:                                        rinfo.getPageName(), 
  10:                                        httpRequest.getMethod(), 
  11:                                        end - start, 

View Full Code Here

getPathInfo

public String getPathInfo()
Returns the URI part after the selected servlet and null if there is no suffix.

Corresponds to CGI's PATH_INFO

getPathInfo() is /foo for the uri /myapp/servlet/Hello/foo. getPathInfo() is /hello.jsp for for the uri /myapp/dir/hello.jsp/foo.

Usages and Demos :

View More Examples of getPathInfo()
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: 
   6:     protected void doGet(HttpServletRequest request, HttpServletResponse response)
   7:     throws ServletException, IOException {
   8:         ...
   9:         RequestDispatcher rd =  getServletContext().getRequestDispatcher(
  10:             request.getPathInfo());
  11:         rd.include(request, response);

View Full Code Here
   1: 
   2:   public void doGet(HttpServletRequest req, HttpServletResponse res)
   3:                                throws ServletException, IOException {
   4:         ...
   5:     URL source = ServletUtils.getResource(getServletContext(),
   6:                                           req.getPathInfo());
   7:     if (source == null) {
   8:       res.sendError(res.SC_NOT_FOUND,
   9:               "Extra path information must point to an image");

View Full Code Here
   1: {
   2:   public void service (HttpServletRequest request,
   3:                          HttpServletResponse response)  throws
   4:         ...
   5:       request.getServletPath () + "<br>" + "Path Info: " +
   6:       request.getPathInfo() + "<br>" + "Path Translated: " +
   7:       request.getPathTranslated () + "<br>" + "Query String: " +
   8:       request.getQueryString () + "<br>" + "Content Length: " +
   9:       request.getContentLength () + "<br>" + "Content Type: " +

View Full Code Here
   1: 
   2:   public void doGet(HttpServletRequest req, 
   3:                     HttpServletResponse resp) throws ServletException {
   4:         ...
   5: 
   6:   public void doPost(HttpServletRequest req, 
   7:                      HttpServletResponse resp) throws ServletException {
   8:         ...
   9: 
  10:   private String getResourceName(HttpServletRequest req) {
  11:         ...
  12:     return req.getPathInfo();

View Full Code Here
   1:     public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
   2:         HttpServletRequest hsr = (HttpServletRequest) request;
   3: 
   4:         ...
   5:         if( hsr.getAttribute("javax.servlet.forward.path_info") != null ) {
   6:              hsr.setAttribute( "javax.servlet.forward.path_info", hsr.getPathInfo() );
   7:         }
   8:         if( hsr.getAttribute("javax.servlet.forward.query_string") != null ) {
   9:              hsr.setAttribute( "javax.servlet.forward.query_string", hsr.getQueryString() );

View Full Code Here

getPathTranslated

public String getPathTranslated()
Returns the physical path name for the path info.

Corresponds to CGI's PATH_TRANSLATED

Returns:
null if there is no path info.
Usages and Demos :

View More Examples of getPathTranslated()
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5: 
   6:   public static void printParameters(HttpServletRequest req)
   7:   {
   8:         ...
   9:       log.debug("getPathInfo " + req.getPathInfo());
  10:       log.debug("getPathTranslated " + req.getPathTranslated());
  11:       log.debug("getQueryString " + req.getQueryString());

View Full Code Here
   1: {
   2:   public void service (HttpServletRequest request,
   3:                          HttpServletResponse response)  throws
   4:         ...
   5:       request.getPathInfo () + "<br>" + "Path Translated: " +
   6:       request.getPathTranslated() + "<br>" + "Query String: " +
   7:       request.getQueryString () + "<br>" + "Content Length: " +
   8:       request.getContentLength () + "<br>" + "Content Type: " +
   9:       request.getContentType () + "<br>" + "Server name: " +

View Full Code Here
   1: 
   2:     public static void printAllRequestInfo (HttpServletRequest req, BCategory logger) {
   3:         showGeneral(req, logger);
   4:         ...
   5:     
   6:     public static void showGeneral (HttpServletRequest req, BCategory logger) {
   7:         logger.debug(0, "General Request Info:");
   8:         ...
   9:         logger.debug(1, "PathInfo:"+req.getPathInfo());
  10:         logger.debug(1, "PathTranslated:"+req.getPathTranslated());
  11:         logger.debug(1, "QueryString:"+req.getQueryString());
  12:         ...
  13:     
  14:     public static void showHeader (HttpServletRequest req, BCategory logger) {

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: public class HttpServletRequestWrapper extends ServletRequestWrapper implements
   6:     HttpServletRequest
   7: {
   8:         ...
   9: 
  10:     private transient HttpServletRequest request;
  11: 
  12:         ...
  13:     {
  14:         return request != null ? request.getPathTranslated() : null;

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6: public class RequestWrapper implements HttpServletRequest {
   7: 
   8:         ...
   9:     HttpServletRequest wrappedRequest;
  10:     
  11:         ...
  12:     public String getPathTranslated() {
  13:         return wrappedRequest.getPathTranslated();

View Full Code Here

getQueryString

public String getQueryString()
Returns the request's query string. Form based servlets will use ServletRequest.getParameter() to decode the form values.

Corresponds to CGI's PATH_TRANSLATED

Usages and Demos :

View More Examples of getQueryString()
   1: {
   2:   public void service (HttpServletRequest request,
   3:                          HttpServletResponse response)  throws
   4:         ...
   5:       request.getPathTranslated () + "<br>" + "Query String: " +
   6:       request.getQueryString() + "<br>" + "Content Length: " +
   7:       request.getContentLength () + "<br>" + "Content Type: " +
   8:       request.getContentType () + "<br>" + "Server name: " +
   9:       request.getServerName () + "<br>" + "Server port: " +

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5:   
   6:   public static String getPageURI(HttpServletRequest request)
   7:   {
   8:         ...
   9:   
  10:   public static String getPageContextPath(HttpServletRequest request)
  11:   {
  12:         ...
  13:     else
  14:       return request.getQueryString();

View Full Code Here
   1: import javax.servlet.ServletException;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:   protected abstract String getName();
   6:   protected abstract User getUser(HttpServletRequest req);
   7:   protected abstract void startSession(CalSession session, Log log, User user)
   8:         ...
   9: 
  10:   protected String getRedirectUrl(HttpServletRequest req)
  11:   {
  12:         ...
  13:     if (req.getQueryString() == null ||

View Full Code Here
   1: import javax.servlet.ServletResponse;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: 
   6:     HttpServletRequest httpReq;
   7:     HttpServletResponse httpRes;
   8:         ...
   9:     try {
  10:       httpReq = (HttpServletRequest) req;
  11:       httpRes = (HttpServletResponse) res;
  12:         ...
  13:     String queryString = 
  14:       httpReq.getQueryString();

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5:     public static String getFullRequestUrl(FilterInvocation fi) {
   6:         HttpServletRequest r = fi.getHttpRequest();
   7: 
   8:         ...
   9:         return buildFullRequestUrl(r.getScheme(), r.getServerName(), r.getServerPort(), r.getContextPath(),
  10:             r.getRequestURL().toString(), r.getServletPath(), r.getRequestURI(), r.getPathInfo(), r.getQueryString());
  11:     }
  12:         ...
  13:         return buildFullRequestUrl(sr.getScheme(), sr.getServerName(), sr.getServerPort(), sr.getContextPath(),
  14:             sr.getRequestURL(), sr.getServletPath(), sr.getRequestURI(), sr.getPathInfo(), sr.getQueryString());

View Full Code Here

getRemoteUser

public String getRemoteUser()
Returns the remote user if authenticated.
Usages and Demos :

View More Examples of getRemoteUser()
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: {
   6:   protected String getUser(HttpServletRequest req)
   7:       throws InvalidSession, Exception
   8:         ...
   9:   {
  10:     return req.getRemoteUser();
  11:   }
  12:         ...
  13: 
  14:   protected void performAction(HttpServletRequest req, HttpServletResponse resp)

View Full Code Here
   1: import javax.servlet.ServletException;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: 
   6:     protected boolean processRoles(HttpServletRequest request,
   7:             HttpServletResponse response, ActionMapping mapping)
   8:         ...
   9:                 if (log.isDebugEnabled()) {
  10:                     log.debug(" User '" + request.getRemoteUser() +
  11:                         "' has role '" + roles[i] + "', granting access");
  12:         ...
  13:         if (log.isDebugEnabled()) {
  14:             log.debug(" User '" + request.getRemoteUser() +

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: 
   6:   protected User getUser(HttpServletRequest req) throws IllegalStateException
   7:   {
   8:         ...
   9: 
  10:     return req.getRemoteUser() == null ? null : new User(req.getRemoteUser());
  11:   }
  12:         ...
  13: 
  14:   protected void sendRedirect(HttpServletRequest req,

View Full Code Here
   1: {
   2:   public void service (HttpServletRequest request,
   3:                          HttpServletResponse response)  throws
   4:         ...
   5:       request.getServerPort () + "<br>" + "Remote User: " +
   6:       request.getRemoteUser() + "<br>" + "Remote Address: " +
   7:       request.getRemoteAddr () + "<br>" + "Remote Host: " +
   8:       request.getRemoteHost () + "<br>" + "Authentication Scheme: " +
   9:       request.getAuthType () + "<br>" + "<hr><p>";

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import java.security.Principal;
   4:         ...
   5: public class ServletPrincipalProxy implements PrincipalProxy {
   6:     private HttpServletRequest request;
   7: 
   8:         ...
   9:     public ServletPrincipalProxy(HttpServletRequest request) {
  10:         this.request = request;
  11:         ...
  12:     public String getRemoteUser() {
  13:         return request.getRemoteUser();

View Full Code Here

getRequestURI

public String getRequestURI()
Returns the entire request URI
Usages and Demos :

View More Examples of getRequestURI()
   1: public class ShowRequestHeaders extends HttpServlet {
   2:   public void doGet(HttpServletRequest request,
   3:                     HttpServletResponse response)
   4:         ...
   5:                 "<B>Request URI: </B>" +
   6:                 request.getRequestURI() + "<BR>\n" +
   7:                 "<B>Request Protocol: </B>" +
   8:                 request.getProtocol() + "<BR><BR>\n" +
   9:                 "<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +

View Full Code Here
   1: public class ShowRequestHeaders extends HttpServlet {
   2:   public void doGet(HttpServletRequest request,
   3:                     HttpServletResponse response)
   4:         ...
   5:                 "<B>Request URI: </B>" +
   6:                 request.getRequestURI() + "<BR>\n" +
   7:                 "<B>Request Protocol: </B>" +
   8:                 request.getProtocol() + "<BR><BR>\n" +
   9:                 "<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: public class HttpServletRequestWrapper extends ServletRequestWrapper implements
   6:     HttpServletRequest
   7: {
   8:         ...
   9: 
  10:     private transient HttpServletRequest request;
  11: 
  12:         ...
  13:     {
  14:         return request != null ? request.getRequestURI() : "/";

View Full Code Here
   1: 
   2:     public void doGet(HttpServletRequest request, HttpServletResponse response)
   3:         throws IOException, ServletException {
   4:         ...
   5:         request.setAttribute("original.request_uri",
   6:                              request.getRequestURI());
   7:         request.setAttribute("original.context_path",
   8:                              request.getContextPath());
   9:         request.setAttribute("original.servlet_path",

View Full Code Here
   1: 
   2:   public static String getBrowser (HttpServletRequest req) 
   3:   {
   4:         ...
   5: 
   6:   public static boolean isHttps (HttpServletRequest req) 
   7:   {
   8:         ...
   9: 
  10:   public static StringBuffer getReqUrl (HttpServletRequest req,     
  11:                     boolean forceHttps)
  12:         ...
  13:     {
  14:     return req.getRequestURI()

View Full Code Here

getRequestURL

public StringBuffer getRequestURL()
Reconstructs the URL the client used for the request.
Since:
Servlet 2.3
Usages and Demos :

View More Examples of getRequestURL()
   1:       throws ServletException, IOException {
   2:     HttpServletRequest req = (HttpServletRequest)request;
   3:     System.out.println(req.getRemoteHost() +
   4:         ...
   5:                        " tried to access " +
   6:                        req.getRequestURL() +
   7:                        " on " + new Date() + ".");
   8:     chain.doFilter(request,response);
   9:   }

View Full Code Here
   1:       throws ServletException, IOException {
   2:     HttpServletRequest req = (HttpServletRequest)request;
   3:     System.out.println(req.getRemoteHost() +
   4:         ...
   5:                        " tried to access " +
   6:                        req.getRequestURL() +
   7:                        " on " + new Date() + ".");
   8:     chain.doFilter(request,response);
   9:   }

View Full Code Here
   1:       throws ServletException, IOException {
   2:     HttpServletRequest req = (HttpServletRequest)request;
   3:     context.log(req.getRemoteHost() +
   4:         ...
   5:                 " tried to access " +
   6:                 req.getRequestURL() +
   7:                 " on " + new Date() + ". " +
   8:                 "(Reported by " + filterName + ".)");
   9:     chain.doFilter(request,response);

View Full Code Here
   1: import javax.servlet.ServletResponse;
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5:     throws IOException, ServletException {
   6:         HttpServletRequest request = (HttpServletRequest) req;
   7: 
   8:         ...
   9: 
  10:         request.setAttribute("requestURL", request.getRequestURL());
  11:         chain.doFilter(req, res);

View Full Code Here
   1: import javax.servlet.http.HttpServlet;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: 
   6:   public void doGet(HttpServletRequest request, HttpServletResponse response)
   7:     throws IOException, ServletException {
   8:         ...
   9:     request.setAttribute("history", history);
  10:     request.setAttribute("URI", request.getRequestURL().toString());

View Full Code Here

getRequestedSessionId

public String getRequestedSessionId()
Returns the session id. Sessions are a convenience for keeping user state across requests.

The session id is the value of the JSESSION cookie.

Usages and Demos :

View More Examples of getRequestedSessionId()
   1:        
   2: public void doGet (HttpServletRequest req, HttpServletResponse res)
   3:        throws ServletException, IOException
   4:         ...
   5:     out.println("Session ID in Request: " +
   6:                 req.getRequestedSessionId());
   7:     out.println("<br>Session ID in Request from Cookie: " +
   8:                 req.isRequestedSessionIdFromCookie());
   9:     out.println("<br>Session ID in Request from URL: " +

View Full Code Here
   1: {
   2:     private HttpServletRequest servletRequest = null;
   3:     private PortletRequest portletRequest = null;
   4:         ...
   5:     
   6:     public PortletRequestFilter(HttpServletRequest servletRequest,
   7:                                 PortletRequest portletRequest)
   8:         ...
   9:     
  10:     public void setServletRequest(HttpServletRequest servletRequest)
  11:     {
  12:         ...
  13:     {
  14:         return servletRequest.getRequestedSessionId();

View Full Code Here
   1:   
   2:   public void doGet (HttpServletRequest req, HttpServletResponse res)
   3:        throws ServletException, IOException
   4:         ...
   5:     out.println("Session ID in Request: " +
   6:                 req.getRequestedSessionId());
   7:     out.println("<br>Session ID in Request from Cookie: " +
   8:                 req.isRequestedSessionIdFromCookie());
   9:     out.println("<br>Session ID in Request from URL: " +

View Full Code Here
   1: 
   2:   public void doGet(HttpServletRequest request, HttpServletResponse response)
   3:   throws ServletException, IOException
   4:         ...
   5:     out.println("?????Id: " +
   6:     request.getRequestedSessionId());
   7:     out.println("?????Id: " + session.getId());
   8:     out.println("?????????: " + session.getCreationTime());
   9:     out.println("???????????: " +session.getLastAccessedTime());

View Full Code Here
   1: 
   2:     public void doGet(HttpServletRequest request, HttpServletResponse response)
   3:         throws ServletException, IOException
   4:         ...
   5:         out.println("Requested Session Id: " +
   6:                     request.getRequestedSessionId());
   7:         out.println("Current Session Id: " + session.getId());
   8:     out.println("Session Created Time: " + session.getCreationTime());
   9:         out.println("Session Last Accessed Time: " +

View Full Code Here

getServletPath

public String getServletPath()
Returns the URI part corresponding to the selected servlet. The URI is relative to the application.

Corresponds to CGI's SCRIPT_NAME getServletPath() is /servlet/Hello for the uri /myapp/servlet/Hello/foo. getServletPath() is /dir/hello.jsp for the uri /myapp/dir/hello.jsp/foo,

Usages and Demos :

View More Examples of getServletPath()
   1: {
   2:   public void service (HttpServletRequest request,
   3:                          HttpServletResponse response)  throws
   4:         ...
   5:       request.getProtocol () + "<br>" + "Servlet Path: " +
   6:       request.getServletPath() + "<br>" + "Path Info: " +
   7:       request.getPathInfo () + "<br>" + "Path Translated: " +
   8:       request.getPathTranslated () + "<br>" + "Query String: " +
   9:       request.getQueryString () + "<br>" + "Content Length: " +

View Full Code Here
   1: import javax.servlet.ServletException;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: 
   6:   public boolean isAuthorized(HttpServletRequest request,
   7:                               HttpServletResponse response,
   8:         ...
   9:     if (secureHost != null) {
  10:             request.getServletPath());

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5:     public static String getFullRequestUrl(FilterInvocation fi) {
   6:         HttpServletRequest r = fi.getHttpRequest();
   7: 
   8:         ...
   9:         return buildFullRequestUrl(r.getScheme(), r.getServerName(), r.getServerPort(), r.getContextPath(),
  10:             r.getRequestURL().toString(), r.getServletPath(), r.getRequestURI(), r.getPathInfo(), r.getQueryString());
  11:     }
  12:         ...
  13:         return buildFullRequestUrl(sr.getScheme(), sr.getServerName(), sr.getServerPort(), sr.getContextPath(),
  14:             sr.getRequestURL(), sr.getServletPath(), sr.getRequestURI(), sr.getPathInfo(), sr.getQueryString());

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.jsp.tagext.BodyContent;
   4:         ...
   5:                         public Object run() throws Exception {
   6:                             HttpServletRequest pnamer =
   7:         ...
   8:                                 (HttpServletRequest) pageContext.getRequest();
   9:                             String pthinfo = (pnamer.getPathInfo() != null) ?
  10:         ...
  11:                             engine.exec (pnamer.getContextPath() +
  12:                                          pnamer.getServletPath() +

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.jsp.tagext.BodyContent;
   4:         ...
   5:                             public Object run() throws Exception {
   6:                                 HttpServletRequest pnamer = 
   7:         ...
   8:                                     (HttpServletRequest) 
   9:                                     pageContext.getRequest();
  10:         ...
  11:                                 return engine.eval (pnamer.getContextPath() +
  12:                                                     pnamer.getServletPath() +

View Full Code Here

getSession

public HttpSession getSession()
Returns the current session, creating one if necessary. Sessions are a convenience for keeping user state across requests.
Usages and Demos :

View More Examples of getSession()
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     public ActionForward execute(ActionMapping mapping, ActionForm form,
   6:             HttpServletRequest request, HttpServletResponse response)
   7:             throws Exception {
   8:         ...
   9:         AccountActionForm workingAcctForm = new AccountActionForm();
  10:         request.getSession().removeAttribute("workingAccountForm");
  11:         ...
  12:         request.getSession()

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5: 
   6:     public void perform(HttpServletRequest request) 
   7:     throws HTMLActionException, DataAccessException {
   8:         ...
   9:         StdBreakfastModel breakfast = (StdBreakfastModel)
  10:             request.getSession().getAttribute("StdBreakfast");
  11:         if (breakfast == null) {
  12:         ...
  13:             breakfast = new StdBreakfastModel();
  14:             request.getSession().setAttribute("StdBreakfast", breakfast);

View Full Code Here
   1: import javax.servlet.http.HttpServlet;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     public void service(
   6:         HttpServletRequest request,
   7:         HttpServletResponse response)
   8:         ...
   9:                     view,
  10:                     request.getSession().getAttribute("currentLocale") + "");                
  11:             

View Full Code Here
   1: import javax.servlet.ServletException;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:         ActionForm form,
   6:         HttpServletRequest request,
   7:         HttpServletResponse response)
   8:         ...
   9:                         User.getInstance(
  10:                             request.getSession().getAttribute("userLogin")
  11:                                 + ""))

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:         Hashtable params,
   6:         HttpServletRequest request,
   7:         HttpServletResponse response)
   8:         ...
   9:             String currentLocale =
  10:                 request.getSession().getAttribute("currentLocale") + "";

View Full Code Here

getSession

public HttpSession getSession(boolean create)
Returns a session. If no session exists and create is true, then create a new session, otherwise return null.
Parameters:
create - If true, then create a new session if none exists.
Usages and Demos :

View More Examples of getSession(boolean create)
   1:     static HttpSession getSession(Context context, boolean create){
   2:         HttpServletRequest request =
   3:         ...
   4:             (HttpServletRequest)context.get(PnutsServlet.SERVLET_REQUEST);
   5:         if (request == null){
   6:         ...
   7:         }
   8:         return request.getSession(create);
   9:     }

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: {
   6:     private final HttpServletRequest _httpRequest;
   7: 
   8:         ...
   9:     SessionMap(HttpServletRequest httpRequest)
  10:     {
  11:         ...
  12:     {
  13:         _httpRequest.getSession(true).setAttribute(key, value);

View Full Code Here
   1: public class MockExternalContext extends ExternalContext {
   2: protected HttpServletRequest request_ ;
   3:   protected HttpServletResponse response_ ;
   4:         ...
   5:   
   6:   public void init(HttpServletRequest request,  HttpServletResponse response) {
   7:     request_ = request ;
   8:         ...
   9: 
  10:   public Object getSession( boolean create ) { return request_.getSession(create) ; }

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6:     private HttpServletRequest httpRequest = null;
   7:     private MultiPartRequest multiPartRequest = null;
   8:         ...
   9:     }
  10:     public RequestWrapper(HttpServletRequest httpRequest) {
  11:         cache = new Hashtable();
  12:         ...
  13:     public HttpSession getSession(boolean b) {
  14:         return httpRequest.getSession( b );

View Full Code Here
   1:      public
   2:      void selectNextScreen(HttpServletRequest oRequest)
   3:        throws ScreenSelectorException{
   4:         ...
   5:             oLogger.debug("Storing:["+sScreenSessionID+"]["+sTarget+"]");
   6:             oRequest.getSession(false).setAttribute(sScreenSessionID,sTarget);
   7:             return;
   8:         ...
   9:             oLogger.debug("Storing:["+sScreenSessionID+"]["+sTarget+"]");
  10:             oRequest.getSession(false).setAttribute(sScreenSessionID,sTarget);
  11:             return;
  12:         ...
  13:                       oLogger.debug("token is presenbt for this screen ... storing");
  14:                       oRequest.getSession(false).setAttribute(ISessionKeys.sCURRENT_TOKEN,oSM.getToken());

View Full Code Here

getUserPrincipal

public Principal getUserPrincipal()
Returns the equivalent principal object for the authenticated user.
Usages and Demos :

View More Examples of getUserPrincipal()
   1: 
   2:   public void doGet(HttpServletRequest req, HttpServletResponse res)
   3:                                throws ServletException, IOException {
   4:         ...
   5:     out.println("User Name: " + req.getRemoteUser());
   6:     String name = (req.getUserPrincipal() == null) ? 
   7:         ...
   8:                    null : req.getUserPrincipal().getName();
   9:     out.println("Principal Name: " + name);

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     public ActionForward execute(ActionMapping mapping, ActionForm form,
   6:             HttpServletRequest request, HttpServletResponse response)
   7:             throws Exception {
   8:         ...
   9:     public abstract ActionForward doExecute(ActionMapping mapping, ActionForm form,
  10:             HttpServletRequest request, HttpServletResponse response)
  11:             throws Exception;
  12:         ...
  13:     protected User getUser(HttpServletRequest request) {
  14:         return request.getUserPrincipal() == null ? 

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     public ActionForward execute(ActionMapping mapping, ActionForm form,
   6:             HttpServletRequest request, HttpServletResponse response)
   7:             throws Exception {
   8:         ...
   9:     public abstract ActionForward doExecute(ActionMapping mapping, ActionForm form,
  10:             HttpServletRequest request, HttpServletResponse response)
  11:             throws Exception;
  12:         ...
  13:     protected User getUser(HttpServletRequest request) {
  14:         return request.getUserPrincipal() == null ? 

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     public ActionForward execute(ActionMapping mapping, ActionForm form,
   6:             HttpServletRequest request, HttpServletResponse response)
   7:             throws Exception {
   8:         ...
   9:     public abstract ActionForward doExecute(ActionMapping mapping, ActionForm form,
  10:             HttpServletRequest request, HttpServletResponse response)
  11:             throws Exception;
  12:         ...
  13:     protected User getUser(HttpServletRequest request) {
  14:         return request.getUserPrincipal() == null ? 

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:     public ActionForward execute(ActionMapping mapping, ActionForm form,
   6:             HttpServletRequest request, HttpServletResponse response)
   7:             throws Exception {
   8:         ...
   9:     public abstract ActionForward doExecute(ActionMapping mapping, ActionForm form,
  10:             HttpServletRequest request, HttpServletResponse response)
  11:             throws Exception;
  12:         ...
  13:     protected User getUser(HttpServletRequest request) {
  14:         return request.getUserPrincipal() == null ? 

View Full Code Here

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Returns true if the session came from a cookie.
Usages and Demos :

View More Examples of isRequestedSessionIdFromCookie()
   1:        
   2: public void doGet (HttpServletRequest req, HttpServletResponse res)
   3:        throws ServletException, IOException
   4:         ...
   5:     out.println("<br>Session ID in Request from Cookie: " +
   6:                 req.isRequestedSessionIdFromCookie());
   7:     out.println("<br>Session ID in Request from URL: " +
   8:                 req.isRequestedSessionIdFromURL());
   9:     out.println("<br>Valid Session ID: " +

View Full Code Here
   1:     
   2:     public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
   3:     {
   4:         ...
   5:     out.println("Requested session ID from cookie: " +
   6:                 req.isRequestedSessionIdFromCookie() + "<BR>");
   7:     out.println("Requested session ID from URL: " +
   8:                 req.isRequestedSessionIdFromUrl() + "<BR>");
   9:     out.println("Requested session ID valid: " +

View Full Code Here
   1: 
   2:   public void doGet(HttpServletRequest req, HttpServletResponse res)
   3:                                throws ServletException, IOException {
   4:         ...
   5:     out.println("Requested session ID from cookie: " +
   6:                 req.isRequestedSessionIdFromCookie() + "<BR>");
   7:     out.println("Requested session ID from URL: " +
   8:                 req.isRequestedSessionIdFromUrl() + "<BR>");
   9:     out.println("Requested session ID valid: " +

View Full Code Here
   1: {
   2:     private HttpServletRequest servletRequest = null;
   3:     private PortletRequest portletRequest = null;
   4:         ...
   5:     
   6:     public PortletRequestFilter(HttpServletRequest servletRequest,
   7:                                 PortletRequest portletRequest)
   8:         ...
   9:     
  10:     public void setServletRequest(HttpServletRequest servletRequest)
  11:     {
  12:         ...
  13:     {
  14:         return servletRequest.isRequestedSessionIdFromCookie();

View Full Code Here
   1:   
   2:   public void doGet (HttpServletRequest req, HttpServletResponse res)
   3:        throws ServletException, IOException
   4:         ...
   5:     out.println("<br>Session ID in Request from Cookie: " +
   6:                 req.isRequestedSessionIdFromCookie());
   7:     out.println("<br>Session ID in Request from URL: " +
   8:                 req.isRequestedSessionIdFromURL());
   9:     out.println("<br>Valid Session ID: " +

View Full Code Here

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Returns true if the session came URL-encoding.
Usages and Demos :

View More Examples of isRequestedSessionIdFromURL()
   1:        
   2: public void doGet (HttpServletRequest req, HttpServletResponse res)
   3:        throws ServletException, IOException
   4:         ...
   5:     out.println("<br>Session ID in Request from URL: " +
   6:                 req.isRequestedSessionIdFromURL());
   7:     out.println("<br>Valid Session ID: " +
   8:                 req.isRequestedSessionIdValid());
   9:     out.println("<h3>Session Data:</h3>");

View Full Code Here
   1: {
   2:     private HttpServletRequest servletRequest = null;
   3:     private PortletRequest portletRequest = null;
   4:         ...
   5:     
   6:     public PortletRequestFilter(HttpServletRequest servletRequest,
   7:                                 PortletRequest portletRequest)
   8:         ...
   9:     
  10:     public void setServletRequest(HttpServletRequest servletRequest)
  11:     {
  12:         ...
  13:     {
  14:         return servletRequest.isRequestedSessionIdFromURL();

View Full Code Here
   1:   
   2:   public void doGet (HttpServletRequest req, HttpServletResponse res)
   3:        throws ServletException, IOException
   4:         ...
   5:     out.println("<br>Session ID in Request from URL: " +
   6:                 req.isRequestedSessionIdFromURL());
   7:     out.println("<br>Valid Session ID: " +
   8:                 req.isRequestedSessionIdValid());
   9:     out.println("<h3>Session Data:</h3>");

View Full Code Here
   1: 
   2: package tests.javax_servlet_http.HttpServletRequest;
   3: 
   4:         ...
   5: import javax.servlet.http.HttpServletRequest;
   6: import javax.servlet.http.HttpServletResponse;
   7:         ...
   8: 
   9:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
  10: 
  11:         ...
  12:         boolean expectedResult = false;
  13:         boolean result = request.isRequestedSessionIdFromURL();

View Full Code Here
   1: 
   2:     public void service ( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
   3: 
   4:         ...
   5:         boolean expectedResult = false;
   6:         boolean result = request.isRequestedSessionIdFromURL();
   7: 
   8:         if ( result == expectedResult ) {
   9:             out.println( "HttpServletRequestWrapperIsRequestedSessionIdFromURL_01Test test PASSED<BR>" );

View Full Code Here

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()

Deprecated.

Usages and Demos :

View More Examples of isRequestedSessionIdFromUrl()
   1:     
   2:     public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
   3:     {
   4:         ...
   5:     out.println("Requested session ID from URL: " +
   6:                 req.isRequestedSessionIdFromUrl() + "<BR>");
   7:     out.println("Requested session ID valid: " +
   8:                  req.isRequestedSessionIdValid() + "<BR>");

View Full Code Here
   1: 
   2:   public void doGet(HttpServletRequest req, HttpServletResponse res)
   3:                                throws ServletException, IOException {
   4:         ...
   5:     out.println("Requested session ID from URL: " +
   6:                 req.isRequestedSessionIdFromUrl() + "<BR>");
   7:     out.println("Requested session ID valid: " +
   8:                  req.isRequestedSessionIdValid() + "<BR>");

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6: public class MockCacheRequest implements HttpServletRequest {
   7: 
   8:         ...
   9:     private HttpServletRequest request;
  10: 
  11:         ...
  12:     public boolean isRequestedSessionIdFromURL() {
  13:         return request.isRequestedSessionIdFromURL();

View Full Code Here
   1: import javax.servlet.http.Cookie;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpSession;
   4:         ...
   5: 
   6: public class RequestWrapper implements HttpServletRequest {
   7: 
   8:         ...
   9:     HttpServletRequest wrappedRequest;
  10:     
  11:         ...
  12:     public boolean isRequestedSessionIdFromURL() {
  13:         return wrappedRequest.isRequestedSessionIdFromURL();

View Full Code Here
   1: import javax.servlet.http.HttpSession;
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5: public class MultipartRequestWrapper implements HttpServletRequest {
   6:     
   7:         ...
   8:     
   9:     protected HttpServletRequest request;
  10:     
  11:         ...
  12:     public boolean isRequestedSessionIdFromURL() {
  13:         return request.isRequestedSessionIdFromURL();

View Full Code Here

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Returns true if the session is valid.
Usages and Demos :

View More Examples of isRequestedSessionIdValid()
   1:        
   2: public void doGet (HttpServletRequest req, HttpServletResponse res)
   3:        throws ServletException, IOException
   4:         ...
   5:     out.println("<br>Valid Session ID: " +
   6:                 req.isRequestedSessionIdValid());
   7:     out.println("<h3>Session Data:</h3>");
   8:     out.println("New Session: " + session.isNew());
   9:     out.println("<br>Session ID: " + session.getId());

View Full Code Here
   1:     
   2:     public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
   3:     {
   4:         ...
   5:     out.println("Requested session ID valid: " +
   6:                  req.isRequestedSessionIdValid() + "<BR>");
   7: 
   8:     out.println("<H3>Here are all the current session IDs");
   9:     out.println("and the times they've hit this page:</H3>");

View Full Code Here
   1: 
   2:   public void doGet(HttpServletRequest req, HttpServletResponse res)
   3:                                throws ServletException, IOException {
   4:         ...
   5:     out.println("Requested session ID valid: " +
   6:                  req.isRequestedSessionIdValid() + "<BR>");
   7: 
   8:     out.println("<H3>Here are all the current session IDs");
   9:     out.println("and the times they've hit this page:</H3>");

View Full Code Here
   1: {
   2:     private HttpServletRequest servletRequest = null;
   3:     private PortletRequest portletRequest = null;
   4:         ...
   5:     
   6:     public PortletRequestFilter(HttpServletRequest servletRequest,
   7:                                 PortletRequest portletRequest)
   8:         ...
   9:     
  10:     public void setServletRequest(HttpServletRequest servletRequest)
  11:     {
  12:         ...
  13:     {
  14:         return servletRequest.isRequestedSessionIdValid();

View Full Code Here
   1:   
   2:   public void doGet (HttpServletRequest req, HttpServletResponse res)
   3:        throws ServletException, IOException
   4:         ...
   5:     out.println("<br>Valid Session ID: " +
   6:                 req.isRequestedSessionIdValid());
   7:     out.println("<h3>Session Data:</h3>");
   8:     out.println("New Session: " + session.isNew());
   9:     out.println("<br>Session ID: " + session.getId());

View Full Code Here

isUserInRole

public boolean isUserInRole(String role)
Returns true if the user is in the given role.
Usages and Demos :

View More Examples of isUserInRole(String role)
   1:         }
   2:         HttpServletRequest request = 
   3:         ...
   4:             (HttpServletRequest) pageContext.getRequest();
   5:         ...
   6:         return request.isUserInRole(role);
   7:     }

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: 
   4:         ...
   5: 
   6:     public boolean isUserInRole( HttpServletRequest request, Principal role )
   7:     {
   8:         ...
   9:         return request.isUserInRole( role.getName() );
  10:     }

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5: 
   6:   public boolean isMatch(HttpServletRequest request,
   7:                          HttpServletResponse response)
   8:         ...
   9: 
  10:     return request.isUserInRole(_role);
  11:   }

View Full Code Here
   1: 
   2: import javax.servlet.http.HttpServletRequest;
   3: import java.security.Principal;
   4:         ...
   5: public class ServletPrincipalProxy implements PrincipalProxy {
   6:     private HttpServletRequest request;
   7: 
   8:         ...
   9:     public ServletPrincipalProxy(HttpServletRequest request) {
  10:         this.request = request;
  11:         ...
  12:     public boolean isUserInRole(String role) {
  13:         return request.isUserInRole(role);

View Full Code Here
   1: import javax.servlet.ServletContext;
   2: import javax.servlet.http.HttpServletRequest;
   3: import javax.servlet.http.HttpServletResponse;
   4:         ...
   5:    private ServletContext context;
   6:    private HttpServletRequest request;
   7:    private HttpServletResponse response;
   8:         ...
   9:    {
  10:       return request.isUserInRole(role);
  11:    }
  12:         ...
  13: 
  14:    public HttpServletRequest getHttpServletRequest()

View Full Code Here