Package org.kohsuke.stapler
Class HttpResponses
java.lang.Object
org.kohsuke.stapler.HttpResponses
Factory for
HttpResponse.- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic class -
Constructor Summary
Constructors -
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 ForwardToViewforwardToView(Class clazz, String view) static ForwardToViewforwardToView(Object it, String view) static HttpResponseDeprecated.static HttpResponseliteralHtml(String text) Serves an HTML response.notFound()ok()static HttpResponseDeprecated.Adds a platform-specific newline; prefertext(java.lang.String).static HttpRedirectredirectTo(int statusCode, String url) static HttpRedirectredirectTo(String url) Redirect to the context rootstatic HttpResponseRedirect to "."redirectViaContextPath(int statusCode, String relative) redirectViaContextPath(String relative) static HttpResponsestaticResource(URL resource) Serves a static resource specified by the URL.static HttpResponsestaticResource(URL resource, long expiration) Serves a static resource specified by the URL.status(int code) static HttpResponseServes 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).