Class WebApps

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

@LimitedPrivate({"YARN","MapReduce"}) 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");
     }
   });
  • Constructor Details

    • WebApps

      public WebApps()
  • Method Details

    • $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

      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

      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)