web.xml
file,
placed into the WEB-INF
directory.
The minimal web.xml
looks like this:
<web-app version="3.0" ...3.0 schema-decls omitted...>
<listener>
<listener-class>org.civilian.server.servlet.ContextListener</listener-class>
</listener>
</web-app>
WEB-INF/civilian.ini
(see next section), initializes the application
and dynamically creates all needed servlets.
civilian.ini
allows to configure most settings of Civilian.WEB-INF
folder.
civilian.ini
is a simple config file in java.util.Properties
format,
containing definitions in key = value form.
The config file of a newly scaffolded application (or of the samples) contains detailed comments which explain the various settings and their default values. We give an overview of the most important entries:
The develop flag controls if the Civilian Server and its applications run in development mode:
develop = true
app.id.*
with id being a unique identifier for each application.app.crm.class = org.example.crm.web.CrmApp
app.crm.path = /crm
app.crm.enabled = true
app.crm.encoding = UTF-8
app.crm.locales = en-UK,de-CH,fr
app.crm.messages = resbundle:org/example/crm/text/message
app.crm.asset.location.0 = dir:assets
app.crm.asset.location.1 = dir:~/crm/files
app.crm.asset.location.2 = res:assets
app.crm.async = true
app.crm.async.enabled = true
app.crm.upload.enabled = true
app.crm.upload.dir =
app.crm.upload.maxRequestSize = 200000
app.crm.upload.maxFileSize = 100000
app.crm.upload.fileSizeThreshold = 5000
app.crm.dev.classreload = true
The built-in admin app can be configured with entries civ.admin.* which are similar to an application config:
civ.admin.enabled = develop
civ.admin.path = civadmin
civilian.ini
can also be changed programmatically
by your implementation of the Application class. Some advanced settings can
only be changed programmatically.civilian.ini
.
The method should also be used to initialize any other application-global resources.Civilian uses the following logger names for the corresponding part of the framework:
myapp
:
1. Prevent Civilian from dynamically creating the servlet, either in civilian.ini
app.myapp.connect = false
protected void init(AppConfig config) {
config.setConnect(false);
...
<web-app>
...
<servlet>
<servlet-name>myapp-servlet-name</servlet-name>
<servlet-class>org.civilian.server.servlet.AppServlet</servlet-class>
<init-param>
<param-name>app.id</param-name>
<param-value>myapp</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>myapp-servlet-name</servlet-name>
<url-pattern>/mypath/*</url-pattern>
</servlet-mapping>
...
<web-app>