| <?xml version="1.0"?> |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| <document> |
| |
| <properties> |
| <title>Turbine Services - Velocity Service</title> |
| <author email="jvanzyl@apache.org">Jason van Zyl</author> |
| </properties> |
| |
| <body> |
| |
| <section name="Velocity Service"> |
| |
| <p> |
| The Velocity Service is used to process |
| <a href="http://velocity.apache.org/engine/">Velocity</a> templates from within |
| a Turbine Screen. It is used in conjunction with the |
| <a href="template-service.html">Template Service</a> as a Templating Engine for |
| templates ending in "vm". |
| </p> |
| |
| </section> |
| |
| <section name="Configuration"> |
| |
| <source><![CDATA[ |
| # ------------------------------------------------------------------- |
| # |
| # S E R V I C E S |
| # |
| # ------------------------------------------------------------------- |
| # Classes for Turbine Services should be defined here. |
| # Format: services.[name].classname=[implementing class] |
| # |
| # To specify properties of a service use the following syntax: |
| # service.[name].[property]=[value] |
| |
| services.VelocityService.classname = org.apache.turbine.services.velocity.TurbineVelocityService |
| . |
| . |
| . |
| # ------------------------------------------------------------------- |
| # |
| # V E L O C I T Y S E R V I C E |
| # |
| # ------------------------------------------------------------------- |
| |
| # The location of Velocity configuration file, relative to webapp root |
| # These properties will override the default properties set by Velocity. |
| # You should specify the path to the templates directories as well as |
| # the path to the log file and they should also be relative to webapp root |
| |
| services.VelocityService.template.extension = vm |
| services.VelocityService.default.page = VelocityPage |
| services.VelocityService.default.screen = VelocityScreen |
| services.VelocityService.default.layout = VelocityOnlyLayout |
| services.VelocityService.default.navigation = VelocityNavigation |
| services.VelocityService.default.error.screen = VelocityErrorScreen |
| services.VelocityService.default.layout.template = Default.vm |
| |
| # |
| # Set this to true to catch Velocity Errors and display them in the log file |
| services.VelocityService.catch.errors = true |
| |
| services.VelocityService.runtime.log = /logs/velocity.log |
| #services.VelocityService.input.encoding = UTF-8 |
| services.VelocityService.velocimacro.library = GlobalMacros.vm |
| |
| services.VelocityService.resource.loader = file |
| services.VelocityService.file.resource.loader.description = Velocity File Resource Loader |
| services.VelocityService.file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader |
| services.VelocityService.file.resource.loader.path = /templates/app |
| services.VelocityService.file.resource.loader.cache = false |
| services.VelocityService.file.resource.loader.modificationCheckInterval = 2 |
| |
| services.VelocityService.resource.loader = classpath |
| services.VelocityService.classpath.resource.loader.description = Velocity Classpath Resource Loader |
| services.VelocityService.classpath.resource.loader.class = org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader |
| |
| ]]></source> |
| |
| </section> |
| |
| <section name="Usage"> |
| |
| <p> |
| The Velocity Service registers itself as translation engine with the Template |
| Service and it gets accessed from there. After configuring it in your properties, |
| it should never be necessary to call methods from this service directly. Please |
| refer to the <a href="../howto/context-howto.html">Velocity Context Howto</a> |
| for details of how to use this service. |
| </p> |
| |
| </section> |
| |
| <section name="Properties"> |
| <ul> |
| <li>"services.VelocityService.catch.errors" controls the reporting of Velocity errors to the application (and to to the user). |
| If this is set to "true" (which is the default), errors are caught by Turbine and reported in the turbine.log file at |
| error level. Velocity will get the String "[Turbine caught an Error here. Look into the turbine.log for further information]" |
| as return value (this might cause further errors down the road if you e.g. expect a numerical value or an object as the result |
| of a method), so if you see this message in your screen, follow the instructions. |
| </li> |
| </ul> |
| </section> |
| |
| </body> |
| </document> |