[
https://issues.apache.org/jira/browse/SLING-594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12618813#action_12618813
]
Tobias Bocanegra commented on SLING-594:
----------------------------------------
> As there is no real use case for pre processing...
yes there is:
example: validation
you need to validate the input before storing. but you don't want to reject
the POST, but maybe just
adjust some value.
stupid example: transformation
you want to change all 'title' properties to uppercase before storing.
> Add pre and post processing hooks to the sling post servlet
> -----------------------------------------------------------
>
> Key: SLING-594
> URL: https://issues.apache.org/jira/browse/SLING-594
> Project: Sling
> Issue Type: Improvement
> Components: Servlets Post
> Affects Versions: Servlets Post 2.0.2
> Reporter: Carsten Ziegeler
> Assignee: Carsten Ziegeler
> Fix For: Servlets Post 2.0.4
>
>
> Currently during a post, a SlingPostOperation is selected and then executed.
> The post operation does "everything", performing the changes and saving them.
> I think we could reintroduce a Changes interface with several implementations
> like Add, Remove, Copy etc. This interface has all knowledge of what to
> change.
> The SlingPostOperation would then return a list of changes:
> interface SlingPostOperation {
> List <Change> prepare(SlingHttpServletRequest);
> }
> So the first step when a post comes in, is still to select the post
> operation, but then this operation just generates a list of changes without
> changing anything in the repository.
> We then introduce pre and post processor interfaces (these are no final names
> yet:)
> interface PreProcessor {
> void process(SlingHttpServletRequest, List<Change>);
> }
> interface PostProcessor {
> void process(SlingHttpServletRequest, List<Change>);
> }
> There can be several pre and post processor registered, a property of a
> processor is used to order them and guarantee an ordered execution.
> A pre processor can alter the list of changes.
> When all pre processors are run, the changes are applied to the repository by
> Sling, then all post processors are executed.
> Finally all changes are saved.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.