|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--rup.robot.httpserver.response.MyResponse
|
+--rup.robot.httpserver.response.MyHttpServletResponse
Permet de formuler une réponse conforme au protocole http
| Fields inherited from class rup.robot.httpserver.response.MyResponse |
headers_out,
out |
| Fields inherited from interface javax.servlet.http.HttpServletResponse |
SC_ACCEPTED,
SC_BAD_GATEWAY,
SC_BAD_REQUEST,
SC_CONFLICT,
SC_CONTINUE,
SC_CREATED,
SC_FORBIDDEN,
SC_GATEWAY_TIMEOUT,
SC_GONE,
SC_HTTP_VERSION_NOT_SUPPORTED,
SC_INTERNAL_SERVER_ERROR,
SC_LENGTH_REQUIRED,
SC_METHOD_NOT_ALLOWED,
SC_MOVED_PERMANENTLY,
SC_MOVED_TEMPORARILY,
SC_MULTIPLE_CHOICES,
SC_NO_CONTENT,
SC_NON_AUTHORITATIVE_INFORMATION,
SC_NOT_ACCEPTABLE,
SC_NOT_FOUND,
SC_NOT_IMPLEMENTED,
SC_NOT_MODIFIED,
SC_OK,
SC_PARTIAL_CONTENT,
SC_PAYMENT_REQUIRED,
SC_PRECONDITION_FAILED,
SC_PROXY_AUTHENTICATION_REQUIRED,
SC_REQUEST_ENTITY_TOO_LARGE,
SC_REQUEST_TIMEOUT,
SC_REQUEST_URI_TOO_LONG,
SC_RESET_CONTENT,
SC_SEE_OTHER,
SC_SERVICE_UNAVAILABLE,
SC_SWITCHING_PROTOCOLS,
SC_UNAUTHORIZED,
SC_UNSUPPORTED_MEDIA_TYPE,
SC_USE_PROXY |
| Constructor Summary | |
MyHttpServletResponse(java.io.OutputStream out)
|
|
| Method Summary | |
void |
addCookie(javax.servlet.http.Cookie cookie)
PAS IMPLEMENTE ,PAS IMPLEMENTE,PAS IMPLMENTE Adds the specified cookie to the response. |
protected void |
connectionCloseEnabled(boolean bool)
Indique si l'on veut une connexion persistante ou non. |
boolean |
containsHeader(java.lang.String name)
Checks whether the response message header has a field with the specified name. |
java.lang.String |
encodeRedirectUrl(java.lang.String url)
Deprecated. Use encodeRedirectURL(String url) |
java.lang.String |
encodeRedirectURL(java.lang.String url)
PAS IMPLEMENTE ,PAS IMPLEMENTE,PAS IMPLMENTE Encodes the specified URL for use in the sendRedirect method or, if encoding is not needed,
returns the URL unchanged. |
java.lang.String |
encodeUrl(java.lang.String url)
Deprecated. Use encodeURL(String url) |
java.lang.String |
encodeURL(java.lang.String url)
PAS IMPLEMENTE, PAS IMPLEMENTE, PAS IMPLMENTE Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged. |
static java.lang.String |
findStatusString(int sc)
Methode provenant de JServ !! |
java.lang.String |
getCharacterEncoding()
Returns the name of the character set encoding used for the MIME body sent by this response. |
javax.servlet.ServletOutputStream |
getOutputStream()
Returns a ServletOutputStream suitable for writing binary
data in the response. |
java.io.PrintWriter |
getWriter()
Returns a PrintWriter object that you
can use to send character text to the client.
|
static java.lang.String |
parseCharacterEncoding(java.lang.String contentType)
Methode provenant de Jserv Parse a content-type header for the character encoding. |
protected void |
requestEnabled(boolean bool)
Indique si l'on veut juste envoyée une réponse http du type HTTP/1.1 200 OK etc... ou alors envoyer une requête
du type GET /hello.html HTTP/1.1 .
|
void |
sendError(int sc)
Sends an error response to the client using the specified status code and a default message. |
void |
sendError(int sc,
java.lang.String msg)
PAS IMPLEMENTE, PAS IMPLEMENTE, PAS IMPLEMENTE Sends an error response to the client using the specified status code and descriptive message. |
void |
sendHttpHeaders()
Envoie l'entête d'une réponse HTTP ou d'une requêtte HTTP Choix en fonction de la methode requestEnabled()
Par défaut c'est uen réponse conforme au protocol HTTP. |
void |
sendRedirect(java.lang.String location)
Sends a temporary redirect response to the client using the specified redirect location URL. |
void |
setContentLength(int len)
Sets the length of the content the server returns to the client. |
void |
setContentType(java.lang.String type)
Sets the content type of the response the server sends to the client. |
void |
setDateHeader(java.lang.String name,
long date)
Adds a field to the response header with the given name and date-valued field. |
protected void |
setGetMethod(java.lang.String path)
Si l'on appelle la méthode requestEnabled<\code> avec comme paramètre
|
void |
setHeader(java.lang.String name,
java.lang.String value)
Adds a field to the response header with the given name and value. |
void |
setIntHeader(java.lang.String name,
int value)
Adds a field to the response header with the given name and integer value. |
protected void |
setPostMethod(java.lang.String path)
|
protected void |
setServer(java.lang.String Server)
Indique le nom du server à partir duquel on effectue la requête. |
void |
setStatus(int sc)
Sets the status code for this response. |
void |
setStatus(int sc,
java.lang.String sm)
Deprecated. ambiguous meaning. To send an error with a description page, use sendError(int sc, String msg); |
java.lang.String |
writeHttpHeaders()
Idem que sendHttpHeaders() mais l'entête est écrit dans un StringBuffer Pour pouvoir tester ou débugger |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public MyHttpServletResponse(java.io.OutputStream out)
| Method Detail |
protected void connectionCloseEnabled(boolean bool)
bool - si true alors la valeur de Connection est "close"
sinon sa valeur est Keep-Aliveprotected void setServer(java.lang.String Server)
protected void requestEnabled(boolean bool)
HTTP/1.1 200 OK etc... ou alors envoyer une requête
du type GET /hello.html HTTP/1.1 .
C'est un détournement de l'utilisation de MyHttpServletResponse
pour permetre de faire des requêtes...
protected void setGetMethod(java.lang.String path)
requestEnabled<\code> avec comme paramètre
true<\code> alors on dait préciser le type de méthode que l'on veut effectuer.
Ici, On veut effectuer un Get.
protected void setPostMethod(java.lang.String path)
public void sendHttpHeaders()
requestEnabled()
Par défaut c'est uen réponse conforme au protocol HTTP.public java.lang.String writeHttpHeaders()
public void addCookie(javax.servlet.http.Cookie cookie)
cookie - the Cookie to return to the clientpublic boolean containsHeader(java.lang.String name)
name - the header field namepublic java.lang.String encodeURL(java.lang.String url)
All URLs emitted by a Servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
url - the url to be encoded.public java.lang.String encodeRedirectURL(java.lang.String url)
sendRedirect method or, if encoding is not needed,
returns the URL unchanged. The implementation of this method
should include the logic to determine whether the session ID
needs to be encoded in the URL. Because the rules for making
this determination differ from those used to decide whether to
encode a normal link, this method is seperate from the
encodeUrl method.
All URLs sent to the HttpServletResponse.sendRedirect method should be run through this method. Otherwise, URL rewriting canont be used with browsers which do not support cookies.
After this method is called, the response should be considered to be committed and should not be written to.
url - the url to be encoded.sendRedirect(java.lang.String),
encodeUrl(java.lang.String)public java.lang.String encodeUrl(java.lang.String url)
All URLs emitted by a Servlet should be run through this method. Otherwise, URL rewriting cannot be used with browsers which do not support cookies.
url - the url to be encoded.public java.lang.String encodeRedirectUrl(java.lang.String url)
sendRedirect method or, if encoding is not needed,
returns the URL unchanged. The implementation of this method
should include the logic to determine whether the session ID
needs to be encoded in the URL. Because the rules for making
this determination differ from those used to decide whether to
encode a normal link, this method is seperate from the
encodeUrl method.
All URLs sent to the HttpServletResponse.sendRedirect method should be run through this method. Otherwise, URL rewriting canont be used with browsers which do not support cookies.
url - the url to be encoded.
public void sendError(int sc,
java.lang.String msg)
throws java.io.IOException
After using this method, the response should be considered to be committed and should not be written to.
sc - the status codemsg - the detail message
public void sendError(int sc)
throws java.io.IOException
sc - the status code
public void sendRedirect(java.lang.String location)
throws java.io.IOException
https://hostname/path/file.html).
Relative URLs are not permitted here.location - the redirect location URL
public void setDateHeader(java.lang.String name,
long date)
containsHeader method can be used to test for the
presence of a header before setting its value.name - the name of the header fieldvalue - the header field's date valuecontainsHeader(java.lang.String)
public void setHeader(java.lang.String name,
java.lang.String value)
containsHeader method can be
used to test for the presence of a header before setting its
value.name - the name of the header fieldvalue - the header field's valuecontainsHeader(java.lang.String)
public void setIntHeader(java.lang.String name,
int value)
containsHeader
method can be used to test for the presence of a header before
setting its value.name - the name of the header fieldvalue - the header field's integer valuecontainsHeader(java.lang.String)public void setStatus(int sc)
sendError method should be used
instead.sc - the status codesendError(int, java.lang.String)
public void setStatus(int sc,
java.lang.String sm)
sc - the status codesm - the status messagepublic java.lang.String getCharacterEncoding()
The character encoding is either the one specified in the content itself or another one the client understands. If no character encoding has been assigned, it is implicitly set to text/plain.
See RFC 2047 (http://ds.internic.net/rfc/rfc2045.txt) for more information about character encoding and MIME.
String specifying the
name of the character set encoding, for
example, text/plain
public javax.servlet.ServletOutputStream getOutputStream()
throws java.io.IOException
ServletOutputStream suitable for writing binary
data in the response. The servlet engine does not encode the
binary data.ServletOutputStream for writing binary datagetWriter method
for the same responsegetWriter()
public java.io.PrintWriter getWriter()
throws java.io.IOException
PrintWriter object that you
can use to send character text to the client.
The character encoding used is the one specified
in the charset= property of the
setContentType(java.lang.String) method, which you must call
before you call this method.
If necessary, the MIME type of the response is modified to reflect the character encoding used.
You cannot use this method if you have already
called getOutputStream() for this
ServletResponse object.
PrintWriter object that
can return text to the clientsetContentType cannot be
usedgetOutputStream
method has already been called for this
response object; in that case, you can't
use this methodgetOutputStream(),
setContentType(java.lang.String)public void setContentLength(int len)
len - an integer specifying the length of the
content being returned to the client; sets
the Content-Length headerpublic void setContentType(java.lang.String type)
text/html; charset=ISO-8859-4.
You can only use this method once, and you should call it
before you obtain a PrintWriter or
ServletOutputStream object to return a response.
type - a String specifying the MIME
type of the contentgetOutputStream(),
getWriter()public static final java.lang.String findStatusString(int sc)
sc - The status code to find a descriptive string.public static java.lang.String parseCharacterEncoding(java.lang.String contentType)
contentType - a content type header.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||