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 TypeMethodDescriptionvoid
addCookie
(jakarta.servlet.http.Cookie cookie) Explicitly add cookie to the responsevoid
Explicitly add a http header to the responsevoid
void
void
redirectRelative
(String path) void
void
Explicitly set (override) a http header to the responsevoid
setStatus
(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
-