Permalink
Browse files

Merge branch 'ns-migration'

  • Loading branch information...
2 parents 9d995a6 + c55171c commit e13e8aa0003bbaf57dc2b49badb977793ac0b872 @ohpauleez ohpauleez committed Feb 14, 2014
Showing with 270 additions and 265 deletions.
  1. +2 −2 guides/documentation/connecting-to-datomic.md
  2. +4 −4 guides/documentation/hello-world-service.md
  3. +7 −7 guides/documentation/service-async.md
  4. +13 −13 guides/documentation/service-context-reference.md
  5. +2 −2 guides/documentation/service-interceptors.md
  6. +13 −13 guides/documentation/service-routing.md
  7. +3 −3 guides/documentation/service-sse.md
  8. +4 −4 guides/documentation/service-streaming.md
  9. +1 −1 jetty/src/io/pedestal/{service → }/http/jetty.clj
  10. +1 −1 samples/auto-reload-server/dev/dev.clj
  11. +1 −1 samples/auto-reload-server/src/auto_reload_server/server.clj
  12. +5 −5 samples/auto-reload-server/src/auto_reload_server/service.clj
  13. +2 −2 samples/auto-reload-server/test/auto_reload_server/service_test.clj
  14. +1 −1 samples/cors/dev/dev.clj
  15. +1 −1 samples/cors/src/cors/server.clj
  16. +9 −9 samples/cors/src/cors/service.clj
  17. +2 −2 samples/cors/test/cors/service_test.clj
  18. +1 −1 samples/jboss/dev/dev.clj
  19. +2 −2 samples/jboss/src/immutant/init.clj
  20. +1 −1 samples/jboss/src/jboss/server.clj
  21. +4 −4 samples/jboss/src/jboss/service.clj
  22. +2 −2 samples/jboss/test/jboss/service_test.clj
  23. +2 −2 samples/ring-middleware/README.md
  24. +1 −1 samples/ring-middleware/dev/dev.clj
  25. +1 −1 samples/ring-middleware/src/ring_middleware/server.clj
  26. +7 −7 samples/ring-middleware/src/ring_middleware/service.clj
  27. +2 −2 samples/ring-middleware/test/ring_middleware/service_test.clj
  28. +1 −1 samples/server-sent-events/dev/dev.clj
  29. +1 −1 samples/server-sent-events/src/server_sent_events/server.clj
  30. +5 −5 samples/server-sent-events/src/server_sent_events/service.clj
  31. +2 −2 samples/server-sent-events/test/server_sent_events/service_test.clj
  32. +1 −1 samples/server-with-links/dev/dev.clj
  33. +1 −1 samples/server-with-links/src/server_with_links/server.clj
  34. +7 −7 samples/server-with-links/src/server_with_links/service.clj
  35. +2 −2 samples/server-with-links/test/server_with_links/service_test.clj
  36. +1 −1 samples/template-server/dev/dev.clj
  37. +1 −1 samples/template-server/src/template_server/server.clj
  38. +5 −5 samples/template-server/src/template_server/service.clj
  39. +2 −2 samples/template-server/test/template_server/service_test.clj
  40. +1 −1 service-template/src/leiningen/new/pedestal_service/dev.clj
  41. +1 −1 service-template/src/leiningen/new/pedestal_service/server.clj
  42. +4 −4 service-template/src/leiningen/new/pedestal_service/service.clj
  43. +2 −2 service-template/src/leiningen/new/pedestal_service/service_test.clj
  44. +1 −0 service-tools/README.md
  45. +2 −0 service-tools/project.clj
  46. +2 −1 service-tools/src/io/pedestal/service_tools/dev.clj
  47. +3 −2 service-tools/test/io/pedestal/service_tools/dev_test.clj
  48. +10 −10 service/bench/io/pedestal/log_bench.clj
  49. +1 −1 service/project.clj
  50. +14 −14 service/src/io/pedestal/{service → }/http.clj
  51. +3 −3 service/src/io/pedestal/{service → }/http/body_params.clj
  52. +4 −4 service/src/io/pedestal/{service → }/http/cors.clj
  53. +6 −6 service/src/io/pedestal/{service → }/http/impl/servlet_interceptor.clj
  54. +2 −2 service/src/io/pedestal/{service → }/http/ring_middlewares.clj
  55. +4 −4 service/src/io/pedestal/{service → }/http/route.clj
  56. +4 −4 service/src/io/pedestal/{service → }/http/route/definition.clj
  57. +3 −3 service/src/io/pedestal/{service → }/http/route/definition/verbose.clj
  58. +1 −1 service/src/io/pedestal/{service → }/http/servlet.clj
  59. +7 −7 service/src/io/pedestal/{service → }/http/sse.clj
  60. +2 −2 service/src/io/pedestal/{service → }/impl/interceptor.clj
  61. +3 −3 service/src/io/pedestal/{service → }/interceptor.clj
  62. +1 −1 service/src/io/pedestal/{service → }/log.clj
  63. +3 −3 service/src/io/pedestal/{service → }/test.clj
  64. +3 −3 service/test/io/pedestal/{service → }/http/body_params_test.clj
  65. +7 −7 service/test/io/pedestal/{service → }/http/cors_test.clj
  66. +9 −9 service/test/io/pedestal/{service → }/http/jetty_test.clj
  67. BIN service/test/io/pedestal/{service → }/http/keystore.jks
  68. +7 −7 service/test/io/pedestal/{service → }/http/request_handling_test.clj
  69. +2 −2 service/test/io/pedestal/{service → }/http/ring_middlewares_test.clj
  70. +7 −7 service/test/io/pedestal/{service → }/http/route_test.clj
  71. +8 −8 service/test/io/pedestal/{service → }/http/sse_test.clj
  72. +12 −12 service/test/io/pedestal/{service → }/http_test.clj
  73. +5 −5 service/test/io/pedestal/{service → }/interceptor_test.clj
  74. +2 −2 service/test/io/pedestal/{service → }/test_test.clj
  75. +1 −1 tomcat/src/io/pedestal/{service → }/http/tomcat.clj
@@ -130,8 +130,8 @@ reference helloworld.peer:
```clj
(ns helloworld.service
- (:require [io.pedestal.service.http :as bootstrap]
- [io.pedestal.service.http.route.definition :refer [defroutes]]
+ (:require [io.pedestal.http :as bootstrap]
+ [io.pedestal.http.route.definition :refer [defroutes]]
[ring.util.response :refer [response]]
[helloworld.peer :as peer :refer [results]]))
```
@@ -90,10 +90,10 @@ work. Edit src/helloworld/service.clj until it looks like this:
```clojure
(ns helloworld.service
- (:require [io.pedestal.service.http :as bootstrap]
- [io.pedestal.service.http.route :as route]
- [io.pedestal.service.http.body-params :as body-params]
- [io.pedestal.service.http.route.definition :refer [defroutes]]
+ (:require [io.pedestal.http :as bootstrap]
+ [io.pedestal.http.route :as route]
+ [io.pedestal.http.body-params :as body-params]
+ [io.pedestal.http.route.definition :refer [defroutes]]
[ring.util.response :as ring-resp]))
(defn home-page
@@ -43,23 +43,23 @@ thread, as shown below:
```clj
(interceptors/defbefore takes-time [{req :request :as context}]
;; give back the web server thread after doing work in body
- (io.pedestal.service.impl.interceptor/with-pause
+ (io.pedestal.impl.interceptor/with-pause
[paused-context context]
;; kick off another thread to wait
(future
;; wait
(let [result (wait-for-something-that-takes-a-long-time req)]
;; resume with context that includes response
- (io.pedestal.service.impl.interceptor/resume
+ (io.pedestal.impl.interceptor/resume
(assoc paused-context :response (response result)))))))
(defroutes routes
[[["/takes-time" {:get takes-time}]]])
```
-The _io.pedestal.service.impl.interceptor/with-pause_ macro pauses interceptor
+The _io.pedestal.impl.interceptor/with-pause_ macro pauses interceptor
processing and returns the calling thread. The
-_io.pedestal.service.impl.interceptor/resume_ function resumes processing
+_io.pedestal.impl.interceptor/resume_ function resumes processing
on another thread.
It is important to note that pausing and resuming an interceptor path
@@ -78,12 +78,12 @@ releases the Web server thread without using another thread.
```clj
(defn resume-fn [context result]
- (io.pedestal.service.impl.interceptor/resume
+ (io.pedestal.impl.interceptor/resume
(assoc context :response (response result))))
(interceptors/defbefore takes-time [{:request req :as context}]
;; give back the web server thread after doing work in body
- (io.pedestal.service.impl.interceptor/with-pause
+ (io.pedestal.impl.interceptor/with-pause
[paused-context context]
;; give context to some other code that will resume it
;; by extracting resume-fn and calling it, passing result
@@ -101,7 +101,7 @@ approach can be used to implement long-polling. In fact, this is how
Pedestal's built in support for server-sent events works.
(Note that both these examples use functions in the
-_io.pedestal.service.impl.inteceptor_ namespace. The code in this
+_io.pedestal.impl.inteceptor_ namespace. The code in this
namespace is subject to change.)
For more about streaming, see [Streaming Responses](/documentation/service-streaming). For more
@@ -32,7 +32,7 @@ being added to the context map to allow for extension.
Some of the keys described in this document are in namespaces
containing implementation details,
-e.g. io.pedestal.service.impl.interceptor. These namespaces always
+e.g. io.pedestal.impl.interceptor. These namespaces always
contain an 'impl' token in the namespace hierarchy. The keys in these
namespaces do not represent a public interface and are subject to
change. Their inclusion in this document is not a commitment to keep
@@ -81,40 +81,40 @@ The context map supports the following values:
* *:servlet* - The javax.servlet.Servlet instance which bootstrapped
this interceptor path's execution.
-* *:io.pedestal.service.impl.interceptor/execution-id* -
+* *:io.pedestal.impl.interceptor/execution-id* -
Autoincrementing long which can associate a single interceptor
execution context across multiple threads.
-* *:io.pedestal.service.impl.interceptor/queue* - A PersistentQueue of
+* *:io.pedestal.impl.interceptor/queue* - A PersistentQueue of
interceptors which still need to be executed during the 'enter'
stage. So long as this value is not empty, the head of the queue
will be removed and executed, then added to the end of
- *:io.pedestal.service.impl.interceptor/stack*
+ *:io.pedestal.impl.interceptor/stack*
-* *:io.pedestal.service.impl.interceptor/stack* - A PersistentList of
+* *:io.pedestal.impl.interceptor/stack* - A PersistentList of
interceptors which still need to be executed during the 'leave'
stage. So long as this value is not empty, the tail of the list
will be removed and executed.
-* *:io.pedestal.service.impl.interceptor/pause-stack* - A
+* *:io.pedestal.impl.interceptor/pause-stack* - A
PersistentList of interceptors which will have their pause fns
called during the pause stage. This stack will be consumed as
pause fns are called, leaving
- *:io.pedestal.service.impl.interceptor/stack* unchanged.
+ *:io.pedestal.impl.interceptor/stack* unchanged.
-* *:io.pedestal.service.impl.interceptor/resume-stack* - A
+* *:io.pedestal.impl.interceptor/resume-stack* - A
PersistentList of interceptors which will have their resume fns
called during the resume stage. Initially starts as the reversed
- value of *:io.pedestal.service.impl.interceptor/stack*, and is
+ value of *:io.pedestal.impl.interceptor/stack*, and is
consumed as an interceptor's execution is resumed.
-* *:io.pedestal.service.impl.interceptor/terminators* - A seq of
+* *:io.pedestal.impl.interceptor/terminators* - A seq of
predicate fns. Each predicate fn is handed the present context in
turn after each interceptor executes during the 'enter' stage. If
any predicate fn returns true, the interceptor immediately enters
the 'leave' stage.
-* *:io.pedestal.service.impl.interceptor/error* - The most recently
+* *:io.pedestal.impl.interceptor/error* - The most recently
uncaught throwable thrown during the execution of an
interceptor. If an uncaught exception is thrown during the enter
stage, the enter stage will immediately cease. The error stage will
@@ -130,11 +130,11 @@ The context map supports the following values:
error fn returns the context with the error dissociated, the next
interceptor on the stack will have its leave fn called.
-* *:io.pedestal.service.impl.interceptor/rebind* - A boolean,
+* *:io.pedestal.impl.interceptor/rebind* - A boolean,
indicating that the thread bindings as specified in :bindings
should be re-established using clojure.core/with-bindings
-* *:io.pedestal.service.http.impl.servlet-interceptor/async* - A
+* *:io.pedestal.http.impl.servlet-interceptor/async* - A
boolean, which will be set to true if this context has been paused
and the servlet request being serviced with this context has an
asynchronous context created for it.
@@ -198,7 +198,7 @@ _xyz-response_ functions. These functions process requests and
responses separately. The _wrap-xys_ functions have been refactored to
use the separate request and response processing functions.
-The _io.pedestal.service.http.ring-middlewares_ namespace defines
+The _io.pedestal.http.ring-middlewares_ namespace defines
interceptors that use the new Ring _xyz-request_ and _xyz-response_
functions, making all the standard Ring middlewares usable in Pedestal
services.
@@ -312,5 +312,5 @@ You can port Ring code to Pedestal by:
routes should be replaced by interceptors referenced directly in
your route definitions. There are interceptors provided for all the
existing Ring middlewares. They are defined in the
- _io.pedestal.service.http.ring-middlewares_ namespace.
+ _io.pedestal.http.ring-middlewares_ namespace.
@@ -152,9 +152,9 @@ The following sections explains how these values are used.
A terse route definition must be expanded to a full route table
before it can be used. There are two ways to do this:
-- the _io.pedestal.service.http.route.definition/expand-routes_ function
+- the _io.pedestal.http.route.definition/expand-routes_ function
-- the _io.pedestal.service.http.route.definition/defroutes_ macro
+- the _io.pedestal.http.route.definition/defroutes_ macro
The _expand-routes_ function takes a terse route definition data
structure as input and returns a route table. For example:
@@ -212,12 +212,12 @@ without quoting it at all. Here is an example:
In this case, the _hello-world_ symbol is resolved to the
_hello-world_ function as the data structure is built. The _handler_
-function (defined in _io.pedestal.service.interceptor_) takes the
+function (defined in _io.pedestal.interceptor_) takes the
function and builds an interceptor from it, to meet the requirement
that a value in a verb map must be a symbol, an interceptor, or a list.
Alternatively, _hello-world_ can be defined as an interceptor
-directly, using the _io.pedestal.service.interceptor/defhandler_ macro:
+directly, using the _io.pedestal.interceptor/defhandler_ macro:
```clj
(defhandler hello-world [req] {:status 200 :body "Hello World!"})
@@ -440,7 +440,7 @@ Like intermediate interceptors, constraints are inherited by child routes.
# Routing
Once a route table is defined, it can be used to create a router. The
-_io.pedestal.service.http.route/router_ function takes a route table as
+_io.pedestal.http.route/router_ function takes a route table as
input and returns an interceptor that handles routing.
```clj
@@ -497,12 +497,12 @@ interceptor values, the route-name is the name of the interceptor.
For interceptors defined using the _defbefore_, _defafter_,
_defaround_, _defon-request_, _defhandler_ and _defon-response_ macros
-in the _io.pedestal.service.interceptor_ namespace, the name is the
+in the _io.pedestal.interceptor_ namespace, the name is the
interceptor's fully-qualified symbol name expressed as a keyword.
For interceptors defined using the _before_, _after_, _around_,
_on-request_, _handler_ and _on-response_ functions in the
-_io.pedestal.service.interceptor_ namespace, the name is the keyword
+_io.pedestal.interceptor_ namespace, the name is the keyword
passed to the function, if any.
For routes that specify interceptors indirectly as lists to be
@@ -546,13 +546,13 @@ The second route specified an explicit route name, _:make-an-order_,
which takes precedence over the implicit name for that route,
_:orders/create-order_.
-The _io.pedestal.service.http.route/print-routes_ helper function prints
+The _io.pedestal.http.route/print-routes_ helper function prints
route verbs, paths and names at the repl. When in doubt, you can use
it to find route names.
## URL generation
-The _io.pedestal.service.http.route/url-for-routes_ function takes a
+The _io.pedestal.http.route/url-for-routes_ function takes a
route table and returns a function that accepts a route-name (and optional
arguments) and returns a URL that can be used in a hyperlink.
@@ -593,19 +593,19 @@ function to the interceptor context and the Ring request map, using
the key _:url-for_.
The request-specific URL generator function is also dynamically bound
-to a private var in the _io.pedestal.service.http.route_ namespace. The
-_io.pedestal.service.http.route/url-for_ function calls the dynamically
+to a private var in the _io.pedestal.http.route_ namespace. The
+_io.pedestal.http.route/url-for_ function calls the dynamically
bound function.
-The _io.pedestal.service.http.route/url-for_ function can be called from
+The _io.pedestal.http.route/url-for_ function can be called from
any thread that is currently executing an interceptor. If you need to
use a request-specific URL generator function elsewhere, extract
_:url-for_ from the context or request map and propagate it as needed.
## Verb smuggling
The _url-for_ functions only return URLs. The
-_io.pedestal.service.http.route/form-action-for-routes_ function takes a
+_io.pedestal.http.route/form-action-for-routes_ function takes a
route table returns a function that accepts a route-name (and optional
arguments) and returns a map containing a URL and an HTTP verb.
@@ -33,7 +33,7 @@ API.
You can setup an event source endpoint by defining a route that maps
requests to an interceptor returned from the
-_io.pedestal.service.http.sse/start-event-stream_ function. The
+_io.pedestal.http.sse/start-event-stream_ function. The
resulting SSE interceptor processes a request by:
- pausing interceptor execution (see [Service Async](/documentation/service-async))
@@ -53,7 +53,7 @@ The _stream-ready-fn_ is responsible for using the context or storing it for
later use by some other piece of code.
Events can be sent to the client using the
-_io.pedestal.service.http.sse/send-event_ function. It takes the context
+_io.pedestal.http.sse/send-event_ function. It takes the context
passed to the _stream-ready-fn_, an event name and event data as
arguments.
@@ -67,7 +67,7 @@ clean up the streaming context.
When a streaming context is no longer needed, either because there are
no more events to send or the connection was broken by the client, it
must be cleaned up by calling the
-_io.pedestal.service.http.sse/end-event-stream_ function.
+_io.pedestal.http.sse/end-event-stream_ function.
Here is an example that shows how an SSE streaming context is created
and used.
@@ -41,14 +41,14 @@ streaming:
- _clojure.lang.Fn_ - the function is invoked when the response body
is written. The function is passed the HTTP output stream and can
write directly to it. You can use the
- _io.pedestal.service.http.impl.servlet-interceptor/write-body-to-stream_
+ _io.pedestal.http.impl.servlet-interceptor/write-body-to-stream_
function to do this, but you don't have to.
- _java.io.File_ or _java.io.InputStream_ - the contents are copied in
chunks to the HTTP output stream in chunks using _clojure.java.io/copy_
when the response body is written.
-- _io.pedestal.service.http.impl.servlet-interceptor/WriteableBody_ - the
+- _io.pedestal.http.impl.servlet-interceptor/WriteableBody_ - the
instance writes itself to the HTTP output stream.
The thread completing the interceptor path will write the body out to
@@ -83,8 +83,8 @@ that streaming process completes, no more data can be sent.
There may be cases, however, where you want to stream data back but
then continue processing. You can do that from within an interceptor
by invoking the
-_io.pedestal.service.http.impl.servlet-interceptor/write-response_ and
-_io.pedestal.service.http.impl.servlet-interceptor/write-response-body_
+_io.pedestal.http.impl.servlet-interceptor/write-response_ and
+_io.pedestal.http.impl.servlet-interceptor/write-response-body_
functions.
The _write-response_ function takes a context map a Ring response
@@ -10,7 +10,7 @@
;
; You must not remove this notice, or any other, from this software.
-(ns io.pedestal.service.http.jetty
+(ns io.pedestal.http.jetty
(:import (org.eclipse.jetty.server Server Request)
(org.eclipse.jetty.server.handler AbstractHandler)
(org.eclipse.jetty.server.nio SelectChannelConnector)
@@ -1,5 +1,5 @@
(ns dev
- (:require [io.pedestal.service.http :as bootstrap]
+ (:require [io.pedestal.http :as bootstrap]
[auto-reload-server.service :as service]
[auto-reload-server.server :as server]
[ns-tracker.core :as tracker]))
@@ -1,7 +1,7 @@
(ns auto-reload-server.server
(:gen-class) ; for -main method in uberjar
(:require [auto-reload-server.service :as service]
- [io.pedestal.service.http :as bootstrap]))
+ [io.pedestal.http :as bootstrap]))
(defonce service-instance nil)
@@ -1,8 +1,8 @@
(ns auto-reload-server.service
- (:require [io.pedestal.service.http :as bootstrap]
- [io.pedestal.service.http.route :as route]
- [io.pedestal.service.http.body-params :as body-params]
- [io.pedestal.service.http.route.definition :refer [defroutes]]
+ (:require [io.pedestal.http :as bootstrap]
+ [io.pedestal.http.route :as route]
+ [io.pedestal.http.body-params :as body-params]
+ [io.pedestal.http.route.definition :refer [defroutes]]
[ring.util.response :as ring-resp]))
(defn about-page
@@ -19,7 +19,7 @@
^:interceptors [(body-params/body-params) bootstrap/html-body]
["/about" {:get about-page}]]]])
-;; You can use this fn or a per-request fn via io.pedestal.service.http.route/url-for
+;; You can use this fn or a per-request fn via io.pedestal.http.route/url-for
(def url-for (route/url-for-routes routes))
;; Consumed by auto-reload-server.server/create-server
@@ -1,7 +1,7 @@
(ns auto-reload-server.service-test
(:require [clojure.test :refer :all]
- [io.pedestal.service.test :refer :all]
- [io.pedestal.service.http :as bootstrap]
+ [io.pedestal.test :refer :all]
+ [io.pedestal.http :as bootstrap]
[auto-reload-server.service :as service]))
(def service
@@ -12,7 +12,7 @@
;; dev mode in repl (can get prod mode by passing prod options to dev-init
(ns dev
- (:require [io.pedestal.service.http :as bootstrap]
+ (:require [io.pedestal.http :as bootstrap]
[cors.service :as service]
[cors.server :as server]))
@@ -12,7 +12,7 @@
(ns cors.server
(:require [cors.service :as service]
- [io.pedestal.service.http :as bootstrap]))
+ [io.pedestal.http :as bootstrap]))
(def service-instance
"Global var to hold service instance."
Oops, something went wrong.

0 comments on commit e13e8aa

Please sign in to comment.