How to access data in Instant JChem using URLs

This document describes how to access data in IJC using a URL. This lets you do things like:

  • Send an email containing an IJC URL so that when user clicks on the link IJC opens and displays the appropriate data.

  • Provide links in web pages that open IJC and take you to a particular set of data.
    IJC URLs operate on two different levels:

  1. They can refer to data in a shared project using information in any of the databases that are defined in this shared project. In this mode a URL can be generated by one person and used by a different person in their own copy of IJC. To use this mechanism a shared project must be set up.

  2. The information in a shared project can be referred to using a HTTP based URL. In this mode a Java Web Start installation of IJC can be referred to so that clicking on the link for the URL (e.g. in an email or web page) loads IJC, opens the shared project and then opens the data that is specified. To use this mechanism the administrator needs to install the IJC UrlWepApp application to your web server as well as the shared projects. For examples of this in action see the demo page .

What you need

IJC URLs are used with shared projects. Only by using a shared project is it possible for a URL to refer to the same thing in different running copies of IJC. To deploy a shared project you need a standard HTTP server.

You must have an IJC enterprise license to deploy shared projects and use IJC URLs.

To deploy the web application that provides the HTTP URLs (mechanism 2 above) you must have a web server that supports Servlets (e.g. Tomcat or most other J2EE servers). You must also deploy the Java Web Start version of IJC to your server.

Steps

The exact steps you need to follow depends on which mechanism you are using. See above for details.

1. Prepare the shared project files

Create the .ijp and .zip files that are needed for shared project configurations. See here for details of these files. Do not deploy these files yet.

2. Deploy the UrlWebApp application to your server

The UrlWebApp application is contained in the file UrlWebApp.war that can be downloaded from here: UrlWebApp.war .

Recommended: If you have a servlet container that supports Servlet 2.4/JSP 2.0 or later, such as Glassfish, Tomcat 5, JBoss, Jetty 6, etc., then you can deploy URLWebApp.war as you would any WAR file. e.g. to install on Tomcat, simply copy UrlWebApp.war to $TOMCAT_HOME/webapps, then access http://yourhost.com:8080/URLWebApp/ for further instructions.

Alternative: If you do not have a servlet container such as Tomcat you can alternatively run the server application directly from the command line:

java -jar UrlWebApp.war

This starts a web server contained within the UrlWebApp.war file. More details and possible command line arguments can be found here .

Once deployed connect to the server with a web browser using a URL like this:

http://yourhost.com:8080/UrlWebApp/

from the server machine.

Follow the exact instructions on the page UrlWebApp regarding folders, repeated here for simplicity:

  1. Download

    jws-url.zip

    from IJC download page . This file also contains the InstantJChem Java Web Start distribution.

  2. Unzip the downloaded file to the folder and it should create several items for you:

    $\{HOME\}/.instantjchem/jnlpwebApp

    1. A folder named 'JWS' and contains a number of important files. 2. A folder named 'data'. 3. A file named extra.properties. The folder

    $\{HOME\}/.instantjchem/jnlpwebApp

    can be configured using the ijc.data.dir property in this WebApplication's WEB-INF/web.xml file (this means you need to unzip the UrlWebApp.war file, edit the web.xml file, and then re-zip the files to recreate the UrlWebApp.war file).

  3. Copy the ChemAxon license file to:

    $\{HOME\}/.instantjchem/jnlpwebApp/data/license.cxl
  4. The extra.properties file is used in case that you forward url from a webserver (e.g. Apache, IIS, Lighttpd) to java webserver with the deployed

    UrlWebApp.war

    Edit the extra.properties and set the "base.url" property to be

    http://yourhost.com:8080/UrlWebApp/

    For example the UrlWebApp is installed to:

    http://javaserver:8080/UrlWebApp/

    Your apache server forward request from

    http://myapacheserver/urldemo/

    to

    http://javaserver:8080/UrlWebApp/

    User wants to type to web browser url like

    http://myapacheserver/urldemo/prj1.jnlp

    In this case you have to put to the file

    $\{HOME\}/.instantjchem/jnlpwebApp/extra.properties

    this property:

    base.url=http://myapacheserver/urldemo

    If everything is configured correctly InstantJChem will be started and the demo project opened after going to the URL

    http://yourhost.com:8080/UrlWebApp/demo.jnlp?startJnlp

    in your web browser (This is the link in the UrlWebApp page). You can now deploy your own shared project prepared in the section 1. The two files that are prepared for shared project (e.g. prj.ijp and prj.zip ) should be copied to

    $\{HOME\}/.instantjchem/jnlpwebApp/data/

    You may need to refresh the page

    http://yourhost.com:8080/UrlWebApp/

    in order to see any new link for your shared project. The project

    prj.ijp

    is opened in InstantJChem after typing

    http://yourhost.com:8080/UrlWebApp/prj.jnlp?startJnlp

    to web browser. You can also open the project in InstantJChem by File->Open Shared Project action from main menu. The demo project can be removed by deleting

    demo.ijp

    and

    demo.zip

    files from folder with projects.

Structure of folder with configurations data

$\{HOME\}/.instantjchem/jnlpwebApp
  • data/

    - folder with deployed shared projects,

    license.cxl

    and html pages. You can change the default index page of the UrlWebApp application by changing the

    index.html

    file.

  • jws/

    - folder with InstantJChem JWS distribution. You can modify startup options of InstantJChem in

    master.jnlp

    file. Available parameters are listed here .

  • extra.properties

    allows to specify base url of web application. It has been described in previous instructions.

3. Generate IJC URLs

Once installed IJC URLs can be used. Create these using the 'Generate URL' function within IJC. See the user documentation for more details.

How to update already installed distribution

  1. Download

    jws-url.zip

    from here . This file also contains the InstantJChem Java Web Start distribution.

  2. Unzip the downloaded file to the temporary folder.

  3. Customize

    jws/info.properties

    configuration file. If you want to deploy installation folder and user dir of InstantJChem to the same folder on client like in previous Java Web Start distribution you can replace

    __ijc_version

    property with the existing in

    $\{HOME\}/.instantjchem/jnlpwebApp/jws

    file. You can also uncomment line

      #obsolete_versions=5.4,5.5

    and specify that previously installed InstantJChem JWS versions will be deleted on client machines.

  4. Copy

      info.properties
      instantjchem.zip
      JNLPInstaller.jar

    files from

    jws

    folder to:

    $\{HOME\}/.instantjchem/jnlpwebApp/jws

    folder. If you want to use the same installation folder and user dir of

    How to use centralized InstantJChem installation

    In case you don't want to download InstantJChem installation by all users you can use centralized InstantJChem installation (e.g. deployed to network drive). The folder with ijc installation can be specified in info.properties by property

    existing_install_dir

    If the folder is not found on client machine InstantJChem will be downloaded. It's possible to use platform dependent path for InstantJchem installation by using these three properties:

  • existing_install_dir.linux

  • existing_install_dir.windows

  • existing_install_dir.macos

Problems?

If you find problems or have any questions then please report them to the IJC freshdesk.