|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The context that is used by the template to return its data. This class provides some additional HTTP-specific template functions.
| Inner Class Summary | |
static interface |
HttpContext.Attributes
The Attributes interface provides access to the request attributes. |
static interface |
HttpContext.Cookies
The Cookies interface provides access to the request cookies. |
static interface |
HttpContext.Header
The Header interface provides access to a request header value. |
static interface |
HttpContext.Headers
The Headers interface provides access to the request headers. |
static interface |
HttpContext.Parameter
The Parameter interface provides access to a request parameter value. |
static interface |
HttpContext.Parameters
The Parameters interface provides access to the request parameters. |
static interface |
HttpContext.ParameterValues
The ParameterValues interface provides access to the request parameter values. |
static interface |
HttpContext.Request
The Request interface provides access to the data that is passed to an HTTP servlet. |
static class |
HttpContext.StringArrayList
An ArrayList of Strings. |
| Method Summary | |
java.lang.String |
encodeParameter(java.lang.String str)
Encodes the given string so that it can be safely used in a URL. |
boolean |
fileExists(java.lang.String path)
Tests if a file at the given path exists. |
HttpContext.Request |
getRequest()
Gets an object that contains all the request information from the client. |
HttpContext.Request |
getRequest(java.lang.String encoding)
Gets an object that contains all the request information from the client and all the parameters are converted using the specified character encoding. |
void |
insertFile(java.lang.String path)
Inserts the contents of the given file into the page output or not at all if the file does not exist or cannot be read. |
void |
insertURL(java.lang.String URL)
Inserts the contents of the resource at the given URL into the page output. |
java.lang.String |
readFile(java.lang.String path)
Reads and returns the contents of the given file. |
java.lang.String |
readFile(java.lang.String path,
java.lang.String encoding)
Reads and returns the contents of the given file. |
java.lang.String |
readURL(java.lang.String URL)
Reads and returns the contents of the given URL. |
java.lang.String |
readURL(java.lang.String URL,
java.lang.String encoding)
Reads and returns the contents of the given URL. |
void |
sendError(int code)
Causes an error page to be generated using the given status code. |
void |
sendError(int code,
java.lang.String message)
Causes an error page to be generated using the given status code and message. |
void |
sendRedirect(java.lang.String url)
Creates a response that forces the client to redirect to the given URL. |
void |
setContentType(java.lang.String type)
Sets the MIME type of the page, like "text/html" or "text/plain". |
void |
setHeader(java.lang.String name,
java.util.Date value)
An advanced function that sets the date value of an arbitrary HTTP response header. |
void |
setHeader(java.lang.String name,
int value)
An advanced function that sets the integer value of an arbitrary HTTP response header. |
void |
setHeader(java.lang.String name,
java.lang.String value)
An advanced function that sets the string value of an arbitrary HTTP response header. |
void |
setStatus(int code)
Sets the response's HTTP status code, like 200 for OK or 404 for not found. |
void |
setURLTimeout(long timeout)
Requests to check, insert, or read URLs will timeout if the remote hosts doesn't respond in time. |
boolean |
URLExists(java.lang.String URL)
Tests if a resource at the given URL exists. |
| Methods inherited from interface com.go.tea.runtime.UtilityContext |
cardinal, cardinal, currentDate, endsWith, find, find, findFirst, findFirst, findLast, findLast, ordinal, ordinal, replace, replace, replace, replaceFirst, replaceFirst, replaceLast, replaceLast, shortOrdinal, shortOrdinal, startsWith, substring, substring, toLowerCase, toUpperCase, trim, trimLeading, trimTrailing |
| Methods inherited from interface com.go.tea.runtime.Context |
dateFormat, dateFormat, getAvailableLocales, getAvailableTimeZones, getDateFormat, getDateFormatTimeZone, getLocale, getNullFormat, getNumberFormat, getNumberFormatInfinity, getNumberFormatNaN, nullFormat, numberFormat, numberFormat, print, print, print, print, print, print, print, setLocale, setLocale, setLocale, toString, toString, toString, toString, toString, toString, toString, toString |
| Method Detail |
public HttpContext.Request getRequest()
public HttpContext.Request getRequest(java.lang.String encoding)
encoding - the character encodingpublic void setStatus(int code)
code - the status code int
public void sendError(int code)
throws AbortTemplateException,
java.io.IOException
code - the error code int
public void sendError(int code,
java.lang.String message)
throws AbortTemplateException,
java.io.IOException
code - the error code intmessage - the error message
public void sendRedirect(java.lang.String url)
throws AbortTemplateException,
java.io.IOException
url - the url to redirect to
public void setContentType(java.lang.String type)
throws java.io.UnsupportedEncodingException,
java.io.IOException
type - the MIME type of the page
public void setHeader(java.lang.String name,
java.lang.String value)
name - the name of the headervalue - the string value of the header
public void setHeader(java.lang.String name,
int value)
name - the name of the headervalue - the int value of the header
public void setHeader(java.lang.String name,
java.util.Date value)
name - the name of the headervalue - the date value of the headerpublic java.lang.String encodeParameter(java.lang.String str)
str - the string to encode
public boolean fileExists(java.lang.String path)
throws java.io.IOException
path - the name of the file to test
public void insertFile(java.lang.String path)
throws java.io.IOException
readFile in order to use character conversion.
If the servlet that is running the template has a root directory, it is used to determine the physical file path. If the servlet does not have a root directory set, it is assumed to be the root of the file system. If the path given to this function does not lead with a slash, the path is relative to the pathInfo variable from the request.
path - the name of the file to insert
public java.lang.String readFile(java.lang.String path)
throws java.io.IOException
insertFile in that the character conversion is
applied and the file's contents are returned.
If the servlet that is running the template has a root directory, it is used to determine the physical file path. If the servlet does not have a root directory set, it is assumed to be the root of the file system. If the path given to this function does not lead with a slash, the path is relative to the pathInfo variable from the request.
path - the name of the file to insert
public java.lang.String readFile(java.lang.String path,
java.lang.String encoding)
throws java.io.IOException
insertFile in that the character conversion is
applied and the file's contents are returned.
If the servlet that is running the template has a root directory, it is used to determine the physical file path. If the servlet does not have a root directory set, it is assumed to be the root of the file system. If the path given to this function does not lead with a slash, the path is relative to the pathInfo variable from the request.
path - the name of the file to insertencoding - character encoding
public boolean URLExists(java.lang.String URL)
throws java.io.IOException
url - the resource URL
public void insertURL(java.lang.String URL)
throws java.io.IOException
readURL in order to use character conversion.url - the resource URL
public java.lang.String readURL(java.lang.String URL)
throws java.io.IOException
insertURL in that the character conversion is
applied and the resource's contents are returned.path - the name of the file to insert
public java.lang.String readURL(java.lang.String URL,
java.lang.String encoding)
throws java.io.IOException
insertURL in that the character conversion is
applied and the resource's contents are returned.path - the name of the file to insertencoding - character encodingpublic void setURLTimeout(long timeout)
timeout - max time to wait for URL operation to complete, in
milliseconds
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||