dke.smwp.wrapper
Class Show_Content

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--dke.smwp.wrapper.Show_Content
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class Show_Content
extends javax.servlet.http.HttpServlet

database wrapper fetching XML documents from database.

Version:
1.0
Author:
Werner Enser
See Also:
Serialized Form

Field Summary
private static java.lang.String CONTENT_TYPE
          content type of return string
private static java.lang.String DB_SCHEMA_NAME
          database schema-name
private static java.lang.String TABLE_SMWP_XML_DOCUMENT
          tablename for stored XML documents
private static java.lang.String TABLE_SMWP_XML_DOCUMENT_PARAMS
          tablename for metadata of stored XML documents
 
Fields inherited from class javax.servlet.http.HttpServlet
HEADER_IFMODSINCE, HEADER_LASTMOD, LSTRING_FILE, lStrings, METHOD_DELETE, METHOD_GET, METHOD_HEAD, METHOD_OPTIONS, METHOD_POST, METHOD_PUT, METHOD_TRACE
 
Fields inherited from class javax.servlet.GenericServlet
config
 
Constructor Summary
Show_Content()
           
 
Method Summary
 void destroy()
          Clean up resources
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          processes the HTTP get request; fetches XML documents designated by given parameters: systemID: filename of xml document which is to be fetched (e.g. wines/winery_rioja.xml) or id: id of xml document which is to be fetched (integer value)
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          processes the HTTP post request
private  void getContent(int id, java.io.PrintWriter out)
          gets the XML document content designated by id
private  void getContent(java.lang.String systemID, java.io.PrintWriter out)
          gets the XML document content designated by systemID
 void init()
          initializes global variables
 
Methods inherited from class javax.servlet.http.HttpServlet
, doDelete, doHead, doOptions, doPut, doTrace, getAllDeclaredMethods, getLastModified, maybeSetLastModified, 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, registerNatives, toString, wait, wait, wait
 

Field Detail

CONTENT_TYPE

private static final java.lang.String CONTENT_TYPE
content type of return string

DB_SCHEMA_NAME

private static final java.lang.String DB_SCHEMA_NAME
database schema-name

TABLE_SMWP_XML_DOCUMENT

private static final java.lang.String TABLE_SMWP_XML_DOCUMENT
tablename for stored XML documents

TABLE_SMWP_XML_DOCUMENT_PARAMS

private static final java.lang.String TABLE_SMWP_XML_DOCUMENT_PARAMS
tablename for metadata of stored XML documents
Constructor Detail

Show_Content

public Show_Content()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
initializes global variables
Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException -  

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
processes the HTTP post request
Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request - HTTP request
response - fetched XML document or error message (in XML format)
Throws:
javax.servlet.ServletException -  
java.io.IOException - fetching XML documents failed

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
processes the HTTP get request; fetches XML documents designated by given parameters: systemID: filename of xml document which is to be fetched (e.g. wines/winery_rioja.xml) or id: id of xml document which is to be fetched (integer value)
Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request - HTTP request
response - fetched XML document or error message (in XML format)
Throws:
javax.servlet.ServletException -  
java.io.IOException - fetching XML documents failed

getContent

private void getContent(java.lang.String systemID,
                        java.io.PrintWriter out)
                 throws java.sql.SQLException,
                        java.io.IOException
gets the XML document content designated by systemID
Parameters:
systemID - filename of xml document which is to be fetched
out - output writer
Throws:
java.sql.SQLException - fetching content failed
java.io.IOException - reading clob failed

getContent

private void getContent(int id,
                        java.io.PrintWriter out)
                 throws java.sql.SQLException,
                        java.io.IOException
gets the XML document content designated by id
Parameters:
id - id of xml document which is to be fetched
out - output writer
Throws:
java.sql.SQLException - fetching content failed
java.io.IOException - reading clob failed

destroy

public void destroy()
Clean up resources
Overrides:
destroy in class javax.servlet.GenericServlet