Apache Tomcat 7.0.28

org.apache.catalina.startup
Class Embedded

java.lang.Object
  extended by org.apache.catalina.util.LifecycleBase
      extended by org.apache.catalina.util.LifecycleMBeanBase
          extended by org.apache.catalina.core.StandardService
              extended by org.apache.catalina.startup.Embedded
All Implemented Interfaces:
MBeanRegistration, Lifecycle, Service

Deprecated. Use Tomcat instead.

@Deprecated
public class Embedded
extends StandardService

Convenience class to embed a Catalina servlet container environment inside another application. You must call the methods of this class in the following order to ensure correct operation.

After normal operations have begun, you can add and remove Connectors, Engines, Hosts, and Contexts on the fly. However, once you have removed a particular component, it must be thrown away -- you can create a new one with the same characteristics if you merely want to do a restart.

To initiate a normal shutdown, call the stop() method of this object.

Version:
$Id: Embedded.java 1175897 2011-09-26 15:01:21Z markt $
Author:
Craig R. McClanahan
See Also:
For a complete example of how Tomcat is set up and launched as an Embedded application.

Field Summary
protected  HashMap<String,Authenticator> authenticators
          Deprecated. Custom mappings of login methods to authenticators
protected  boolean await
          Deprecated. Use await.
protected  Engine[] engines
          Deprecated. The set of Engines that have been deployed in this server.
protected static String info
          Deprecated. Descriptive information about this server implementation.
protected  Realm realm
          Deprecated. The default realm to be used by all containers associated with this component.
protected  boolean redirectStreams
          Deprecated. Is standard streams redirection enabled ?
protected static StringManager sm
          Deprecated. The string manager for this package.
protected  boolean useNaming
          Deprecated. Is naming enabled ?
 
Fields inherited from class org.apache.catalina.core.StandardService
connectors, container, executors, support
 
Fields inherited from class org.apache.catalina.util.LifecycleMBeanBase
mserver
 
Fields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT
 
Constructor Summary
Embedded()
          Deprecated. Construct a new instance of this class with default properties.
Embedded(Realm realm)
          Deprecated. Construct a new instance of this class with specified properties.
 
Method Summary
 void addAuthenticator(Authenticator authenticator, String loginMethod)
          Deprecated.  
 void addConnector(Connector connector)
          Deprecated. Add a new Connector to the set of defined Connectors.
 void addEngine(Engine engine)
          Deprecated. Add a new Engine to the set of defined Engines.
 Connector createConnector(InetAddress address, int port, boolean secure)
          Deprecated. Create, configure, and return a new TCP/IP socket connector based on the specified properties.
 Connector createConnector(InetAddress address, int port, String protocol)
          Deprecated.  
 Connector createConnector(String address, int port, boolean secure)
          Deprecated.  
 Connector createConnector(String address, int port, String protocol)
          Deprecated.  
 Context createContext(String path, String docBase)
          Deprecated. Create, configure, and return a Context that will process all HTTP requests received from one of the associated Connectors, and directed to the specified context path on the virtual host to which this Context is connected.
 Engine createEngine()
          Deprecated. Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties.
 Host createHost(String name, String appBase)
          Deprecated. Create, configure, and return a Host that will process all HTTP requests received from one of the associated Connectors, and directed to the specified virtual host.
 Loader createLoader(ClassLoader parent)
          Deprecated. Create and return a class loader manager that can be customized, and then attached to a Context, before it is started.
 String getCatalinaBase()
          Deprecated.  
 String getCatalinaHome()
          Deprecated.  
 String getInfo()
          Deprecated. Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.
 Realm getRealm()
          Deprecated. Return the default Realm for our Containers.
protected  void initDirs()
          Deprecated.  
protected  void initNaming()
          Deprecated. Initialize naming - this should only enable java:env and root naming.
protected  void initStreams()
          Deprecated.  
 boolean isAwait()
          Deprecated.  
 boolean isRedirectStreams()
          Deprecated. Return true if redirection of standard streams is enabled.
 boolean isUseNaming()
          Deprecated. Return true if naming is enabled.
 void removeContext(Context context)
          Deprecated. Remove the specified Context from the set of defined Contexts for its associated Host.
 void removeEngine(Engine engine)
          Deprecated. Remove the specified Engine from the set of defined Engines, along with all of its related Hosts and Contexts.
 void removeHost(Host host)
          Deprecated. Remove the specified Host, along with all of its related Contexts, from the set of defined Hosts for its associated Engine.
 void setAwait(boolean b)
          Deprecated.  
 void setCatalinaBase(String s)
          Deprecated.  
 void setCatalinaHome(String s)
          Deprecated.  
 void setRealm(Realm realm)
          Deprecated. Set the default Realm for our Containers.
 void setRedirectStreams(boolean redirectStreams)
          Deprecated. Enables or disables redirection.
protected  void setSecurityProtection()
          Deprecated. Set the security package access/protection.
 void setUseNaming(boolean useNaming)
          Deprecated. Enables or disables naming support.
protected  void startInternal()
          Deprecated. Start nested components (Connectors and Engines) and implement the requirements of LifecycleBase.startInternal().
protected  void stopInternal()
          Deprecated. Stop nested components (Connectors and Engines) and implement the requirements of LifecycleBase.stopInternal().
 
Methods inherited from class org.apache.catalina.core.StandardService
addExecutor, addPropertyChangeListener, destroyInternal, findConnectors, findExecutors, getConnectorNames, getContainer, getDomainInternal, getExecutor, getName, getObjectNameKeyProperties, getParentClassLoader, getServer, initInternal, removeConnector, removeExecutor, removePropertyChangeListener, setContainer, setName, setParentClassLoader, setServer, toString
 
Methods inherited from class org.apache.catalina.util.LifecycleMBeanBase
getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister
 
Methods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, init, removeLifecycleListener, setState, setState, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.Lifecycle
addLifecycleListener, destroy, findLifecycleListeners, getState, getStateName, init, removeLifecycleListener, start, stop
 

Field Detail

useNaming

protected boolean useNaming
Deprecated. 
Is naming enabled ?


redirectStreams

protected boolean redirectStreams
Deprecated. 
Is standard streams redirection enabled ?


engines

protected Engine[] engines
Deprecated. 
The set of Engines that have been deployed in this server. Normally there will only be one.


authenticators

protected volatile HashMap<String,Authenticator> authenticators
Deprecated. 
Custom mappings of login methods to authenticators


info

protected static final String info
Deprecated. 
Descriptive information about this server implementation.

See Also:
Constant Field Values

realm

protected Realm realm
Deprecated. 
The default realm to be used by all containers associated with this component.


sm

protected static final StringManager sm
Deprecated. 
The string manager for this package.


await

protected boolean await
Deprecated. 
Use await.

Constructor Detail

Embedded

public Embedded()
Deprecated. 
Construct a new instance of this class with default properties.


Embedded

public Embedded(Realm realm)
Deprecated. 
Construct a new instance of this class with specified properties.

Parameters:
realm - Realm implementation to be inherited by all components (unless overridden further down the container hierarchy)
Method Detail

isUseNaming

public boolean isUseNaming()
Deprecated. 
Return true if naming is enabled.


setUseNaming

public void setUseNaming(boolean useNaming)
Deprecated. 
Enables or disables naming support.

Parameters:
useNaming - The new use naming value

isRedirectStreams

public boolean isRedirectStreams()
Deprecated. 
Return true if redirection of standard streams is enabled.


setRedirectStreams

public void setRedirectStreams(boolean redirectStreams)
Deprecated. 
Enables or disables redirection.

Parameters:
redirectStreams - The new redirection value

getRealm

public Realm getRealm()
Deprecated. 
Return the default Realm for our Containers.


setRealm

public void setRealm(Realm realm)
Deprecated. 
Set the default Realm for our Containers.

Parameters:
realm - The new default realm

setAwait

public void setAwait(boolean b)
Deprecated. 

isAwait

public boolean isAwait()
Deprecated. 

setCatalinaHome

public void setCatalinaHome(String s)
Deprecated. 

setCatalinaBase

public void setCatalinaBase(String s)
Deprecated. 

getCatalinaHome

public String getCatalinaHome()
Deprecated. 

getCatalinaBase

public String getCatalinaBase()
Deprecated. 

addConnector

public void addConnector(Connector connector)
Deprecated. 
Add a new Connector to the set of defined Connectors. The newly added Connector will be associated with the most recently added Engine.

Specified by:
addConnector in interface Service
Overrides:
addConnector in class StandardService
Parameters:
connector - The connector to be added
Throws:
IllegalStateException - if no engines have been added yet

addEngine

public void addEngine(Engine engine)
Deprecated. 
Add a new Engine to the set of defined Engines.

Parameters:
engine - The engine to be added

createConnector

public Connector createConnector(InetAddress address,
                                 int port,
                                 boolean secure)
Deprecated. 
Create, configure, and return a new TCP/IP socket connector based on the specified properties.

Parameters:
address - InetAddress to bind to, or null if the connector is supposed to bind to all addresses on this server
port - Port number to listen to
secure - true if the generated connector is supposed to be SSL-enabled, and false otherwise

createConnector

public Connector createConnector(String address,
                                 int port,
                                 boolean secure)
Deprecated. 

createConnector

public Connector createConnector(InetAddress address,
                                 int port,
                                 String protocol)
Deprecated. 

createConnector

public Connector createConnector(String address,
                                 int port,
                                 String protocol)
Deprecated. 

createContext

public Context createContext(String path,
                             String docBase)
Deprecated. 
Create, configure, and return a Context that will process all HTTP requests received from one of the associated Connectors, and directed to the specified context path on the virtual host to which this Context is connected.

After you have customized the properties, listeners, and Valves for this Context, you must attach it to the corresponding Host by calling:

   host.addChild(context);
 
which will also cause the Context to be started if the Host has already been started.

Parameters:
path - Context path of this application ("" for the default application for this host, must start with a slash otherwise)
docBase - Absolute pathname to the document base directory for this web application
Throws:
IllegalArgumentException - if an invalid parameter is specified

createEngine

public Engine createEngine()
Deprecated. 
Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties.


createHost

public Host createHost(String name,
                       String appBase)
Deprecated. 
Create, configure, and return a Host that will process all HTTP requests received from one of the associated Connectors, and directed to the specified virtual host.

After you have customized the properties, listeners, and Valves for this Host, you must attach it to the corresponding Engine by calling:

   engine.addChild(host);
 
which will also cause the Host to be started if the Engine has already been started. If this is the default (or only) Host you will be defining, you may also tell the Engine to pass all requests not assigned to another virtual host to this one:
   engine.setDefaultHost(host.getName());
 

Parameters:
name - Canonical name of this virtual host
appBase - Absolute pathname to the application base directory for this virtual host
Throws:
IllegalArgumentException - if an invalid parameter is specified

createLoader

public Loader createLoader(ClassLoader parent)
Deprecated. 
Create and return a class loader manager that can be customized, and then attached to a Context, before it is started.

Parameters:
parent - ClassLoader that will be the parent of the one created by this Loader

getInfo

public String getInfo()
Deprecated. 
Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.

Specified by:
getInfo in interface Service
Overrides:
getInfo in class StandardService

removeContext

public void removeContext(Context context)
Deprecated. 
Remove the specified Context from the set of defined Contexts for its associated Host. If this is the last Context for this Host, the Host will also be removed.

Parameters:
context - The Context to be removed

removeEngine

public void removeEngine(Engine engine)
Deprecated. 
Remove the specified Engine from the set of defined Engines, along with all of its related Hosts and Contexts. All associated Connectors are also removed.

Parameters:
engine - The Engine to be removed

removeHost

public void removeHost(Host host)
Deprecated. 
Remove the specified Host, along with all of its related Contexts, from the set of defined Hosts for its associated Engine. If this is the last Host for this Engine, the Engine will also be removed.

Parameters:
host - The Host to be removed

addAuthenticator

public void addAuthenticator(Authenticator authenticator,
                             String loginMethod)
Deprecated. 

startInternal

protected void startInternal()
                      throws LifecycleException
Deprecated. 
Start nested components (Connectors and Engines) and implement the requirements of LifecycleBase.startInternal().

Overrides:
startInternal in class StandardService
Throws:
LifecycleException - if this component detects a fatal error that prevents this component from being used

stopInternal

protected void stopInternal()
                     throws LifecycleException
Deprecated. 
Stop nested components (Connectors and Engines) and implement the requirements of LifecycleBase.stopInternal().

Overrides:
stopInternal in class StandardService
Throws:
LifecycleException - if this component detects a fatal error that needs to be reported

initNaming

protected void initNaming()
Deprecated. 
Initialize naming - this should only enable java:env and root naming. If tomcat is embedded in an application that already defines those - it shouldn't do it. XXX The 2 should be separated, you may want to enable java: but not the initial context and the reverse XXX Can we "guess" - i.e. lookup java: and if something is returned assume false ? XXX We have a major problem with the current setting for java: url


initDirs

protected void initDirs()
Deprecated. 

initStreams

protected void initStreams()
Deprecated. 

setSecurityProtection

protected void setSecurityProtection()
Deprecated. 
Set the security package access/protection.


Apache Tomcat 7.0.28

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.