@InterfaceAudience.LimitedPrivate(value={"YARN","MapReduce"}) public abstract class Controller extends Object implements Params
Modifier and Type | Class and Description |
---|---|
static class |
Controller.RequestContext |
Modifier and Type | Field and Description |
---|---|
static org.slf4j.Logger |
LOG |
ERROR_DETAILS, TITLE, TITLE_LINK, USER
Constructor and Description |
---|
Controller() |
Controller(Controller.RequestContext ctx) |
Modifier and Type | Method and Description |
---|---|
String |
$(String key) |
Controller.RequestContext |
context() |
Map<String,javax.servlet.http.Cookie> |
cookies()
Get the cookies
|
void |
echo() |
Throwable |
error() |
String |
get(String key,
String defaultValue) |
<T> T |
getInstance(Class<T> cls) |
boolean |
inDevMode() |
abstract void |
index()
The default action.
|
ResponseInfo |
info(String about) |
com.google.inject.Injector |
injector() |
protected void |
render(Class<? extends View> cls) |
protected void |
renderJSON(Class<? extends ToJSON> cls) |
protected void |
renderJSON(Object object)
Convenience method for REST APIs (without explicit views)
|
protected void |
renderText(String s)
Convenience method for hello world :)
|
javax.servlet.http.HttpServletRequest |
request() |
javax.servlet.http.HttpServletResponse |
response() |
void |
set(String key,
String value) |
void |
setStatus(int status) |
void |
setTitle(String title) |
void |
setTitle(String title,
String url) |
int |
status() |
String |
url(String... parts)
Create an url from url components
|
protected PrintWriter |
writer() |
public Controller()
public Controller(Controller.RequestContext ctx)
public Controller.RequestContext context()
public Throwable error()
public int status()
public void setStatus(int status)
public boolean inDevMode()
public com.google.inject.Injector injector()
public <T> T getInstance(Class<T> cls)
public javax.servlet.http.HttpServletRequest request()
public javax.servlet.http.HttpServletResponse response()
public void setTitle(String title)
public ResponseInfo info(String about)
public Map<String,javax.servlet.http.Cookie> cookies()
public String url(String... parts)
parts
- components to joinpublic abstract void index()
public void echo()
protected void renderJSON(Object object)
object
- - the object as the response (in JSON)protected void renderText(String s)
s
- - the content to render as plain textprotected PrintWriter writer()
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.