To use Scopes you need:
- a Java 5.0 runtime environment, such as Sun JRE 5.0;
- a servlet container (2.3 probably), such as Tomcat.
Building the source
To build Scopes from source you need to have Apache ant installed.
Extract the downloaded package, go in its root directory and type:
When it's finished, under the "dist" directory you will find the "scopes.jar" file that you will need to copy in the correct place (see the rest of this document).
Use in your web application
Here you will find how to use Scopes in your web application, everything without changing your code!
Using the base version of Scopes
To use Scopes in your web application you need to:
- extract the binary release;
- copy the "scopes.jar" file in the directory [webapp_root]/WEB-INF/lib;
- copy "lib/commons-io.jar" in [webapp_root]/WEB-INF/lib, or download the latest version from Jakarta Commons I/O site.
- configure the CompleteHttpScopesFilter in front of
your servlet, by modifying your "web.xml" file:
<filter> <filter-name>scopesFilter</filter-name> <filter-class>net.sourceforge.scopes.filters.CompleteScopesHttpFilter</filter-class> <init-param> <param-name>manager-scope-names</param-name> <param-value>request,session,application</param-value> </init-param> <init-param> <param-name>manager-class-names</param-name> <param-value> net.sourceforge.scopes.managers.impl.RequestScopeManager, net.sourceforge.scopes.managers.impl.SessionScopeManager, net.sourceforge.scopes.managers.impl.ApplicationScopeManager </param-value> </init-param> </filter> <filter-mapping> <filter-name>scopesFilter</filter-name> <servlet-name>myServletName</servlet-name> </filter-mapping>
- That's it! For the use see the Quick start. Obviously this is the simplest case, if you want to use some custom scopes such as the new "window" scope, follow the following part of this page.
Using Scopes with additional scopes
To use Scopes with the additional scopes support provided inside the main package, see More scopes
Installation of the test web application
Simply deploy the "scopes-test.war" of the test web application distribution. If you want you can build it from source by typing:
in the distribution directory.