net.spy.jwebkit
Class JWHttpServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by net.spy.jwebkit.JWHttpServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
DebugServlet, MemServlet, XMLOutputServlet

public abstract class JWHttpServlet
extends javax.servlet.http.HttpServlet

Jwebkit base HTTP servlet.

See Also:
Serialized Form

Constructor Summary
JWHttpServlet()
           
 
Method Summary
protected  java.lang.String getContextRelativeFilePathParameter(java.lang.String name, java.lang.String def)
          Get a context relative file path configuration parameter.
protected  net.spy.log.Logger getLogger()
          Get the logger for this instance.
protected  void sendHTML(java.lang.String html, javax.servlet.http.HttpServletResponse response)
          Send a chunk of HTML as the response with the text/html content type.
protected  void sendPlain(java.lang.String text, javax.servlet.http.HttpServletResponse response)
          Send a chunk of plain text as the response with the text/plain content type.
protected  void sendSimple(java.lang.String string, javax.servlet.http.HttpServletResponse response)
          Send a simple string.
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Prevent subclasses from implementing service.
 void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
          Prevent subclasses from implementing service.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JWHttpServlet

public JWHttpServlet()
Method Detail

getLogger

protected net.spy.log.Logger getLogger()
Get the logger for this instance.

Returns:
a Logger instance

getContextRelativeFilePathParameter

protected java.lang.String getContextRelativeFilePathParameter(java.lang.String name,
                                                               java.lang.String def)
                                                        throws javax.servlet.ServletException
Get a context relative file path configuration parameter.

Parameters:
name - the name of the config parameter
def - the default value
Returns:
the translated path in either case
Throws:
javax.servlet.ServletException

service

public final void service(javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse res)
                   throws javax.servlet.ServletException,
                          java.io.IOException
Prevent subclasses from implementing service.

Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

service

public final void service(javax.servlet.ServletRequest req,
                          javax.servlet.ServletResponse res)
                   throws javax.servlet.ServletException,
                          java.io.IOException
Prevent subclasses from implementing service.

Specified by:
service in interface javax.servlet.Servlet
Overrides:
service in class javax.servlet.http.HttpServlet
Throws:
javax.servlet.ServletException
java.io.IOException

sendSimple

protected void sendSimple(java.lang.String string,
                          javax.servlet.http.HttpServletResponse response)
                   throws java.io.IOException
Send a simple string. Note that this method does not set the content type.

Parameters:
string - the string to send
response - the response over which to send it
Throws:
java.io.IOException - if there's an IO problem
See Also:
sendHTML(String,HttpServletResponse), sendPlain(String,HttpServletResponse)

sendHTML

protected void sendHTML(java.lang.String html,
                        javax.servlet.http.HttpServletResponse response)
                 throws java.io.IOException
Send a chunk of HTML as the response with the text/html content type.

Parameters:
html - the HTML
response - the servlet response over which the response will go
Throws:
java.io.IOException

sendPlain

protected void sendPlain(java.lang.String text,
                         javax.servlet.http.HttpServletResponse response)
                  throws java.io.IOException
Send a chunk of plain text as the response with the text/plain content type.

Parameters:
text - the text
response - the servlet response over which the response will go
Throws:
java.io.IOException


Copyright © 1995-2007 SPY Internetworking. All Rights Reserved.