public class HttpAdaptor extends java.lang.Object implements HttpAdaptorMBean, javax.management.MBeanRegistration
Constructor and Description |
---|
HttpAdaptor()
Default Constructor added so that we can have some additional
constructors as well.
|
HttpAdaptor(int port)
Overloaded constructor to allow the port to be set.
|
HttpAdaptor(int port,
java.lang.String host)
Overloaded constructor to allow the port to be set.
|
HttpAdaptor(java.lang.String host)
Overloaded constructor to allow the host to be set.
|
Modifier and Type | Method and Description |
---|---|
void |
addAuthorization(java.lang.String username,
java.lang.String password)
Adds an authorization pair as username/password
|
void |
addCommandProcessor(java.lang.String path,
HttpCommandProcessor processor)
Adds a command processor object
|
void |
addCommandProcessor(java.lang.String path,
java.lang.String processorClass)
Adds a command processor object by class
|
protected void |
buildCommands()
Build the commands
|
protected void |
findUnknownElement(java.lang.String path,
HttpOutputStream out,
HttpInputStream in) |
java.lang.String |
getAuthenticationMethod()
Authentication Method
|
java.lang.String |
getHost()
Return the host name the server will be listening to.
|
int |
getPort()
Returns the port where the server is running on.
|
ProcessorMBean |
getProcessor()
Returns the Processor set by
HttpAdaptorMBean.setProcessor(mx4j.tools.adaptor.http.ProcessorMBean) |
protected HttpCommandProcessor |
getProcessor(java.lang.String path) |
javax.management.ObjectName |
getProcessorName()
Returns the ObjectName of the processor set by
HttpAdaptorMBean.setProcessorName(javax.management.ObjectName) |
long |
getRequestsCount()
Requests count
|
java.util.Date |
getStartDate()
Starting date
|
java.lang.String |
getVersion()
Gets the HttpAdaptor version
|
boolean |
isActive()
Indicates whether the server's running
|
void |
postDeregister()
Callback called just after the MBean has been successfully unregistered.
|
protected void |
postProcess(HttpOutputStream out,
HttpInputStream in,
org.w3c.dom.Document document) |
protected void |
postProcess(HttpOutputStream out,
HttpInputStream in,
java.lang.Exception e) |
void |
postRegister(java.lang.Boolean registrationDone)
Callback called just after the MBean has been registered (successfully or not).
|
void |
preDeregister()
Callback called just before MBean unregistration from the MBeanServer.
|
protected java.lang.String |
preProcess(java.lang.String path) |
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
Gathers some basic data
|
void |
removeCommandProcessor(java.lang.String path)
Removes a command processor object by class
|
void |
restart()
Deprecated.
as of RC 1
|
void |
setAuthenticationMethod(java.lang.String method)
Sets the Authentication Method.
|
void |
setHost(java.lang.String host)
Sets the host name where the server will be listening
|
void |
setPort(int port)
Sets the value of the server's port
|
void |
setProcessor(ProcessorMBean processor)
Sets the object which will post process the XML results.
|
void |
setProcessorClass(java.lang.String processorClass)
Sets the classname of the object which will post process the XML results.
|
void |
setProcessorName(javax.management.ObjectName processorName)
Sets the object name which will post process the XML result.
|
void |
setProcessorNameString(java.lang.String processorName)
Sets the object name of the PostProcessor MBean.
|
void |
setSocketFactory(AdaptorServerSocketFactory factory)
Sets the object which create the server sockets
|
void |
setSocketFactoryName(javax.management.ObjectName factoryName)
Sets the factory's object name which will create the server sockets
|
void |
setSocketFactoryNameString(java.lang.String factoryName)
Sets the factory's object name which will create the server sockets
|
void |
start()
Starts the server
|
void |
stop()
Stops the HTTP daemon
|
public HttpAdaptor()
public HttpAdaptor(int port)
This constructor uses the default host or the host must be set later.
port
- The port on which the HttpAdaptor should listenpublic HttpAdaptor(java.lang.String host)
This constructor uses the default port or the port must be set later.
host
- The host on which the HttpAdaptor should listenpublic HttpAdaptor(int port, java.lang.String host)
port
- The port on which the HttpAdaptor should listenhost
- The host on which the HttpAdaptor should listenpublic void setPort(int port)
setPort
in interface HttpAdaptorMBean
port
- the new port's valuepublic int getPort()
getPort
in interface HttpAdaptorMBean
public void setHost(java.lang.String host)
setHost
in interface HttpAdaptorMBean
host
- Server's hostpublic java.lang.String getHost()
getHost
in interface HttpAdaptorMBean
public void setAuthenticationMethod(java.lang.String method)
setAuthenticationMethod
in interface HttpAdaptorMBean
method
- none/basic/digestpublic java.lang.String getAuthenticationMethod()
getAuthenticationMethod
in interface HttpAdaptorMBean
public void setProcessor(ProcessorMBean processor)
setProcessor
in interface HttpAdaptorMBean
processor
- a Post processor objectpublic void setProcessorClass(java.lang.String processorClass)
setProcessorClass
in interface HttpAdaptorMBean
processorClass
- a Post processor objectpublic void setProcessorNameString(java.lang.String processorName) throws javax.management.MalformedObjectNameException
setProcessorNameString
in interface HttpAdaptorMBean
processorName
- a Post processor objectjavax.management.MalformedObjectNameException
public void setProcessorName(javax.management.ObjectName processorName)
setProcessorName
in interface HttpAdaptorMBean
processorName
- The new processorName valuepublic ProcessorMBean getProcessor()
HttpAdaptorMBean
HttpAdaptorMBean.setProcessor(mx4j.tools.adaptor.http.ProcessorMBean)
getProcessor
in interface HttpAdaptorMBean
public javax.management.ObjectName getProcessorName()
HttpAdaptorMBean
HttpAdaptorMBean.setProcessorName(javax.management.ObjectName)
getProcessorName
in interface HttpAdaptorMBean
public void setSocketFactory(AdaptorServerSocketFactory factory)
setSocketFactory
in interface HttpAdaptorMBean
factory
- the socket factorypublic void setSocketFactoryName(javax.management.ObjectName factoryName)
setSocketFactoryName
in interface HttpAdaptorMBean
factoryName
- the socket factorypublic void setSocketFactoryNameString(java.lang.String factoryName) throws javax.management.MalformedObjectNameException
setSocketFactoryNameString
in interface HttpAdaptorMBean
factoryName
- the socket factoryjavax.management.MalformedObjectNameException
public boolean isActive()
isActive
in interface HttpAdaptorMBean
public java.util.Date getStartDate()
getStartDate
in interface HttpAdaptorMBean
public long getRequestsCount()
getRequestsCount
in interface HttpAdaptorMBean
public java.lang.String getVersion()
getVersion
in interface HttpAdaptorMBean
public void addCommandProcessor(java.lang.String path, HttpCommandProcessor processor)
addCommandProcessor
in interface HttpAdaptorMBean
public void addCommandProcessor(java.lang.String path, java.lang.String processorClass)
addCommandProcessor
in interface HttpAdaptorMBean
public void removeCommandProcessor(java.lang.String path)
removeCommandProcessor
in interface HttpAdaptorMBean
public void start() throws java.io.IOException
start
in interface HttpAdaptorMBean
java.io.IOException
public void restart() throws java.io.IOException
java.io.IOException
public void stop()
stop
in interface HttpAdaptorMBean
public void addAuthorization(java.lang.String username, java.lang.String password)
addAuthorization
in interface HttpAdaptorMBean
public javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name) throws java.lang.Exception
preRegister
in interface javax.management.MBeanRegistration
server
- The MBeanServer on which the MBean will be registered.name
- The ObjectName
of the MBean.ObjectName
of the registered MBean, must not be nulljava.lang.Exception
- Any possible exception generated by this method will be caught
by the MBeanServer
and re-thrown as an MBeanRegistrationException
to the client.public void postRegister(java.lang.Boolean registrationDone)
javax.management.MBeanRegistration
postRegister
in interface javax.management.MBeanRegistration
registrationDone
- True if the registration was successful, false otherwise.public void preDeregister() throws java.lang.Exception
javax.management.MBeanRegistration
preDeregister
in interface javax.management.MBeanRegistration
java.lang.Exception
- Any possible exception generated by this method will be caught
by the MBeanServer
and re-thrown as an MBeanRegistrationException
to the client.public void postDeregister()
javax.management.MBeanRegistration
postDeregister
in interface javax.management.MBeanRegistration
protected HttpCommandProcessor getProcessor(java.lang.String path)
protected void buildCommands()
protected void postProcess(HttpOutputStream out, HttpInputStream in, org.w3c.dom.Document document) throws java.io.IOException, javax.management.JMException
java.io.IOException
javax.management.JMException
protected void findUnknownElement(java.lang.String path, HttpOutputStream out, HttpInputStream in) throws java.io.IOException, javax.management.JMException
java.io.IOException
javax.management.JMException
protected java.lang.String preProcess(java.lang.String path) throws java.io.IOException, javax.management.JMException
java.io.IOException
javax.management.JMException
protected void postProcess(HttpOutputStream out, HttpInputStream in, java.lang.Exception e) throws java.io.IOException, javax.management.JMException
java.io.IOException
javax.management.JMException