Defines an object to assist a servlet in sending a response to the client.
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getErrorHandler, getInheritedConcepts, getResourceURI, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML, setResourceURI |
|
Parameters: |
$cookie : | the Cookie to return to the client. |
|
Adds the specified cookie to the response. This method can be
called multiple times to set more than one cookie.
$cook typeof Cookie
$cook.setName($request.getParameters.getValue("JSESSIONID"))
$cook.setValue($request.getParameters.getValue("zsz9mhtsz1"))
$response.addCookie($cook)
-- the result is --
Cookie: JSESSIONID=zsz9mhtsz1
Parameters: |
$name : | the name of the header. |
$value : | the additional header value. |
|
Adds a response header with the given name and value. This
method allows response headers to have multiple values.
$response.addHeader("MyName", "MyValue")
print "Contains: ", $response.containsHeader("MyValue")
-- the result is --
Contains: true
Returns a logical indicating whether the named response
header has already been set.
$response.addHeader("MyName", "MyValue")
print "Contain 'MyName' in header: " + $response.containsHeader("MyName")
-- the result is --
Contain 'MyName' in header: true
Parameters: |
$url : | the url to be encoded. |
|
Encodes the specified URL for use in the sendRedirect method
or, if encoding is not needed, returns the URL unchanged. The
implementation of this method includes the logic to determine
whether the session ID needs to be encoded in the URL. Because
the rules for making this determination can 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 ServletResponse.sendRedirect method
should be run through this method. Otherwise, URL rewriting
cannot be used with browsers which do not support cookies.
print $response.encodeRedirectURL($request.getRequestURI)
-- the result is --
URL: /mn8/ServletTest.mn8
Parameters: |
$url : | the url to be encoded. |
|
Encodes the specified URL by including the session ID in it,
or, if encoding is not needed, returns the URL unchanged. The
implementation of this method includes the logic to determine
whether the session ID needs to be encoded in the URL. For
example, if the browser supports cookies, or session tracking is
turned off, URL encoding is unnecessary.
For robust session tracking, 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.
print $response.encodeURL($request.getRequestURI)
-- the result is --
URL: /mn8/ServletTest.mn8
Forces any content in the buffer to be written to the client.
A call to this method automatically commits the response,
meaning the status code and headers will be written.
$response.flushBuffer
-- the result is --
Content of buffer is writed to the client.
Returns the actual buffer size used for the response. If no
buffering is used, this method returns 0.
print "<p><b>Buffer Size: </b>" ,$response.getBufferSize
-- the result is --
Buffer Size: 8192
Returns the name of the charset used for the MIME body sent
in this response.
If no charset has been assigned, it is implicitly set to ISO-
8859-1 (Latin-1).
See RFC 2047 (http://ds.internic.net/rfc/rfc2045.txt
) for
more information about character encoding and MIME.
print "<p><b>Encoding: </b>" ,$response.getCharacterEncoding
-- the result is --
Encoding: ISO-8859-1
Returns a logical indicating if the response has been
committed. A commited response has already had its status code
and headers written.
print "<p><b>Commited: </b>" ,$response.isCommited
-- the result is --
Commited: false
Clears any data that exists in the buffer as well as the
status code and headers. If the response has been committed,
this method throws an IllegalStateException.
$response.reset
-- the result is --
Clears the data from buffer.
Parameters: |
$statusCode : | the error status code. |
|
Sends an error response to the client using the specified
status. The server generally creates the response to look like a
normal server error page.
If the response has already
been committed, this method throws an IllegalStateException.
After using this method, the response should be considered to be
committed and should not be written to.
$response.sendError(501)
-- the result is --
Send an error response to the client using the specified status.
Parameters: |
$statusCode : | the error status code. |
$message : | the descriptive message. |
|
Sends an error response to the client using the specified
status code and descriptive message. The server generally
creates the response to look like a normal server error
page.
If the response has already been committed, this method
throws an IllegalStateException. After using this method, the
response should be considered to be committed and should not be
written to.
$response.sendError(501, "This is a error.")
-- the result is --
Send an error rwsponse to the client using the specified status
and descriptive message.
Parameters: |
$location : | the redirect location URL. |
|
Sends a temporary redirect response to the client using the
specified redirect location URL. This method can accept relative
URLs; the servlet container will convert the relative URL to an
absolute URL before sending the response to the client.
If the response has already been committed, this method
throws an IllegalStateException. After using this method, the
response should be considered to be committed and should not be
written to.
$response.sendRedirect( $response.encodeRedirectURL($request.getRequestURI) )
-- the response is --
Send a redirect response to the client.
Parameters: |
$bufferSize : | the preferred buffer size. |
|
Sets the preferred buffer size for the body of the response.
The servlet container will use a buffer at least as large as the
size requested. The actual buffer size used can be found using
getBufferSize.
A larger buffer allows more content to be written before
anything is actually sent, thus providing the servlet with more
time to set appropriate status codes and headers. A smaller
buffer decreases server memory load and allows the client to
start receiving data more quickly.
This method must be called before any response body content
is written; if content has been written, this method throws an
IllegalStateException.
$response.setBufferSize(4096)
print "<p><b>Buffer Size: </b>" ,$response.getBufferSize
-- the result is --
Buffer Size: 4096
Parameters: |
$length : | an integer specifying the length of the content
being returned to the client; sets the Content-Length
header |
|
Sets the length of the content body in the response In HTTP
servlets, this method sets the HTTP Content-Length header.
$response.setContentLength(4096)
-- the result is --
Sets the content length of the content body to 4096.
Parameters: |
$contentType : | a String specifying the MIME type of the content. |
|
Sets the content type of the response being sent to the
client. The content type may include the type of character
encoding used, for example, text/html; charset=ISO-8859-4.
$response.setContentType("text/html")
print "Content-Type: ",$request.getContentType
-- the result is --
Content-Type: text/html
Parameters: |
$name : | the name of the header. |
$value : | the header value. |
|
Sets a response header with the given name and value. If the
header had already been set, the new value overwrites the
previous one. The containsHeader method can be used to test for the presence of a header before setting its value.
$response.setHeader("MyName", "MyValue")
print "Contains: ", $response.containsHeader("MyValue")
-- the result is --
Contains: true
Parameters: |
$statusCode : | the status code. |
|
Sets the status code for this response. This method is used
to set the return status code when there is no error (for
example, for the status codes OK(200) or MOVED TEMPORARILY(302). If
there is an error, the sendError method should be used
instead.