Class TokenReaderArg
java.lang.Object
org.apache.juneau.rest.server.arg.SimpleRestOperationArg
org.apache.juneau.rest.server.arg.TokenReaderArg
- All Implemented Interfaces:
RestOpArg
Resolves method parameters of type
TokenReader (or any subtype) on
RestOp-annotated Java methods.
Implements the two-layer resolution for token-cursor parameters:
- Static parameter type filters eligible parsers — e.g.
JsonlTokenReaderparam means onlyJsonlParseris eligible. - Request
Content-Typenegotiates among the eligible parsers (the matched parser must accept the incoming media type).
The parameter value is resolved by:
- Negotiating the request's
Content-Typeto a matchedParser. - Building a request-configured
ParserSessionand callingreadTokens(input)on it — so the cursor honors the same locale / timezone / schema / charset as a normal parsed body. - Verifying the returned cursor is assignable to the declared parameter type.
Rejection paths (all surfaced as HTTP 415 / 406):
- No parser matched the
Content-Type— resolution returnsnulland the framework rejects the request (415/406 via the empty match). - Matched parser does not implement
TokenReadable(the format cannot serve the token-reader surface) — throwsUnsupportedMediaType(415). - Matched parser produces a cursor not assignable to the declared parameter type
— throws
UnsupportedMediaType(415).
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TokenReaderArgcreate(ParameterInfo paramInfo) Static creator.Class<?>Returns the declared parameter type for diagnostic / introspection use.Methods inherited from class org.apache.juneau.rest.server.arg.SimpleRestOperationArg
resolve
-
Constructor Details
-
TokenReaderArg
Constructor.- Parameters:
declaredType- The declared parameter type.
-
-
Method Details
-
create
Static creator.- Parameters:
paramInfo- The Java method parameter being resolved. Must not benull .- Returns:
- A new
TokenReaderArg, ornull if the parameter type is notTokenReaderor a subtype.
-
getDeclaredType
Returns the declared parameter type for diagnostic / introspection use.
-