Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

RestExpress is the easiest way to create RESTful web services in Java. An extremely Lightweight, Fast, REST Engine and API for Java. Supports JSON and XML serialization automagically as well as ISO 8601 date formats. A thin wrapper on Netty IO HTTP handling, RestExpress lets you create performant, stand-alone REST web services rapidly. Works 'ex…

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 src
Octocat-spinner-32 test
Octocat-spinner-32 .classpath
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .project
Octocat-spinner-32 LICENSE
Octocat-spinner-32 NOTICE
Octocat-spinner-32 README
Octocat-spinner-32 build.properties
Octocat-spinner-32 build.xml
README
RestExpress is a thin wrapper on the JBOSS Netty HTTP stack to provide a simple and easy way to create
RESTful services in Java.

Born to be simple, only three things are required to wire up a service:
1) The main class which looks just like the JBOSS Netty examples.
2) A RouteMapping extender (much like routes.rb in a Rails app), which contains DSL for the
   supported URLs and HTTP methods of the service(s).
3) Service implementation(s), which is/are a simple POJO--no interface or super class implementation.

See: examples/kickstart directory to get started (there is a README there).

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

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

You can choose to return objects from the methods, if desired, which will be returned to the client as
body of the response.  The object will be marshaled into JSON or XML, depending on the default or based on the
format on the request.

If you choose to not return a value from the method (void methods), 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.

Change History/Release Notes:
===================================================================================================
Release 0.5.4
* Added alias() capability to DefaultTxtProcessor to facilitate custom text serialization.
* Updated kickstart application to illustrate latest features.
* Minor refactoring of constants and their locations (moved to RestExpress.java).

===================================================================================================
Release 0.5.3
* Fixed issue with JSON date/timestamp parsing.
* Fixed issues with XML date/timestamp parsing.
* Upgraded to GSON 1.6 release.
* Added correlation ID to Request to facilitate timing, etc. in pipeline.
* Added alias(String, Class) to DefaultXmlProcessor.
* By default, alias List and Link in DefaultXmlProcessor.

===================================================================================================
Release 0.5.2
* Introduced DateJsonProcessor (sibling to DefaultJsonProcessor) which parses dates vs. time points.
* Refactored ExceptionMapping.getExceptionFor() signature from Exception to Throwable.
* Introduced MessageObserver, which accepts notifications of onReceived(), onSuccess(), onException(), onComplete() to facilitate logging, auditing, timing, etc.
* Changed RouteResolver.resolve() to throw NotFoundException instead of BadRequestException for unresolvable URI.

===================================================================================================
Release 0.5.1
* Enhanced support for mark, unreserved and some reserved characters in URL. Specifically, added
  $-+*()~:!' and %.  Still doesn't parse URLs with '.' within the string itself--because of the
  support for .{format} URL section.

===================================================================================================
Release 0.5
* Renamed repository from RestX to RestExpress.
* Repackaged everything from com.strategicgains.restx... to com.strategicgains.restexpress...
* Changed DefaultHttpResponseWriter to output resonse headers correctly.
* Updated javadoc on RouteBuilder to provide some documentation on route DSL.

===================================================================================================
Release 0.4
* Fixed error in "Connection: keep-alive" processing during normal and error response writing.
* Can now create route mappings for OPTIONS and HEAD http methods.
* Added decoding to URL when Request is constructed.
* Improved pre-processor implementation, including access to resolved route in request.
* Better null handling here and there to avoid NullPointerException, including serialization resolver.
* Improved UT coverage.
* KickStart application builds and is a more accurate template.

===================================================================================================
Release 0.3
* Added support for "method tunneling" in POST via query string parameter (e.g. _method=PUT or _method=DELETE)
* Added JSONP support. Use jsonp=<method_name> in query string.
* Utilized Builder pattern in DefaultPipelineFactory, which is now PipelineBuilder.
* Externalized DefaultRequestHandler in PipelineBuilder and now supports pre/post processors (with associated interfaces).
Something went wrong with that request. Please try again.