<commit_before>[![Build Status](https://buildhive.cloudbees.com/job/RestExpress/job/RestExpress/badge/icon)](https://buildhive.cloudbees.com/job/RestExpress/job/RestExpress/)

[![Stories in Ready](https://badge.waffle.io/RestExpress/RestExpress.png?label=Ready)](http://waffle.io/RestExpress/RestExpress)

RestExpress is a thin wrapper on the JBOSS Netty HTTP stack to provide a simple and easy way to
create RESTful services in Java that support massive Internet Scale and performance.

Born to be simple, only three things are required to wire up a service:

1. The main class which utilizes the RestExpress DSL to create a server instance.
2. Use a DSL for the declaration of supported URLs and HTTP methods of the service(s) (much like routes.rb in a Rails app).
3. Service implementation(s), which is/are a simple POJO--no interface or super class implementation.

See: https://github.com/RestExpress/RestExpress-Archetype to get started (there is a README there).

Maven Usage
===========
Stable:
```xml
		<dependency>
			<groupId>com.strategicgains</groupId>
			<artifactId>RestExpress</artifactId>
			<version>0.10.5</version>
		</dependency>
```
Development:
```xml
		<dependency>
			<groupId>com.strategicgains</groupId>
			<artifactId>RestExpress</artifactId>
			<version>0.11.0-SNAPSHOT</version>
		</dependency>
```
Or download the jar directly from: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22RestExpress%22

Note that to use the SNAPSHOT version, you must enable snapshots and a repository in your pom file as follows
(if you already have a profile with repositories in your pom, you can just copy the <repository> section):
```xml
  <profiles>
    <profile>
       <id>allow-snapshots</id>
          <activation><activeByDefault>true</activeByDefault></activation>
       <repositories>
         <repository>
           <id>sonatype-snapshots-repo</id>
           <url>https://oss.sonatype.org/content/repositories/snapshots</url>
           <releases><enabled>false</enabled></releases>
           <snapshots><enabled>true</enabled></snapshots>
         </repository>
       </repositories>
     </profile>
  </profiles>
```

===================================================================================================
## A quick tutorial:

Please see the Maven Archetypes at https://github.com/RestExpress/RestExpress-Archetype for kick-starting your API.

* HTTP Methods, if not changed in the fluent (DSL) interface, map to the following:
	* GET --> read(Request, Response)
	* PUT --> update(Request, Response)
	* POST --> create(Request, Response)
	* DELETE --> delete(Request, Response)

* You can choose to return objects from the methods, if desired, which will be returned to the client in the body of the response.  The object will be marshaled into JSON or XML, depending on the default or based on the format in the request (e.g. '.xml' or '?format=xml').

* If you choose to not return a value from the method (void methods) and using raw responses, then call response.setResponseNoContent() before returning to set the response HTTP status code to 204 (no content).

* On successful creation, call response.setResponseCreated() to set the returning HTTP status code to 201.

* For more real-world examples, see the https://github.com/RestExpress/RestExpress-Examples repo which contains additional projects that setup RestExpress services.  Simply do '**mvn exec:java**' to run them.  Then to see what's available perform a GET on the route: '/routes/metadata' to get a list of all the routes (or endpoints) available (e.g. localhost:8081/routes/metadata in the browser).

===================================================================================================
Change History/Release Notes:
---------------------------------------------------------------------------------------------------
Release 0.11.0-SNAPSHOT - in 'master' branch
--------------------------------------------
* **Bug Fix** Strip the response body from HEAD requests to conform to [RFC 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4)(HTTP spec). (from Codey Whitt)
* Upgraded Netty version from 3.9.5.Final to 4.0.25.Final (from <NAME> and <NAME>).
* Enhanced QueryRange.asContentRange() and Response.setCollectionResponse() to support output of '*' as max items in range header for count < 0. 
* Added Unit Tests to test RestExpress' ability to compress responses and decompress requests.
* KNOWN ISSUE - Controllers cannot return ReferenceCounted objects that also exist in the Request object.  This will cause the transaction to fail with an IllegalReferenceCountException.  If a ReferenceCounted object needs to be returned, a separate copy of the object will need to be made (some classes, such as ByteBuf, have a .copy() method to facilitate this).

Release 0.10.6-SNAPSHOT - in '0.10.6' branch
--------------------------------------------
* **Bug Fix** Strip the response body from HEAD requests to conform to [RFC 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4)(HTTP spec). (from Codey Whitt)

Release 0.10.5 - 2 Dec 2014
---------------------------<commit_msg>Updated README for latest release.<commit_after>[![Build Status](https://buildhive.cloudbees.com/job/RestExpress/job/RestExpress/badge/icon)](https://buildhive.cloudbees.com/job/RestExpress/job/RestExpress/)

[![Stories in Ready](https://badge.waffle.io/RestExpress/RestExpress.png?label=Ready)](http://waffle.io/RestExpress/RestExpress)

RestExpress is a thin wrapper on the JBOSS Netty HTTP stack to provide a simple and easy way to
create RESTful services in Java that support massive Internet Scale and performance.

Born to be simple, only three things are required to wire up a service:

1. The main class which utilizes the RestExpress DSL to create a server instance.
2. Use a DSL for the declaration of supported URLs and HTTP methods of the service(s) (much like routes.rb in a Rails app).
3. Service implementation(s), which is/are a simple POJO--no interface or super class implementation.

See: https://github.com/RestExpress/RestExpress-Archetype to get started (there is a README there).

Maven Usage
===========
Stable:
```xml
		<dependency>
			<groupId>com.strategicgains</groupId>
			<artifactId>RestExpress</artifactId>
			<version>0.11.0</version>
		</dependency>
```
Development:
```xml
		<dependency>
			<groupId>com.strategicgains</groupId>
			<artifactId>RestExpress</artifactId>
			<version>0.11.1-SNAPSHOT</version>
		</dependency>
```
Or download the jar directly from: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22RestExpress%22

Note that to use the SNAPSHOT version, you must enable snapshots and a repository in your pom file as follows
(if you already have a profile with repositories in your pom, you can just copy the <repository> section):
```xml
  <profiles>
    <profile>
       <id>allow-snapshots</id>
          <activation><activeByDefault>true</activeByDefault></activation>
       <repositories>
         <repository>
           <id>sonatype-snapshots-repo</id>
           <url>https://oss.sonatype.org/content/repositories/snapshots</url>
           <releases><enabled>false</enabled></releases>
           <snapshots><enabled>true</enabled></snapshots>
         </repository>
       </repositories>
     </profile>
  </profiles>
```

===================================================================================================
## A quick tutorial:

Please see the Maven Archetypes at https://github.com/RestExpress/RestExpress-Archetype for kick-starting your API.

* HTTP Methods, if not changed in the fluent (DSL) interface, map to the following:
	* GET --> read(Request, Response)
	* PUT --> update(Request, Response)
	* POST --> create(Request, Response)
	* DELETE --> delete(Request, Response)

* You can choose to return objects from the methods, if desired, which will be returned to the client in the body of the response.  The object will be marshaled into JSON or XML, depending on the default or based on the format in the request (e.g. '.xml' or '?format=xml').

* If you choose to not return a value from the method (void methods) and using raw responses, then call response.setResponseNoContent() before returning to set the response HTTP status code to 204 (no content).

* On successful creation, call response.setResponseCreated() to set the returning HTTP status code to 201.

* For more real-world examples, see the https://github.com/RestExpress/RestExpress-Examples repo which contains additional projects that setup RestExpress services.  Simply do '**mvn exec:java**' to run them.  Then to see what's available perform a GET on the route: '/routes/metadata' to get a list of all the routes (or endpoints) available (e.g. localhost:8081/routes/metadata in the browser).

===================================================================================================
Change History/Release Notes:
---------------------------------------------------------------------------------------------------
Release 0.11.0 - 12 Mar 2015
----------------------------
* **Bug Fix** Strip the response body from HEAD requests to conform to [RFC 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4)(HTTP spec). (from <NAME>)
* Upgraded Netty version from 3.9.5.Final to 4.0.25.Final (from <NAME> and Mathew Leigh).
* Enhanced QueryRange.asContentRange() and Response.setCollectionResponse() to support output of '*' as max items in range header for count < 0. 
* Added Unit Tests to test RestExpress' ability to compress responses and decompress requests.
* Added Environment.load(String[], Class) to eliminate the need for Main.loadEnvironments() in all archetype projects.
* KNOWN ISSUE - Controllers cannot return ReferenceCounted objects that also exist in the Request object.  This will cause the transaction to fail with an IllegalReferenceCountException.  If a ReferenceCounted object needs to be returned, a separate copy of the object will need to be made (some classes, such as ByteBuf, have a .copy() method to facilitate this).

Release 0.10.6-SNAPSHOT - in '0.10.6' branch
--------------------------------------------
* **Bug Fix** Strip the response body from HEAD requests to conform to [RFC 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4)(HTTP spec). (from <NAME>)

Release 0.10.5 - 2 Dec 2014
---------------------------
{'fraction_non_alphanumeric': 0.17357363145720894, 'fraction_numerical': 0.018118735543562067, 'mean_word_length': 3.6388019669199823, 'pattern_counts': {'":': 0, '<': 96, '<?xml version=': 0, '>': 102, 'https://': 14, 'lorem ipsum': 0, 'www.': 4, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5572941', 'n_tokens_mistral': 3011, 'n_tokens_neox': 2743, 'n_words': 1064}