Permalink
Browse files

Added readme and license

  • Loading branch information...
1 parent 8af96bd commit 42ca77d55b4a6fb021389032c995771573d6b8c8 @laurentpetit committed Dec 18, 2010
Showing with 1,161 additions and 0 deletions.
  1. +45 −0 README.md
  2. +1,116 −0 epl-v10.html
View
@@ -0,0 +1,45 @@
+#Ring java servlet
+
+Allows you to embed ring handlers in existing java web applications without having to add an AOT phase to your build process, by providing you with a generic way to declare servlets in your web.xml, and where the clojure ring handler is located.
+
+##Example
+
+### Add the Ring java servlet dependency to your project
+Add this project as a dependency of your project. By means of transitive dependencies magic, you''ll need to add no other dependency.
+
+ring-java-servlet produces maven artifacts, with following coordinates:
+
+* groupId=org.lpetit.ring
+* artifactId=ring-java-servlet
+* version=0.1.0 (as of the time where this README was last updated)
+
+ring-java-servlet artifacts are currently only available on clojars.org
+
+### Create your Ring handler
+Write a clojure ring handler and place it somewhere in your source/resources folder (so that your build system adds it to the webapp classpath, e.g. places it in WEB-INF/classes folder of your webapp) :
+
+ ; file lpetit.ring_test.clj
+ (ns lpetit.ring-test
+ (defn hello [req]
+ {:status 200
+ :headers {"Content-Type" "text/html"}
+ :body "Hello world from ring java servlet"})
+
+
+### Declare the servlet in your web.xml
+ <servlet>
+ <servlet-name>some-unique-name</servlet-name>
+ <servlet-class>org.lpetit.ring.servlet.RingHttpServlet</servlet-class>
+ <init-param>
+ <param-name>handler</param-name>
+ <param-value>lpetit.ring-test/hello</param-value>
+ </init-param>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>some-unique-name</servlet-name>
+ <url-pattern>*.some-extension</url-pattern>
+ </servlet-mapping>
+
+### Test it
+That''s all. Next start you build your webapp and start it, you should see a "Hello world from ring java servlet" welcome message at http://the-server:the-port/<your-webapp-context>/foo.some-extension
+
Oops, something went wrong.

0 comments on commit 42ca77d

Please sign in to comment.