# Resource Configuration Reload Example

This example demonstrates how to create a simple Jersey application with resource reloading capability using Grizzly HTTP Server container.

## Contents

The mapping of the URI path space is presented in the following table:

URI path | Resource class | Content | HTTP methods
--- | --- | --- | ---
/flights/arrivals | org.glassfish.jersey.examples.reload.ArrivalsResource | Dummy Arrivals Information | GET
/flights/departures | org.glassfish.jersey.examples.reload.DeparturesResource | Dummy Departures Information | GET
/flights/stats | org.glassfish.jersey.examples.reload.StatsResource | Statistics on application resource utilization | GET

The application gets configured via a plain text file named `resources`. The file contains a list of resource classes to be published by the application. After the application gets started, it checks the file regularily each 2 seconds and reloads the application as file updates are being detected.

## Running the Example

Run the example as follows:

>     mvn clean compile exec:java

This deploys current example using Grizzly container. StatsResource should be available at http://localhost:8080/flights/stats

You may want to check the other resources as well:

- http://localhost:8080/flights/departures
- http://localhost:8080/flights/arrivals

Updated information on number of hits should be available at http://localhost:8080/flights/stats.

Now you can try to edit the `resources` file and comment the stats resource out by using the `#` prefix. The point is you leave the application running while editing the file. The changes wil get picked up automatically. No need to manually restart the application. The `resource` file content should now look like follows:

    org.glassfish.jersey.examples.reload.DeparturesResource
    org.glassfish.jersey.examples.reload.ArrivalsResource
    #org.glassfish.jersey.examples.reload.StatsResource

Once you save the change, the stats resource should not be available, but the other, departures/arrivals, resources should remain functional.

Now you can revert the change back and check the stats resource is back providing actual statistics information.