Permalink
Browse files

Make these behave better outside of the container

  • Loading branch information...
jcrossley3 committed Mar 14, 2013
1 parent a894072 commit b316fe2ded86facbfb91239929ad4872ad112951
Showing with 6 additions and 3 deletions.
  1. +6 −3 namespaces/common/src/main/clojure/immutant/util.clj
@@ -46,7 +46,8 @@
(defn app-relative
"Returns a file relative to app-root"
[& path]
- (apply io/file (app-root) path))
+ (if-let [root (app-root)]
+ (apply io/file root path)))
(defn at-exit
"Registers a function to be called when the application is undeployed.
@@ -80,12 +81,14 @@
(defn http-port
"Returns the HTTP port for the embedded web server"
[]
- (.getPort (registry/get "jboss.web.connector.http")))
+ (if-let [server (registry/get "jboss.web.connector.http")]
+ (.getPort server)))
(defn context-path
"Returns the HTTP context path for the deployed app"
[]
- (.getName (immutant.registry/get "web-context")))
+ (if-let [context (immutant.registry/get "web-context")]
+ (.getName context)))
(defn app-uri
"Returns the base URI for the app, given a host [localhost]"

0 comments on commit b316fe2

Please sign in to comment.