|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jdmk.comm.CommunicatorServer | +--com.sun.jdmk.comm.HtmlAdaptorServer
This class acts as an HTML server which allows an HTML browser to manage all MBeans in the agent. The HTML protocol adaptor is implemented as a dynamic MBean.
To connect a browser to the agent open this page in a web browser:
The HTML protocol adaptor goes ONLINE at preregistration.
During preregistration it will create a TCP/IP socket and listen for client connections.
If a client tries to connect, the HtmlAdaptorServer
creates a thread
which receives and processes all subsequent requests from this client. The number of
clients is limited by the maxActiveClientCount
property. The default value
of the maxActiveClientCount
is 10.
When an HtmlAdaptorServer
is stopped, all current HTTP connections
are interrupted (some requests may be terminated abruptly), and the TCP/IP
socket is closed.
The HtmlAdaptorServer
can perform user authentication. The add/remove
user authentication info methods can be used to manage users and their corresponding
authentication information. The HTML server uses the 'Basic Authentication Scheme'
(as defined in RFC 1945, section 11.1) to authenticate clients connecting to the server.
Limitations of the HTML protocol adaptor:
toString()
is called are displayed.
boolean Boolean Boolean[]
byte byte[] Byte Byte[]
char char[] Character Character[]
Date Date[]
double double[] Double Double[]
float float[] Float Float[]
int int[] Integer Integer[]
long long[] Long Long[]
Number
javax.management.ObjectName javax.management.ObjectName[]
short Short Short[]
String String[]
Number
the server tries to convert it
first to an Integer, then a Long, then a Float and finally a Double, stopping at the first
which succeeds.
Fields inherited from class com.sun.jdmk.comm.CommunicatorServer |
dbgTag,
host,
HTML_TYPE,
HTTP_TYPE,
HTTPS_TYPE,
infoType,
maxActiveClientCount,
mbs,
objectName,
OFFLINE,
ONLINE,
port,
RMI_TYPE,
servedClientCount,
SNMP_TYPE,
STARTING,
state,
STOPPING |
Constructor Summary | |
HtmlAdaptorServer()
Constructs an HtmlAdaptorServer that will use the default port (8082). |
|
HtmlAdaptorServer(int p)
Constructs the HtmlAdaptorServer that will use the specified port. |
Method Summary | |
void |
addUserAuthenticationInfo(AuthInfo authinfo)
Adds the authentication information of the user to be authenticated by this server. |
void |
createParser(java.lang.String className,
java.lang.String parserName,
java.lang.String loaderName)
Creates and registers in the MBeanServer the HTML parser MBean used by the HtmlAdaptorServer to parse incomming requests or build outgoing HTML pages |
protected void |
doBind()
Binds the HTML protocol adaptor. |
protected void |
doProcess()
Handles the requests recieved. |
protected void |
doReceive()
Collects incoming requests. |
protected void |
doUnbind()
Unbinds the HTML protocol adaptor. |
java.lang.Object |
getAttribute(java.lang.String attribute)
Gets the value of a specific attribute of the HTML protocol adaptor. |
AttributeList |
getAttributes(java.lang.String[] attributes)
Gets the values of several attributes of the HTML server. |
java.lang.String |
getLastConnectedClient()
Returns the name of the last connected client. |
MBeanInfo |
getMBeanInfo()
Gets the exposed attributes and actions of the HTML protocol adaptor. |
ObjectName |
getParser()
Returns the ObjectName of the currently designated HTML parser MBean. |
java.lang.String |
getProtocol()
Returns the protocol of this HtmlAdaptorServer . |
java.lang.Object |
invoke(java.lang.String actionName,
java.lang.Object[] params,
java.lang.String[] signature)
Invokes a specific operation on the HTML protocol adaptor. |
boolean |
isAuthenticationOn()
Returns true if the list of users supported by this server is not empty. |
void |
postDeregister()
Does nothing, needed for MBeanRegistration interface. |
void |
postRegister(java.lang.Boolean registrationDone)
Does nothing, needed for MBeanRegistration interface. |
void |
preDeregister()
Interrupts all the current HTTP connections and close the TCP/IP socket. |
ObjectName |
preRegister(MBeanServer server,
ObjectName name)
Creates a TCP/IP connection to listen for client connections. |
void |
removeUserAuthenticationInfo(AuthInfo authinfo)
Removes the authentication information of the given user from the list of users authenticated by this server. |
void |
resetParser()
Sets the ObjectName of the Parser attribute to null |
void |
setAttribute(Attribute attribute)
Sets the value of a specific attribute of the HTML protocol adaptor. |
AttributeList |
setAttributes(AttributeList attributes)
Sets the values of several attributes of the HTML protocol adaptor. |
void |
setParser(ObjectName parser)
Sets the MBean that will be used to parse the incoming HTML requests or to built the outgoing HTML pages. |
void |
stop()
Stops the HTML protocol adaptor. |
Methods inherited from class com.sun.jdmk.comm.CommunicatorServer |
changeState,
debug,
debug,
debug,
debug,
getActiveClientCount,
getHost,
getMaxActiveClientCount,
getMBeanServer,
getObjectName,
getPort,
getServedClientCount,
getState,
getStateString,
isActive,
isDebugOn,
isTraceOn,
makeDebugTag,
makeThreadName,
run,
setMaxActiveClientCount,
setPort,
start,
trace,
trace,
waitState |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public HtmlAdaptorServer()
HtmlAdaptorServer
that will use the default port (8082).public HtmlAdaptorServer(int p)
HtmlAdaptorServer
that will use the specified port.p
- An integer representing a valid port number.Method Detail |
public void setParser(ObjectName parser) throws InstanceNotFoundException, ServiceNotFoundException
parser
- the ObjectName of the HTML parser MBean.public ObjectName getParser()
public void resetParser()
public void createParser(java.lang.String className, java.lang.String parserName, java.lang.String loaderName) throws MalformedObjectNameException, ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
className
- the class that contains the parsing proceduresparserObjectName
- the String used as an object name to register the parser into the MBeanServerloaderObjectName
- the loader user to obtain the class of the parserpublic java.lang.String getLastConnectedClient()
public java.lang.String getProtocol()
HtmlAdaptorServer
.public void addUserAuthenticationInfo(AuthInfo authinfo)
authinfo
- the user authentication information.public void removeUserAuthenticationInfo(AuthInfo authinfo)
authinfo
- the user authentication information.public boolean isAuthenticationOn()
public void stop()
public ObjectName preRegister(MBeanServer server, ObjectName name) throws java.lang.Exception
If no object name is provided, the server will use a default object name (defaultDomain:name=HtmlAdaptorServer).
server
- The MBeanServer in which the HTML protocol adaptor will be registered.name
- The object name of the HTML protocol adaptor or null to specify the default object name
(defaultDomain:name=HtmlAdaptorServer).public void postRegister(java.lang.Boolean registrationDone)
MBeanRegistration
interface.public void preDeregister() throws java.lang.Exception
public void postDeregister()
MBeanRegistration
interface.public MBeanInfo getMBeanInfo()
public java.lang.Object getAttribute(java.lang.String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException
attribute
- The name of the attribute to be retrievedpublic AttributeList getAttributes(java.lang.String[] attributes)
attributes
- Enables the values of several attributes of the Dynamic MBean.public java.lang.Object invoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature) throws MBeanException, ReflectionException
actionName
- The name of the action to be invoked.params
- An array containing the parameters to be set when the action is
invoked.signature
- An array containing the signature of the action. The class objects will
be loaded through the same class loader as the one used for loading the
HTML protocol adaptor.public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
attribute
- The identification of the attribute to
be set and the value it is to be set to.public AttributeList setAttributes(AttributeList attributes)
attributes
- A list of attributes: The identification of the
attributes to be set and the values they are to be set to.protected void doBind() throws CommunicationException, java.lang.InterruptedException
Create a socket listener.
protected void doUnbind() throws CommunicationException, java.lang.InterruptedException
Close the socket listener.
protected void doReceive() throws CommunicationException, java.lang.InterruptedException
protected void doProcess() throws CommunicationException, java.lang.InterruptedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |