immutant.util

Various utility functions.

app-name

(app-name)

Returns the name of the current application.

app-relative

deprecated in 2.1.3

(app-relative & path)

Returns an absolute file relative to app-root. DEPRECATED: use clojure.java.io/resource instead.

app-root

(app-root)

Returns a file pointing to the root dir of the application. DEPRECATED: use clojure.java.io/resource instead.

at-exit

(at-exit f)

Registers f to be called when the application is either stopped or, if running within a container, undeployed. Used internally to shutdown various services, but can be used by application code as well.

classpath

(classpath)

Returns the effective classpath for the application.

context-path

(context-path)

Returns the over-arching context-path for the web server.

Returns the servlet-context’s context path in-container, and "" outside.

dev-mode?

(dev-mode?)

Returns true if the app is running in dev mode.

This is controlled by the LEIN_NO_DEV environment variable.

http-port

(http-port)(http-port options)

Returns the HTTP port for the embedded web server.

Returns the correct port when in-container, and the :port value from options or the default (8080) outside.

in-cluster?

(in-cluster?)

Returns true if running inside a WildFly/EAP container that’s part of a cluster

in-container?

(in-container?)

Returns true if running inside a WildFly/EAP container.

in-eap?

(in-eap?)

Returns true if running inside an EAP container.

messaging-remoting-port

(messaging-remoting-port)

Returns the port that HornetQ is listening on for remote connections.

Returns the correct port when in-container, and the default (5445), outside.

reset

(reset)

Resets the underlying WunderBoss layer. This stops and clears all services. Intended to be used from a repl or from tests.

reset-fixture

(reset-fixture f)

Invokes f, then calls reset if not in-container?.

Useful as a test fixture where you want to reset underlying state after a test run, but also run the same tests in-container (via fntest or other), where resetting state will disconnect the repl. In the in-container case, you rely on undeploy to reset the state.

set-bean-property

(set-bean-property bean prop value)

Calls a java bean-style setter (.setFooBar) for the given property (:foo-bar) and value.

set-log-level!

(set-log-level! level)

Sets the global log level for the interal logging system.

Valid options for level are: :OFF, :ERROR, :WARN, :INFO, :DEBUG, :TRACE, :ALL