Interface AuthorizationAwareContentTypeHandler
- All Superinterfaces:
ContentTypeHandler
- All Known Implementing Classes:
JacksonJsonHandler,JacksonXmlHandler,JuneauXmlHandler
ContentTypeHandler implementations that respect the
ParameterAuthorizationContext ThreadLocal during deserialization, enforcing
@StrutsParameter authorization per-property.
When struts.parameters.requireAnnotations=true, the REST plugin's
ContentTypeInterceptor binds the authorization context before invoking handlers that
implement this interface, allowing them to filter unauthorized properties during deserialization
(rather than after, via reflection-based copying).
Handlers that do NOT implement this interface fall back to the legacy two-phase copy in
ContentTypeInterceptor — correct but more expensive (and requires a no-arg constructor
on the target).
Implementer responsibility: A handler that declares this interface MUST register
the authorization-aware mechanism on its underlying parser (e.g. for Jackson, register
ParameterAuthorizingModule on the ObjectMapper). If the handler implements the
interface but its parser does not honor the context, authorization will silently do nothing —
a serious security bug. The marker interface is the contract; implementations must uphold it.
- Since:
- 7.2.0
-
Method Summary
Methods inherited from interface org.apache.struts2.rest.handler.ContentTypeHandler
fromObject, getContentType, getExtension, toObject