Package org.kohsuke.stapler
Class HttpResponses
java.lang.Object
org.kohsuke.stapler.HttpResponses
Factory for
HttpResponse
.- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionSends an error with a stack trace.errorWithoutStack
(int code, String errorMessage) Sends an error without a stack trace.Redirects the user back to where he came from.static ForwardToView
forwardToView
(Class clazz, String view) static ForwardToView
forwardToView
(Object it, String view) static HttpResponse
Deprecated.static HttpResponse
literalHtml
(String text) Serves an HTML response.notFound()
ok()
static HttpResponse
Deprecated.Adds a platform-specific newline; prefertext(java.lang.String)
.static HttpRedirect
redirectTo
(int statusCode, String url) static HttpRedirect
redirectTo
(String url) Redirect to the context rootstatic HttpResponse
Redirect to "."redirectViaContextPath
(int statusCode, String relative) redirectViaContextPath
(String relative) static HttpResponse
staticResource
(URL resource) Serves a static resource specified by the URL.static HttpResponse
staticResource
(URL resource, long expiration) Serves a static resource specified by the URL.status
(int code) static HttpResponse
Serves a plain text response.wrap
(HttpResponse delegate) A runtime exception which honors a defined response.
-
Constructor Details
-
HttpResponses
public HttpResponses()
-
-
Method Details
-
ok
-
notFound
-
forbidden
-
status
-
error
Sends an error with a stack trace.- See Also:
-
error
-
error
-
errorWithoutStack
Sends an error without a stack trace.- Since:
- 1.215
- See Also:
-
wrap
A runtime exception which honors a defined response. -
redirectViaContextPath
-
redirectViaContextPath
public static HttpResponses.HttpResponseException redirectViaContextPath(int statusCode, String relative) - Parameters:
relative
- The path relative to the context path. The context path + this value is sent to the user.
-
redirectTo
- Parameters:
url
- The URL to redirect to. If relative, relative to the page currently being served.
-
redirectTo
-
redirectToDot
Redirect to "." -
redirectToContextRoot
Redirect to the context root -
forwardToPreviousPage
Redirects the user back to where he came from. -
staticResource
Serves a static resource specified by the URL. Short forstaticResource(resource,0)
-
staticResource
Serves a static resource specified by the URL.- Parameters:
resource
- The static resource to be served.expiration
- The number of milliseconds until the resource will "expire". Until it expires the browser will be allowed to cache it and serve it without checking back with the server. After it expires, the client will send conditional GET to check if the resource is actually modified or not. If 0, it will immediately expire.
-
html
Deprecated.Adds a platform-specific newline; preferliteralHtml(java.lang.String)
. -
literalHtml
Serves an HTML response. -
plainText
Deprecated.Adds a platform-specific newline; prefertext(java.lang.String)
. -
text
Serves a plain text response. -
forwardToView
-
forwardToView
-
literalHtml(java.lang.String)
.