Class TextToUrl

  • All Implemented Interfaces:
    java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class TextToUrl
    extends javax.servlet.http.HttpServlet
    This servlet allows POSTing a text and retrieve it (up to 24h) later via GET under a given name Each servlet instance has its only scope name. Use for example <servlet> <servlet-name>SldToUrl</servlet-name> <servlet-class>de.businesscode.bcdui.toolbox.TextToUrl</servlet-class> <init-param><param-name>SCOPE</param-name> <param-value>sld</param-value></init-param> <init-param><param-name>NAME_TEMPLATE</param-name> <param-value>sld%d.xml</param-value></init-param> <init-param><param-name>DATA_SOURCE</param-name> <param-value>jdbc/datasourceName</param-value></init-param> <init-param><param-name>TABLE</param-name> <param-value>tableName</param-value></init-param> <init-param><param-name>MIME_TYPE</param-name> <param-value>text/xml</param-value></init-param> </servlet> to initialize the servlet. Table needs to have the form CREATE TABLE tablename ( name VARCHAR(64), value CLOB, scope VARCHAR(32), ts TIMESTAMP ) ; For parameters > 4000 character Oracle requires connectionProperties="SetBigStringTryClob=true" (for example in Tomcat DataSource Resource definition)
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      TextToUrl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doGet​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void doPost​(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)  
      void init​(javax.servlet.ServletConfig config)  
      • 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

      • INIT_NAME_TEMPLATE

        protected static final java.lang.String INIT_NAME_TEMPLATE
        See Also:
        Constant Field Values
      • INIT_DATASOURCE_TOKEN

        protected static final java.lang.String INIT_DATASOURCE_TOKEN
        See Also:
        Constant Field Values
      • INIT_TABLE_TOKEN

        protected static final java.lang.String INIT_TABLE_TOKEN
        See Also:
        Constant Field Values
      • mimeType

        protected java.lang.String mimeType
      • stmtWrite

        protected java.lang.String stmtWrite
      • stmtRead

        protected java.lang.String stmtRead
      • stmtClean

        protected java.lang.String stmtClean
      • nameTemplate

        protected java.lang.String nameTemplate
      • ds

        protected javax.sql.DataSource ds
    • Constructor Detail

      • TextToUrl

        public TextToUrl()
    • Method Detail

      • doPost

        public void doPost​(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws javax.servlet.ServletException,
                           java.io.IOException
        Overrides:
        doPost in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doGet

        public void doGet​(javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse resp)
                   throws javax.servlet.ServletException,
                          java.io.IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • init

        public void init​(javax.servlet.ServletConfig config)
                  throws javax.servlet.ServletException
        Specified by:
        init in interface javax.servlet.Servlet
        Overrides:
        init in class javax.servlet.GenericServlet
        Throws:
        javax.servlet.ServletException