JavaScript is disabled on your browser.
  • Summary:
  • Nested |
  • Field |
  • Constr |
  • Method
  • Detail:
  • Field |
  • Constr |
  • Method
javax.servlet

Interface ServletRequest

  • All Known Subinterfaces:
    HttpServletRequest
    All Known Implementing Classes:
    HttpServletRequestWrapper, ServletRequestWrapper


    public interface ServletRequest
    Whenever the server receives a request it creates a ServletRequest object, puts all the request information in it and passes this along with a ServletResponse object to the approriate servlet.
    Since:
    1.0
    • Method Summary

      Methods
      Modifier and Type Method and Description
      AsyncContext getAsyncContext ()
      Returns the current context for asynchronous operation.
      java.lang.Object getAttribute (java.lang.String name)
      Gets a named attribute's value.
      java.util.Enumeration getAttributeNames ()
      Gets an Enumeration of all the attribute names.
      java.lang.String getCharacterEncoding ()
      Gets the character encoding of the request data.
      int getContentLength ()
      Gets the size in bytes of the request
      java.lang.String getContentType ()
      Gets the mime type of the request
      DispatcherType getDispatcherType ()
      Returns the dispatcher type of this request.
      ServletInputStream getInputStream ()
      Creates an inputstream for servlets to read client request data from.
      java.lang.String getLocalAddr ()
      Returns the IP address of the interface on which the request was received.
      java.util.Locale getLocale ()
      get the locale associated with the request.
      java.util.Enumeration getLocales ()
      get all the locales associated with the request.
      java.lang.String getLocalName ()
      Returns the DNS hostname of the IP interface on which the request was received.
      int getLocalPort ()
      Returns the port number of the interface on which the request was received.
      java.lang.String getParameter (java.lang.String name)
      Gets the value of a named requestparameter.
      java.util.Map getParameterMap ()
      Gets a Map of all the parameters contained within this request
      java.util.Enumeration getParameterNames ()
      Gets all parameter names.
      java.lang.String[] getParameterValues (java.lang.String name)
      Gets an array of Strings containing all the request parameter's values whose name matches name.
      java.lang.String getProtocol ()
      Gets the protocol of the request as Proto/Major.Minor ("HTTP/1.1").
      java.io.BufferedReader getReader ()
      Creates an BufferedReader for servlets to read client request data from.
      java.lang.String getRealPath (java.lang.String path)
      Deprecated.
      Should use getRealPath from the current ServletContext.
      java.lang.String getRemoteAddr ()
      Gets the ip address of the client that sent the request
      java.lang.String getRemoteHost ()
      Gets the hostname of the client that sent the request.
      int getRemotePort ()
      Returns the IP source port of the client that sent the request.
      RequestDispatcher getRequestDispatcher (java.lang.String path)
      get a means of dispatching to the specified path.
      java.lang.String getScheme ()
      Gets the scheme of the request as defined by RFC 1783 ("ftp", "http", "gopher", "news").
      java.lang.String getServerName ()
      Get the name of the server receiving the request
      int getServerPort ()
      Gets the portnumber the server reveiving the request is running on.
      ServletContext getServletContext ()
      Returns the context to which this request was last dispatched.
      boolean isAsyncStarted ()
      Indicates whether this request has been put into asynchronous mode.
      boolean isAsyncSupported ()
      Indicates whether asynchronous mode is supported for this request.
      boolean isSecure ()
      has the request arrived under secure conditions? A secure condition might be an encrypted channel, for example SSL.
      void removeAttribute (java.lang.String name)
      remove the specified attribute.
      void setAttribute (java.lang.String name, java.lang.Object o)
      Puts a named object into the ServletRequest.
      void setCharacterEncoding (java.lang.String enc)
      Sets the name of the character encoding used for the body of this request
      AsyncContext startAsync ()
      Put this request into asynchronous mode.
      AsyncContext startAsync (ServletRequest request, ServletResponse response)
      Put this request into asynchronous mode using the specified request/response pair.
    • Method Detail

      • getAttribute

        java.lang.Object getAttribute(java.lang.String name)
        Gets a named attribute's value. This gives one of the initialization attribute values.

        Note that the Servlet 2.1 API Documentation mentions some predefined attribute names, but the Servlet Spec does not mention them. I (MJW) am not sure if they are platform specific (JWS) or not.

        Parameters:
        name - the attribute name
        Returns:
        The value of the attribute, null if not found.
      • getAttributeNames

        java.util.Enumeration getAttributeNames()
        Gets an Enumeration of all the attribute names.
        Returns:
        The Enumeration of all attribute names set in this request.
        Since:
        2.1
      • getCharacterEncoding

        java.lang.String getCharacterEncoding()
        Gets the character encoding of the request data.
        Returns:
        Character encoding or null if the encoding is unavailable
        Since:
        2.0
      • setCharacterEncoding

        void setCharacterEncoding(java.lang.String enc)
         throws java.io.UnsupportedEncodingException
        Sets the name of the character encoding used for the body of this request
        Parameters:
        enc - a String containing the name of the character encoding
        Throws:
        java.io.UnsupportedEncodingException - if the provided name is not a valid encoding scheme
        Since:
        2.3
      • getContentLength

        int getContentLength()
        Gets the size in bytes of the request
        Returns:
        the number of bytes in the request or -1 if not known
      • getContentType

        java.lang.String getContentType()
        Gets the mime type of the request
        Returns:
        a String containing the mime type of the request or null if not known
      • getInputStream

        ServletInputStream getInputStream()
         throws java.io.IOException
        Creates an inputstream for servlets to read client request data from.
        Returns:
        The created InputStreams
        Throws:
        java.io.IOException - if an i/o related error occured
        java.lang.IllegalStateException - if getReader was already called on this request.
        See Also:
        getReader()
      • getParameter

        java.lang.String getParameter(java.lang.String name)
        Gets the value of a named requestparameter. If the parameter can have more than one value getParameterValues should be used. If there are more than one values associated with the parameter this method will only return the first value as return by getParameterValues is returned. see javax.servlet.ServletRequest.getParameterValues()
        Parameters:
        name - the name of the parameter whose value we want
        Returns:
        the (first) value of the parameter or null if not present
      • getParameterNames

        java.util.Enumeration getParameterNames()
        Gets all parameter names.

        Note that the Servlet API 2.1 documentation says that this returns an empty Enumeration if the input stream is empty, but this is not mandated by the Servlet Spec.

        Returns:
        an enumeration containing all parameter names
      • getParameterValues

        java.lang.String[] getParameterValues(java.lang.String name)
        Gets an array of Strings containing all the request parameter's values whose name matches name.
        Parameters:
        name - the parameter name
        Returns:
        the array containing all the values or null if not present
      • getParameterMap

        java.util.Map getParameterMap()
        Gets a Map of all the parameters contained within this request
        Returns:
        java.util.Map containing key value pairs of the request parameters, where the key is a String containing the parameter name, and the value is an array of Strings containing the parameter values
        Since:
        2.3
      • getProtocol

        java.lang.String getProtocol()
        Gets the protocol of the request as Proto/Major.Minor ("HTTP/1.1").
        Returns:
        A string containing the protocol name
      • getScheme

        java.lang.String getScheme()
        Gets the scheme of the request as defined by RFC 1783 ("ftp", "http", "gopher", "news").
        Returns:
        A String containing the scheme
      • getServerName

        java.lang.String getServerName()
        Get the name of the server receiving the request
        Returns:
        The name of the server.
      • getServerPort

        int getServerPort()
        Gets the portnumber the server reveiving the request is running on.
        Returns:
        the portnumber
      • getReader

        java.io.BufferedReader getReader()
         throws java.io.IOException
        Creates an BufferedReader for servlets to read client request data from.
        Returns:
        The created BufferedReader
        Throws:
        java.io.IOException - if an i/o related error occured
        java.lang.IllegalStateException - if getInputStream was already called on this request.
        java.io.UnsupportedEncodingException - if the character encoding cannot be decoded.
        Since:
        2.0
        See Also:
        getInputStream()
      • getRemoteAddr

        java.lang.String getRemoteAddr()
        Gets the ip address of the client that sent the request
        Returns:
        the client's ip address
      • getRemoteHost

        java.lang.String getRemoteHost()
        Gets the hostname of the client that sent the request. This is either a fully qualified host name or a string representing the remote IP address.
        Returns:
        the client's hostname
      • setAttribute

        void setAttribute(java.lang.String name,
         java.lang.Object o)
        Puts a named object into the ServletRequest. Can be used to communicate with other servlets if this ServletRequest is passed to another servlet through a RequestDispatcher. The names used must follow the conventions used for naming java packages.
        Parameters:
        name - - which is used to refer to this object
        object - - which should be returned when somebody calls getAttribute(name)
        Since:
        2.1
        See Also:
        getAttribute(java.lang.String), RequestDispatcher
      • removeAttribute

        void removeAttribute(java.lang.String name)
        remove the specified attribute.
        Parameters:
        name - the name of the attribute to be removed
        Since:
        2.1
      • getLocale

        java.util.Locale getLocale()
        get the locale associated with the request.
        Returns:
        the international locale of the request
        Since:
        2.2
      • getLocales

        java.util.Enumeration getLocales()
        get all the locales associated with the request.
        Since:
        2.2
      • isSecure

        boolean isSecure()
        has the request arrived under secure conditions? A secure condition might be an encrypted channel, for example SSL.
        Since:
        2.2
      • getRequestDispatcher

        RequestDispatcher getRequestDispatcher(java.lang.String path)
        get a means of dispatching to the specified path. Relative path resolution is performed.
        Parameters:
        path - if relative it will be resolved
        Returns:
        the means if dispatching to the path
        Since:
        2.2
      • getRealPath

        java.lang.String getRealPath(java.lang.String path)
        Deprecated. Should use getRealPath from the current ServletContext.
        Translates the given path to the real path on the servers filesystem, using the servers documentroot.
        Parameters:
        path - the path which requires translating
        Returns:
        the translated path
        See Also:
        ServletContext.getRealPath(java.lang.String)
      • getRemotePort

        int getRemotePort()
        Returns the IP source port of the client that sent the request.
        Since:
        2.4
      • getLocalName

        java.lang.String getLocalName()
         throws java.io.IOException
        Returns the DNS hostname of the IP interface on which the request was received.
        Throws:
        java.io.IOException
        Since:
        2.4
      • getLocalAddr

        java.lang.String getLocalAddr()
         throws java.io.IOException
        Returns the IP address of the interface on which the request was received.
        Throws:
        java.io.IOException
        Since:
        2.4
      • getLocalPort

        int getLocalPort()
         throws java.io.IOException
        Returns the port number of the interface on which the request was received.
        Throws:
        java.io.IOException
        Since:
        2.4
      • getServletContext

        ServletContext getServletContext()
        Returns the context to which this request was last dispatched.
        Since:
        3.0
      • startAsync

        AsyncContext startAsync()
         throws java.lang.IllegalStateException
        Put this request into asynchronous mode. The associated response will not be committed until AsyncContext.complete() has been called.
        Returns:
        the context for the asynchronous operation
        Throws:
        java.lang.IllegalStateException
        Since:
        3.0
      • startAsync

        AsyncContext startAsync(ServletRequest request,
         ServletResponse response)
         throws java.lang.IllegalStateException
        Put this request into asynchronous mode using the specified request/response pair. The associated response will not be committed until AsyncContext.complete() has been called.
        Returns:
        the context for the asynchronous operation
        Throws:
        java.lang.IllegalStateException
        Since:
        3.0
      • isAsyncStarted

        boolean isAsyncStarted()
        Indicates whether this request has been put into asynchronous mode.
        Since:
        3.0
      • isAsyncSupported

        boolean isAsyncSupported()
        Indicates whether asynchronous mode is supported for this request.
        Since:
        3.0
      • getAsyncContext

        AsyncContext getAsyncContext()
        Returns the current context for asynchronous operation.
        Throws:
        java.lang.IllegalStateException - if this request has not been put into asynchronous mode.
        Since:
        3.0
      • getDispatcherType

        DispatcherType getDispatcherType()
        Returns the dispatcher type of this request.
        Since:
        3.0
  • Summary:
  • Nested |
  • Field |
  • Constr |
  • Method
  • Detail:
  • Field |
  • Constr |
  • Method

AltStyle によって変換されたページ (->オリジナル) /