Examples


Pax Web includes a set of examples that demonstrates its usage.

Hello World (Http Service usage)

This example shows you how to register a servlet and resources using the standard Http Service. Source code can be found in SVN.
Once the example is started (see below) you can point your web browser to http://localhost:8080/helloworld/hs.

You can simply start the example by using Pax Runner using one of the two methods below:

Download the provision file
  1. Download https://scm.ops4j.org/repos/ops4j/projects/pax/web/samples/provision/src/main/resources/sample-helloworld-hs.bundles to an arbitrary location
  2. Start Pax Runner from the directory you have downloaded the provision file:
    pax-run sample-helloworld-hs.bundles
    
Direct
pax-run scan-file:jar:mvn:org.ops4j.pax.web.samples/provision!/sample-helloworld-hs.bundles

Hello World (Web Container usage (extended http service))

This example shows you how to register servlets, resources, filters, listeners and error pages using the extended Http Service, WebContainer. Source code can be found in SVN.
Once the example is started (see bellow) you can point your web browser to

To verify that the listener (a ServletRequestListener is working you can repeat the request and check out the bottom of the page that displays a counter for the request made to the server.

You can simply start the example by using Pax Runner using one of the two methods below:

Download the provision file
  1. Download https://scm.ops4j.org/repos/ops4j/projects/pax/web/samples/provision/src/main/resources/sample-helloworld-wc.bundles to an arbitrary location
  2. Start Pax Runner from the directory you have downloaded the provision file:
    pax-run sample-helloworld-wc.bundles
    
Direct
pax-run scan-file:jar:mvn:org.ops4j.pax.web.samples/provision!/sample-helloworld-wc.bundles

Hello World (JSP support (extended http service))

This example shows you how to register jsps using the extended Http Service, WebContainer. Source code can be found in SVN.
Once the example is started (see bellow) you can point your web browser to

You can simply start the example by using Pax Runner using one of the two methods below:

Download the provision file
  1. Download https://scm.ops4j.org/repos/ops4j/projects/pax/web/samples/provision/src/main/resources/sample-helloworld-jsp.bundles to an arbitrary location
  2. Start Pax Runner from the directory you have downloaded the provision file:
    pax-run sample-helloworld-jsp.bundles
    
Direct
pax-run scan-file:jar:mvn:org.ops4j.pax.web.samples/provision!/sample-helloworld-jsp.bundles

Backup Department Store example

This example shows you standard Http Service usage via the Department Store example from Backup. Source code can be found in SVN.
Once the example is started (see bellow) you can point your web browser to http://localhost:8080/deptStore.

You can simply start the example by using Pax Runner using one of the two methods bellow:

Download the provision file
  1. Download https://scm.ops4j.org/repos/ops4j/projects/pax/web/samples/provision/src/main/resources/sample-deptstore.bundles to an arbitrary location
  2. Start Pax Runner from the directory you have downloaded the provision file:
    pax-run sample-deptstore.bundles
    
Direct
pax-run scan-file:jar:mvn:org.ops4j.pax.web.samples/provision!/sample-deptstore.bundles

Content