Package io.varhttp
Interface ResponseHeader
- All Known Implementing Classes:
VarResponseHeader
public interface ResponseHeader
Carrier for http response headers to be injected into extension point controller methods, to allow the methods to gain access to the response headers
Example:@Controller(path = "/myPath")public void myControllerMethod(ResponseHeader responseHeader) { responseHeader.addHeader("myHeaderName", "myHeaderValue"); responseHeader.setStatus(200); }
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddCookie(jakarta.servlet.http.Cookie cookie) Explicitly add cookie to the responsevoidExplicitly add a http header to the responsevoidvoidvoidredirectRelative(String path) voidvoidExplicitly set (override) a http header to the responsevoidsetStatus(int httpResponseCode) Explicitly set the http response code
-
Method Details
-
setStatus
void setStatus(int httpResponseCode) Explicitly set the http response code- Parameters:
httpResponseCode- response code, e.g. 200 for "OK"
-
addHeader
Explicitly add a http header to the response- Parameters:
name- the header namevalue- the header value
-
setHeader
Explicitly set (override) a http header to the response- Parameters:
name- the header namevalue- the header value
-
addCookie
void addCookie(jakarta.servlet.http.Cookie cookie) Explicitly add cookie to the response- Parameters:
cookie- the cookie
-
redirect
- Parameters:
path- relative to the root of the domain
-
redirectRelative
- Parameters:
path- relative to this controller class
-
redirect
- Parameters:
url-
-
setContentType
-