简体   繁体   中英

How to access apache sling remotely?

I'm developing a Sling WCMS. I need to setup Sling repo on a server computer and access remotely.

How can I access sling repo remotely? Is there special configuration?

Thanks.

Sling uses Apache Jackrabbit as its JCR content repository, you could configure the Jackrabbit repository for remote davex or RMI access.

For this I think you have to supply a custom repository.xml file, as per Jackrabbit's documentation.

However, the recommended way is to access content via Sling's RESTful interface, see http://sling.apache.org/site/discover-sling-in-15-minutes.html for a quick overview of how that works.

As pointed out in the previous answer, Sling exposes everything in the repository via REST interface. That might be the easiest way to access the data.

However, if you are looking for more of a direct integration, you can connect to the Sling repo via RMI or DAV. In your client app you can use org.apache.jackrabbit.commons.JcrUtils.getRepository() to obtain a JCR repository object. This offers the closest integration with Sling an external app can get, however it is not very fast. Depending on your network connection to the server, it might be unusable.

Here's a simple example, you'll have to adapt the URL to your needs and add the necessary dependencies to your classpath:

Repository repository = JcrUtils.getRepository("http://localhost:4502/crx/server");
Session session = repository.login(new SimpleCredentials("user", "password"))
// Use session...

Also have a look at http://wiki.apache.org/jackrabbit/RemoteAccess

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM