org.apache.hadoop.yarn.webapp
Class View

java.lang.Object
  extended by org.apache.hadoop.yarn.webapp.View
All Implemented Interfaces:
Params
Direct Known Subclasses:
TextView

public abstract class View
extends Object
implements Params

Base class for all views


Nested Class Summary
static class View.ViewContext
           
 
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
View()
           
View(View.ViewContext ctx)
           
 
Method Summary
 String $(String key)
          Lookup a value from the current context
 String $(String key, String defaultValue)
          Lookup a value from the current context.
 View.ViewContext context()
           
 Map<String,javax.servlet.http.Cookie> cookies()
          Get the cookies
 Throwable error()
           
<T> T
getInstance(Class<T> cls)
           
 boolean inDevMode()
           
 ResponseInfo info(String about)
           
 com.google.inject.Injector injector()
           
 Map<String,String> moreParams()
           
 javax.servlet.ServletOutputStream outputStream()
           
 String prefix()
           
abstract  void render()
          The API to render the view
 void render(Class<? extends SubView> cls)
          Render a sub-view
 javax.servlet.http.HttpServletRequest request()
           
 javax.servlet.http.HttpServletResponse response()
           
 String root_url(String... parts)
          Create an url from url components
 String root()
           
 void set(String key, String value)
          Set a context value.
 void setTitle(String title)
           
 void setTitle(String title, String url)
           
 int status()
           
 String url(String... parts)
          Create an url from url components
 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

View

public View()

View

public View(View.ViewContext ctx)
Method Detail

render

public abstract void render()
The API to render the view


context

public View.ViewContext context()

error

public Throwable error()

status

public 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()

moreParams

public Map<String,String> moreParams()

cookies

public Map<String,javax.servlet.http.Cookie> cookies()
Get the cookies

Returns:
the cookies map

outputStream

public javax.servlet.ServletOutputStream outputStream()

writer

public PrintWriter writer()

$

public String $(String key,
                String defaultValue)
Lookup a value from the current context.

Parameters:
key - to lookup
defaultValue - if key is missing
Returns:
the value of the key or the default value

$

public String $(String key)
Lookup a value from the current context

Parameters:
key - to lookup
Returns:
the value of the key or empty string

set

public void set(String key,
                String value)
Set a context value. (e.g. UI properties for sub views.) Try to avoid any application (vs view/ui) logic.

Parameters:
key - to set
value - to set

root

public String root()

prefix

public String prefix()

setTitle

public void setTitle(String title)

setTitle

public void setTitle(String title,
                     String url)

root_url

public String root_url(String... parts)
Create an url from url components

Parameters:
parts - components to join
Returns:
an url string

url

public String url(String... parts)
Create an url from url components

Parameters:
parts - components to join
Returns:
an url string

info

public ResponseInfo info(String about)

render

public void render(Class<? extends SubView> cls)
Render a sub-view

Parameters:
cls - the class of the sub-view


Copyright © 2012 Apache Software Foundation. All Rights Reserved.