Brooklyn

brooklyn.launcher
[Java] Class BrooklynWebServer

java.lang.Object
  brooklyn.launcher.BrooklynWebServer

public class BrooklynWebServer

Starts the web-app running, connected to the given management context


Field Summary
static java.lang.String BROOKLYN_WAR_URL

protected java.net.InetAddress actualAddress

protected int actualPort

actual port where this gets bound; will be consistent with the "port" passed in but that might be a range and here it is a single port, or -1 if not yet set

protected java.net.InetAddress bindAddress

IP of NIC where this server should bind, or null to autodetect (e.g. 0.0.0.0 if security is configured, or loopback if no security)

protected PortRange httpsPort

protected PortRange port

protected Server server

protected java.lang.String war

 
Constructor Summary
BrooklynWebServer(ManagementContext managementContext)

BrooklynWebServer(java.util.Map flags, ManagementContext managementContext)

accepts flags: port, war (url of war file which is the root), wars (map of context-prefix to url), attrs (map of attribute-name : object pairs passed to the servlet)

BrooklynWebServer(ManagementContext managementContext, int port)

BrooklynWebServer(ManagementContext managementContext, int port, java.lang.String warUrl)

 
Method Summary
BrooklynWebServer addAttribute(java.lang.String field, java.lang.Object value)

@deprecated use setAttribute

protected void addShutdownHook()

BrooklynWebServer addWar(java.lang.String path, java.lang.String warUrl)

specifies a WAR to use at a given context path (only if server not yet started); cf deploy(path, url)

BrooklynWebServer configure(ConfigKey key, java.lang.Object value)

WebAppContext deploy(java.lang.String pathSpec, java.lang.String warUrl)

serve given WAR at the given pathSpec; if not yet started, it is simply remembered until start; if server already running, the context for this WAR is started.

void deploy(WebAppContext context)

int getActualPort()

returns port where this is running, or -1 if not yet known

java.net.InetAddress getAddress()

interface/address where this server is listening; if bound to 0.0.0.0 (all NICs, e.g. because security is set) this will return one NIC where this is bound

boolean getHttpsEnabled()

PortRange getRequestedPort()

WebAppContext getRootContext()

java.lang.String getRootUrl()

URL for accessing this web server (root context)

Server getServer()

static void installAsServletFilter(ServletContextHandler context)

BrooklynWebServer putAttributes(java.util.Map newAttrs)

Specifies attributes passed to deployed webapps (in addition to BrooklynServiceAttributes#BROOKLYN_MANAGEMENT_CONTEXT#BROOKLYN_MANAGEMENT_CONTEXT

BrooklynWebServer setAttribute(java.lang.String field, java.lang.Object value)

Specifies an attribute passed to deployed webapps (in addition to BrooklynServiceAttributes#BROOKLYN_MANAGEMENT_CONTEXT#BROOKLYN_MANAGEMENT_CONTEXT

BrooklynWebServer setBindAddress(java.net.InetAddress address)

InetAddress to which server should bind; defaults to 0.0.0.0 (although common call path is to set to 127.0.0.1 when security is not set)

BrooklynWebServer setPort(java.lang.Object port)

void setSecurityFilter(java.lang.Class filterClazz)

BrooklynWebServer setWar(java.lang.String url)

sets the WAR to use as the root context (only if server not yet started); cf deploy("/", url)

void start()

void stop()

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

BROOKLYN_WAR_URL

public static final java.lang.String BROOKLYN_WAR_URL


actualAddress

protected java.net.InetAddress actualAddress


actualPort

protected int actualPort
actual port where this gets bound; will be consistent with the "port" passed in but that might be a range and here it is a single port, or -1 if not yet set


bindAddress

protected InetAddress bindAddress = null;
protected java.net.InetAddress bindAddress
IP of NIC where this server should bind, or null to autodetect (e.g. 0.0.0.0 if security is configured, or loopback if no security)


httpsPort

protected PortRange httpsPort = PortRanges.fromString("8443+");
protected PortRange httpsPort


port

protected PortRange port = PortRanges.fromString("8081+");
protected PortRange port


server

protected Server server


war

protected String war = BROOKLYN_WAR_URL;
protected java.lang.String war


 
Constructor Detail

BrooklynWebServer

public BrooklynWebServer(ManagementContext managementContext)


BrooklynWebServer

public BrooklynWebServer(java.util.Map flags, ManagementContext managementContext)
accepts flags: port, war (url of war file which is the root), wars (map of context-prefix to url), attrs (map of attribute-name : object pairs passed to the servlet)


BrooklynWebServer

public BrooklynWebServer(ManagementContext managementContext, int port)


BrooklynWebServer

public BrooklynWebServer(ManagementContext managementContext, int port, java.lang.String warUrl)


 
Method Detail

addAttribute

public BrooklynWebServer addAttribute(java.lang.String field, java.lang.Object value)
deprecated:
use setAttribute


addShutdownHook

protected void addShutdownHook()


addWar

public BrooklynWebServer addWar(java.lang.String path, java.lang.String warUrl)
specifies a WAR to use at a given context path (only if server not yet started); cf deploy(path, url)


configure

public BrooklynWebServer configure(ConfigKey key, java.lang.Object value)


deploy

public WebAppContext deploy(java.lang.String pathSpec, java.lang.String warUrl)
serve given WAR at the given pathSpec; if not yet started, it is simply remembered until start; if server already running, the context for this WAR is started.
Returns:
the context created and added as a handler (and possibly already started if server is started, so be careful with any changes you make to it!)


deploy

public void deploy(WebAppContext context)


getActualPort

public int getActualPort()
returns port where this is running, or -1 if not yet known


getAddress

public java.net.InetAddress getAddress()
interface/address where this server is listening; if bound to 0.0.0.0 (all NICs, e.g. because security is set) this will return one NIC where this is bound


getHttpsEnabled

public boolean getHttpsEnabled()


getRequestedPort

public PortRange getRequestedPort()


getRootContext

public WebAppContext getRootContext()


getRootUrl

public java.lang.String getRootUrl()
URL for accessing this web server (root context)


getServer

public Server getServer()


installAsServletFilter

public static void installAsServletFilter(ServletContextHandler context)


putAttributes

public BrooklynWebServer putAttributes(Map newAttrs) {
public BrooklynWebServer putAttributes(java.util.Map newAttrs)
Specifies attributes passed to deployed webapps (in addition to BrooklynServiceAttributes#BROOKLYN_MANAGEMENT_CONTEXT#BROOKLYN_MANAGEMENT_CONTEXT


setAttribute

public BrooklynWebServer setAttribute(java.lang.String field, java.lang.Object value)
Specifies an attribute passed to deployed webapps (in addition to BrooklynServiceAttributes#BROOKLYN_MANAGEMENT_CONTEXT#BROOKLYN_MANAGEMENT_CONTEXT


setBindAddress

public BrooklynWebServer setBindAddress(java.net.InetAddress address)
InetAddress to which server should bind; defaults to 0.0.0.0 (although common call path is to set to 127.0.0.1 when security is not set)


setPort

public BrooklynWebServer setPort(java.lang.Object port)


setSecurityFilter

public void setSecurityFilter(java.lang.Class filterClazz)


setWar

public BrooklynWebServer setWar(java.lang.String url)
sets the WAR to use as the root context (only if server not yet started); cf deploy("/", url)


start

public void start()


stop

public void stop()


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.