Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
mx4j.tools.adaptor.http.HttpAdaptor
public class HttpAdaptor
extends java.lang.Object
implements HttpAdaptorMBean, javax.management.MBeanRegistration
Constructor Summary | |
| |
| |
| |
|
Method Summary | |
void |
|
void |
|
void |
|
protected void |
|
protected void |
|
String |
|
String |
|
int |
|
ProcessorMBean | |
protected HttpCommandProcessor |
|
javax.management.ObjectName | |
long |
|
Date |
|
String |
|
boolean |
|
void | |
protected void |
|
protected void |
|
void |
|
void | |
protected String |
|
javax.management.ObjectName |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public HttpAdaptor()
Default Constructor added so that we can have some additional constructors as well.
public HttpAdaptor(String host)
Overloaded constructor to allow the host to be set. The reason this was added was to allow the loading of this adaptor by the dynamic loading service of the MBean server and have the host set from a param in the mlet file. Example: (replaced lt & gt symbol with [])
[mlet code="mx4j.tools.adaptor.http.HttpAdaptor"
archive="mx4j.jar"
name="Server:name=HttpAdaptor"]
[arg type="java.lang.String" value="someserver.somehost.com"]
[/mlet] This constructor uses the default port or the port must be set later.
- Parameters:
host
- The host on which the HttpAdaptor should listen
public HttpAdaptor(int port)
Overloaded constructor to allow the port to be set. The reason this was added was to allow the loading of this adaptor by the dynamic loading service of the MBean server and have the port set from a param in the mlet file. Example: (replaced lt & gt symbol with [])
[mlet code="mx4j.tools.adaptor.http.HttpAdaptor"
archive="mx4j.jar"
name="Server:name=HttpAdaptor"]
[arg type="int" value="12345"]
[/mlet] This constructor uses the default host or the host must be set later.
- Parameters:
port
- The port on which the HttpAdaptor should listen
public HttpAdaptor(int port, String host)
Overloaded constructor to allow the port to be set. The reason this was added was to allow the loading of this adaptor by the dynamic loading service of the MBean server and have the port set from a param in the mlet file. Example: (replaced lt & gt symbol with []) NOTE that the port must come before the host in the arg list of the mlet
[mlet code="mx4j.tools.adaptor.http.HttpAdaptor"
archive="mx4j.jar"
name="Server:name=HttpAdaptor"]
[arg type="int" value="12345"]
[arg type="java.lang.String" value="someserver.somehost.com"]
[/mlet]
- Parameters:
port
- The port on which the HttpAdaptor should listenhost
- The host on which the HttpAdaptor should listen
public void addAuthorization(String username, String password)
Adds an authorization pair as username/password
- Specified by:
- addAuthorization in interface HttpAdaptorMBean
public void addCommandProcessor(String path, String processorClass)
Adds a command processor object by class
- Specified by:
- addCommandProcessor in interface HttpAdaptorMBean
public void addCommandProcessor(String path, HttpCommandProcessor processor)
Adds a command processor object
- Specified by:
- addCommandProcessor in interface HttpAdaptorMBean
protected void buildCommands()
Build the commands
protected void findUnknownElement(String path, HttpOutputStream out, HttpInputStream in) throws IOException, javax.management.JMException
public String getAuthenticationMethod()
Authentication Method
- Specified by:
- getAuthenticationMethod in interface HttpAdaptorMBean
- Returns:
- authentication method
public String getHost()
Return the host name the server will be listening to. If null the server listen at the localhost
- Specified by:
- getHost in interface HttpAdaptorMBean
- Returns:
- the current hostname
public int getPort()
Returns the port where the server is running on. Default is 8080
- Specified by:
- getPort in interface HttpAdaptorMBean
- Returns:
- HTTPServer's port
public ProcessorMBean getProcessor()
- Specified by:
- getProcessor in interface HttpAdaptorMBean
public javax.management.ObjectName getProcessorName()
- Specified by:
- getProcessorName in interface HttpAdaptorMBean
public long getRequestsCount()
Requests count
- Specified by:
- getRequestsCount in interface HttpAdaptorMBean
- Returns:
- The total of requests served so far
public Date getStartDate()
Starting date
- Specified by:
- getStartDate in interface HttpAdaptorMBean
- Returns:
- The date when the server was started
public String getVersion()
Gets the HttpAdaptor version
- Specified by:
- getVersion in interface HttpAdaptorMBean
- Returns:
- HttpAdaptor's version
public boolean isActive()
Indicates whether the server's running
- Specified by:
- isActive in interface HttpAdaptorMBean
- Returns:
- The active value
public void postDeregister()
- Specified by:
- postDeregister in interface javax.management.MBeanRegistration
protected void postProcess(HttpOutputStream out, HttpInputStream in, Document document) throws IOException, javax.management.JMException
protected void postProcess(HttpOutputStream out, HttpInputStream in, Exception e) throws IOException, javax.management.JMException
public void postRegister(Boolean registrationDone)
- Specified by:
- postRegister in interface javax.management.MBeanRegistration
public void preDeregister() throws java.lang.Exception
- Specified by:
- preDeregister in interface javax.management.MBeanRegistration
protected String preProcess(String path) throws IOException, javax.management.JMException
public javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name) throws java.lang.Exception
Gathers some basic data
- Specified by:
- preRegister in interface javax.management.MBeanRegistration
public void removeCommandProcessor(String path)
Removes a command processor object by class
- Specified by:
- removeCommandProcessor in interface HttpAdaptorMBean
public void restart() throws IOException
Deprecated. as of RC 1
Restarts the server. Useful when changing the Server parameters
public void setAuthenticationMethod(String method)
Sets the Authentication Method.
- Specified by:
- setAuthenticationMethod in interface HttpAdaptorMBean
- Parameters:
method
- none/basic/digest
public void setHost(String host)
Sets the host name where the server will be listening
- Parameters:
host
- Server's host
public void setPort(int port)
Sets the value of the server's port
- Specified by:
- setPort in interface HttpAdaptorMBean
- Parameters:
port
- the new port's value
public void setProcessor(ProcessorMBean processor)
Sets the object which will post process the XML results. The last value set between the setPostProcessor and setPostProcessorName will be the valid one
- Specified by:
- setProcessor in interface HttpAdaptorMBean
- Parameters:
processor
- a Post processor object
public void setProcessorClass(String processorClass)
Sets the classname of the object which will post process the XML results. The adaptor will try to build the object and use the processor name ObjectName to register it The class name has to implements mx4j.tools.adaptor.http.ProcessorMBean and be MBean compliant
- Specified by:
- setProcessorClass in interface HttpAdaptorMBean
- Parameters:
processorClass
- a Post processor object
public void setProcessorName(javax.management.ObjectName processorName)
Sets the object name which will post process the XML result. The last value set between the setPostProcessor and setPostProcessorName will be the valid one. The MBean will be verified to be of instance HttpPostProcessor
- Specified by:
- setProcessorName in interface HttpAdaptorMBean
- Parameters:
processorName
- The new processorName value
public void setProcessorNameString(String processorName) throws javax.management.MalformedObjectNameException
Sets the object name of the PostProcessor MBean. If ProcessorClass is set the processor will be created
- Specified by:
- setProcessorNameString in interface HttpAdaptorMBean
- Parameters:
processorName
- a Post processor object
public void setSocketFactory(AdaptorServerSocketFactory factory)
Sets the object which create the server sockets
- Specified by:
- setSocketFactory in interface HttpAdaptorMBean
- Parameters:
factory
- the socket factory
public void setSocketFactoryName(javax.management.ObjectName factoryName)
Sets the factory's object name which will create the server sockets
- Specified by:
- setSocketFactoryName in interface HttpAdaptorMBean
- Parameters:
factoryName
- the socket factory
public void setSocketFactoryNameString(String factoryName) throws javax.management.MalformedObjectNameException
Sets the factory's object name which will create the server sockets
- Specified by:
- setSocketFactoryNameString in interface HttpAdaptorMBean
- Parameters:
factoryName
- the socket factory
public void start() throws IOException
Starts the server
- Specified by:
- start in interface HttpAdaptorMBean