/**
* A page is responsible for handling HTTP requests and creating appropriate
* responses.
- *
+ *
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public interface Page {
/**
* Returns the path of this toadlet.
- *
+ *
* @return The path of this toadlet
*/
public String getPath();
/**
* Handles a request.
- *
+ *
* @param request
* The request to handle
* @return The response
/**
* Container for request data.
- *
+ *
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class Request {
/**
* Creates a new request that holds the given data.
- *
+ *
* @param uri
* The URI of the request
* @param method
/**
* Returns the URI that was accessed.
- *
+ *
* @return The accessed URI
*/
public URI getURI() {
/**
* Returns the HTTP method that was used to access the page.
- *
+ *
* @return The HTTP method
*/
public Method getMethod() {
/**
* Returns the HTTP request.
- *
+ *
* @return The HTTP request
*/
public HTTPRequest getHttpRequest() {
/**
* Returns the toadlet context.
- *
+ *
* @return The toadlet context
*/
public ToadletContext getToadletContext() {
/**
* Container for the HTTP response of a {@link Page}.
- *
+ *
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class Response {
/**
* Creates a new response.
- *
+ *
* @param statusCode
* The HTTP status code of the response
* @param statusText
/**
* Creates a new response.
- *
+ *
* @param statusCode
* The HTTP status code of the response
* @param statusText
/**
* Creates a new response.
- *
+ *
* @param statusCode
* The HTTP status code of the response
* @param statusText
/**
* Creates a new response.
- *
+ *
* @param statusCode
* The HTTP status code of the response
* @param statusText
/**
* Creates a new response.
- *
+ *
* @param statusCode
* The HTTP status code of the response
* @param statusText
/**
* Returns the HTTP status code of the response.
- *
+ *
* @return The HTTP status code
*/
public int getStatusCode() {
/**
* Returns the HTTP status text.
- *
+ *
* @return The HTTP status text
*/
public String getStatusText() {
/**
* Returns the content type of the response.
- *
+ *
* @return The content type of the reponse
*/
public String getContentType() {
/**
* Returns HTTP headers of the response. May be {@code null} if no
* headers are returned.
- *
+ *
* @return The response headers, or {@code null} if there are no
* response headers
*/
/**
* Returns the content of the response body. May be {@code null} if the
* response does not have a body.
- *
+ *
* @return The content of the response body
*/
public InputStream getContent() {
/**
* Returns the UTF-8 representation of the given text.
- *
+ *
* @param text
* The text to encode
* @return The encoded text
/**
* Creates a header map containing a single header.
- *
+ *
* @param name
* The name of the header
* @param value
/**
* {@link Response} implementation that performs an HTTP redirect.
- *
+ *
* @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class RedirectResponse extends Response {
/**
* Creates a new redirect response to the new location.
- *
+ *
* @param newLocation
* The new location
*/
/**
* Creates a new redirect response to the new location.
- *
+ *
* @param newLocation
* The new location
* @param permanent