SRB Servlet | ||||||||
| Line: 161 to 161 | ||||||||
|---|---|---|---|---|---|---|---|---|
| Changed: | ||||||||
| < < |
| |||||||
| > > |
| |||||||
| ||||||||
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 | ||||||||
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 | ||||||||||
|
| ||||||||||
| Changed: | ||||||||||
| < < |
| |||||||||
| > > |
| |||||||||
|
| ||||||||||
| Changed: | ||||||||||
| < < |
| |||||||||
| > > |
| |||||||||
|
| ||||||||||
| Changed: | ||||||||||
| < < |
| |||||||||
| > > |
| |||||||||
|
| ||||||||||
| Changed: | ||||||||||
| < < |
| |||||||||
| > > |
| |||||||||
|
| ||||||||||
| Changed: | ||||||||||
| < < |
| |||||||||
| > > |
| |||||||||
|
| ||||||||||
| Changed: | ||||||||||
| < < |
| |||||||||
| > > |
| |||||||||
|
| ||||||||||
| 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 | ||||||||||
| ||||||||||
| 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 FactoryThe 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: | ||||||||||
| < < |
| |||||||||
| > > |
Session Connection FactoryThe 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 | |||||||||
| ||||||||||
| Deleted: | ||||||||||
| < < |
-- MikeSmorul - 16 Nov 2006 | |||||||||
| Changed: | ||||||||||
| < < |
| |||||||||
| > > |
| |||||||||
SRB Servlet | ||||||||
| Line: 62 to 62 | ||||||||
|---|---|---|---|---|---|---|---|---|
| Parameters to configure the servlet: | ||||||||
| 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 | ||||||||
| Line: 80 to 80 | ||||||||
| Parameters to configure the default factory: | ||||||||
| Changed: | ||||||||
| < < |
| |||||||
| > > |
| |||||||
Files | ||||||||
| Line: 1 to 1 | ||||||||
|---|---|---|---|---|---|---|---|---|
| Added: | ||||||||
| > > |
SRB ServletOverviewThe 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 TheSrbServlet 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.
UsageSetup 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 ConfigurationThe 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 theedu.umiacs.srb.connectionfactory parameter in your web.xml and specifying your own implementation of edu.umiacs.srb.servlet.ConnectionFactory.
Parameters to configure the servlet:
<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:
Files
| |||||||