net.sourceforge.rtf.web.servlet
Class AbstractRTFTemplateServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by net.sourceforge.rtf.web.servlet.AbstractRTFTemplateServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

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

Abstract class RTFTemplate servlet to manage RTFTEmplate with Web Application. Method to implement are :

Version:
1.0.0
Author:
Angelo ZERR
See Also:
Serialized Form

Field Summary
static java.lang.String RTF_CONTENT_TYPE
           
 
Constructor Summary
AbstractRTFTemplateServlet()
           
 
Method Summary
protected  java.lang.String cacheWithKey(javax.servlet.http.HttpServletRequest request)
           
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles HTTP GET requests by calling #doRequest().
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles HTTP POST requests by calling #doRequest().
protected  void doRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles all requests (by default).
protected  void error(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.Exception cause)
          Invoked when there is an error thrown in any part of doRequest() processing.
protected  org.springframework.context.ApplicationContext getApplicationContext(javax.servlet.http.HttpServletRequest request)
          Return Spring configuration for RTFTemplate
protected  java.lang.String getFileNameOfContentDisposition(javax.servlet.http.HttpServletRequest request)
           
protected  org.springframework.context.ApplicationContext getGlobalApplicationContext()
          Return global Spring configuration for RTFTemplate
protected  int getGroupByPerPageBreak(javax.servlet.http.HttpServletRequest request)
           
protected  java.lang.String getRealPathOfRTFModel(javax.servlet.http.HttpServletRequest request, java.lang.String rtfModelFile)
          Return the real path of RTF Model.
protected  java.io.InputStream getRTFInputStream(javax.servlet.http.HttpServletRequest request)
          This method to implement must return InputStream of the RTF model source to use.
protected  java.io.Reader getRTFReader(javax.servlet.http.HttpServletRequest request)
          This method to implement must return Reader of the RTF model source to use.
protected  java.lang.String getRTFTemplateImpl(javax.servlet.http.HttpServletRequest request)
           
protected  java.io.InputStream getTransformerConfig(javax.servlet.http.HttpServletRequest request)
          If this method is implemented, RTFTemplate use this TransformerConfig, oterwise, RTFTemplate use default TransformerConfig.
protected abstract  java.io.InputStream getXMLFieldsAvailable(javax.servlet.http.HttpServletRequest request)
          This method to implement must return XML fileds available for the RTF model or null if there is not XML Fileds available.
 void init()
           
protected abstract  void putContext(javax.servlet.http.HttpServletRequest request, IContext ctx)
          This method to implement must put context for the RTF model source to use.
protected  void putDefaultFormat(javax.servlet.http.HttpServletRequest request, RTFTemplate rtfTemplate)
           
protected  void putGlobalContext(javax.servlet.http.HttpServletRequest request, IContext newContext)
           
protected  void setContentDisposition(javax.servlet.http.HttpServletResponse response, java.lang.String fileName)
          Set FileName of Content Disposition
protected  void setContentType(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Set content type to RTF.
protected  java.lang.String unCacheWithKey(javax.servlet.http.HttpServletRequest request)
           
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, 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
 

Field Detail

RTF_CONTENT_TYPE

public static final java.lang.String RTF_CONTENT_TYPE
See Also:
Constant Field Values
Constructor Detail

AbstractRTFTemplateServlet

public AbstractRTFTemplateServlet()
Method Detail

init

public void init()
Overrides:
init in class javax.servlet.GenericServlet

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
Handles HTTP GET requests by calling #doRequest().

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

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
Handles HTTP POST requests by calling #doRequest().

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

doRequest

protected void doRequest(javax.servlet.http.HttpServletRequest request,
                         javax.servlet.http.HttpServletResponse response)
                  throws javax.servlet.ServletException,
                         java.io.IOException
Handles all requests (by default).

Parameters:
request - HttpServletRequest object containing client request
response - HttpServletResponse object for the response
Throws:
javax.servlet.ServletException
java.io.IOException

error

protected void error(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     java.lang.Exception cause)
              throws javax.servlet.ServletException,
                     java.io.IOException
Invoked when there is an error thrown in any part of doRequest() processing.

Default will send a simple HTML response indicating there was a problem.

Parameters:
request - original HttpServletRequest from servlet container.
response - HttpServletResponse object from servlet container.
cause - Exception that was thrown by some other part of process.
Throws:
javax.servlet.ServletException
java.io.IOException

setContentType

protected void setContentType(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
Set content type to RTF.

Parameters:
request -
response -

setContentDisposition

protected void setContentDisposition(javax.servlet.http.HttpServletResponse response,
                                     java.lang.String fileName)
Set FileName of Content Disposition

Parameters:
response -
fileName -

getRTFReader

protected java.io.Reader getRTFReader(javax.servlet.http.HttpServletRequest request)
                               throws java.lang.Exception
This method to implement must return Reader of the RTF model source to use.

Parameters:
request -
Returns:
Throws:
java.lang.Exception

getRTFInputStream

protected java.io.InputStream getRTFInputStream(javax.servlet.http.HttpServletRequest request)
                                         throws java.lang.Exception
This method to implement must return InputStream of the RTF model source to use.

Parameters:
request -
Returns:
Throws:
java.lang.Exception

putContext

protected abstract void putContext(javax.servlet.http.HttpServletRequest request,
                                   IContext ctx)
                            throws java.lang.Exception
This method to implement must put context for the RTF model source to use.

Parameters:
request -
response -
ctx -
Throws:
java.lang.Exception

getXMLFieldsAvailable

protected abstract java.io.InputStream getXMLFieldsAvailable(javax.servlet.http.HttpServletRequest request)
                                                      throws java.lang.Exception
This method to implement must return XML fileds available for the RTF model or null if there is not XML Fileds available.

Parameters:
request -
response -
Returns:
Throws:
java.lang.Exception

getTransformerConfig

protected java.io.InputStream getTransformerConfig(javax.servlet.http.HttpServletRequest request)
If this method is implemented, RTFTemplate use this TransformerConfig, oterwise, RTFTemplate use default TransformerConfig.

Returns:

getRealPathOfRTFModel

protected java.lang.String getRealPathOfRTFModel(javax.servlet.http.HttpServletRequest request,
                                                 java.lang.String rtfModelFile)
Return the real path of RTF Model.

Parameters:
request -
rtfModelFile -
Returns:

getFileNameOfContentDisposition

protected java.lang.String getFileNameOfContentDisposition(javax.servlet.http.HttpServletRequest request)

getRTFTemplateImpl

protected java.lang.String getRTFTemplateImpl(javax.servlet.http.HttpServletRequest request)

putDefaultFormat

protected void putDefaultFormat(javax.servlet.http.HttpServletRequest request,
                                RTFTemplate rtfTemplate)

putGlobalContext

protected void putGlobalContext(javax.servlet.http.HttpServletRequest request,
                                IContext newContext)

getGroupByPerPageBreak

protected int getGroupByPerPageBreak(javax.servlet.http.HttpServletRequest request)

cacheWithKey

protected java.lang.String cacheWithKey(javax.servlet.http.HttpServletRequest request)

unCacheWithKey

protected java.lang.String unCacheWithKey(javax.servlet.http.HttpServletRequest request)

getGlobalApplicationContext

protected org.springframework.context.ApplicationContext getGlobalApplicationContext()
Return global Spring configuration for RTFTemplate

Returns:

getApplicationContext

protected org.springframework.context.ApplicationContext getApplicationContext(javax.servlet.http.HttpServletRequest request)
Return Spring configuration for RTFTemplate

Returns:


Copyright 2007 null. All Rights Reserved.