Class ResourceRequest
- All Implemented Interfaces:
Future<ResourceResult>,Associator,Eligible
- Direct Known Subclasses:
ConletResourceRequest,PageResourceRequest
This event is effectively a “transformed” Request.In.Get. It
simplifies handling of such an event by web console components, because
they can simply set a result of type ResourceResult and
thus need no knowledge about generating all the events required to
properly respond to a Request.In.Get.
The complete sequence of events is shown in the diagram.
Of course, due to internal buffering, the “Response Header” data and the “Response body” data may collapse in a single message that is sent to the browser (in case of a small resource).
If a value is provided by ifModifiedSince(),
and the resource has not changed since the given instant,
a resource provider may set ResourceNotModified as
result. This information will be forwarded to the browser.
For a result of type ResourceByUrl, the check
for modification will be made automatically, using information
derived from the URL.
Handlers of ResourceRequest events use usually only
the information provided by resourceUri(). The other
items are needed by the handler of the ResourceRequestCompleted
event (the web console) to generate the response for the Request.In.Get.
If none of the provided ResourceResult type matches the
requirements of the resource provider, it can set
ResourceProvided as result. This signals that it genertes
the response itself.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State -
Field Summary
Fields inherited from class org.jgrapes.core.internal.EventBase
completed, completionEvents, invokedFor -
Constructor Summary
ConstructorsConstructorDescriptionResourceRequest(URI resourceUri, Instant ifModifiedSince, org.jdrupes.httpcodec.protocols.http.HttpRequest httpRequest, IOSubchannel httpChannel, Session session, RenderSupport renderSupport) Creates a new request, including the associatedResourceRequestCompletedevent. -
Method Summary
Modifier and TypeMethodDescriptionorg.jdrupes.httpcodec.protocols.http.HttpRequestReturns the “raw” request as provided by the HTTP decoder.If not null, this value may be used to decide if the resource must be refreshed.Returns the render support.session()Returns the (browser) session.Methods inherited from class org.jgrapes.core.Event
addCompletionEvent, associated, cancel, channels, channels, completionEvents, currentResults, defaultCriterion, forChannels, get, get, handled, handlingError, isCancelled, isDone, isEligibleFor, isStopped, processedBy, results, results, resumeHandling, setAssociated, setChannels, setRequiresResult, setResult, stop, suspendHandling, suspendHandling, tieTo, toStringMethods inherited from class org.jgrapes.core.internal.EventBase
disableTracking, enqueued, firstResultAssigned, isTracked, onCompletionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jgrapes.core.Associator
associated, associated, associated, associatedGetMethods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Constructor Details
-
ResourceRequest
public ResourceRequest(URI resourceUri, Instant ifModifiedSince, org.jdrupes.httpcodec.protocols.http.HttpRequest httpRequest, IOSubchannel httpChannel, Session session, RenderSupport renderSupport) Creates a new request, including the associatedResourceRequestCompletedevent.- Parameters:
resourceUri- the requested resourcehttpRequest- the original HTTP requesthttpChannel- the channel that the HTTP request was received onrenderSupport- the render support
-
-
Method Details
-
resourceUri
- Returns:
- the resourceUri
-
ifModifiedSince
If not null, this value may be used to decide if the resource must be refreshed.- Returns:
- the instant
-
httpRequest
Returns the “raw” request as provided by the HTTP decoder.- Returns:
- the request
-
httpChannel
- Returns:
- the httpChannel
-
renderSupport
Returns the render support.- Returns:
- the render support
-
session
Returns the (browser) session.- Returns:
- the session
-