org.apache.hadoop.yarn.webapp
Class Controller
java.lang.Object
org.apache.hadoop.yarn.webapp.Controller
- All Implemented Interfaces:
- Params
- Direct Known Subclasses:
- HelloWorld.Hello, MyApp.MyController
public abstract class Controller
- extends Object
- implements Params
|
Field Summary |
static org.slf4j.Logger |
LOG
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
public static final org.slf4j.Logger LOG
Controller
public Controller()
Controller
public Controller(Controller.RequestContext ctx)
context
public Controller.RequestContext context()
error
public Throwable error()
status
public int status()
setStatus
public void setStatus(int status)
inDevMode
public boolean inDevMode()
injector
public com.google.inject.Injector injector()
getInstance
public <T> T getInstance(Class<T> cls)
request
public javax.servlet.http.HttpServletRequest request()
response
public javax.servlet.http.HttpServletResponse response()
set
public void set(String key,
String value)
get
public String get(String key,
String defaultValue)
$
public String $(String key)
setTitle
public void setTitle(String title)
setTitle
public void setTitle(String title,
String url)
info
public ResponseInfo info(String about)
cookies
public Map<String,javax.servlet.http.Cookie> cookies()
- Get the cookies
- Returns:
- the cookies map
url
public String url(String... parts)
- Create an url from url components
- Parameters:
parts - components to join
- Returns:
- an url string
index
public abstract void index()
- The default action.
echo
public void echo()
render
protected void render(Class<? extends View> cls)
renderJSON
protected void renderJSON(Object object)
- Convenience method for REST APIs (without explicit views)
- Parameters:
object - - the object as the response (in JSON)
renderJSON
protected void renderJSON(Class<? extends ToJSON> cls)
renderText
protected void renderText(String s)
- Convenience method for hello world :)
- Parameters:
s - - the content to render as plain text
writer
protected PrintWriter writer()
Copyright © 2012 Apache Software Foundation. All Rights Reserved.