org.apache.hadoop.yarn.webapp
Class WebApps

java.lang.Object
  extended by org.apache.hadoop.yarn.webapp.WebApps

public class WebApps
extends Object

Helpers to create an embedded webapp.

Quick start:

   WebApp wa = WebApps.$for(myApp).start();
Starts a webapp with default routes binds to 0.0.0.0 (all network interfaces) on an ephemeral port, which can be obtained with:
   int port = wa.port();

With more options:

   WebApp wa = WebApps.$for(myApp).at(address, port).
                        with(configuration).
                        start(new WebApp() {
     @Override public void setup() {
       route("/foo/action", FooController.class);
       route("/foo/:id", FooController.class, "show");
     }
   });


Nested Class Summary
static class WebApps.Builder<T>
           
 
Constructor Summary
WebApps()
           
 
Method Summary
static
<T> WebApps.Builder<T>
$for(String prefix)
           
static
<T> WebApps.Builder<T>
$for(String prefix, Class<T> api, T app)
          Create a new webapp builder.
static
<T> WebApps.Builder<T>
$for(String prefix, Class<T> api, T app, String wsPrefix)
          Create a new webapp builder.
static
<T> WebApps.Builder<T>
$for(String prefix, T app)
           
static
<T> WebApps.Builder<T>
$for(T app)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebApps

public WebApps()
Method Detail

$for

public static <T> WebApps.Builder<T> $for(String prefix,
                                          Class<T> api,
                                          T app,
                                          String wsPrefix)
Create a new webapp builder.

Type Parameters:
T - application (holding the embedded webapp) type
Parameters:
prefix - of the webapp
api - the api class for the application
app - the application instance
wsPrefix - the prefix for the webservice api for this app
Returns:
a webapp builder
See Also:
for a complete example

$for

public static <T> WebApps.Builder<T> $for(String prefix,
                                          Class<T> api,
                                          T app)
Create a new webapp builder.

Type Parameters:
T - application (holding the embedded webapp) type
Parameters:
prefix - of the webapp
api - the api class for the application
app - the application instance
Returns:
a webapp builder
See Also:
for a complete example

$for

public static <T> WebApps.Builder<T> $for(String prefix,
                                          T app)

$for

public static <T> WebApps.Builder<T> $for(T app)

$for

public static <T> WebApps.Builder<T> $for(String prefix)


Copyright © 2012 Apache Software Foundation. All Rights Reserved.