net.sf.j2ep.servers
Class ClusterContainer.ClusteredServer

java.lang.Object
  extended by net.sf.j2ep.servers.ClusterContainer.ClusteredServer
All Implemented Interfaces:
Server
Enclosing class:
ClusterContainer

protected class ClusterContainer.ClusteredServer
extends java.lang.Object
implements Server

A server in the cluster. Will have access to the encapsulating Cluster so that we can use its methods to get the rule and such.

Author:
Anders Nyman

Constructor Summary
ClusterContainer.ClusteredServer(java.lang.String domainName, java.lang.String path, java.lang.String serverId)
          Basic constructor that sets the domain name and directory.
 
Method Summary
 java.lang.String getDomainName()
          Returns the host name and port for this server.
 java.lang.String getPath()
          Returns the path that we are mapping to.
 Rule getRule()
          Returns the mapped rule so we can rewrite links.
 java.lang.String getServerId()
          Returns this servers ID.
 boolean online()
          Returns the online status of this server
 HttpServletResponse postExecute(HttpServletResponse response)
          Will wrap the response so that sessions are rewritten to remove the tailing .something that indicated which server the session is linked to.
 HttpServletRequest preExecute(HttpServletRequest request)
          Will wrap the request so the tailing .something, identifying the server, is removed from the request.
 void setConnectionExceptionRecieved(java.lang.Exception e)
          Notifies the server status checker that a server might have gone offline.
 void setOnline(boolean online)
          Marks if this server should be considered online or offline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterContainer.ClusteredServer

public ClusterContainer.ClusteredServer(java.lang.String domainName,
                                        java.lang.String path,
                                        java.lang.String serverId)
Basic constructor that sets the domain name and directory.

Parameters:
domainName - The domain name
path - The directory
Method Detail

preExecute

public HttpServletRequest preExecute(HttpServletRequest request)
Will wrap the request so the tailing .something, identifying the server, is removed from the request.

Specified by:
preExecute in interface Server
Parameters:
request - The request we are receiving
Returns:
Eventual modified HttpServletRequest
See Also:
net.sf.j2ep.model.Server#preExecute(javax.servlet.http.HttpServletRequest)

postExecute

public HttpServletResponse postExecute(HttpServletResponse response)
Will wrap the response so that sessions are rewritten to remove the tailing .something that indicated which server the session is linked to.

Specified by:
postExecute in interface Server
Parameters:
response - The response we are receiving
Returns:
Eventual modified HttpServletResponse
See Also:
net.sf.j2ep.model.Server#postExecute(javax.servlet.http.HttpServletResponse)

setConnectionExceptionRecieved

public void setConnectionExceptionRecieved(java.lang.Exception e)
Notifies the server status checker that a server might have gone offline.

Specified by:
setConnectionExceptionRecieved in interface Server
Parameters:
e - The exception received when trying to use this servers data
See Also:
Server.setConnectionExceptionRecieved(java.lang.Exception)

getDomainName

public java.lang.String getDomainName()
Description copied from interface: Server
Returns the host name and port for this server.

Specified by:
getDomainName in interface Server
Returns:
Host name and port
See Also:
Server.getDomainName()

getPath

public java.lang.String getPath()
Description copied from interface: Server
Returns the path that we are mapping to. Starting from the servers root the path starts with a / but doesn't end with a /. A mapping to the root results in path being an empty string "".

Specified by:
getPath in interface Server
Returns:
The path
See Also:
Server.getPath()

online

public boolean online()
Returns the online status of this server

Returns:
true if the server is online, otherwise false

setOnline

public void setOnline(boolean online)
Marks if this server should be considered online or offline.

Parameters:
online - The status of the server

getRule

public Rule getRule()
Description copied from interface: Server
Returns the mapped rule so we can rewrite links.

Specified by:
getRule in interface Server
Returns:
The rule we are mapped to
See Also:
Server.getRule()

getServerId

public java.lang.String getServerId()
Returns this servers ID.

Returns:
The server ID