简体   繁体   English

如何远程访问apache吊索?

[英]How to access apache sling remotely?

I'm developing a Sling WCMS. 我正在开发Sling WCMS。 I need to setup Sling repo on a server computer and access remotely. 我需要在服务器计算机上设置Sling存储库并进行远程访问。

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. Sling使用Apache Jackrabbit作为其JCR内容存储库,您可以将Jackrabbit存储库配置为进行远程davex或RMI访问。

For this I think you have to supply a custom repository.xml file, as per Jackrabbit's documentation. 为此,我认为您必须根据Jackrabbit的文档提供一个自定义的repository.xml文件。

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. 但是,推荐的方法是通过Sling的RESTful界面访问内容,请参见http://sling.apache.org/site/discover-sling-in-15-minutes.html ,以快速了解其工作原理。

As pointed out in the previous answer, Sling exposes everything in the repository via REST interface. 如上一个答案所指出的那样,Sling通过REST接口公开了存储库中的所有内容。 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. 但是,如果您希望更多直接集成,可以通过RMI或DAV连接到Sling存储库。 In your client app you can use org.apache.jackrabbit.commons.JcrUtils.getRepository() to obtain a JCR repository object. 在您的客户端应用程序中,可以使用org.apache.jackrabbit.commons.JcrUtils.getRepository()获得JCR存储库对象。 This offers the closest integration with Sling an external app can get, however it is not very fast. 这提供了与外部应用程序可以获得的Sling的最紧密集成,但是速度不是很快。 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: 这是一个简单的示例,您必须根据需要调整URL并将必要的依赖项添加到类路径中:

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 也可以看看http://wiki.apache.org/jackrabbit/RemoteAccess

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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