Project JXTA

net.jxta.impl.endpoint.servlethttp
Class HttpMessageServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by net.jxta.impl.endpoint.servlethttp.HttpMessageServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class HttpMessageServlet
extends HttpServlet

This is a simple servlet that accepts POSTed Jxta messages over HTTP and hands them up to EndpointService. It also supports a ping operation. When the URI is /ping, it simply responds with a 200.

See Also:
Serialized Form

Constructor Summary
HttpMessageServlet()
           
 
Method Summary
 void destroy()
           
 void doGet(HttpServletRequest req, HttpServletResponse res)
          Handle the ping by sending back a 200.
 void doPost(HttpServletRequest req, HttpServletResponse res)
          Handle posted messages.
 void init(ServletConfig config)
          Stores the endpoint from the ServletContext in to the data member for easy access.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpMessageServlet

public HttpMessageServlet()
Method Detail

init

public void init(ServletConfig config)
          throws ServletException
Stores the endpoint from the ServletContext in to the data member for easy access.

Specified by:
init in interface Servlet
Overrides:
init in class GenericServlet
Throws:
ServletException

doGet

public void doGet(HttpServletRequest req,
                  HttpServletResponse res)
           throws ServletException,
                  IOException
Handle the ping by sending back a 200.

Overrides:
doGet in class HttpServlet
Throws:
ServletException
IOException

doPost

public void doPost(HttpServletRequest req,
                   HttpServletResponse res)
            throws ServletException,
                   IOException
Handle posted messages. We first validate the message, which is where we check the content-length of the message. If that passes

Overrides:
doPost in class HttpServlet
Throws:
ServletException
IOException

destroy

public void destroy()
Specified by:
destroy in interface Servlet
Overrides:
destroy in class GenericServlet

JXTA J2SE