1. HttpServletRequest
Method |
Description |
Getattributenames () |
Returns the name collection for all properties of the current request |
GetAttribute (String name) |
Returns the property value specified by name |
GetCookies () |
Returns the cookie sent by the client |
GetSession () |
Returns the session associated with the client and returns NULL if no session is assigned to the client |
GetSession (Boolean Create) |
Returns the session associated with the client and, if no session is assigned to the client, creates a session and returns |
GetParameter (String name) |
Gets the parameter in the request, which is specified by name |
Getparametervalues (String name) |
Returns the value of the parameter in the request, which is specified by name |
Getcharacterencoding () |
Returns the character encoding of the request |
Getcontentlength () |
Returns the effective length of the request body |
getInputStream () |
Gets the data in the requested input stream |
GetMethod () |
Gets the way the request is sent, such as GET, post |
Getparameternames () |
Gets the name of all parameters in the request |
Getprotocol () |
Gets the protocol name used by the request |
Getreader () |
Gets the data flow of the request body |
GETREMOTEADDR () |
Get the IP address of the client |
Getremotehost () |
Get the name of the client |
getServerName () |
Returns the name of the server that accepted the request |
Getserverpath () |
Gets the path of the requested file |
Common methods of HttpServletResponse
Method |
Description |
Addcookie (Cookie cookie) |
Adds the specified cookie to the current response |
AddHeader (String name,string value) |
Adds the specified name and value to the header information of the response |
Containsheader (String name) |
Returns a Boolean value that determines whether the head of the response is set |
Encodeurl (String URL) |
Encode the specified URL |
Senderror (int SC) |
Sends an error to the client using the specified status code |
Sendredirect (String location) |
Send a temporary response to the client |
Setdateheader (String name,long date) |
Sets the given name and date to the head of the response |
SetHeader (String name,string value) |
Sets the given name and value to the head of the response |
SetStatus (int SC) |
Set the status code for the current response |
setContentType (String ContentType) |
Set the MIME type of the response |
About HttpServletRequest and HttpServletResponse in Servlets