Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Buggered if I know

Matthew Kennedy lispnik

💭
Buggered if I know
View GitHub Profile
View gist:5658993
standalone.xml:
...
<jms-destinations>
<jms-queue name="queue/test">
<entry name="java:/queue/test"/>
<durable>true</durable>
</jms-queue>
</jms-destinations>
</hornetq-server>
View project.clj
(defproject mytest "1.0.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.4.0"]
;; [org.clojure/google-closure-library "0.0-1376"]
;; [org.clojure/google-closure-library-third-party "0.0-1376"]
]
:plugins [[lein-cljsbuild "0.2.1"]]
:cljsbuild {:builds [{:source-path "src-cljs"
:compiler {:output-to "extension/mytest.js"
:optimizations :advanced}}]})
View gist:1222722
(defn- boot-spring
"Initialize a Jetty server for Spring and also Spring Security"
([server handler context-config-location]
(let [filter (doto (org.mortbay.jetty.servlet.FilterHolder. org.springframework.web.filter.DelegatingFilterProxy)
(.setName "springSecurityFilterChain"))
servlet (doto (org.mortbay.jetty.servlet.ServletHolder. (ring.util.servlet/servlet handler))
(.setName "default"))
context (doto (org.mortbay.jetty.servlet.Context. server "/"
(bit-or org.mortbay.jetty.servlet.Context/SESSIONS
org.mortbay.jetty.servlet.Context/SECURITY))
View gist:1221164
(defroutes main-routes
(GET "/" req (index-html req))
(GET "/admin" req (example-html req))
(GET "/user" req (example-html req))
(GET "/other" req (example-html req))
(route/resources "/")
(route/not-found "Page not found"))
View gist:1221161
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns:beans="http://www.springframework.org/schema/beans"
xmlns="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
<authentication-manager>
<authentication-provider>
<user-service>
<user name="user" password="1234" authorities="ROLE_USER"/>
View gist:1221150
(defn boot []
(jetty/run-jetty #'app
{:port 9090
:join? false
:configurator (fn [server] (boot-spring server #'app "classpath:security.xml"))
:default-handler? false}))
@lispnik
lispnik / gist:1221146
Created Sep 16, 2011
Spring/Spring Security bootstrapper for Jetty and Ring
View gist:1221146
(defn- boot-spring
"Initialize a Jetty server for Spring and also Spring Security"
([server handler context-config-location]
(let [filter (doto (org.mortbay.jetty.servlet.FilterHolder. org.springframework.web.filter.DelegatingFilterProxy)
(.setName "springSecurityFilterChain"))
servlet (doto (org.mortbay.jetty.servlet.ServletHolder. (ring.util.servlet/servlet handler))
(.setName "default"))
context (doto (org.mortbay.jetty.servlet.Context. server "/"
(bit-or org.mortbay.jetty.servlet.Context/SESSIONS
org.mortbay.jetty.servlet.Context/SECURITY))