| 1 |
<%@ page import="java.net.URI"%><%-- |
| 2 |
Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 |
contributor license agreements. See the NOTICE file distributed with |
| 4 |
this work for additional information regarding copyright ownership. |
| 5 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 |
(the "License"); you may not use this file except in compliance with |
| 7 |
the License. You may obtain a copy of the License at |
| 8 |
|
| 9 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 10 |
|
| 11 |
Unless required by applicable law or agreed to in writing, software |
| 12 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 13 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 |
See the License for the specific language governing permissions and |
| 15 |
limitations under the License. |
| 16 |
--%><%@page import="org.apache.jackrabbit.util.Text"%><% |
| 17 |
request.setAttribute("title", "Remote Repository Access"); |
| 18 |
|
| 19 |
URI uri = new URI(request.getRequestURL().toString()); |
| 20 |
String base = |
| 21 |
uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort() |
| 22 |
+ request.getContextPath(); |
| 23 |
base = Text.encodeIllegalXMLCharacters(base); |
| 24 |
%><jsp:include page="header.jsp"/> |
| 25 |
<p> |
| 26 |
The content repository within this web application is made available |
| 27 |
to remote clients through |
| 28 |
<a href="http://java.sun.com/javase/technologies/core/basic/rmi/">RMI</a> |
| 29 |
and the <em>jackrabbit-jcr-rmi</em> component. |
| 30 |
<p> |
| 31 |
<p> |
| 32 |
The remote repository stub is available both in the RMI registry |
| 33 |
(one is started automatically by this web application if not already running) |
| 34 |
and as a direct HTTP download. The default URLs for accessing the remote |
| 35 |
repository are: |
| 36 |
</p> |
| 37 |
<ul> |
| 38 |
<li>RMI registry: //localhost/jackrabbit.repository</li> |
| 39 |
<li>HTTP download: <%= base %>/rmi</li> |
| 40 |
</ul> |
| 41 |
<p> |
| 42 |
Note that the above URLs are the defaults. You can disable or change them |
| 43 |
by modifying the /WEB-INF/web.xml deployment descriptor. |
| 44 |
</p> |
| 45 |
|
| 46 |
<h3>Accessing the remote repository</h3> |
| 47 |
<p> |
| 48 |
To access the remote content repository you need to use the |
| 49 |
<em>jackrabbit-jcr-rmi</em> component in your application. If you use |
| 50 |
Maven 2, you can declare the JCR and jackrabbit-jcr-rmi dependencies |
| 51 |
like this: |
| 52 |
</p> |
| 53 |
<pre><dependency> |
| 54 |
<groupId>javax.jcr</groupId> |
| 55 |
<artifactId>jcr</artifactId> |
| 56 |
<version>1.0</version> |
| 57 |
</dependency> |
| 58 |
<dependency> |
| 59 |
<groupId>org.apache.jackrabbit</groupId> |
| 60 |
<artifactId>jackrabbit-jcr-rmi</artifactId> |
| 61 |
<version>1.4</version> |
| 62 |
</dependency> |
| 63 |
</pre> |
| 64 |
<p> |
| 65 |
With that dependency in place, you can use either the RMI registry or |
| 66 |
the direct HTTP download to access the repository. |
| 67 |
</p> |
| 68 |
<p> |
| 69 |
The required code for accessing the repository using the RMI registry is: |
| 70 |
</p> |
| 71 |
<pre> |
| 72 |
<b>import</b> javax.jcr.Repository; |
| 73 |
<b>import</b> org.apache.jackrabbit.rmi.repository.RMIRemoteRepository; |
| 74 |
|
| 75 |
Repository repository = |
| 76 |
<b>new</b> RMIRemoteRepository("<em>//localhost/jackrabbit.repository</em>"); |
| 77 |
</pre> |
| 78 |
<p> |
| 79 |
The required code for accessing the repository using the RMI registry is: |
| 80 |
</p> |
| 81 |
<pre> |
| 82 |
<b>import</b> javax.jcr.Repository; |
| 83 |
<b>import</b> org.apache.jackrabbit.rmi.repository.URLRemoteRepository; |
| 84 |
|
| 85 |
Repository repository = |
| 86 |
<b>new</b> URLRemoteRepository("<em><%= base %>/rmi</em>"); |
| 87 |
</pre> |
| 88 |
<p> |
| 89 |
See the <a href="http://jcp.org/en/jsr/detail?id=170">JCR specification</a> |
| 90 |
and the |
| 91 |
<a href="http://www.day.com/maven/jsr170/javadocs/jcr-1.0/javax/jcr/Repository.html">Repository</a> |
| 92 |
javadoc for details on what to do with the acquired Repository instance. |
| 93 |
</p> |
| 94 |
|
| 95 |
<h3>Remote access performance</h3> |
| 96 |
<p> |
| 97 |
Note that the design goal of the current jackrabbit-jcr-rmi component |
| 98 |
is correct and complete functionality instead of performance, so you should |
| 99 |
not rely on remote access for performance-critical applications. |
| 100 |
</p> |
| 101 |
<p> |
| 102 |
You may want to look at the Jackrabbit clustering feature for best |
| 103 |
performance for concurrently accessing the repository on multiple separate |
| 104 |
servers. |
| 105 |
</p> |
| 106 |
<jsp:include page="footer.jsp"/> |