Class AsyncJobRef
ActionResult when
the write is asynchronous.
Why this is not a new RowAction wire field
Whether an action is asynchronous is a property of the response, not of the declared action: the same
RowAction POST returns either a terminal ActionResult (synchronous) or this pointer (asynchronous).
So the RowAction wire schema is untouched — no new field, no fail-loud contract bump — and the
juneau-views.js runtime routes to the streaming path purely by recognizing a streamUrl in the 2xx
body. It carries no data to render, only capability pointers, so it needs no version handshake of its own.
The URLs are capabilities
streamUrl points at the SSE progress stream and cancelUrl at the cancel endpoint; both embed the
job's unguessable 256-bit id (see AsyncJob), which is the whole of the
access control. The browser EventSource that consumes streamUrl cannot set a CSRF header,
which is precisely why the id must be unguessable rather than CSRF-gated.
See Also:
- Since:
- 10.0.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AsyncJobRefBuilds a reference carrying explicit stream/cancel URLs (for a consumer that resolves URLs itself, e.g. a template-rendered surface downstream of theservlet:rewrite).static AsyncJobRefBuilds a reference to the given job usingservlet:-relative URLs against theAsyncJobsMixinmount — the sameservlet:conventionViewsMixinuses for its asset URLs.
-
Field Details
-
Constructor Details
-
AsyncJobRef
public AsyncJobRef()
-
-
Method Details
-
of
Builds a reference to the given job usingservlet:-relative URLs against theAsyncJobsMixinmount — the sameservlet:conventionViewsMixinuses for its asset URLs.streamUrlandcancelUrlare@Uri-annotated, which is what opts them into resolution: Juneau's serializer only rewrites theservlet:pseudo-scheme for a property whoseClassMetaorBeanPropertyMetareportsisUri()==true, and a plainStringfield reports that only via an explicit@Uri(seeMarshalledPropertyPostProcessor); without it the literal"servlet:..."string would reach the wire unresolved. With the annotation present, every REST response serializer (JSON, HTML, XML, ...) resolves it against the current request'sUriContext.- Parameters:
job- The started job. Must not benull .- Returns:
- A new reference carrying the job's id and its
servlet:-relative stream + cancel URLs.
-
of
Builds a reference carrying explicit stream/cancel URLs (for a consumer that resolves URLs itself, e.g. a template-rendered surface downstream of theservlet:rewrite).- Parameters:
jobId- The job's capability id. Must not benull or blank.streamUrl- The SSE stream URL. Must not benull or blank.cancelUrl- The cancel URL. Must not benull or blank.- Returns:
- A new reference.
-