Giter Club home page Giter Club logo

pedestal's Introduction

Pedestal

CI Clojars Project Home Page

Pedestal is a set of libraries written in Clojure that aims to bring both the language and its principles (Simplicity, Power and Focus) to server-side development.

Pedestal requires Java 1.11+ and Servlet 3.1

Getting the Latest Stable Release

Please see Releases for version details, updates, and necessary migration steps.

Notable capabilities

  • Secure by default: automatic use of secure headers, CSRF (cross-site request forgery) protection, and other essential security practices right out of the box
  • Flexible:
    • Pedestal builds on top of your choice of several servlet containers, including Jetty and Tomcat
    • Pedestal can work with non-servlet containers such as nginx or Netty
    • Everything from servlet container integration, to routing table notation is easily overridden or extended
    • Metrics can be published to JMX, StatsD, Cloudwatch, and more
    • Behavior is defined by small interceptors that can be easily combined and extended
  • Fast:
    • High-performance prefix-tree router to dispatch incoming requests
    • Full support for asynchronous request processing on top of Clojure's core.async
  • Mature:
    • Integrated linking and testing tools
    • Integrated logging, tracing, and runtime metrics
    • Advanced error handling, even for for async systems
    • Support for WebSockets and for server-sent events
    • Support for Cross-origin resource sharing (CORS)
    • HTTP/2, HTTP/2 Cleartext, and ALPN support

Principles

We prefer data over functions, and functions over macros.

Open subsystems, such as routing, are defined in terms of a well-defined protocol so that applications can seamlessly integrate their own solutions when necessary.

We feel that interceptors are the ideal way to implement these ideals.

Getting started

Starting a new project

Use leiningen (2.2.0+) to create a new Pedestal service. This will automatically pull templates from http://clojars.org

lein new pedestal-service the-next-big-server-side-thing

See the samples or Pedestal.io docs site for information on Pedestal, including:

  • Getting started tutorial and other guides
  • Main concepts
  • Advanced usage
  • API docs
  • Reference docs

Digging deeper

Roadmap

Our primary focus for the near future is Pedestal documentation, sample applications and improving general ease of use.

Pedestal's roadmap gets captured within the GitHub issues.

Documentation

Supported Platforms

At present Pedestal supports OSX and Linux environments. At this time we do not support using Pedestal on a Windows environment.

Some good news: We will still gladly accept pull requests extending our Windows support

The bad news: We will not invest significant amounts of time into diagnosing or correcting Windows issues.

Find out more

Contributing

See CONTRIBUTING.md for details on contributing to Pedestal.

Running the tests

From the tests subdirectory, execute 'clj -X:test`.


License

Copyright 2013 Relevance, Inc.

Copyright 2014-2023 Cognitect, Inc.

The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0) which can be found in the file epl-v10.html at the root of this distribution.

By using this software in any fashion, you are agreeing to be bound by the terms of this license.

You must not remove this notice, or any other, from this software.

pedestal's People

Contributors

anthonyjchriste avatar aredington avatar bltavares avatar bobby avatar bonkydog avatar bvandgrift avatar candera avatar claj avatar cldwalker avatar daemianmack avatar ddeaguiar avatar grzm avatar hlship avatar janherich avatar jcrossley3 avatar mpivaa avatar mtnygard avatar ohpauleez avatar phmeier-nubank avatar propan avatar redinger avatar solussd avatar stuarth avatar sumbach avatar tbcs avatar timewald avatar tomjack avatar vedang avatar vielmath avatar yokolet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pedestal's Issues

update template destroys event handlers

io.pedestal.app.render.push.templates/update-template uses dom/set-html! to re-render its data. This is a problem if you have previously placed event listeners on the html element that was previously there, it gets wiped out.

[domina :as dom]
[domina.css :as dc]
[domina.events :as de]

(de/listen! (dc/sel "h1") :dblclick 
     (fn [e] (dom/set-html! (dc/sel "#stuff") "I am new html")))
(de/listen! (dom/by-id "stuff") :dblclick 
      (fn [e] (.log js/console "I was clicked on")))
<h1>Header</h1>
<div id="stuff">Click on me</div>

You can use the event handler for #stuff until you double click the header, then it will wipe out #stuff. It no longer responds to double click events.

io.pedestal.app.dataflow/get-path only supports wildcards one level deep

Consider a the slightly modified dataflow from the skeleton app that contains a single transform:

(def example-app
  {;; There are currently 2 versions (formats) for dataflow
   ;; descritpion: the original version (version 1) and the current
   ;; version (version 2). If the version is not specified, the
   ;; descritpion will be assumed to be version 1 and an attempt
   ;; will be made to convert it to version 2.
   :version 2
   :transform [[:set-value [:greeting :hello] set-value-transform]]
   })

This results in a data-model of:

{:greeting {:hello "x"}}

However, io.pedestal.app/ensure-default-emitter generates:

[[#{[:*]} (default-emitter [])]]

The resulting app-model ends up being this:

[:node-create [] :map]
[:node-create [:greeting] :map]
[:value [:greeting] nil {:hello x}]

when one would expect:

[:node-create [] :map]
[:node-create [:greeting] :map]
[:node-create [:greeting :hello] :map]
[:value [:greeting :hello] nil x]

get-path only supports :* and not :** constructs, so it halts at the top level. Ideally it would support both and ensure-default-emitter would essentially mirror the data-model (which I think should be the default expectation).

App template's test namespace should be "alternate" of implementation namespace.

As a developer working on a pedestal-app application
In order to more easily switch between test and implementation namespaces in my editor
I need test files generated by app-template to have the correct namespace format ({{namespace}}.behavior-test)

Acceptance Criteria:

  • Test namespaces in app-template follow the {{namespace}}.behavior-test scheme and directory structure.

Add support for heroku and pedestal-service

Generate an app: lein new pedestal-service heroku-pedestal

Modify project.lj to mention :min-lein-version "2.0.0"

Deploy and we see this:

$ git push heroku master
Counting objects: 12, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 884 bytes, done.
Total 10 (delta 6), reused 0 (delta 0)

-----> Clojure (Leiningen 2) app detected
-----> Installing OpenJDK 1.6...done
-----> Installing Leiningen
       Downloading: leiningen-2.0.0-standalone.jar
       Writing: lein script
-----> Building with Leiningen
       Running: lein with-profile production compile :all
       Retrieving lein-standalone-repl/lein-standalone-repl/0.1.4/lein-standalone-repl-0.1.4.pom from clojars
       Retrieving lein-standalone-repl/lein-standalone-repl/0.1.4/lein-standalone-repl-0.1.4.jar from clojars
       Performing task 'compile' with profile(s): 'production'
       Compiling heroku-pedestal.server
       Exception in thread "main" java.lang.IllegalArgumentException: No implementation of method: :handler-interceptor of protocol: #'io.pedestal.service.http.route.definition.verbose/HandlerFn found for class: io.pedestal.service.impl.interceptor.Interceptor, compiling:
(server.clj:12:1)
        at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3463)
        at clojure.lang.Compiler.compile1(Compiler.java:7153)
        at clojure.lang.Compiler.compile1(Compiler.java:7143)
        at clojure.lang.Compiler.compile(Compiler.java:7219)
        at clojure.lang.RT.compile(RT.java:398)
        at clojure.lang.RT.load(RT.java:438)

Running the command that failed above lein with-profile production compile :all locally doesn't cause any errors.

I suspected :main and removed it but that didn't change the outcome.

Switch to Cheshire for JSON parsing

cheshire is significantly faster than clojure.data.json.

Upgrade body parsing and JSON response generation to use cheshire. Make sure the API is consuming input data directly from a request's input stream and producing output data directly to a response's output stream without making a copy in a string in either direction.

  • Update body-params json parser
  • Update json-response emitter
  • Keywordize JSON by default.
  • Keywordize JSON can be turned off trivially.
  • Add any new tests that may be necessary.
  • Bump minor version (this may slightly break some existing apps we know of that rely on existing behavior)

Obviously, all tests should remain passing.

Switch to namespaced keyword shorthands

Now that we have updated ClojureScript support in pedestal-app, we should switch to using namespaced keyword shorthands (::msg/topic instead of msg/topic)

Switch from msg/topic and msg/type symbols to ::msg/topic and ::msg/type keywords.

  • Make the change in app
  • Make the change in app-template
  • Make the change in samples (create card there as needed.)
  • Make the change in app-tutorial (create card there as needed.)

Interactive development

Hi! I am new to clojure and just ran across this project and am hoping to use it. One question immediately would be how can I, when I make changes, have those changes reflected immediately on a refresh instead of having to restart the server? It seems by default that is how it is. Thanks!

pedestal-service uses application/octet-stream for resources served from classpath

Resources found in the filesystem under a pedestal-service project are served as a mime-type based on their file extension.

If I move the resources into the classpath of a jar file that is included in my project, then the bytes of the resource are served, but the Content-Type header is set to application/octet-stream regardless of the file extension of the resource in the jar.

Support for http-kit/non-servlet servers

I think http-kit is cool. I also think pedestal is cool and so I want to use them together. After a brief read through server.clj it seems like a server constructed from a ring handler (not a servlet) should be possible.

Is it? Are there other components that rely on the Servlet API which cannot be avoided? Any help or direction would be appreciated.

Here is my attempt at an HTTP adapter I modeled after io.pedestal.service.http.jetty.

io.pedestal.service.http.http-kit.

Preserve line numbers during logging

I think it would be helpful to change the log methods for the application to be a macro instead of function calls as they are right now. This would allow for the line number output in Chrome console, etc to map to the correct file and location of where the logging output was generated.

Right now all of the logging output references console_log.js

pedestal-service's default responses are now served as application/octet-stream

Previously, it was the case that running lein new pedestal-service helloworld and making src/helloworld/service.clj match the following would result in the / route serving "Hello world" as normal browser-friendly response.

(ns helloworld.service
    (:require [io.pedestal.service.http :as bootstrap]
              [io.pedestal.service.http.route.definition :refer [defroutes]]
              [ring.util.response :refer [response]]))

(defn home-page
  [request]
  (response "Hello World!"))

(defroutes routes
  [[["/" {:get home-page}]]])

;; Consumed by helloworld.server/create-server
(def service {:env :prod
              ::bootstrap/routes routes
              ::bootstrap/type :jetty
              ::bootstrap/port 8080})

Now, without the addition of an html-body interceptor as below the / route is served as application/octet-stream.

(defroutes routes
 [[["/" {:get home-page} ^:interceptors [(body-params/body-params) bootstrap/html-body]]]])

It should probably be the case that by-default content is not served as an octet-stream.

app-tools compilation should be more clear about when it has failed to compile something

As brought up in #105, sometimes we write code that can't actually be represented in ClojureScript (character manipulation, for example.) In these cases, app-tools generally serves a blank page instead of ones applications, and it is quite difficult to track down the source of these errors without scanning through log output.

We should degrade more gracefully in these cases. Ideally we might display an error page a la the Rails stack trace page:

Rails Stack Trace

Add option to disable pedestal-app directory flattening

EDIT(@rkneufeld): I've co-opted this issue to serve as the issue for adding an option to disable directory flattening.

Original Issue Report:

The decision of how to name compiled/copied files should be left to the :application configuration map, which already handles where to generate them.

The current method is automatic directory flattening. It might make more sense for the user to have to opt-in to flattening, and default to a less opinionated method.

See https://groups.google.com/forum/#!topic/pedestal-users/0bat90hlsCM

Default Emitter and dataflow updated problem

There is a potential problem with how the default emitter handles updates to models when the value changes from a true value to a false value. For example, let us say you have a model {:tasks {task1 {task-id: task1}}

If you update the tasks model so that it's now:

{:tasks {task1 {task-id: task1 :completed true}}

It will output the new value, [:value [:tasks task1 :completed] true]

However, if you change it from a true value to a false one, such as nil or false, then it won't output the new value. For example, I would expect the following to be output:

[:value [:tasks task1 :completed] false]

That's not what happens though. Nothing gets output.

Here is how everything gets done:

(let [updates (->> inputs
                   dataflow/updated-inputs
                   (filter-changes inputs))]
  (mapv (fn [[k v]] [:value (prefixed k prefix) v]) updates))

It then goes from updated-inputs into changed-inputs, which calls (input-map inputs)

(defn input-map [{:keys [new-model input-paths]}]
  (into {} (for [path input-paths
                 [k v] (get-path new-model path)
                 :when v]
             [k v])))

The problem comes from the fact that if v is false or nil, it's not getting included because of the when clause. I could see excluding nil, but I think false is a valid value that a map can hold.

Perhaps a :when (nil? v) clause instead?

EventSource issue with advanced compilation

Problem

If you run the chat sample in the "production" mode, the client app fails as the window.EventSource gets obfuscated by the closure compiler with advanced compilation mode. This isn't limited to the chat sample, but that is just an easy way to replicate it.

I haven't been able to properly pass in an extern file in the config to resolve this. Is there some way to pass in externs in the config and have them passed through to the Closure compiler?

Long term, I think that it might be useful to include the extern file from Google https://code.google.com/p/closure-compiler/source/browse/contrib/externs/w3c_eventsource.js in Pedestal in order to make the production mode work by default.

Wrong input to merge in 'update-constraints'

There's a function called 'update-constraints' in the file called 'io/pedestal/service/http/route/definition/verbose.clj' and it has a bug.

Line 93 looks like that:

(update-in dna [:path-constraints] merge (map capture-constraint constraints))

But it should be probably something like that:

(update-in dna [:path-constraints] merge (into {} (map capture-constraint constraints)))

app-tools.build/split-path probably won't work in Windows

In app-tools.build/split-path (copied below) we're creating a regular expression out of the raw java.io.File/separator.

(defn- split-path [s]
  (string/split s (re-pattern File/separator)))

On *nix systems, this is "/" and creates a re-pattern that works correctly.

On Windows, this is "\\" and creates a re-pattern that will probably raise a java.util.regex.Pattern.error. You would instead have to escape this separator as "\\\\" for it to split a string "C:\some\dir" correctly.

There are a couple of really nasty ways to fix this ((clojure.string/escape "\\" {\\ "\\\\"}) for one).

Can we come up with a better solution and some tests to stress this?

char fn breaks data-ui

With the following definition in behavior.clj

(def letter (char 75)); \K

the data-ui in pedestal-app fails to render. The number supplied to char doesn't matter. I do not know if the app continues to work elsewhere.

I created a gist here: https://gist.github.com/JouisWalker/5991163

behavior.clj can be copy-pasted into a project created by

lein new pedestal-app broken-character
. The gist includes a project.clj with the template version number.

Arch Linux; 
Linux 3.9.9-1-ARCH x86_64
Leiningen 2.2.0 on Java 1.7.0_40 OpenJDK 64-Bit Server VM
[io.pedestal/pedestal.app "0.1.10"]
[io.pedestal/pedestal.app-tools "0.1.10"]

This occurs in firefox 22.0-1 and chromium 28.0.1500.71-1, so I assume it to be browser independent.

Bad ex-info call in url-for

In io.pedestal.service.http.route/url-for line 396:

(throw (ex-info "*url-for* not bound"))

must include a map in the call, like:

(throw (ex-info "*url-for* not bound" {}))

How do I load css files

How Can I load css files so that my html templates files can use them. My css files are under /resources/public/css

Dependency resolution fails with lein-pedantic.

$ lein deps
Retrieving org/clojure/clojure/1.3.0-alpha6/clojure-1.3.0-alpha6.jar from central
Failing dependency resolution because:

[ch.qos.logback/logback-classic "1.0.7"] -> [org.slf4j/slf4j-api "1.6.6"]
is overrulling
[org.slf4j/jcl-over-slf4j "1.7.2"] -> [org.slf4j/slf4j-api "1.7.2"]

Please use [ch.qos.logback/logback-classic "1.0.7" :exclusions [org.slf4j/slf4j-api]] to get [org.slf4j/slf4j-api "1.7.2"] or use [org.slf4j/jcl-over-slf4j "1.7.2" :exclusions [org.slf4j/slf4j-api]] to get [org.slf4j/slf4j-api "1.6.6"].

[ch.qos.logback/logback-classic "1.0.7"] -> [org.slf4j/slf4j-api "1.6.6"]
is overrulling
[io.pedestal/pedestal.service "0.1.6-SNAPSHOT"] -> [org.slf4j/slf4j-api "1.7.2"]

Please use [ch.qos.logback/logback-classic "1.0.7" :exclusions [org.slf4j/slf4j-api]] to get [org.slf4j/slf4j-api "1.7.2"] or use [io.pedestal/pedestal.service "0.1.6-SNAPSHOT" :exclusions [org.slf4j/slf4j-api]] to get [org.slf4j/slf4j-api "1.6.6"].

[ch.qos.logback/logback-classic "1.0.7"] -> [org.slf4j/slf4j-api "1.6.6"]
is overrulling
[org.slf4j/log4j-over-slf4j "1.7.2"] -> [org.slf4j/slf4j-api "1.7.2"]

Please use [ch.qos.logback/logback-classic "1.0.7" :exclusions [org.slf4j/slf4j-api]] to get [org.slf4j/slf4j-api "1.7.2"] or use [org.slf4j/log4j-over-slf4j "1.7.2" :exclusions [org.slf4j/slf4j-api]] to get [org.slf4j/slf4j-api "1.6.6"].

[ch.qos.logback/logback-classic "1.0.7"] -> [org.slf4j/slf4j-api "1.6.6"]
is overrulling
[org.slf4j/jul-to-slf4j "1.7.2"] -> [org.slf4j/slf4j-api "1.7.2"]

Please use [ch.qos.logback/logback-classic "1.0.7" :exclusions [org.slf4j/slf4j-api]] to get [org.slf4j/slf4j-api "1.7.2"] or use [org.slf4j/jul-to-slf4j "1.7.2" :exclusions [org.slf4j/slf4j-api]] to get [org.slf4j/slf4j-api "1.6.6"].

Please have PDF form fields for the Relevance Contributor Agreement

Hi Relevance: Would it be possible to update the PDF for the Contributor Agreement to use actual PDF form fields please? That would enable a faster and easier submission of the form for those of us who don't have a printer and scanner: we could type the required data in, and either type-to-sign or use one of the various finger-signing apps for iOS/Android. Thanks!

Add ability to map one template data field to more html attributes

Consider for example the following template:

<li template="todo" field="id:id" field="class:status">
    <div class="view">
        <input class="toggle" type="checkbox" checked>
        <label field="content:text">Create a TodoMVC template</label>
        <button class="destroy"></button>
    </div>
    <input class="edit" value="Create a TodoMVC template" field="value:text">
</li>

In current app version, the last occurence of the "something:text" overwrites all previous occurences, so for example in template above, the content of label tag is not bound to the text data field.

I already solved the issue in my fork of pedestal (janherich@18c40d5), i will create a pull request as soon as i sign CA.

Unable to create a pedestal project

Tried creating a pedestal project, using the steps mentioned https://github.com/pedestal/pedestal/tree/master/app
But getting the below error, looks like the jars are missing in repo,

Please suggest.
Retrieving org/clojure/clojure/1.5.1/clojure-1.5.1.pom (6k)
from http://repo1.maven.org/maven2/
Could not find artifact io.pedestal:pedestal.app-tools:pom:0.1.1-SNAPSHOT in central (http://repo1.maven.org/maven2)
Could not find artifact io.pedestal:pedestal.app-tools:pom:0.1.1-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact io.pedestal:pedestal.app-tools:jar:0.1.1-SNAPSHOT in central (http://repo1.maven.org/maven2)
Retrieving org/clojure/clojure/1.5.1/clojure-1.5.1.jar (3501k)
from http://repo1.maven.org/maven2/
Could not find artifact io.pedestal:pedestal.app-tools:jar:0.1.1-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact io.pedestal:pedestal.app-tools:jar:0.1.1-SNAPSHOT in central (http://repo1.maven.org/maven2)
Check :dependencies and :repositories for typos.
It's possible the specified jar is not in any repository.
If so, see "Free-floating Jars" under http://j.mp/repeatability

How to set the state of a checkbox via an app dynamic template function is not clear

Take for example the following html_templates.clj content:

(defmacro todo-mvc-templates
  []
  {:todo-mvc-page (dtfn (tnodes "todo-mvc.html" "todoapp" [[:#todo-list] [:#footer]]) #{})
   :todo-item (dtfn (tnodes "todo-mvc.html" "todo-item") #{:id})
   :count (dtfn (tnodes "todo-mvc.html" "count") #{})
   :filters (dtfn (tnodes "todo-mvc.html" "filters") #{})
   :clear-completed (dtfn (tnodes "todo-mvc.html" "clear-completed") #{})})

and this template html:

<li class="completed" template="todo-item" field="class:status" >
  <div class="view" field="id:id">
    <input class="toggle" type="checkbox">
    <label field="content:content">Create a TodoMVC template</label>
    <button class="destroy"></button>
  </div>
  <input class="edit" value="Create a TodoMVC template" field="value:content">
</li>

I'd like to hook up "status" in some way to <input class="toggle" type="checkbox">, but setting the checked field to anything can cause issues. In this case I'd like checked="checked" to appear for true, and no attribute at all to appear for false.

dev/watch should fail gracefully if handed a non-existent aspect

Current behavior is to spam the console with a flood of stacktraces, requiring a kill/restart.

Additionally, it appears to corrupt the files under ./out, requiring a manual remove of that directory.

(daemian@headcrab:~/relevance/samples/todo-mvc)       (todo-mvc)       (08:46:25)
> lein repl
nREPL server started on port 64904
REPL-y 0.1.0-beta10
Clojure 1.5.0
    Exit: Control+D or (exit) or (quit)
Commands: (user/help)
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
          (user/sourcery function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
Examples from clojuredocs.org: [clojuredocs or cdoc]
          (user/clojuredocs name-here)
          (user/clojuredocs "ns-here" "name-here")
user=> (dev)
#<Namespace dev>
dev=> (watch :developmentt)
watching [:todo-mvc] / :developmentt
:ok
dev=> ERROR io.pedestal.app-tools.build - {:line 203}
java.io.FileNotFoundException: out/public/generated-js (Is a directory)
        at java.io.FileOutputStream.open(Native Method) ~[na:1.7.0_15]
        at java.io.FileOutputStream.<init>(FileOutputStream.java:212) ~[na:1.7.0_15]
        at clojure.java.io$fn__8664.invoke(io.clj:234) ~[clojure-1.5.0.jar:na]
        at clojure.java.io$fn__8588$G__8564__8595.invoke(io.clj:73) ~[clojure-1.5.0.jar:na]
        at clojure.java.io$fn__8676.invoke(io.clj:267) ~[clojure-1.5.0.jar:na]
        at clojure.java.io$fn__8588$G__8564__8595.invoke(io.clj:73) ~[clojure-1.5.0.jar:na]
        at clojure.java.io$fn__8638.invoke(io.clj:170) ~[clojure-1.5.0.jar:na]
        at clojure.java.io$fn__8614$G__8568__8621.invoke(io.clj:73) ~[clojure-1.5.0.jar:na]
        at clojure.java.io$writer.doInvoke(io.clj:123) ~[clojure-1.5.0.jar:na]
        at clojure.lang.RestFn.invoke(RestFn.java:410) ~[clojure-1.5.0.jar:na]
        at clojure.lang.AFn.applyToHelper(AFn.java:161) ~[clojure-1.5.0.jar:na]
        at clojure.lang.RestFn.applyTo(RestFn.java:132) ~[clojure-1.5.0.jar:na]
        at clojure.core$apply.invoke(core.clj:619) ~[clojure-1.5.0.jar:na]
        at clojure.core$spit.doInvoke(core.clj:6291) ~[clojure-1.5.0.jar:na]
        at clojure.lang.RestFn.invoke(RestFn.java:425) ~[clojure-1.5.0.jar:na]
        at cljs.closure$output_one_file.invoke(closure.clj:781) ~[na:na]
        at cljs.closure$output_deps_file.invoke(closure.clj:785) ~[na:na]
        at cljs.closure$output_unoptimized.doInvoke(closure.clj:841) ~[na:na]
        at clojure.lang.RestFn.applyTo(RestFn.java:139) ~[clojure-1.5.0.jar:na]
        at clojure.core$apply.invoke(core.clj:619) ~[clojure-1.5.0.jar:na]
        at cljs.closure$build.invoke(closure.clj:915) ~[na:na]
        at io.pedestal.app_tools.compile$build_sources_BANG_.invoke(compile.clj:124) ~[na:na]
        at io.pedestal.app_tools.compile$compile_BANG_.invoke(compile.clj:199) ~[na:na]
        at io.pedestal.app_tools.build$build_BANG_.invoke(build.clj:193) ~[na:na]
        at io.pedestal.app_tools.build$thread_safe_build_BANG_$fn__8069$fn__8070.invoke(build.clj:201) ~[na:na]
        at io.pedestal.app_tools.build$thread_safe_build_BANG_$fn__8069.invoke(build.clj:201) ~[na:na]
        at clojure.core$binding_conveyor_fn$fn__4115.invoke(core.clj:1839) ~[clojure-1.5.0.jar:na]
        at clojure.lang.AFn.applyToHelper(AFn.java:161) ~[clojure-1.5.0.jar:na]
        at clojure.lang.RestFn.applyTo(RestFn.java:132) ~[clojure-1.5.0.jar:na]
        at clojure.lang.Agent$Action.doRun(Agent.java:114) [clojure-1.5.0.jar:na]
        at clojure.lang.Agent$Action.run(Agent.java:163) [clojure-1.5.0.jar:na]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_15]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_15]
        at java.lang.Thread.run(Thread.java:722) [na:1.7.0_15]
^CERROR

Modifying parent.html then refreshing child.html does not trigger recompilation

In a pedestal-app, if you have a page named child.html that rests _within some parent.html, changing parent.html and then re-visiting child.html will not trigger recompilation of that page. These changes will only be seen when child.html is modified next.

  • Find out if it is possible to trigger re-compile in this scenario
  • Trigger re-compile in this scenario

body-params interceptor should honor *data-readers*

Hi Pedestal Team,

I get the following exception when reading a custom EDN tag with
the body-params interceptor:

java.lang.RuntimeException: No reader function for tag geo/point
    at clojure.lang.EdnReader$TaggedReader.readTagged(EdnReader.java:739) ~[clojure-1.5.1.jar:na]
    at clojure.lang.EdnReader$TaggedReader.invoke(EdnReader.java:721) ~[clojure-1.5.1.jar:na]
    at clojure.lang.EdnReader$DispatchReader.invoke(EdnReader.java:507) ~[clojure-1.5.1.jar:na]
    at clojure.lang.EdnReader.readDelimitedList(EdnReader.java:695) ~[clojure-1.5.1.jar:na]
    at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:638) ~[clojure-1.5.1.jar:na]
    at clojure.lang.EdnReader.read(EdnReader.java:148) ~[clojure-1.5.1.jar:na]
    at clojure.lang.EdnReader.read(EdnReader.java:114) ~[clojure-1.5.1.jar:na]
    at clojure.edn$read.invoke(edn.clj:35) ~[clojure-1.5.1.jar:na]
    at io.pedestal.service.http.body_params$edn_parser.invoke(body_params.clj:62) ~[na:na]
    at io.pedestal.service.http.body_params$parse_content_type.invoke(body_params.clj:30) ~[na:na]

In my project I defined a data_readers.clj file sitting in my
resources directory, so I expect pedestal to honor my custom tags
as well. My data_readers.clj looks like this.

{geo/line-string geo.postgis/read-line-string
 geo/multi-point geo.postgis/read-multi-point
 geo/multi-polygon geo.postgis/read-multi-polygon
 geo/point geo.postgis/read-point
 inst datumbazo.io/read-instant-date-time}

I thing the fix is to call edn/read in the edn-parser like this:

(edn/read {:eof nil :readers *data-readers*})

I can sign the CA tomorrow and send a patch tomorrow if you are
fine with that solution.

I had this problem with:

Linux bombaclaat 3.9.8-1-ARCH #1 SMP PREEMPT Thu Jun 27 21:37:31 CEST 2013 x86_64 GNU/Linux
Leiningen 2.1.3 on Java 1.7.0_40 OpenJDK 64-Bit Server VM
[io.pedestal/pedestal.service "0.1.9"]
[io.pedestal/pedestal.jetty "0.1.9"]

Thanks, Roman.

pedestal-service doesn't log requests to STDOUT by default

We had this working before with INFO but it seems we switched logback.xml to log at WARN or above. If we don't want to change this, we should update the template to not mention "By default, app logs to stdout" and the comment in logback.xml. @aredington: Thoughts? I think you made the change.

How to get rid of the control panel in a generated application host-page is not clear

It's not clear to me how to get rid of control panel div with all aspect links from config.clj in case i don't want it in some aspect (for example :production). I can see that this div with links is appended to host-page by default dev-server (and in turn service) interceptor add-control-panel which is defined in the namespace io.pedestal.app-tools.host-page. But i think it should be possible to somehow override this behavior in a config.clj file for each aspect, for example with the key :control-panel set to false... Or am i missing some point and it's already possible ?

Clean up old names in pedestal-app

When we moved from v1 to v2 dataflows we renamed a number of dataflow function types.

  • Review names in app and dataflow namespace to ensure that all the old names have been removed
    • change msg/output to msg/effect

@brentonashworth are there any other likely suspects contributors should look out for?

Sets are not supported as tree nodes.

Using a app tree like this:

[{:app
{:todos #{}}}]

Causes the following exception in the browser:

Uncaught Error: No matching clause: :unknown tree.js:146
(anonymous function) tree.js:146
(anonymous function) tree.js:149
cljs.core.apply.apply__2 core.js:7659
cljs.core.apply.apply core.js:7744
do_dispatch core.js:19568
cljs.core.MultiFn.cljs$core$IMultiFn$dispatch$arity$2 core.js:19663
dispatch core.js:19544
cljs.core.MultiFn.call.G__18053__delegate core.js:19669
cljs.core.MultiFn.call.G__18053 core.js:19676
cljs.core.seq_reduce.seq_reduce__3 core.js:4569
cljs.core.seq_reduce.seq_reduce core.js:4592
cljs.core.reduce.reduce__3 core.js:4673
cljs.core.reduce.reduce core.js:4681
update_tree tree.js:431
apply_deltas tree.js:666
cljs.core.swap_BANG
.swap_BANG___3 core.js:18508
cljs.core.swap_BANG
.swap_BANG_ core.js:18547
io.pedestal.app.render.consume_app_model_queue render.js:9
process_next_item queue.js:20
io.pedestal.app.queue.process_next_item

Multiple renderers for a single path

It would be nice to have a concise way of plugging in more than one renderer for a path.

Sometimes you have two views over the same data and you don't want to do them all in one function. Presently it seems the only way to go about it is to make it one function that calls the dedicated renderer for each of the views:

(defn render-simulation [renderer delta transmitter]
  (render-simulation-gfx renderer delta transmitter)
  (render-simulation-labels renderer delta transmitter))

It would be nice if I could do it right in the renderer config, like so:

[:value [:simulation-state] [render-simulation-gfx render-simulation-labels]]

Or:

[:value [:simulation-state] render-simulation-gfx]
[:value [:simulation-state] render-simulation-labels]

Tests fail on a new Pedestal 0.1.7 service

When I create a new pedestal service using the following command:

lein new pedestal-service pedestal-test

And then run the tests:

cd pedestal-test && lein test

I get 2 failures:

lein test pedestal-test.service-test
INFO  i.p.s.http.impl.servlet-interceptor - {:line 362, :in :interceptor-service-fn, :context {:servlet #<FnServlet io.pedestal.service.http.servlet.FnServlet@180c20e9>, :servlet-config nil, :servlet-response #<test$test_servlet_response$reify__278 io.pedestal.service.test$test_servlet_response$reify__278@78cf88cf>, :servlet-request #<test$test_servlet_request$reify__268 io.pedestal.service.test$test_servlet_request$reify__268@1d4cd493>}}
INFO  io.pedestal.service.http - {:line 58, :msg "GET /about"}
INFO  i.p.s.http.impl.servlet-interceptor - {:line 362, :in :interceptor-service-fn, :context {:servlet #<FnServlet io.pedestal.service.http.servlet.FnServlet@7447d144>, :servlet-config nil, :servlet-response #<test$test_servlet_response$reify__278 io.pedestal.service.test$test_servlet_response$reify__278@16fc0300>, :servlet-request #<test$test_servlet_request$reify__268 io.pedestal.service.test$test_servlet_request$reify__268@7b2900c9>}}
INFO  io.pedestal.service.http - {:line 58, :msg "GET /about"}

lein test :only pedestal-test.service-test/about-page-test

FAIL in (about-page-test) (service_test.clj:22)
expected: (= (:headers (response-for service :get "/about")) {"Content-Type" "text/html"})
  actual: (not (= {"Content-Type" "text/html;charset=UTF-8"} {"Content-Type" "text/html"}))
INFO  i.p.s.http.impl.servlet-interceptor - {:line 362, :in :interceptor-service-fn, :context {:servlet #<FnServlet io.pedestal.service.http.servlet.FnServlet@2678b3c1>, :servlet-config nil, :servlet-response #<test$test_servlet_response$reify__278 io.pedestal.service.test$test_servlet_response$reify__278@3e6157a2>, :servlet-request #<test$test_servlet_request$reify__268 io.pedestal.service.test$test_servlet_request$reify__268@68c06cac>}}
INFO  io.pedestal.service.http - {:line 58, :msg "GET /"}
INFO  i.p.s.http.impl.servlet-interceptor - {:line 362, :in :interceptor-service-fn, :context {:servlet #<FnServlet io.pedestal.service.http.servlet.FnServlet@311ec5ee>, :servlet-config nil, :servlet-response #<test$test_servlet_response$reify__278 io.pedestal.service.test$test_servlet_response$reify__278@5b54a573>, :servlet-request #<test$test_servlet_request$reify__268 io.pedestal.service.test$test_servlet_request$reify__268@123a4fdd>}}
INFO  io.pedestal.service.http - {:line 58, :msg "GET /"}

lein test :only pedestal-test.service-test/home-page-test

FAIL in (home-page-test) (service_test.clj:14)
expected: (= (:headers (response-for service :get "/")) {"Content-Type" "text/html"})
  actual: (not (= {"Content-Type" "text/html;charset=UTF-8"} {"Content-Type" "text/html"}))

Ran 2 tests containing 4 assertions.
2 failures, 0 errors.
Tests failed.

OS: Ubuntu 13.04
Leiningen version: Leiningen 2.1.3 on Java 1.7.0_21 OpenJDK 64-Bit Server VM
Pedestal version: io.pedestal/pedestal.service "0.1.7"

Should we allow lower-case header names in io.pedestal.service.test/test-servlet-request ?

Re: https://github.com/pedestal/pedestal/blob/master/service/src/io/pedestal/service/test.clj#L96-97

I spent a bit of time trying to pass a "content-type" header to io.pedestal.service.test/response-for before realizing I needed to pass a "Content-Type" header instead.

Do we suppose this is a sufficiently-common error that it's worth searching for arbitrarily-cased headers in the test-servlet-request fn?

If so, I'll submit a PR.

[Client App] Template

When I created client side app by lein new pedestal-app <name>, Pedestal created a project with README.md. This README.md has old links don't exist any more:

## Links

* [Getting Started](https://github.com/relevance/platform/tree/master/app#usage)
* [Overview of how pedestal-client applications work](https://github.com/relevance/platform/wiki/Client-Application-Model)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.