com.sun.jaw.impl.adaptor.html
Class AdaptorServerImpl

java.lang.Object
  |
  +--com.sun.jaw.impl.adaptor.generic.AdaptorServer
        |
        +--com.sun.jaw.impl.adaptor.html.AdaptorServerImpl

public class AdaptorServerImpl
extends AdaptorServer

This class provides an implementation of the server part of an HTML adaptor. When an HTML AdaptorServerImpl is started, it creates a TCP/IP socket and listens for client connections. When a client tries to connect, the AdaptorServerImpl 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 HTML AdaptorServerImpl is stopped, all current HTTP connections are interrupted (some requests may be terminated abruptly) and the TCP/IP socket is closed.

When an HTML AdaptorServerImpl is registered in the framework, it parses its ObjectName and updates the port number that it uses with the value of the 'port' key. If the ObjectName does not contain a port key, the default port (8082) is used.

For example, if you want to use the port 8099, register your HTML AdaptorServerImpl with the following name:

An HTML AdaptorServerImpl can perform authentication. Authentication uses the AuthenticationInfo property. If the AuthenticationInfo property is null, no authentication is performed.

An HTML AdaptorServerImpl can perform user authentication. The add/remove user authentication info methods are used to add/remove users and their corresponding authentication information. If this server carries out client authentication then clients connecting to this server are authenticated using the 'Basic Authentication Scheme' as define in RFC 1945, section 11.1.

Limitations of the HTML adaptor:

See Also:
Serialized Form

Fields inherited from class com.sun.jaw.impl.adaptor.generic.AdaptorServer
cmf, maxActiveClientCount, objectName, OFFLINE, ONLINE, port, STARTING, state, STOPPING
 
Constructor Summary
AdaptorServerImpl()
          Initializes this AdaptorServerImpl using the default port (8082).
AdaptorServerImpl(int p)
          Initializes this AdaptorServerImpl using the specified port.
 
Method Summary
 void addUserAuthenticationInfo(AuthInfo authinfo)
          Adds the authentication information of the user to be authenticated by this server.
 boolean checkChallengeResponse(java.lang.String response)
          For Java DMK internal use only.
protected  void doBind()
           
protected  void doProcess()
           
protected  void doReceive()
           
protected  void doUnbind()
           
 java.lang.String getClassVersion()
          Returns the version of this class.
 java.lang.Boolean getFlattenView()
          Returns the value of the flatten view flag.
 java.lang.String getLastConnectedClient()
          Returns the name of the last connected client.
 java.lang.String getPageBodyOption()
          Returns the page BODY option.
 java.lang.String getProtocol()
          Returns the protocol of this AdaptorServer.
 void initCmf(Framework f, ObjectName name, boolean db, ModificationList list)
          For Java DMK internal use only.
 boolean isAuthenticationOn()
          Returns true if the list of users supported by this server is not empty.
 void performStop()
           
 void removeUserAuthenticationInfo(AuthInfo authinfo)
          Removes the authentication information of the given user from the list of users authenticated by this server.
 void setFlattenView(java.lang.Boolean value)
          Sets the value of the flatten view flag.
 void setPageBodyOption(java.lang.String value)
          Sets the BODY option of all JDMK HTML pages.
 void setPort(java.lang.Integer p)
          Sets the port of this AdaptorServerImpl.
 
Methods inherited from class com.sun.jaw.impl.adaptor.generic.AdaptorServer
addAdaptorListener, deleteCmf, getActiveClientCount, getMaxActiveClientCount, getPort, getServedClientCount, getState, getStateString, isActive, performStart, performWaitState, removeAdaptorListener, setMaxActiveClientCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdaptorServerImpl

public AdaptorServerImpl()
Initializes this AdaptorServerImpl using the default port (8082).

AdaptorServerImpl

public AdaptorServerImpl(int p)
Initializes this AdaptorServerImpl using the specified port.
Parameters:
p - The port number.
Method Detail

setPort

public void setPort(java.lang.Integer p)
Sets the port of this AdaptorServerImpl. If this AdaptorServerImpl is ONLINE, it must be stopped and then restarted to use the new port value.
Parameters:
p - a port number.

doBind

protected void doBind()
               throws CommunicationException,
                      java.lang.InterruptedException
Overrides:
doBind in class AdaptorServer

doUnbind

protected void doUnbind()
                 throws CommunicationException,
                        java.lang.InterruptedException
Overrides:
doUnbind in class AdaptorServer

doReceive

protected void doReceive()
                  throws CommunicationException,
                         java.lang.InterruptedException
Overrides:
doReceive in class AdaptorServer

doProcess

protected void doProcess()
                  throws CommunicationException,
                         java.lang.InterruptedException
Overrides:
doProcess in class AdaptorServer

initCmf

public void initCmf(Framework f,
                    ObjectName name,
                    boolean db,
                    ModificationList list)
             throws InstanceAlreadyExistException
For Java DMK internal use only.

Parses the object name and updates the port with the value associated to the 'port' key (if any). Then calls the ancestor initCmf.

Throws:
InstanceAlreadyExistException - The m-bean is already registered in the repository.
Overrides:
initCmf in class AdaptorServer

getLastConnectedClient

public java.lang.String getLastConnectedClient()
Returns the name of the last connected client.
Returns:
The name of the last connected client.

getClassVersion

public java.lang.String getClassVersion()
Returns the version of this class.
Returns:
The version of this class.

getProtocol

public java.lang.String getProtocol()
Returns the protocol of this AdaptorServer.
Returns:
The string "html".
Overrides:
getProtocol in class AdaptorServer

addUserAuthenticationInfo

public void addUserAuthenticationInfo(AuthInfo authinfo)
Adds the authentication information of the user to be authenticated by this server. In order to populate the list of users supported by this server invoke this method for each user you want to add.
Parameters:
authinfo - the user authentication information.

removeUserAuthenticationInfo

public void removeUserAuthenticationInfo(AuthInfo authinfo)
Removes the authentication information of the given user from the list of users authenticated by this server.
Parameters:
authinfo - the user authentication information.

isAuthenticationOn

public boolean isAuthenticationOn()
Returns true if the list of users supported by this server is not empty.
Returns:
True, if the list of users supported by this server is not empty. False, if the list of supported users is empty so no authentication is performed by this server.

getFlattenView

public java.lang.Boolean getFlattenView()
Returns the value of the flatten view flag.

When the flatten view flag is true, inherited properties are displayed in the property list HTML page. When the flag is false, only the properties defined by the object are displayed.

Returns:
The value of the flatten view flag.
See Also:
setFlattenView(java.lang.Boolean)

setFlattenView

public void setFlattenView(java.lang.Boolean value)
Sets the value of the flatten view flag.
Parameters:
value - The value that the flatten view flag will be set to.
See Also:
getFlattenView()

getPageBodyOption

public java.lang.String getPageBodyOption()
Returns the page BODY option.
Returns:
a string representation of the BODY option used to build JDMK HTML pages.
See Also:
setPageBodyOption(java.lang.String)

setPageBodyOption

public void setPageBodyOption(java.lang.String value)
Sets the BODY option of all JDMK HTML pages. This is the string is part of
 option
 of all JDMK HTML pages.
 

Example:

BGCOLOR=#ffffff
set the background of HTML pages to white

Parameters:
value - The value of the BODY option will be set to.
See Also:
getPageBodyOption()

checkChallengeResponse

public boolean checkChallengeResponse(java.lang.String response)
For Java DMK internal use only.

Check if the response sent by the client matches any of the login/password pairs stored in the server. If the match is successful then the client has been authenticated and the method returns true. False, otherwise.


performStop

public void performStop()
Overrides:
performStop in class AdaptorServer
See Also:
AdaptorServerImpl