Webapp
A Java Web Application (webapp) is a collection of servlets, other Java classes, static resources such as HTML pages, other resources, and meta information that describes the webapp bundled together. You can run a webapp on a servlet container. A Java webapp has a typical structure.
List of webapps
Magnolia provides the following stand-alone, pre-configured Apache Tomcat server that does not include a webapp:
Artifact | Download | Usage |
---|---|---|
|
A preconfigured Tomcat server ready to be used with any Magnolia webapp. |
Magnolia provides the following webapps and bundles.
To get the complete list of the modules in each webapp or bundle, look at the corresponding POM file of the bundle. |
DX Core
Artifact | Usage | |||||
---|---|---|---|---|---|---|
|
This is the DX Core webapp for projects. Use
|
|||||
|
DX Core webapp plus the Travel Demo for evaluation purposes.
|
|||||
|
For internal and partner cloud Magnolia usage.
|
Community
Artifact | Usage | |
---|---|---|
|
This is the most basic Magnolia webapp. Use this as a basis for your custom webapp. |
|
|
Complete Magnolia Community Edition webapp for community projects. |
|
|
Community Edition webapp plus the Travel Demo for evaluation purposes. |
|
|
Community Edition webapp plus the Travel Demo for evaluation purposes bundled with Apache Tomcat. |
Webapp directory structure
The directory structure is the container that holds the components of a webapp. The first step in creating a Magnolia webapp is creating this structure. The following table describes what each directory should contain.
Path | Contents | ||
---|---|---|---|
|
Files with cached content. |
||
|
Files extracted from |
||
|
Magnolia log files. |
||
|
Meta information files, e.g., from Maven. |
||
|
Repository. |
||
|
Templates extracted from |
||
|
Temporary work directory. |
||
|
All resources related to the application that are not in the document root. WEB-INF directory is not part of the public document.
|
||
|
Bootstrap files. Empty by default. |
||
|
Bootstrapped on author and public instances. |
||
|
Bootstrapped on author instance only. |
||
|
Bootstrapped on public instance only. |
||
|
Class path for manually deployed classes. |
||
|
Configuration files for repository and properties. |
||
|
Configuration files. |
||
|
Properties such as: repository location, persistence manager to be used, should samples be bootstrapped, should installation be done in unattended mode etc. |
||
|
Defines repository configuration. |
||
|
Log4j logging configuration. |
||
|
Properties used on author instance only. |
||
|
Properties used on public instance only. |
||
|
Persistence manager configuration files. |
||
|
Configuration for authentication and authorization. |
||
|
JAR files. |
||
|
Deployment descriptor. Describes configuration information for the entire web application. |
Adding the Magnolia main filter to the webapp
The Magnolia main filter is registered in the web.xml
file. The file only defines one filter:
<filter>
<display-name>Magnolia global filters</display-name>
<filter-name>magnoliaFilterChain</filter-name>
<filter-class>info.magnolia.cms.filters.MgnlMainFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>magnoliaFilterChain</filter-name> (1)
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
1 | The Magnolia main filter will delegate the request to the Magnolia filter chain. The filter is also mapped to forward requests, which means that the Magnolia filter chain will be re-executed on internal forwards. |
Adding the Magnolia context listener
In web.xml
we also register one listener:
<listener> (1)
<listener-class>
info.magnolia.cms.servlets.MagnoliaServletContextListener
</listener-class>
</listener>
1 | The listener initializes the system, starts the repository and modules, while the filter handles all requests. |