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 SummaryModifier 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- 
setStatusvoid setStatus(int httpResponseCode) Explicitly set the http response code- Parameters:
- httpResponseCode- response code, e.g. 200 for "OK"
 
- 
addHeaderExplicitly add a http header to the response- Parameters:
- name- the header name
- value- the header value
 
- 
setHeaderExplicitly set (override) a http header to the response- Parameters:
- name- the header name
- value- the header value
 
- 
addCookievoid 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
 
-