mx4j.tools.adaptor.http
Class HttpAdaptor
public
class
HttpAdaptor
extends Object
implements HttpAdaptorMBean, MBeanRegistration
HttpAdaptor sets the basic adaptor listening for HTTP requests
Version: $Revision: 1.13 $
Constructor Summary |
| 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(String host)
Overloaded constructor to allow the host to be set.
|
| HttpAdaptor(int port, String host)
Overloaded constructor to allow the port to be set.
|
Method Summary |
void | addAuthorization(String username, String password)
Adds an authorization pair as username/password |
void | addCommandProcessor(String path, HttpCommandProcessor processor)
Adds a command processor object |
void | addCommandProcessor(String path, String processorClass)
Adds a command processor object by class |
protected void | buildCommands()
Build the commands |
protected void | findUnknownElement(String path, HttpOutputStream out, HttpInputStream in) |
String | getAuthenticationMethod()
Authentication Method
|
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() |
protected HttpCommandProcessor | getProcessor(String path) |
ObjectName | getProcessorName() |
long | getRequestsCount()
Requests count
|
Date | getStartDate()
Starting date
|
String | getVersion()
Gets the HttpAdaptor version
|
boolean | isActive()
Indicates whether the server's running
|
void | postDeregister() |
protected void | postProcess(HttpOutputStream out, HttpInputStream in, Document document) |
protected void | postProcess(HttpOutputStream out, HttpInputStream in, Exception e) |
void | postRegister(Boolean registrationDone) |
void | preDeregister() |
protected String | preProcess(String path) |
ObjectName | preRegister(MBeanServer server, ObjectName name)
Gathers some basic data |
void | removeCommandProcessor(String path)
Removes a command processor object by class |
void | restart()
Restarts the server. |
void | setAuthenticationMethod(String method)
Sets the Authentication Method.
|
void | setHost(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(String processorClass)
Sets the classname of the object which will post process the XML results. |
void | setProcessorName(ObjectName processorName)
Sets the object name which will post process the XML result. |
void | setProcessorNameString(String processorName)
Sets the object name of the PostProcessor MBean. |
void | setSocketFactory(AdaptorServerSocketFactory factory)
Sets the object which create the server sockets
|
void | setSocketFactoryName(ObjectName factoryName)
Sets the factory's object name which will create the server sockets
|
void | setSocketFactoryNameString(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()
Default Constructor added so that we can have some additional
constructors as well.
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(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, 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 listen host The host on which the HttpAdaptor should listen
public void addAuthorization(String username, String password)
Adds an authorization pair as username/password
Adds a command processor object
public void addCommandProcessor(String path, String processorClass)
Adds a command processor object by class
protected void buildCommands()
Build the commands
public String getAuthenticationMethod()
Authentication Method
Returns: authentication method
public String getHost()
Return the host name the server will be listening to. If null the server
listen at the localhost
Returns: the current hostname
public int getPort()
Returns the port where the server is running on. Default is 8080
Returns: HTTPServer's port
public ObjectName getProcessorName()
public long getRequestsCount()
Requests count
Returns: The total of requests served so far
public Date getStartDate()
Starting date
Returns: The date when the server was started
public String getVersion()
Gets the HttpAdaptor version
Returns: HttpAdaptor's version
public boolean isActive()
Indicates whether the server's running
Returns: The active value
public void postDeregister()
public void postRegister(Boolean registrationDone)
public void preDeregister()
protected String preProcess(String path)
public ObjectName preRegister(MBeanServer server, ObjectName name)
Gathers some basic data
public void removeCommandProcessor(String path)
Removes a command processor object by class
public void restart()
Deprecated: as of RC 1
Restarts the server. Useful when changing the Server parameters
public void setAuthenticationMethod(String method)
Sets the Authentication Method.
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
Parameters: port the new port's value
Sets the object which will post process the XML results. The last value set
between the setPostProcessor and setPostProcessorName will be the valid one
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
Parameters: processorClass a Post processor object
public void setProcessorName(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
Parameters: processorName The new processorName value
public void setProcessorNameString(String processorName)
Sets the object name of the PostProcessor MBean. If ProcessorClass is set the processor
will be created
Parameters: processorName a Post processor object
Sets the object which create the server sockets
Parameters: factory the socket factory
public void setSocketFactoryName(ObjectName factoryName)
Sets the factory's object name which will create the server sockets
Parameters: factoryName the socket factory
public void setSocketFactoryNameString(String factoryName)
Sets the factory's object name which will create the server sockets
Parameters: factoryName the socket factory
public void start()
Starts the server
public void stop()
Stops the HTTP daemon
Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.