org.eclipse.rdf4j.workbench.base

## Class AbstractServlet

- java.lang.Object
- - org.eclipse.rdf4j.workbench.base.AbstractServlet

- All Implemented Interfaces:
    javax.servlet.Servlet
  Direct Known Subclasses:
    AbstractRepositoryServlet, BaseServlet, WorkbenchGateway, WorkbenchServlet

      public abstract class AbstractServlet
      extends Object
      implements javax.servlet.Servlet

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `ACCEPT`
    `protected AppConfiguration` | `appConfig`
    `protected static String` | `APPLICATION_JAVASCRIPT` This response content type is always used for JSONP results.
    `protected static String` | `APPLICATION_SPARQL_RESULTS_XML` This response content type is used for SPARQL Results XML results in non-browser user agents or other cases where application/xml is not specifically requested.
    `protected static String` | `APPLICATION_XML` This response content type is used in cases where application/xml is explicitly requested, or in cases where the user agent is known to be a commonly available browser.
    `protected javax.servlet.ServletConfig` | `config`
    `protected static String` | `DEFAULT_JSONP_CALLBACK_PARAMETER` This query parameter is only used in cases where the configuration property is not setup explicitly.
    `protected static String` | `JSONP_CALLBACK_PARAMETER`
    `protected static String` | `JSONP_ENABLED` JSONP property for enabling/disabling jsonp functionality.
    `protected static Pattern` | `JSONP_VALIDATOR`
    `protected org.slf4j.Logger` | `log`
    `protected static String` | `MOZILLA`
    `protected static String` | `MSIE`
    `protected static String` | `SERVER_PASSWORD` Deprecated.
    `protected static String` | `SERVER_USER` Deprecated.
    `protected static String` | `SERVER_USER_PASSWORD`
    `protected static String` | `TEXT_HTML`
    `protected static String` | `TEXT_PLAIN`
    `protected static String` | `USER_AGENT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractServlet()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected QueryResultWriter` | `checkJSONP(javax.servlet.http.HttpServletRequest req, OutputStream outputStream)`
    `void` | `destroy()`
    `protected QueryResultFormat` | `getBooleanResultFormat(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletResponse resp)`
    `protected QueryResultFormat` | `getJSONPResultFormat(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletResponse resp)`
    `protected QueryResultWriter` | `getResultWriter(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletResponse resp, OutputStream outputStream)`
    `javax.servlet.ServletConfig` | `getServletConfig()`
    `String` | `getServletInfo()`
    `protected TupleResultBuilder` | `getTupleResultBuilder(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, OutputStream outputStream)` Gets a `TupleResultBuilder` based on the Accept header, and sets the result content type to the best available match for that, returning a builder that can be used to write out the results.
    `protected QueryResultFormat` | `getTupleResultFormat(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletResponse resp)`
    `void` | `init(javax.servlet.ServletConfig config)`
    `void` | `service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)`
    `void` | `service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### log

          protected final org.slf4j.Logger log

    - #### SERVER_USER

          @Deprecated
          protected static final String SERVER_USER

      Deprecated.
      See Also:
        Constant Field Values

    - #### SERVER_PASSWORD

          @Deprecated
          protected static final String SERVER_PASSWORD

      Deprecated.
      See Also:
        Constant Field Values

    - #### SERVER_USER_PASSWORD

          protected static final String SERVER_USER_PASSWORD

      See Also:
        Constant Field Values

    - #### ACCEPT

          protected static final String ACCEPT

      See Also:
        Constant Field Values

    - #### APPLICATION_JAVASCRIPT

          protected static final String APPLICATION_JAVASCRIPT

      This response content type is always used for JSONP results.
      See Also:
        Constant Field Values

    - #### APPLICATION_XML

          protected static final String APPLICATION_XML

      This response content type is used in cases where application/xml is explicitly requested, or in cases where the user agent is known to be a commonly available browser.
      See Also:
        Constant Field Values

    - #### APPLICATION_SPARQL_RESULTS_XML

          protected static final String APPLICATION_SPARQL_RESULTS_XML

      This response content type is used for SPARQL Results XML results in non-browser user agents or other cases where application/xml is not specifically requested.
      See Also:
        Constant Field Values

    - #### TEXT_HTML

          protected static final String TEXT_HTML

      See Also:
        Constant Field Values

    - #### TEXT_PLAIN

          protected static final String TEXT_PLAIN

      See Also:
        Constant Field Values

    - #### USER_AGENT

          protected static final String USER_AGENT

      See Also:
        Constant Field Values

    - #### MSIE

          protected static final String MSIE

      See Also:
        Constant Field Values

    - #### MOZILLA

          protected static final String MOZILLA

      See Also:
        Constant Field Values

    - #### JSONP_ENABLED

          protected static final String JSONP_ENABLED

      JSONP property for enabling/disabling jsonp functionality.
      See Also:
        Constant Field Values

    - #### DEFAULT_JSONP_CALLBACK_PARAMETER

          protected static final String DEFAULT_JSONP_CALLBACK_PARAMETER

      This query parameter is only used in cases where the configuration property is not setup explicitly.
      See Also:
        Constant Field Values

    - #### JSONP_VALIDATOR

          protected static final Pattern JSONP_VALIDATOR

    - #### JSONP_CALLBACK_PARAMETER

          protected static final String JSONP_CALLBACK_PARAMETER

      See Also:
        Constant Field Values

    - #### config

          protected javax.servlet.ServletConfig config

    - #### appConfig

          protected AppConfiguration appConfig

  - ### Constructor Detail

    - #### AbstractServlet

          public AbstractServlet()

  - ### Method Detail

    - #### getServletConfig

          public javax.servlet.ServletConfig getServletConfig()

      Specified by:
        `getServletConfig` in interface `javax.servlet.Servlet`

    - #### getServletInfo

          public String getServletInfo()

      Specified by:
        `getServletInfo` in interface `javax.servlet.Servlet`

    - #### init

          public void init(javax.servlet.ServletConfig config)
                    throws javax.servlet.ServletException

      Specified by:
        `init` in interface `javax.servlet.Servlet`
      Throws:
        `javax.servlet.ServletException`

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `javax.servlet.Servlet`

    - #### service

          public final void service(javax.servlet.ServletRequest req,
                                    javax.servlet.ServletResponse resp)
                             throws javax.servlet.ServletException,
                                    IOException

      Specified by:
        `service` in interface `javax.servlet.Servlet`
      Throws:
        `javax.servlet.ServletException`
        `IOException`

    - #### service

          public void service(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              IOException

      Throws:
        `javax.servlet.ServletException`
        `IOException`

    - #### getTupleResultFormat

          protected QueryResultFormat getTupleResultFormat(javax.servlet.http.HttpServletRequest req,
                                                           javax.servlet.ServletResponse resp)

    - #### getBooleanResultFormat

          protected QueryResultFormat getBooleanResultFormat(javax.servlet.http.HttpServletRequest req,
                                                             javax.servlet.ServletResponse resp)

    - #### getJSONPResultFormat

          protected QueryResultFormat getJSONPResultFormat(javax.servlet.http.HttpServletRequest req,
                                                           javax.servlet.ServletResponse resp)

    - #### getResultWriter

          protected QueryResultWriter getResultWriter(javax.servlet.http.HttpServletRequest req,
                                                      javax.servlet.ServletResponse resp,
                                                      OutputStream outputStream)
                                               throws UnsupportedQueryResultFormatException,
                                                      IOException

      Throws:
        `UnsupportedQueryResultFormatException`
        `IOException`

    - #### getTupleResultBuilder

          protected TupleResultBuilder getTupleResultBuilder(javax.servlet.http.HttpServletRequest req,
                                                             javax.servlet.http.HttpServletResponse resp,
                                                             OutputStream outputStream)
                                                      throws UnsupportedQueryResultFormatException,
                                                             IOException

      Gets a `TupleResultBuilder` based on the Accept header, and sets the result content type to the best available match for that, returning a builder that can be used to write out the results.
      Parameters:
        `req` - the current HTTP request
        `resp` - the current HTTP response
        `outputStream` - TODO
      Returns:
        a builder that can be used to write out the results
      Throws:
        `IOException`
        `UnsupportedQueryResultFormatException`

    - #### checkJSONP

          protected QueryResultWriter checkJSONP(javax.servlet.http.HttpServletRequest req,
                                                 OutputStream outputStream)
                                          throws IOException

      Throws:
        `IOException`

Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.