Skip to main content

 Sample Code

Some code samples

Sample code for Berlioz

Here is some sample code to use for Berlioz applications.

Services

Simple services.xml

A simple service configuration to automatically bundling and minimizing styles and scripts, returning the navigation, parsing the file based on the Berlioz path and any user currently logged in.

<service-config version="1.0">

  <!-- Default services -->
  <services group="default">

    <!-- Default: PSML document -->
    <service id="pageseeder" method="get">
      <url pattern="/{+path}"/>
      <generator class="com.weborganic.bastille.web.GetWebBundles"       name="bundles"    target="html"/>
      <generator class="com.weborganic.bastille.psml.GetNavigation"      name="navigation" target="navigation"/>
      <generator class="com.weborganic.bastille.psml.GetContentFileAuto" name="psml"       target="main"/>
      <generator class="com.weborganic.bastille.security.GetUser"        name="user"       target="navigation"/>
    </service>

  </services>

</service-config>

Global configuration

The code below are meant to be copied and pasted into a Berlioz configuration file (config-[mode].xml).

Berlioz properties

The core Berlioz properties.

<!--
  Berlioz configuration options:
  - errors.handle          Handle errors or bubble to Web container [true]
  - errors.generator-catch Handle generator errors or bubble up? [true]
  - http.compression       Use HTTP compression? [true]
  - http.get-via-post      Accept POST requests to a GET service? [true]
  - http.max-age           Default max age in seconds [60]
  - xslt.cache             Cache the XSLT? only false for development [true]
-->
<berlioz>
  <errors handle="true" generator-catch="false"/>
  <http compression="true" get-via-post="true" max-age="30"/>
  <xml parse-strict="true"/>
  <xslt cache="false"/>
</berlioz>

Bastille properties

Some common Bastille properties.

<!--
  Bastille properties
-->
<bastille>
  <pageseeder host="localhost" port="8080" />
  <authenticator type="pageseeder" member-of="acme-test"/>
</bastille>
Created on , last edited on