net.sf.j2ep.servers
Class BaseServer

java.lang.Object
  extended by net.sf.j2ep.servers.ServerContainerBase
      extended by net.sf.j2ep.servers.BaseServer
All Implemented Interfaces:
Server, ServerContainer

public class BaseServer
extends ServerContainerBase
implements Server

Author:
Anders Nyman

Constructor Summary
BaseServer()
          Basic constructor that will initialize the directory to "".
 
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.
 Server getServer(HttpServletRequest request)
          Do any processing needed before this server can be used.
 Server getServerMapped(java.lang.String location)
          Finds a server with the full path specified by the location sent in.
 HttpServletResponse postExecute(HttpServletResponse response)
          Will no do any handling
 HttpServletRequest preExecute(HttpServletRequest request)
          Will no do any handling
 void setConnectionExceptionRecieved(java.lang.Exception e)
          Used to notify the server that there is a problem using the data this server supplied to the user.
 void setDomainName(java.lang.String domainName)
          Sets the host and port we are mapping to.
 void setIsRewriting(java.lang.String rewrite)
          Set if this server wants absolute links mapped for this server to be rewritten.
 void setPath(java.lang.String path)
          Sets the path we are mapping to.
 
Methods inherited from class net.sf.j2ep.servers.ServerContainerBase
getRule, setRule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.j2ep.model.Server
getRule
 

Constructor Detail

BaseServer

public BaseServer()
Basic constructor that will initialize the directory to "".

Method Detail

getServer

public Server getServer(HttpServletRequest request)
Description copied from interface: ServerContainer
Do any processing needed before this server can be used. Specifically important for cluster servers that needs to choose which server to use for the current request.

Specified by:
getServer in interface ServerContainer
Returns:
The server that is finished to be used.
See Also:
net.sf.j2ep.model.ServerContainer#getServer(javax.servlet.http.HttpServletRequest)

preExecute

public HttpServletRequest preExecute(HttpServletRequest request)
Will no do any handling

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 no do any handling

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)

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()

getServerMapped

public Server getServerMapped(java.lang.String location)
Description copied from interface: ServerContainer
Finds a server with the full path specified by the location sent in.

Specified by:
getServerMapped in interface ServerContainer
Parameters:
location - The start of a link that a server is mapped to
Returns:
The server that can handle the link, null if no server is found
See Also:
ServerContainer.getServerMapped(java.lang.String)

setIsRewriting

public void setIsRewriting(java.lang.String rewrite)
Set if this server wants absolute links mapped for this server to be rewritten.

Parameters:
rewrite - Should be true if we want to do rewriting

setDomainName

public void setDomainName(java.lang.String domainName)
Sets the host and port we are mapping to.

Parameters:
domainName - Value to set

setPath

public void setPath(java.lang.String path)
Sets the path we are mapping to.

Parameters:
path - The path

setConnectionExceptionRecieved

public void setConnectionExceptionRecieved(java.lang.Exception e)
Description copied from interface: Server
Used to notify the server that there is a problem using the data this server supplied to the user. Maybe the domainName isn't working or the directory doesn't exist on the underlying server, in any case this method can be used to let the server know about the problems. The server should try to analyze the problem and if possible fix it so that the next request to this server will succeed.

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)