Package 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,WorkbenchGateway,WorkbenchServlet
public abstract class AbstractServlet extends Object implements javax.servlet.Servlet
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringACCEPTprotected AppConfigurationappConfigprotected static StringAPPLICATION_JAVASCRIPTThis response content type is always used for JSONP results.protected static StringAPPLICATION_SPARQL_RESULTS_XMLThis 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 StringAPPLICATION_XMLThis 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.ServletConfigconfigprotected static StringDEFAULT_JSONP_CALLBACK_PARAMETERThis query parameter is only used in cases where the configuration property is not setup explicitly.protected static StringJSONP_CALLBACK_PARAMETERprotected static StringJSONP_ENABLEDJSONP property for enabling/disabling jsonp functionality.protected static PatternJSONP_VALIDATORprotected org.slf4j.Loggerlogprotected static StringMOZILLAprotected static StringMSIEprotected static StringSERVER_PASSWORDDeprecated.protected static StringSERVER_USERDeprecated.protected static StringSERVER_USER_PASSWORDprotected static StringTEXT_HTMLprotected static StringTEXT_PLAINprotected static StringUSER_AGENT
-
Constructor Summary
Constructors Constructor Description AbstractServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected QueryResultWritercheckJSONP(javax.servlet.http.HttpServletRequest req, OutputStream outputStream)voiddestroy()protected QueryResultFormatgetBooleanResultFormat(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletResponse resp)protected QueryResultFormatgetJSONPResultFormat(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletResponse resp)protected QueryResultWritergetResultWriter(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletResponse resp, OutputStream outputStream)javax.servlet.ServletConfiggetServletConfig()StringgetServletInfo()protected TupleResultBuildergetTupleResultBuilder(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, OutputStream outputStream)Gets aTupleResultBuilderbased 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 QueryResultFormatgetTupleResultFormat(javax.servlet.http.HttpServletRequest req, javax.servlet.ServletResponse resp)voidinit(javax.servlet.ServletConfig config)voidservice(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)voidservice(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp)
-
-
-
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
-
-
Method Detail
-
getServletConfig
public javax.servlet.ServletConfig getServletConfig()
- Specified by:
getServletConfigin interfacejavax.servlet.Servlet
-
getServletInfo
public String getServletInfo()
- Specified by:
getServletInfoin interfacejavax.servlet.Servlet
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException- Specified by:
initin interfacejavax.servlet.Servlet- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()
- Specified by:
destroyin interfacejavax.servlet.Servlet
-
service
public final void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp) throws javax.servlet.ServletException, IOException- Specified by:
servicein interfacejavax.servlet.Servlet- Throws:
javax.servlet.ServletExceptionIOException
-
service
public void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException- Throws:
javax.servlet.ServletExceptionIOException
-
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
-
getTupleResultBuilder
protected TupleResultBuilder getTupleResultBuilder(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, OutputStream outputStream) throws UnsupportedQueryResultFormatException, IOException
Gets aTupleResultBuilderbased 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 requestresp- the current HTTP responseoutputStream- TODO- Returns:
- a builder that can be used to write out the results
- Throws:
IOExceptionUnsupportedQueryResultFormatException
-
checkJSONP
protected QueryResultWriter checkJSONP(javax.servlet.http.HttpServletRequest req, OutputStream outputStream) throws IOException
- Throws:
IOException
-
-