Class QueryServlet
java.lang.Object
org.eclipse.rdf4j.workbench.base.AbstractServlet
org.eclipse.rdf4j.workbench.base.AbstractRepositoryServlet
org.eclipse.rdf4j.workbench.base.TransformationServlet
org.eclipse.rdf4j.workbench.commands.QueryServlet
- All Implemented Interfaces:
javax.servlet.Servlet, RepositoryServlet
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected booleanFields inherited from class TransformationServlet
CONTEXT, cookies, INFO, NON_VERIFYING_PARSER_CONFIGModifier and TypeFieldDescriptionstatic final Stringprotected CookieHandlerprotected static final Stringprotected static final ParserConfigFields inherited from class AbstractRepositoryServlet
info, manager, MANAGER_PARAM, repository, REPOSITORY_PARAM, vfModifier and TypeFieldDescriptionprotected RepositoryInfoprotected RepositoryManagerstatic final Stringprotected Repositorystatic final Stringprotected ValueFactoryFields inherited from class AbstractServlet
appConfig, APPLICATION_JAVASCRIPT, APPLICATION_SPARQL_RESULTS_XML, APPLICATION_XML, config, DEFAULT_JSONP_CALLBACK_PARAMETER, JSONP_CALLBACK_PARAMETER, JSONP_ENABLED, JSONP_VALIDATOR, log, MOZILLA, MSIE, SERVER_PASSWORD, SERVER_USER, SERVER_USER_PASSWORD, TEXT_HTML, TEXT_PLAIN, USER_AGENTModifier and TypeFieldDescriptionprotected AppConfigurationprotected static final StringThis response content type is always used for JSONP results.protected static final StringThis 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 final StringThis 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.ServletConfigprotected static final StringThis query parameter is only used in cases where the configuration property is not setup explicitly.protected static final Stringprotected static final StringJSONP property for enabling/disabling jsonp functionality.protected static final Patternprotected final org.slf4j.Loggerprotected static final Stringprotected static final Stringprotected static final StringDeprecated.protected static final StringDeprecated.protected static final Stringprotected static final Stringprotected static final Stringprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()protected voiddoPost(WorkbenchRequest req, javax.servlet.http.HttpServletResponse resp, String xslPath) String[]String[]protected Stringvoidinit(javax.servlet.ServletConfig config) Initialize this instance of the servlet.final voidservice(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) Long query strings could blow past the Tomcat default 8k HTTP header limit if stuffed into a cookie.protected voidservice(WorkbenchRequest req, javax.servlet.http.HttpServletResponse resp, String xslPath) protected booleanshouldWriteQueryCookie(String queryText) Determines if the servlet should write out the query text into a cookie as received, or write it's hash instead.protected voidsubstituteAsyncExplainCoordinator(AsyncExplainCoordinator asyncExplainCoordinator) protected static voidsubstituteQueryCache(Map<String, String> testQueryCache) For testing purposes only.protected voidsubstituteQueryStorage(QueryStorage storage) Methods inherited from class TransformationServlet
serviceModifier and TypeMethodDescriptionprotected voidservice(TupleResultBuilder writer, String xslPath) Methods inherited from class AbstractRepositoryServlet
setRepository, setRepositoryInfo, setRepositoryManagerModifier and TypeMethodDescriptionvoidsetRepository(Repository repository) voidvoidsetRepositoryManager(RepositoryManager manager) Methods inherited from class AbstractServlet
checkJSONP, getBooleanResultFormat, getJSONPResultFormat, getResultWriter, getServletConfig, getServletInfo, getTupleResultBuilder, getTupleResultFormat, serviceModifier and TypeMethodDescriptionprotected QueryResultWritercheckJSONP(javax.servlet.http.HttpServletRequest req, OutputStream outputStream) 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.ServletConfigprotected 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) final voidservice(javax.servlet.ServletRequest req, javax.servlet.ServletResponse resp)
-
Field Details
-
REF
- See Also:
-
LIMIT
- See Also:
-
QUERY
- See Also:
-
writeQueryCookie
protected boolean writeQueryCookie
-
-
Constructor Details
-
QueryServlet
public QueryServlet()
-
-
Method Details
-
substituteQueryCache
-
substituteQueryStorage
-
substituteAsyncExplainCoordinator
-
getCookieNames
- Overrides:
getCookieNamesin classTransformationServlet- Returns:
- the names of the cookies that will be retrieved from the request, and returned in the response
-
getCookieNames
- Overrides:
getCookieNamesin classTransformationServlet
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException Initialize this instance of the servlet.- Specified by:
initin interfacejavax.servlet.Servlet- Overrides:
initin classTransformationServlet- Parameters:
config- configuration passed in by the application container- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()- Specified by:
destroyin interfacejavax.servlet.Servlet- Overrides:
destroyin classAbstractServlet
-
service
public final void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException Long query strings could blow past the Tomcat default 8k HTTP header limit if stuffed into a cookie. In this case, we need to set a flag to avoid this happening beforeTransformationServlet.service(HttpServletRequest, HttpServletResponse)is called. A much lower limit on the size of the query text is used to stay well below the Tomcat limitation.- Overrides:
servicein classTransformationServlet- Throws:
javax.servlet.ServletExceptionIOException
-
shouldWriteQueryCookie
Determines if the servlet should write out the query text into a cookie as received, or write it's hash instead.
Note: This is a separate method for testing purposes.
- Parameters:
queryText- the text received as the value for the parameter 'query'
-
service
protected void service(WorkbenchRequest req, javax.servlet.http.HttpServletResponse resp, String xslPath) throws IOException, RDF4JException, BadRequestException - Overrides:
servicein classTransformationServlet- Throws:
IOExceptionRDF4JExceptionBadRequestException
-
doPost
protected void doPost(WorkbenchRequest req, javax.servlet.http.HttpServletResponse resp, String xslPath) throws IOException, BadRequestException, RDF4JException - Overrides:
doPostin classTransformationServlet- Throws:
IOExceptionBadRequestExceptionRDF4JException
-
getQueryText
- Parameters:
req- for looking at the request parameters- Returns:
- the query text, if it can somehow be retrieved from request parameters, otherwise an empty string
- Throws:
BadRequestException- if a problem occurs grabbing the request from storageRDF4JException- if a problem occurs grabbing the request from storage
-