Skip to content

Console

Martin Grigorov edited this page Oct 11, 2017 · 6 revisions

Console Project

Wicket Console provides support for executing code dynamically (at runtime). The main goal is to provide capabilities to inspect, debug and modify state and behavior of the application during development and testing. Wicket Console currently supports Groovy, Clojure, Scala and Jython.

Using Wicket Console is as easy as simply adding GroovyScriptEnginePanel (same for Scala, Clojure and Jython) to a page. This panel consists of a simple form where source code can be entered and executed. Output and return value will then be displayed in response.

Here's a list of possible applications of Wicket Console, which are also available as pre packaged templates:

  • Clear Wicket's markup and properties caches at runtime
  • Read/Modify the state of any component of your system at runtime
  • Execute and evaluate Hibernate HQL or Hibernate queries
  • Enable logging (e.g. Hibernate SQL statements) at runtime
  • Enable Hibernate statistics at runtime
  • Clear caches
  • Inspect the component hierarchy
  • Get the session or component tree size
  • Read system properties

There's basically no limitation in what you can do. So keep in mind, though, that with great power comes great responsibility. Think twice before using this in a production environment and to which user to give access to Wicket Console.

Issues

There are some classpath issues when running the Scala interpreter of the console on Tomcat (Jetty works). I was not able to fix these:

Failed to initialize compiler: object scala not found. ** Note that as of 2.8 scala does not assume use of the java classpath. ** For the old behavior pass -usejavacp to scala, or if using a Settings ** object programatically, settings.usejavacp.value = true.

Maybe somebody could try to fix it or migrate to a newer Scala version.

Clone this wiki locally