Class DataSourceTestServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.jboss.as.test.integration.security.common.servlets.DataSourceTestServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

@WebServlet("/DataSourceTestServlet") public class DataSourceTestServlet extends jakarta.servlet.http.HttpServlet
Servlet which makes a simple test on the given datasource ("ExampleDS" by default, use "datasource" request parameter to change the tested datasource). This servlet lookups the datasource through JNDI and follows these steps:
  1. get Connection from DS
  2. create Statement
  3. create table
  4. insert record
  5. run query and check if the inserted record is returned
  6. drop table
  7. close resources
    1. If everything finishes as expected then "true" is returned as the response body. If query doesn't return expected value then the response body is "false".
      The response contains stack trace in case of SQLException or NamingException.
      The response content type is text/plain.
Author:
Josef Cacek
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     

    Fields inherited from class jakarta.servlet.http.HttpServlet

    LEGACY_DO_HEAD
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
     

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, init, service, service

    Methods inherited from class jakarta.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 Details

  • Constructor Details

    • DataSourceTestServlet

      public DataSourceTestServlet()
  • Method Details

    • doGet

      public void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Throws:
      jakarta.servlet.ServletException
      IOException