Servlet
API Methods
ServletConfig
get ServletConfig()
Returns
a Servlet Config object, which contains initializatin and startup parameteres
for this servlet.
.Java.lang.String
getServletInfo()
Returns
information about the servlet, such as author,version, and copyright.
Void
init(ServletCofig config)
Called
by the servlet container to indicate to a servlet that the servlet that
the servlet is being placed into service.
Void
Service (ServletRequst req, Se4rvletResponse res)
Called
by the servlet container to allow the servlet to respond to a
request.
Void
destory()
Called
by the servlet container to indicate to a servlet that the servlet is being taken
out of service.
Interface: Servlet Config
Package :javax.servlet
This Interface A servlet configuration
object used by a servlet container used to pass information to a servlet during
initialization.
Methods:
java.lang.String
getInitParameter(java.lang.String name)
Retuns
a String containing the value of the named initalization lparameter, or nul if
the parameter does not exist.
java.
util.Enumeration getInitparameterNames()
Returns
the names of the servlet,s initialization parameters as an Enumeration of
String objects , or an empty Enumeraion if the
servlet has no initialization parametrs.
Servlet Context
getServletContext()
Returns
a reference to theServletContext in which the caller
is executing.
java.lang.String
getServletName()
Returns
a reference to the Servlet Context in which the caller is
executing.
java.lang.String
getServletName()
Returns
the name of this servlet instance.
Interface : ServletRequest
package : javax.servlet
This interface defines an object to
provide client request information to a servlet. The servlet container creates
a Servlet Request object and passes it as an argument to the servlet's service
method.
A Servlet Request object provides data
including parameter name and values, attributes, and an input stream
Methods:
java.lang.Object get Attribute
(java. lang.String name)
Returns
the value of the named atributes as an Object, or null if no attribute of the
given name exists.
java.util.Enumeration
getAttributeNames()
Returns an Enumeration containing
the names of the
attributes
available to this
request.
java.lang
.String getCharacterEncoding()
Returns
the name of the character encoding
used inthe body of this request.
int
getContentLength()
Returns the length,in bytes,
of the request body and made available by the
input sream,or-1 if the length is not known.
java.lang.String
getContent Type()
Returns
the MIME type of the body of the request, or null if the type is not
known.
ServletInput
Stream getInputStream()
Retrives
the body of the request as binary
data
using a ServletInputStream
java.util.Locale
getLocale()
Returns
the preferred Locale that the client will accept content
in, based on the Accept -Language header.
java.util.Enumeration
getLocales()
Returns
anEnumeration of Locale object indicating, in
decreasing order starting with the preferred locale,
the locales that are acceptable to the
client based on the Accept-Language header.
java.long.String getLocales()
Returns
an Enumeration of Locale objects indicating, in decreasing order starting with
the preferred locale, the locales that are acceptable to the client based on
the Accept-Language header.
java.util.Enumeration
getParmeterNames()
Returns
an Enumeration of String objects containing the names of the parameters
contained in this request.
java.lang.String[]
getParameterValue(java.lang.String name)
Return
an array of String objects containing all of the values the given request
parameter has, or null if the parameter as a String, or null if the plarameter
does not exist.
java.util.Enumeration
getparameterNames()
Returns
an Enumeration of String object containing the names of the parameters
contained in this request.
java.lang.String[] get
parameter Values (java.lang.String name)
Returns
an array of String objects containing all of the values the given request
parameter has, or null if the parameter does not exist.
java.lang.String
getprotocol()
Returns
the name and version of the protocol the request uses in the form
protocol/majorVersion.minorVersion, for example,HTTP/1.1.
java.io.BufferedReader
getReader()
Retrieves
the body of the request as character data using a BufferedReader.
java.lang.String
getRemoteAddr()
Returns
the Internet protocol(IP) address of the client that sent the request.
java.lang.string
getScheme()
Returns
the name of the scheme used to make this request, for example, http, https, or
ftp.
java.lang.String
getServerName()
Returns
the host name of the server that received the
request.
int
getServerport()
Returns
the port number on which this request was received.
boolean
isSecure()
Returns a Boolean indicating whether
this request was made using a secure channel,such
as HTTPS.
void
remove Attribute(java. lang.String name)
Removes
an attribute from this request.
void
setAttribute(java.lang.String name,java.lang.Object o)
Stores
an attribute in this request.
void
setCharacterEncoding(java.lang.Sting env)
Overrides
the name of the character encoding used in the body of this request.

No comments:
Post a Comment