<<O>>  Difference Topic SrbUtils (r1.5 - 05 Mar 2007 - MikeSmorul)

META TOPICPARENT WebHome

SRB Servlet

Line: 161 to 161

Changed:
<
<
META FILEATTACHMENT adapt-srb.jar attr="h" comment="" date="1163793811" path="adapt-srb.jar" size="21483" user="MikeSmorul" version="1.2"
>
>
META FILEATTACHMENT adapt-srb.jar attr="h" comment="" date="1173111603" path="adapt-srb.jar" size="21671" user="MikeSmorul" version="1.3"

META FILEATTACHMENT login.jsp attr="h" comment="" date="1163796238" path="login.jsp" size="1419" user="MikeSmorul" version="1.1"
META FILEATTACHMENT login.txt attr="h" comment="" date="1163796345" path="login.txt" size="1419" user="MikeSmorul" version="1.1"
 <<O>>  Difference Topic SrbUtils (r1.4 - 06 Dec 2006 - MikeSmorul)

META TOPICPARENT WebHome

SRB Servlet

Line: 16 to 16

http://server.com/SrbServlet/zoneA/home/user.domain/file_or_directory

Changed:
<
<
The SrbServlet is the location of the servlet in your webapp and /zoneA/home/user.domain/file_or_directory is the full path to a file in the SRB.
>
>
The SrbServlet is the location of the servlet in your webapp and /zoneA/home/user.domain/file_or_directory is the full path to a file in the SRB. As the URL's are relatively static, it's easy to throw the servlet behind a proxy and achieve a fairly high performance srb-backed webapp.

Usage

 <<O>>  Difference Topic SrbUtils (r1.3 - 17 Nov 2006 - MikeSmorul)

META TOPICPARENT WebHome

SRB Servlet

Changed:
<
<

Overview

>
>

Overview


The servlet provides url-based access to items in the SRB. This will allow you to access the srb as follows:

Line: 10 to 18

The SrbServlet is the location of the servlet in your webapp and /zoneA/home/user.domain/file_or_directory is the full path to a file in the SRB.

Changed:
<
<

Usage

>
>

Usage


Setup tomcat or your webapp container of choice and create a new web app. Drop the jargon.jar and adapt-srb.jar files listed below into your webapp's WEB-INF/lib directory. In the WEB-INF/web.xml for your web app, add the following lines.

Line: 23 to 32

edu.umiacs.srb.servlet.SimpleConnectionFactory
Changed:
<
<
srb.user
>
>
srb_user

username
Changed:
<
<
srb.mcat
>
>
srb_mcat

mcat.host.com <!-- srb.port is optional -->
Changed:
<
<
srb.port
>
>
srb_port

7618
Changed:
<
<
srb.pass
>
>
srb_pass

password
Changed:
<
<
srb.zone
>
>
srb_zone

zoneA
Changed:
<
<
srb.domain
>
>
srb_domain

domain
Line: 56 to 65

You will now be able to go to http://your_site.com/Browse/ (ie http://localhost:8080/Browse) and see the same directories listed as if you would have done a 'Sls /'

Changed:
<
<

Additional Configuration

>
>

Detailed Servlet Configuration


The webapp is composed of two parts, first is the servlet queries the srb and returns files or directory listings. The second is a factory that creates an actual connection to the srb. The factory can be switched out at any time by editing the edu.umiacs.srb.connectionfactory parameter in your web.xml and specifying your own implementation of edu.umiacs.srb.servlet.ConnectionFactory.

Line: 69 to 79

edu.umiacs.srb.mimeLookup
(Optional) true/false, if true use the mime information in the srb to determine mime type, otherwise use java's built-in functions. This may slow down retrievals
edu.umiacs.srb.showDirectories
(Optional) true/false, allow srb directory listings, return 403 if false, default true
Changed:
<
<

The simple connection factory uses the same parameters to create connections to the srb. These parameters are passed by the servlet from the init-param list above. To use this, you would set the following in your web.xml

>
>

Simple Connection Factory

The simple connection factory uses a set of static parameters to create connections to the srb. These parameters are passed by the servlet from the init-param list above. To enable this factory, you would set the following in your web.xml

        <init-param>
            <param-name>edu.umiacs.srb.connectionfactory</param-name>
Line: 80 to 91

Parameters to configure the default factory:

Changed:
<
<
srb.mcat
SRB Mcat to connect to
srb.user
srb username to connect as
srb.pass
password for the username
srb.domain
domain of the username
srb.zone
home zone of the username

srb.path
(Optional) home directory, defaults to '/'
srb.port
(Optional) port to use on the mcat host, defaults to 5544
srb.resource
(Optional) resource to use when uploading items, default 'null'
>
>
srb_mcat
SRB Mcat to connect to
srb_user
srb username to connect as
srb_pass
password for the username
srb_domain
domain of the username
srb_zone
home zone of the username

srb_path
(Optional) home directory, defaults to '/'
srb_port
(Optional) port to use on the mcat host, defaults to 5544
srb_resource
(Optional) resource to use when uploading items, default 'null'

Session Connection Factory

The session connection factory pulls information for configuring the srb connection out of a current session rather than statically from the servlet initialization parameters. Since the items are in the session, there is a little more qork required to configure. First there is also a login servlet in the package that will allow you to take items from an html form and set them in the users context, Second, a simple filter needs to be setup to give the factory access to the current http session.

First, add the following to your web.xml. This will configure the filter and register the SrbLoginServlet. You can use your own login method to fill out the session. The session connection factory just looks for the srb configuration items listed above in the session.

    <!-- Filter to bridge a clients session to the factory -->
    <filter>
        <filter-name>SessionFilter</filter-name>
        <filter-class>edu.umiacs.srb.servlet.ThreadLocalSessionFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>SessionFilter</filter-name>
        <url-pattern>/*</url-pattern>
        </filter-mapping>
    <!-- Configure the login servlet -->
    <servlet>
        <servlet-name>SrbLoginServlet</servlet-name>
        <servlet-class>edu.umiacs.srb.servlet.SrbLoginServlet</servlet-class>
        <!-- This determines where successfully logged in clients get redirected to -->
        <init-param>
            <param-name>edu.umiacs.srb.successPage</param-name>
            <param-value>Browse2</param-value>
        </init-param>
        <!-- This determines where failes clientc get redirected to -->
        <init-param>
            <param-name>edu.umiacs.srb.failurePage</param-name>
            <param-value>login.jsp</param-value>
        </init-param>
        </servlet>
    <!-- Configure browse servlet with the SessionConnectionFactory -->
    <servlet>
        <servlet-name>Browse2</servlet-name>
        <servlet-class>edu.umiacs.srb.servlet.Browse</servlet-class>
        <init-param>
            <param-name>edu.umiacs.srb.connectionfactory</param-name>
            <param-value>edu.umiacs.srb.servlet.SessionConnectionFactory</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>SrbLoginServlet</servlet-name>
        <url-pattern>/SrbLoginServlet</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Browse2</servlet-name>
        <url-pattern>/Browse2/*</url-pattern>
    </servlet-mapping>

Second, If you're using the login servlet, you will need to create a simple login page. The following shows a sample jsp file that will ask for a username/password and redirect users to the browse servlet if they are successfully in logging in. You can download the jsp file here


Changed:
<
<

Files

>
>

Files


  • adapt-srb.jar: Servlet library, requires tomcat or other servlet container and the srb software
  • Jargon: Jargon srb software, required for the servlet
Deleted:
<
<
-- MikeSmorul - 16 Nov 2006

Changed:
<
<
META FILEATTACHMENT adapt-srb.jar attr="h" comment="" date="1163704563" path="adapt-srb.jar" size="12338" user="MikeSmorul" version="1.1"
>
>
META FILEATTACHMENT adapt-srb.jar attr="h" comment="" date="1163793811" path="adapt-srb.jar" size="21483" user="MikeSmorul" version="1.2"
META FILEATTACHMENT login.jsp attr="h" comment="" date="1163796238" path="login.jsp" size="1419" user="MikeSmorul" version="1.1"
META FILEATTACHMENT login.txt attr="h" comment="" date="1163796345" path="login.txt" size="1419" user="MikeSmorul" version="1.1"
 <<O>>  Difference Topic SrbUtils (r1.2 - 17 Nov 2006 - MikeSmorul)

META TOPICPARENT WebHome

SRB Servlet

Line: 62 to 62

Parameters to configure the servlet:

Changed:
<
<
  • edu.umiacs.srb.connectionfactory - full name of class that implements edu.umiacs.srb.servlet.ConnectionFactory
  • edu.umiacs.srb.fileNotFound - (Optional) Message to display if a file/directory does not exist
  • edu.umiacs.srb.directoryForbidden - (Optional) Message displayed if a directory listing is forbidden
  • edu.umiacs.srb.fileForbidden - (Optional) Message displayed if a file is forbidden
  • edu.umiacs.srb.mimeLookup - (Optional) true/false, if true use the mime information in the srb to determine mime type, otherwise use java's built-in functions. This may slow down retrievals
  • edu.umiacs.srb.showDirectories - (Optional) true/false, allow srb directory listings, return 403 if false, default true
>
>
edu.umiacs.srb.connectionfactory
full name of class that implements edu.umiacs.srb.servlet.ConnectionFactory
edu.umiacs.srb.fileNotFound
(Optional) Message to display if a file/directory does not exist
edu.umiacs.srb.directoryForbidden
(Optional) Message displayed if a directory listing is forbidden
edu.umiacs.srb.fileForbidden
(Optional) Message displayed if a file is forbidden
edu.umiacs.srb.mimeLookup
(Optional) true/false, if true use the mime information in the srb to determine mime type, otherwise use java's built-in functions. This may slow down retrievals
edu.umiacs.srb.showDirectories
(Optional) true/false, allow srb directory listings, return 403 if false, default true

The simple connection factory uses the same parameters to create connections to the srb. These parameters are passed by the servlet from the init-param list above. To use this, you would set the following in your web.xml

Line: 80 to 80

Parameters to configure the default factory:

Changed:
<
<
  • srb.mcat - SRB Mcat to connect to
  • srb.user - srb username to connect as
  • srb.pass - password for the username
  • srb.domain - domain of the username
  • srb.zone - home zone of the username

  • srb.path - (Optional) home directory, defaults to '/'
  • srb.port - (Optional) port to use on the mcat host, defaults to 5544
  • srb.resource - (Optional) resource to use when uploading items, default 'null'
>
>
srb.mcat
SRB Mcat to connect to
srb.user
srb username to connect as
srb.pass
password for the username
srb.domain
domain of the username
srb.zone
home zone of the username

srb.path
(Optional) home directory, defaults to '/'
srb.port
(Optional) port to use on the mcat host, defaults to 5544
srb.resource
(Optional) resource to use when uploading items, default 'null'

Files

 <<O>>  Difference Topic SrbUtils (r1.1 - 16 Nov 2006 - MikeSmorul)
Line: 1 to 1
Added:
>
>
META TOPICPARENT WebHome

SRB Servlet

Overview

The servlet provides url-based access to items in the SRB. This will allow you to access the srb as follows:

http://server.com/SrbServlet/zoneA/home/user.domain/file_or_directory

The SrbServlet is the location of the servlet in your webapp and /zoneA/home/user.domain/file_or_directory is the full path to a file in the SRB.

Usage

Setup tomcat or your webapp container of choice and create a new web app. Drop the jargon.jar and adapt-srb.jar files listed below into your webapp's WEB-INF/lib directory. In the WEB-INF/web.xml for your web app, add the following lines.

    <servlet>
        <servlet-name>Browse</servlet-name>
        <servlet-class>edu.umiacs.srb.servlet.Browse</servlet-class>
        <init-param>
            <param-name>edu.umiacs.srb.connectionfactory</param-name>
            <param-value>edu.umiacs.srb.servlet.SimpleConnectionFactory</param-value>
        </init-param>
        <init-param>
            <param-name>srb.user</param-name>
            <param-value>username</param-value>
        </init-param>
        <init-param>
            <param-name>srb.mcat</param-name>
            <param-value>mcat.host.com</param-value>
        </init-param>
        <!-- srb.port is optional -->
        <init-param>
            <param-name>srb.port</param-name>
            <param-value>7618</param-value>
        </init-param>
        <init-param>
            <param-name>srb.pass</param-name>
            <param-value>password</param-value>
        </init-param>
        <init-param>
            <param-name>srb.zone</param-name>
            <param-value>zoneA</param-value>
        </init-param>
        <init-param>
            <param-name>srb.domain</param-name>
            <param-value>domain</param-value>
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>Browse</servlet-name>
        <url-pattern>/Browse/*</url-pattern>
    </servlet-mapping>

You will now be able to go to http://your_site.com/Browse/ (ie http://localhost:8080/Browse) and see the same directories listed as if you would have done a 'Sls /'

Additional Configuration

The webapp is composed of two parts, first is the servlet queries the srb and returns files or directory listings. The second is a factory that creates an actual connection to the srb. The factory can be switched out at any time by editing the edu.umiacs.srb.connectionfactory parameter in your web.xml and specifying your own implementation of edu.umiacs.srb.servlet.ConnectionFactory.

Parameters to configure the servlet:

  • edu.umiacs.srb.connectionfactory - full name of class that implements edu.umiacs.srb.servlet.ConnectionFactory
  • edu.umiacs.srb.fileNotFound - (Optional) Message to display if a file/directory does not exist
  • edu.umiacs.srb.directoryForbidden - (Optional) Message displayed if a directory listing is forbidden
  • edu.umiacs.srb.fileForbidden - (Optional) Message displayed if a file is forbidden
  • edu.umiacs.srb.mimeLookup - (Optional) true/false, if true use the mime information in the srb to determine mime type, otherwise use java's built-in functions. This may slow down retrievals
  • edu.umiacs.srb.showDirectories - (Optional) true/false, allow srb directory listings, return 403 if false, default true

The simple connection factory uses the same parameters to create connections to the srb. These parameters are passed by the servlet from the init-param list above. To use this, you would set the following in your web.xml

        <init-param>
            <param-name>edu.umiacs.srb.connectionfactory</param-name>
            <param-value>edu.umiacs.srb.servlet.SimpleConnectionFactory</param-value>
        </init-param>

Parameters to configure the default factory:

  • srb.mcat - SRB Mcat to connect to
  • srb.user - srb username to connect as
  • srb.pass - password for the username
  • srb.domain - domain of the username
  • srb.zone - home zone of the username

  • srb.path - (Optional) home directory, defaults to '/'
  • srb.port - (Optional) port to use on the mcat host, defaults to 5544
  • srb.resource - (Optional) resource to use when uploading items, default 'null'

Files

  • adapt-srb.jar: Servlet library, requires tomcat or other servlet container and the srb software
  • Jargon: Jargon srb software, required for the servlet

-- MikeSmorul - 16 Nov 2006

META FILEATTACHMENT adapt-srb.jar attr="h" comment="" date="1163704563" path="adapt-srb.jar" size="12338" user="MikeSmorul" version="1.1"
View topic | Diffs | r1.5 | > | r1.4 | > | r1.3 | More
Revision r1.1 - 16 Nov 2006 - 19:26 - MikeSmorul
Revision r1.5 - 05 Mar 2007 - 16:20 - MikeSmorul