Accessing the CRX Repository

This section describes different ways to access the CRX repository. Which method you have to use depends on where the repository is and how its communication with the outside world is set up.

Accessing a Repository via JNDI

The Java Naming and Directory Interface (JNDI) is a Java naming service. The purpose of a naming service is to translate names into addresses, much like a phone book translates names into phone numbers. The idea is that the names are easier to manage than the addresses.
The following code accesses a CRX repository that runs on the same servlet engine as the application, and that is registered using JNDI:
String lookupName = "crx";
Hashtable env = new Hashtable();
env.put("java.naming.provider.url", "http://jcr.day.com");
env.put("java.naming.factory.initial", "com.day.util.jndi.provider.MemoryInitialContextFactory");
InitialContext initial = new InitialContext(env);
Object obj = initial.lookup(lookupName);
repository = (Repository)PortableRemoteObject.narrow(obj,Repository.class);
session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()), "crx.default");

Accessing a Repository via RMI

Remote Method Invocation (RMI) is a Java technology that allows you to call Java methods from anywhere. The following code can fetch a CRX repository object from any computer you have access to:
String repoUrl = "//localhost:1234/jcrdemo"; 
Repository repository;
ClientRepositoryFactory factory = new ClientRepositoryFactory();
try {
    repository = factory.getRepository(repoUrl);
} catch (MalformedURLException e) {
    // handle exception
} catch (NotBoundException e) {
    // handle exception        
} catch (RemoteException e) {
    // handle exception
}

Note

Note: Make sure that the Java archive file crx-rmi-1.3.1.jar is in your classpath where the version number in the file corresponds to the CRX version number.

HTTP Access

You can access the CRX repository content via an HTTP request. This allows you to integrate CRX content in any application that supports an HTTP interface, and to display files in a Web browser.  

What is Returned

CRX returns the following information if you request an item (node or property):  

  • If you request a property, CRX returns the property.
  • If you request a node that has a primary item, CRX displays the primary item.
  • If you request a node that does not have a primary item, CRX displays a list of the sub items.

Note

Note: If you request a node that has a primary item, and this item is again a node with a primary item, CRX follows the entire chain of primary items and returns the first item that is either a property or does not have a primary item.

Accessing a Node

To find the path to a node, proceed as follows:  

1. Open the CRX content explorer.

2. In the node list (left), click the node you want to access via HTTP.

3. In the node properties pane (lower right), the Path shows the path to the node (without the CRX Web application path).

/content/docs/en/crx/current/developing/accessing_the_crx/jcr:content/par/13_image/file

4. Click the path to open it in the browser. The browser address bar shows the full path (including the CRX Web application path).

/content/docs/en/crx/current/developing/accessing_the_crx/jcr:content/par/15_image_0/file

Accessing a Property

To find the path to a property, proceed as follows:  

1. Find the page to the node (see previous procedure).

2. Add the property name to the node path.

/content/docs/en/crx/current/developing/accessing_the_crx/jcr:content/par/17_image_1/file

Files and Folders

The HTTP access works well for nodes of the type file and folder. For folders, it displays a list of the folder content (that you can click), and for files, it displays the file content.  

This means that files are folders are displayed and work like the HTTP view of an FTP directory, or like other Web folders.

/content/docs/en/crx/current/developing/accessing_the_crx/jcr:content/par/19_0021/file

WebDAV Access

CRX and CQ come with WebDAV support that lets you display and edit the repository content. Setting up WebDAV gives you direct access to the content repository through your desktop. Office and PDF files that are dropped into the repository through the WebDAV connection are automatically full-text indexed and can be searched with the standard search interfaces through the standard Java APIs.

Note

The instructions for using WebDAV for CRX and CQ are identical. The only difference is that CQ generally runs on port 4502 by default. Also see instructions for uploading digital assets

Connecting to WebDAV

Detailed Windows and MacOS instructions are included in this section, but essentially to connect to the default workspace of your repository using the WebDAV protocol, you point your WebDAV client to the following location:

http://localhost:7402/crx/repository/crx.default
/content/docs/en/crx/current/how_to/webdav_access/jcr:content/par/image/file

CRX displays the repository content as follows:  

  • A node of the type nt:folder is displayed as a folder. Nodes below the nt:folder node are displayed as the folder content.
  • A node of the type nt:file is displayed as a file. Nodes below the nt:file node are not displayed, but form the content of the file.

When you use WebDAV to create and edit folders and files, CRX creates and edits the necessary nt:folder and nt:file nodes. If you plan to use WebDAV to import and export content, try to work with nt:file and nt:folder node types as much as possible.

Note

Before setting up WebDAV, please check the Technical Requirements as appropriate - CRX and CQ.

Note

In CRX, you can also find instructions for setting up WebDAV on Windows and MacOS by launching CRX and clicking Work with content from desktop on the CRX Launchpad.

WebDAV URLs

The URL for the WebDAV server has the following structure:

URL part http://<host>:<port> /<crx-webapp-path> /repository /<workspace>
Example http://localhost:7402 /crx /repository /crx.default
Description Host and port, on which CRX runs Path for the CRX repository webapp Path to which WebDAV servlet is mapped Name of the workspace mapped throught this path.
By changing the workspace element in the path, you can map workspaces other than the default one (crx.default); for example, to map a workspace named staging, use the following URL:
http://localhost:7402/crx/repository/staging

Additionally, when the CRX Launchpad module is installed and enabled, CRX provides an additional, simplified WebDAV URL to connect to:

http://localhost:7402/
This URL, when mounted from the operating system level, provides WebDAV access to the default workspace (crx.default). While being simpler for the user, it does not give them the additional flexibility of specifying workspace names.

Note

The simplified CRX Launchpad URL (for example, http://localhost:7402/) is mapped to the WebDAV server module from the CRX Launchpad application. While this module is served by the same underlying WebDAV server implementation as the one in CRX repository, it might be configured slightly differently (for example, with regard to how JCR nodes are mapped to files and folders while copying content from and to the repository). These differences should not impact the majority of use cases.

Setting up WebDAV for Windows

Note

If you are setting up WebDAV for Windows Vista, WebDAV requires Service Pack 2 and some modifications to the registry. See CRX WebDAV client technical requirements or CQ WebDAV client technical requirements for detailed instructions.

Note

Windows 2003 running SP2 requires manual configuration in order for WebDAV to function. See CRX WebDAV client technical requirements or CQ WebDAV client technical requirements for more information.

To set up WebDAV in a Windows environment:

1. In My Computer, click My Network Places.

/content/docs/en/crx/current/how_to/webdav_access/jcr:content/par/image_0/file

2. Click Add a Network Place to start the wizard.

3. Select Choose another network location and click Next.

/content/docs/en/crx/current/how_to/webdav_access/jcr:content/par/image_1/file

4. Type http://localhost:7402/crx/repository/crx.default and click Next.

Note: If CRX is located on another port, use that port number instead of 7402. Also, if you are not running the content repository on your local machine, replace localhost with the respective DNS or IP address.

/content/docs/en/crx/current/how_to/webdav_access/jcr:content/par/image_2/file

5. Enter username admin and password admin. Initially, Day recommends that you use the pre-configured admin account for testing.

/content/docs/en/crx/current/how_to/webdav_access/jcr:content/par/image_3/file

6. Enter a name for the connection and click Next.

/content/docs/en/crx/current/how_to/webdav_access/jcr:content/par/image_4/file

7. Windows indicates that you have successfully added the network place. Open the network place to access your CRX repository.

/content/docs/en/crx/current/how_to/webdav_access/jcr:content/par/image_5/file

Setting up WebDAV for MacOS

To set up WebDAV with MacOS:

1. Navigate to any Finder window and click Go and Connect to Server, or press Apple+k.

2. In the Connect to Server window, type http://localhost:7402/crx/repository/crx.default. CRX prompts you for authentication.


Note

If CRX is located on another port, use that port number instead of 7402. Also, if you are not running the content repository on your local machine, replace localhost with the respective DNS or IP address. 

3. Enter username admin and password admin. Initially, Day recommends that you use the pre-configured admin account for testing.

MacOSX has now mounted CRX as a volume and you can use it like any other drive.

Setting up WebDAV for Linux

To set up WebDAV with Linux (Gnome):

1. In Nautilus (file explorer), select Places and select Connect to Server.

2. In the Connect to Server window, select WebDAV (HTTP) in Service Type.

3. In Server, type http://localhost:7402/crx/repository/crx.default.

Note: If CRX is located on another port, use that port number instead of 7402. Also, if you are not running the content repository on your local machine, replace localhost with the respective DNS or IP address.

4. In Folder, type /dav.

5. Enter your username admin. Initially, Day recommends that you use the pre-configured admin account for testing.

6. Leave the port blank and enter any name for your connection.

7. Click Connect. CRX prompts you for your password.

8. Enter the password and click Connect. Linux GNOME has now mounted CRX as a volume and you can use it like any other drive.

To set up WebDAV with Linux (KDE):

1. Open the Network Folder wizard.

2. Select WebFolder (webdav) and click Next.

3. In Name, type a connection name.

4. In User, type admin. Initially, Day recommends that you use the pre-configured admin account.

5. In Server, type http://localhost:7402/crx/repository/crx.default.

Note: If CRX is located on another port, use that port number instead of 7402. Also, if you are not running the content repository on your local machine, replace localhost with the respective DNS or IP address.

6. In Folder, type dav.

7. Click Save and Connect. CRX prompts you for your password.

8. Enter the password and click Connect. Linux KDE has now mounted CRX as a volume and you can use it like any other drive.


Your comments are welcome!
Did you notice a way we could improve the documentation on this page? Is something unclear or insufficiently explained? Please leave your comments below and we will make the appropriate changes. Comments that have been addressed, by improving the documentation accordingly, will then be removed.
(optional)
No comments yet
In order to post a comment, you need to sign-in.
 

Forgotten your password? Reset the password here.

Note: Customers with DayCare user accounts need to create a new account for use on day.com.

***

Copyright © 1993-2010 Day Management AG. All rights reserved.