com.nhncorp.neptune.common
Class NStatusHttpServer

java.lang.Object
  extended by com.nhncorp.neptune.common.NStatusHttpServer

public class NStatusHttpServer
extends java.lang.Object

Neptune의 Web 인터페이스를 위한 Http 서버


Constructor Summary
NStatusHttpServer(java.lang.String name, java.lang.String bindAddress, int port)
          Create a status server on the given port.
 
Method Summary
<T extends javax.servlet.http.HttpServlet>
void
addServlet(java.lang.String name, java.lang.String pathSpec, java.lang.Class<T> servletClass)
          Add a servlet in the server.
 java.lang.Object getAttribute(java.lang.String name)
          Get the value in the webapp context.
 int getPort()
          Get the port that the server is on
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set a value in the webapp context.
 void setThreads(int min, int max)
           
 void start()
          Start the server.
 void stop()
          stop the server
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NStatusHttpServer

public NStatusHttpServer(java.lang.String name,
                         java.lang.String bindAddress,
                         int port)
                  throws java.io.IOException
Create a status server on the given port. The jsp scripts are taken from src/webapps/.

Parameters:
name - The name of the server
port - The port to use on the server
findPort - whether the server should start at the given port and increment by 1 until it finds a free port.
Throws:
java.io.IOException
Method Detail

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set a value in the webapp context. These values are available to the jsp pages as "application.getAttribute(name)".

Parameters:
name - The name of the attribute
value - The value of the attribute

addServlet

public <T extends javax.servlet.http.HttpServlet> void addServlet(java.lang.String name,
                                                                  java.lang.String pathSpec,
                                                                  java.lang.Class<T> servletClass)
Add a servlet in the server.

Parameters:
name - The name of the servlet (can be passed as null)
pathSpec - The path spec for the servlet
servletClass - The servlet class

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Get the value in the webapp context.

Parameters:
name - The name of the attribute
Returns:
The value of the attribute

getPort

public int getPort()
Get the port that the server is on

Returns:
the port

setThreads

public void setThreads(int min,
                       int max)

start

public void start()
           throws java.io.IOException
Start the server. Does not wait for the server to start.

Throws:
java.io.IOException

stop

public void stop()
          throws java.lang.InterruptedException
stop the server

Throws:
java.lang.InterruptedException