Hi all,

if you have a custom servlet that wants to run Sling's POST servlet
handling _after_ it has done something, it theoretically could do so
by getting the required SlingPostOperation and simply run it (just as
the SlingPostServlet does it).

(The only other way to integrate the POST servlet functionality with
custom things is to implement a SlingPostProcessor, but this is after
the fact, and doesn't allow for cases, where your servlet is the
authority of creating the content that e.g. the modify operation
should work on.)

However, the standard operations, such as the default ModifyOperation,
are unfortunately not exposed as services, and are hidden in the
private export section of the bundle.

I see two solutions:

1) all built-in SlingPostOperations should be registered as service
- works fine for Copy, Move, Delete
- ModifyOperation requires objects passed in its constructor
  + NodeNameGenerator and DateParser:
    their configuration should be moved from the SlingPostServlet component to
    the new ModifyOperation component (only used there anyway)
  + ServletContext:
    required "only" for getting the mime types configured in the servlet engine,
    to be used for file uploads; not sure how to solve that (*)

2) export all *Operation classes from the bundle
   (ie. move them to a new public o.a.sling.servlets.post.operation package)

While 1) seems to be cleaner (not exposing internal implementation),
2) is much simpler to do and would also allow to build custom
operations that extend the existing ones (however, we might not want
to push that...).

WDYT?

Regards,
Alex


(*) Some ideas:
- additional mime type config in the ModifyOperation
- pass ServletContext in new SlingPostOperation.run() method
- pass ServletContext as request attribute in request given via run() method

-- 
Alexander Klimetschek
alexander.klimetsc...@day.com

Reply via email to