From f8fc6a51e5fb7449ed6aea8437f5f0c4b4f20aac Mon Sep 17 00:00:00 2001 From: Jon Brisbin Date: Mon, 16 Apr 2012 09:40:28 -0500 Subject: [PATCH] Updated docs/README. --- README.md | 68 +++++------------------------------------------- doc/main_wiki.md | 51 +++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index ccb5a3ef6..472c3d962 100644 --- a/README.md +++ b/README.md @@ -1,70 +1,16 @@ -# Spring Data Rest Exporter +# Spring Data Web Exporter -The Spring Data Rest exporter is a project that aims to make it easy to expose various -services as Rest endpoints. The goal of the project is to provide a flexible and configurable -mechanism for writing simple services that can expose arbitrary services over HTTP. +The goal of the project is to provide a flexible and configurable mechanism for writing simple services that can be exposed over HTTP. -The first exporter implemented is a JPA Repository exporter. This takes your JPA repositories -and front-ends them with HTTP, allowing you full CRUD capability over your entities, to include -managing associations. +The first exporter implemented is a JPA Repository exporter. This takes your JPA repositories and front-ends them with HTTP, allowing you full CRUD capability over your entities, to include managing associations. ### Installation -To use the Spring Data Rest exporter, first package your domain classes and repositories into a JAR -file. Include some Spring XML configuration files in the `META-INF/spring-data-rest` directory (the -file name should end with "-export.xml" to be picked up by the scanner). In that JAR file include -an applicable EntityManager and DataSource and Repository configuration (using the special JPA -Repository namespace). +Installation instructions are in the wiki. -You can either deploy this JAR file into your Servlet container in a "shared" configuration, or you -can add this JAR file (and any other application dependencies) to the exporter WAR file's `WEB-INF/lib` -directory. +* [https://github.com/springsource/spring-data-rest/wiki/jpa-repository-web-exporter](https://github.com/springsource/spring-data-rest/wiki/jpa-repository-web-exporter) -### Sample Configuration -The configuration used in testing looks like this: - -##### META-INF/spring-data-rest/shared.xml - - - - - - - - - - - - - - - - - - - - - - - -##### META-INF/spring-data-rest/repositories-export.xml - - - - - - - - - - +### License +The Spring Data Web Exporter is [Apache 2.0 licensed](http://www.apache.org/licenses/LICENSE-2.0.html). \ No newline at end of file diff --git a/doc/main_wiki.md b/doc/main_wiki.md index 48b77e450..94a6ec287 100644 --- a/doc/main_wiki.md +++ b/doc/main_wiki.md @@ -4,7 +4,54 @@ The Spring Data JPA Repository Web Exporter allows you to export your [JPA Repos ### Installation -Installation is as simple as downloading a WAR file. To expose your Repositories to the exporter, include a Spring XML configuration file in the classpath. The filename should end with "-export.xml" and reside under the path `META-INF/spring-data-rest/`. Your configuration should include a properly-instaniated EntityManagerFactoryBean, an appropriate DataSource, and the appropriate repository configuration. It's easiest to use the special XML namespace for this purpose. An example configuration (named `WEB-INF/spring-data-rest/repositories-export.xml`) would look like something like this: +#### Servlet environment + +To use the Spring Data Web Exporter, you need to build a WAR file. Start by cloning the base web application project that contains the web.xml file you'll need to run the Web Exporter: [https://github.com/SpringSource/spring-data-rest-webmvc](https://github.com/SpringSource/spring-data-rest-webmvc). + + git clone https://github.com/SpringSource/spring-data-rest-web.git + cd spring-data-rest-web + ./gradlew war + +Deploy the built WAR file to your servlet container: + + cp build/libs/spring-data-rest-webmvc-1.0.0.BUILD-SNAPSHOT.war $TOMCAT_HOME/webapps/data.war + cd $TOMCAT_HOME + bin/catalina.sh run + + The WAR file has a couple example domain classes and exposes a couple repositories by default. You can verify that this configuration is working by issuing an HTTP GET to the root of the web application: + + curl -v http://localhost:8080/data/ + + In return, you should see: + + > GET /data/ HTTP/1.1 + > User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3 + > Host: localhost:8080 + > Accept: */* + > + < HTTP/1.1 200 OK + < Server: Apache-Coyote/1.1 + < Content-Type: application/json;charset=ISO-8859-1 + < Content-Language: en-US + < Content-Length: 257 + < Date: Mon, 16 Apr 2012 14:32:44 GMT + < + { + "_links" : [ { + "rel" : "address", + "href" : "http://localhost:8080/data/address" + }, { + "rel" : "person", + "href" : "http://localhost:8080/data/person" + }, { + "rel" : "profile", + "href" : "http://localhost:8080/data/profile" + } ] + } + +### Export Repositories + +To expose your Repositories to the exporter, include a Spring XML configuration file in the classpath (e.g. in a client JAR or in `WEB-INF/classes`). The filename should end with "-export.xml" and reside under the path `META-INF/spring-data-rest/`. Your configuration should include a properly-instaniated EntityManagerFactoryBean, an appropriate DataSource, and the appropriate repository configuration. It's easiest to use the special XML namespace for this purpose. An example configuration (named `WEB-INF/spring-data-rest/repositories-export.xml`) would look like something like this: