com.ibm.as400.util.servlet

Class AS400Servlet

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


    public abstract class AS400Servlet
    extends AuthenticationServlet
    The AS400Servlet class is an abstract class that represents an HTML Servlet.

    A connection pool can be used to share connections and manage the number of connections a servlet user can have to the system. When using connection pooling and a system is requested, a fully functional AS400 object is returned to the calling application. It is then up to the application to return the AS400 object to the pool. It is not recommended that an application use this object to create additional connections as the pool would not keep track of these connections.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      AS400Servlet()
      Constructs a default AS400Servlet object.
      AS400Servlet(boolean useConnectionPool)
      Constructs an AS400Servlet object specifing whether to use the connection pool.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void destroy()
      Close the connection pool.
      AS400ConnectionPool getConnectionPool()
      Returns the connection pool.
      java.lang.String getDocumentEnd()
      Returns the tag containing the servlet ending.
      java.lang.String getDocumentHead()
      Returns the tag containing the servlet head.
      AS400 getSystem()
      Returns an object representing the system.
      AS400 getSystem(int service)
      Returns an object representing the system.
      AS400 getSystem(java.lang.String systemName)
      Returns an object representing the system.
      AS400 getSystem(java.lang.String systemName, int service)
      Returns an object representing the system.
      AS400 getSystem(java.lang.String systemName, java.lang.String userId, char[] password)
      Returns an object representing the system.
      AS400 getSystem(java.lang.String systemName, java.lang.String userId, java.lang.String password)
      Deprecated. 
      Use getSystem(String systemName, String userId, char[] password) instead.
      AS400 getSystem(java.lang.String systemName, java.lang.String userId, java.lang.String password, int service)
      Returns an object representing the system.
      boolean isUseConnectionPool()
      Indicates if the connection pool is being used.
      void returnSystem(AS400 system)
      Return the system object to the pool when connection pooling is being used.
      void setDocumentEnd(java.lang.String end)
      Set the html document end tags.
      void setDocumentHead(java.lang.String head)
      Sets the html document starting tags.
      void setUseConnectionPool(boolean useConnectionPool)
      Sets the AS400Servlet to use the connection pool.
      boolean validateAuthority(java.lang.String realm, java.lang.String uid, java.lang.String pw)
      Method used to validate authority.
      • Methods inherited from class javax.servlet.http.HttpServlet

        doDelete, doGet, doOptions, doPost, doPut, doTrace, getLastModified, service
      • Methods inherited from class javax.servlet.GenericServlet

        getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, init, log
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AS400Servlet

        public AS400Servlet()
        Constructs a default AS400Servlet object.
      • AS400Servlet

        public AS400Servlet(boolean useConnectionPool)
        Constructs an AS400Servlet object specifing whether to use the connection pool. The default is false.
        Parameters:
        useConnectionPool - true if using connection pool; false otherwise.
    • Method Detail

      • destroy

        public void destroy()
        Close the connection pool.
        Specified by:
        destroy in interface javax.servlet.Servlet
        Overrides:
        destroy in class javax.servlet.GenericServlet
      • getConnectionPool

        public AS400ConnectionPool getConnectionPool()
        Returns the connection pool. The returned pool object allows the connection pool properties to be changed.
        Returns:
        The connection pool.
      • getDocumentEnd

        public java.lang.String getDocumentEnd()
        Returns the tag containing the servlet ending.
        Returns:
        The tag.
      • getDocumentHead

        public java.lang.String getDocumentHead()
        Returns the tag containing the servlet head.
        Returns:
        The tag.
      • getSystem

        public AS400 getSystem(java.lang.String systemName)
                        throws ConnectionPoolException
        Returns an object representing the system. It uses the specified systemName.
        Parameters:
        systemName - The name of the system.
        Returns:
        The system object.
        Throws:
        ConnectionPoolException - If a connection pool error occurs.
      • getSystem

        public AS400 getSystem(int service)
                        throws AS400SecurityException,
                               java.io.IOException,
                               ConnectionPoolException
        Returns an object representing the system. It connects to the specified service.
        Parameters:
        service - The name of the service.
        Returns:
        The system object.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        java.io.IOException - If an error occurs while communicating with the system.
        ConnectionPoolException - If a connection pool error occurs.
      • getSystem

        public AS400 getSystem(java.lang.String systemName,
                      int service)
                        throws AS400SecurityException,
                               java.io.IOException,
                               ConnectionPoolException
        Returns an object representing the system. It connects to the specified systemName and service.
        Parameters:
        systemName - The name of the system.
        service - The name of the service.
        Returns:
        The system object.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        java.io.IOException - If an error occurs while communicating with the system.
        ConnectionPoolException - If a connection pool error occurs.
      • getSystem

        public AS400 getSystem(java.lang.String systemName,
                      java.lang.String userId,
                      java.lang.String password)
                        throws ConnectionPoolException
        Deprecated. Use getSystem(String systemName, String userId, char[] password) instead.
        Returns an object representing the system. It uses the specified systemName, user ID, and password.
        Parameters:
        systemName - The name of the system.
        userId - The user ID to use to connect to the system.
        password - The password to use to connect to the system.
        Returns:
        The system object.
        Throws:
        ConnectionPoolException - If a connection pool error occurs.
      • getSystem

        public AS400 getSystem(java.lang.String systemName,
                      java.lang.String userId,
                      char[] password)
                        throws ConnectionPoolException
        Returns an object representing the system. It uses the specified systemName, user ID, and password.
        Parameters:
        systemName - The name of the system.
        userId - The user ID to use to connect to the system.
        password - The password to use to connect to the system.
        Returns:
        The system object.
        Throws:
        ConnectionPoolException - If a connection pool error occurs.
      • getSystem

        public AS400 getSystem(java.lang.String systemName,
                      java.lang.String userId,
                      java.lang.String password,
                      int service)
                        throws AS400SecurityException,
                               java.io.IOException,
                               ConnectionPoolException
        Returns an object representing the system. It uses the specified systemName, user ID, password, and service.
        Parameters:
        systemName - The name of the system.
        userId - The user ID to use to connect to the system.
        password - The password to use to connect to the system.
        service - The name of the service.
        Returns:
        The system object.
        Throws:
        AS400SecurityException - If a security or authority error occurs.
        java.io.IOException - If an error occurs while communicating with the system.
        ConnectionPoolException - If a connection pool error occurs.
      • isUseConnectionPool

        public boolean isUseConnectionPool()
        Indicates if the connection pool is being used. The default value is false.
        Returns:
        true if using connection pool; false otherwise.
      • setDocumentEnd

        public void setDocumentEnd(java.lang.String end)
        Set the html document end tags.
        Parameters:
        end - The end tags.
      • setDocumentHead

        public void setDocumentHead(java.lang.String head)
        Sets the html document starting tags.
        Parameters:
        head - The starting tags.
      • setUseConnectionPool

        public void setUseConnectionPool(boolean useConnectionPool)
        Sets the AS400Servlet to use the connection pool. The default is false.
        Parameters:
        useConnectionPool - true if using connection pool; false otherwise.
        See Also:
        AS400ConnectionPool
      • returnSystem

        public void returnSystem(AS400 system)
        Return the system object to the pool when connection pooling is being used.
        Parameters:
        system - The system object.
      • validateAuthority

        public final boolean validateAuthority(java.lang.String realm,
                                java.lang.String uid,
                                java.lang.String pw)
                                        throws java.lang.SecurityException,
                                               java.io.IOException
        Method used to validate authority.
        Overrides:
        validateAuthority in class AuthenticationServlet
        Parameters:
        realm - The realm to validate against.
        uid - The user ID to use for validation.
        pw - The password to use for validation.
        Returns:
        always true.
        Throws:
        java.lang.SecurityException - This exception should be thrown if validation fails.
        java.io.IOException - This exception should be thrown if a communication error occurs during validation.