Class HttpRedirectResponse
java.lang.Object
net.targetr.wtm3.net.http.HttpResponse
net.targetr.wtm3.net.http.response.HttpByteArrayResponse
net.targetr.wtm3.net.http.response.HttpStringResponse
net.targetr.wtm3.net.http.response.HttpRedirectResponse
Response to redirect the client to another location.
- Author:
- Dr Michael Gardiner
-
Field Summary
Fields inherited from class net.targetr.wtm3.net.http.HttpResponse
bytesWritten, code, headerLength, headers, info, version, writeErrorHandler -
Constructor Summary
ConstructorsConstructorDescriptionHttpRedirectResponse(int code, String location) Creates a redirect response for sending a client to another location with a custom status code.HttpRedirectResponse(String location) Creates a redirect response for sending a client to another location. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreatePage(String location) Generates a basic HTML page for the redirection.Methods inherited from class net.targetr.wtm3.net.http.response.HttpByteArrayResponse
setAllowGzip, writeMethods inherited from class net.targetr.wtm3.net.http.HttpResponse
getBodyInputStream, getContentLength, parseResponse, toString
-
Constructor Details
-
HttpRedirectResponse
Creates a redirect response for sending a client to another location.- Parameters:
location- where to redirect the user to.
-
HttpRedirectResponse
Creates a redirect response for sending a client to another location with a custom status code.- Parameters:
code- HTTP status code (e.g. 301, 302, 307).location- where to redirect the user to.
-
-
Method Details
-
createPage
Generates a basic HTML page for the redirection.- Parameters:
location- the destination URL- Returns:
- a string containing HTML to redirect the user
-