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
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.