org.apache.hadoop.yarn.webapp
Class Controller

java.lang.Object
  extended by org.apache.hadoop.yarn.webapp.Controller
All Implemented Interfaces:
Params
Direct Known Subclasses:
HelloWorld.Hello, MyApp.MyController

@InterfaceAudience.LimitedPrivate(value={"YARN","MapReduce"})
public abstract class Controller
extends Object
implements Params


Nested Class Summary
static class Controller.RequestContext
           
 
Field Summary
static org.slf4j.Logger LOG
           
 
Fields inherited from interface org.apache.hadoop.yarn.webapp.Params
ERROR_DETAILS, TITLE, TITLE_LINK, USER
 
Constructor Summary
Controller()
           
Controller(Controller.RequestContext ctx)
           
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.slf4j.Logger LOG
Constructor Detail

Controller

public Controller()

Controller

public Controller(Controller.RequestContext ctx)
Method Detail

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 © 2014 Apache Software Foundation. All Rights Reserved.