You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2012/12/04 10:21:57 UTC

Re: getting ContentImporter service

Hi Dimitar,

On Tue, Dec 4, 2012 at 9:52 AM, Dimitar Dimitrov <dd...@consult.bg> wrote:
> ...I am a pretty new in Sling and for now I am searching the way to get the
> ContentImporter instance in my SlingPostProcessor implementation...

You can get it in the same way as the SlingPostServlet [1] does, using
an @Reference to a ContentImporter. Checking /system/console/services
does show that such a ContentImporter service is available in a
default Sling launchpad instance.

The default reference options are probably good for your case, so just

  @Reference
  private ContentImporter contentImporter;

should do.

-Bertrand

[1] http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java

Re: getting ContentImporter service

Posted by Dimitar Dimitrov <dd...@consult.bg>.
Thanks Bertrand.
It works just as you say.

Regards
Dimitar

On 12/04/2012 11:21 AM, Bertrand Delacretaz wrote:
> Hi Dimitar,
>
> On Tue, Dec 4, 2012 at 9:52 AM, Dimitar Dimitrov <dd...@consult.bg> wrote:
>> ...I am a pretty new in Sling and for now I am searching the way to get the
>> ContentImporter instance in my SlingPostProcessor implementation...
> You can get it in the same way as the SlingPostServlet [1] does, using
> an @Reference to a ContentImporter. Checking /system/console/services
> does show that such a ContentImporter service is available in a
> default Sling launchpad instance.
>
> The default reference options are probably good for your case, so just
>
>    @Reference
>    private ContentImporter contentImporter;
>
> should do.
>
> -Bertrand
>
> [1] http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/post/src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java