java.lang.Object
org.apache.jena.fuseki.servlets.HttpAction
HTTP action that represents the user request lifecycle. It is is handled in the
ActionBase.executeLifecycle(HttpAction) method.-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal ActionCategoryfinal longfinal org.slf4j.Loggerintintfinal boolean -
Constructor Summary
ConstructorsConstructorDescriptionHttpAction(long id, org.slf4j.Logger log, ActionCategory category, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Creates a new HTTP Action, using the HTTP request and response, and a given ID. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()voidAbort: ignore exceptions (for clearup code)voidbegin()Begin a transaction - this should be paired with anend()voidbegin(org.apache.jena.query.TxnType txnType) Begin a transaction of anyTxnType- this should be paired with anend()voidBegin a read operation - this should be paired with anendRead()voidBegin a write operation - this should be paired with anendWrite()voidcommit()voidend()End a write transaction - paired withbegin()orbegin(TxnType).voidendRead()End a read transaction - paired withbeginRead().voidendWrite()End a write transaction - paired withbeginWrite().final voidThis is the requestURI with the context path removed.final org.apache.jena.sparql.core.DatasetGraphIf inside the transaction for the action, return the activeDatasetGraph, otherwise return null.org.apache.jena.sparql.util.ContextReturn the Context for thisHttpAction.Get the context path.final DataAccessPointGet theDataAccessPointRegistryfor this action.final DataServiceorg.apache.jena.sparql.core.DatasetGraphReturn the dataset, if any (may be null)final StringGet the endpoint for the action (may be null) .longStart time, in system nanosDeprecated, for removal: This API element is subject to removal in a future version.Get theMetricsProviderfor this action.Get theOperationRegistryfor this action.jakarta.servlet.http.HttpServletRequestintlonggetRequestHeader(String name) getRequestHeaders(String name) Get the request input stream, bypassing any compression.intgetRequestParameter(String string) String[]jakarta.servlet.http.HttpServletResponsejakarta.servlet.ServletOutputStreamjakarta.servlet.ServletContextGetServletContext(may be null).longStart time, in system nanoslonggetTime()Return the recorded time taken in milliseconds.org.apache.jena.sparql.core.TransactionalReturn the "Transactional" for this HttpAction.getUser()Return the authenticated user for thisHttpAction.booleanReturns whether or not the underlying DatasetGraph is fully transactional (supports rollback)voidminimize()Reduce to a size that can be kept around for sometime.voidsetEndpoint(Endpoint endpoint) Set the endpoint and endpoint name that this is an action for.voidvoidsetRequest(DataAccessPoint dataAccessPoint, DataService dService) Initialization after action creation, during lifecycle setup.voidsetResponseCharacterEncoding(String charset) voidsetResponseContentLength(int length) voidsetResponseContentLengthLong(long length) voidvoidsetResponseHeader(String name, String value) voidsetResponseStatus(int statusCode) voidfinal voidvoidsync()toString()
-
Field Details
-
id
public final long id -
verbose
public final boolean verbose -
category
-
log
public final org.slf4j.Logger log -
endpoint
-
statusCode
public int statusCode -
message
-
responseContentLength
public int responseContentLength -
responseContentType
-
-
Constructor Details
-
HttpAction
public HttpAction(long id, org.slf4j.Logger log, ActionCategory category, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Creates a new HTTP Action, using the HTTP request and response, and a given ID.- Parameters:
id- given IDlog- Logger for this actionrequest- HTTP requestresponse- HTTP response
-
-
Method Details
-
setRequest
Initialization after action creation, during lifecycle setup. This is "set once" (in other words, constructor-like but delayed because the information is not yet available at the point we want to create the HttpAction).This method sets the action dataset for service requests. Does not apply to "admin" and "ctl" servlets. Setting will replace any existing
DataAccessPointandDataService, as theDatasetGraphof the current HTTP Action.Once it has updated its members, the HTTP Action will change its transactional state and
Transactionalinstance according to its base dataset graph.- Parameters:
dataAccessPoint-DataAccessPointdService-DataService- See Also:
-
Transactional
-
getDataset
public org.apache.jena.sparql.core.DatasetGraph getDataset()Return the dataset, if any (may be null) -
getContext
public org.apache.jena.sparql.util.Context getContext()Return the Context for thisHttpAction. -
getUser
Return the authenticated user for thisHttpAction. Return null for no authenticated user. -
getTransactional
public org.apache.jena.sparql.core.Transactional getTransactional()Return the "Transactional" for this HttpAction. -
getActionURI
This is the requestURI with the context path removed. It should be used internally for dispatch. -
getContextPath
Get the context path. -
getOperationRegistry
Get theOperationRegistryfor this action. -
getDataAccessPointRegistry
Get theDataAccessPointRegistryfor this action. -
getServletContext
public jakarta.servlet.ServletContext getServletContext()GetServletContext(may be null). -
getMetricsProvider
Get theMetricsProviderfor this action. -
setEndpoint
Set the endpoint and endpoint name that this is an action for.- Parameters:
endpoint-Endpoint
-
getEndpoint
Get the endpoint for the action (may be null) . -
isTransactional
public boolean isTransactional()Returns whether or not the underlying DatasetGraph is fully transactional (supports rollback) -
startRequest
public final void startRequest() -
finishRequest
public final void finishRequest() -
begin
public void begin(org.apache.jena.query.TxnType txnType) Begin a transaction of anyTxnType- this should be paired with anend()httpAction.begin(); try { work possible promote to write commit or abort (if write) response } finally { httpAction.end(); }Prefer one ofbeginRead()orbeginWrite()if the action is known to be a a read or write at the start or callbegin()if the transaction may promote. -
begin
public void begin()Begin a transaction - this should be paired with anend()httpAction.begin(); try { work possible promote to write commit or abort (if write) response } finally { httpAction.end(); } -
beginWrite
public void beginWrite()Begin a write operation - this should be paired with anendWrite()httpAction.beginWrite(); try { work commit or abort response } finally { httpAction.endWrite(); } -
beginRead
public void beginRead()Begin a read operation - this should be paired with anendRead()httpAction.beginRead(); try { work response } finally { httpAction.endRead(); } -
endRead
public void endRead()End a read transaction - paired withbeginRead(). -
endWrite
public void endWrite()End a write transaction - paired withbeginWrite(). -
end
public void end()End a write transaction - paired withbegin()orbegin(TxnType). -
commit
public void commit() -
abortSilent
public void abortSilent()Abort: ignore exceptions (for clearup code) -
abort
public void abort() -
getActiveDSG
public final org.apache.jena.sparql.core.DatasetGraph getActiveDSG()If inside the transaction for the action, return the activeDatasetGraph, otherwise return null.- Returns:
- Current active
DatasetGraph
-
getDataAccessPoint
-
getDataService
-
getDatasetName
-
minimize
public void minimize()Reduce to a size that can be kept around for sometime. -
setStartTime
public void setStartTime() -
getStartTime
public long getStartTime()Start time, in system nanos -
getFinishTime
public long getFinishTime()Start time, in system nanos -
setFinishTime
public void setFinishTime() -
getTime
public long getTime()Return the recorded time taken in milliseconds.setStartTime()andsetFinishTime()must have been called. -
sync
public void sync() -
toString
-
getMethod
Deprecated, for removal: This API element is subject to removal in a future version.UsegetRequestMethod(). -
getRequest
public jakarta.servlet.http.HttpServletRequest getRequest() -
getResponse
public jakarta.servlet.http.HttpServletResponse getResponse() -
getRequestParameter
-
getRequestParameterNames
-
getRequestParameterValues
-
getRequestParameterMap
-
getRequestMethod
-
getRequestHeaderNames
-
getRequestHeader
-
getRequestHeaders
-
getRequestContentType
-
getRequestCharacterEncoding
-
getRequestContentLength
public int getRequestContentLength() -
getRequestContentLengthLong
public long getRequestContentLengthLong() -
getRequestInputStream
- Throws:
IOException
-
getRequestInputStreamRaw
Get the request input stream, bypassing any compression. The state of the input stream is unknown. Only useful for skipping a body on a connection.- Throws:
IOException
-
getRequestQueryString
-
getRequestRequestURI
-
getRequestRequestURL
-
getRequestPathInfo
-
getRequestServletPath
-
getRequestLocalPort
public int getRequestLocalPort() -
setResponseCharacterEncoding
-
setResponseContentType
-
setResponseContentLength
public void setResponseContentLength(int length) -
setResponseContentLengthLong
public void setResponseContentLengthLong(long length) -
setResponseHeader
-
setResponseStatus
public void setResponseStatus(int statusCode) -
getResponseOutputStream
- Throws:
IOException
-
getResponseWriter
- Throws:
IOException
-
getRequestMethod().