Deployment descriptor (web.xml)

Information about development with Vaadin UI.

Deployment descriptor (web.xml)

Postby Development@SIB » Wed Jan 14, 2015 6:41 pm

The following XML is a minimalistic Deployment descriptor for applications using Vaadin UI.

Syntax: [ Download ] [ Hide ]
<?xml version="1.0" encoding="UTF-8"?>

<web-app id="WebApp_ID"
        version="2.4"
        xmlns="http://java.sun.com/xml/ns/j2ee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <!--
 **************************************************************************
 Context configuration
 **************************************************************************
 -->

  <display-name>Simple Application</display-name>

  <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <context-param>
        <description>Vaadin production mode</description>
        <param-name>productionMode</param-name>
        <param-value>true</param-value>
  </context-param>

  <!--
 **************************************************************************
 WebUI configuration
 **************************************************************************
 -->
 
  <servlet>
    <servlet-name>VaadinUI</servlet-name>
    <servlet-class>com.sibvisions.rad.ui.vaadin.server.VaadinServlet</servlet-class>
    <init-param>
      <param-name>UI</param-name>
      <param-value>com.sibvisions.rad.ui.vaadin.impl.VaadinUI</param-value>
    </init-param>
    <init-param>
      <param-name>widgetset</param-name>
      <param-value>com.sibvisions.rad.ui.vaadin.ext.ui.Widgetset</param-value>
    </init-param>
    <init-param>
      <param-name>main</param-name>
      <param-value>com.sibvisions.apps.simpleapp.SimpleApplication</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/com/sibvisions/apps/simpleapp/application.xml</param-value>
    </init-param>
  </servlet>

  <servlet-mapping>
    <servlet-name>VaadinUI</servlet-name>
    <url-pattern>/ui/*</url-pattern>
  </servlet-mapping>
 
  <servlet-mapping>
    <servlet-name>VaadinUI</servlet-name>
    <url-pattern>/VAADIN/*</url-pattern>
  </servlet-mapping>

The application will be available via http://localhost/simpleapp/ui/

If your vaadin application should be available in context-root (http://localhost/simpleapp/), simply change the servlet mapping to:

Syntax: [ Download ] [ Hide ]
  <servlet-mapping>
    <servlet-name>VaadinUI</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
<!--
  <servlet-mapping>
    <servlet-name>VaadinUI</servlet-name>
    <url-pattern>/VAADIN/*</url-pattern>
  </servlet-mapping>
-->


Additional options

There are some useful options, which can be controlled via init parameters:

Push support (needs an application server with push support)

Syntax: [ Download ] [ Hide ]
  <servlet>
    <servlet-name>VaadinUI</servlet-name>
    <servlet-class>com.sibvisions.rad.ui.vaadin.server.VaadinServlet</servlet-class>

    ...

    <init-param>
      <param-name>pushmode</param-name>
      <param-value>automatic | manual</param-value>
    </init-param>
    <init-param>
      <param-name>mobileView</param-name>
      <param-value>true | falsee</param-value>
    </init-param>
   
    <async-supported>true</async-supported>      
  </servlet>

Scale UI on mobile devices. This parameter adds <meta name="viewport" content="user-scalable=no,initial-scale=1.0" /> to the default index.html page, rendered from vaadin.

Syntax: [ Download ] [ Hide ]
    <init-param>
      <param-name>mobileView</param-name>
      <param-value>true | false</param-value>
    </init-param>

Use an external/additional css file. This is useful to override default css definitions without modifying the oricinal vaadin UI css file.

Syntax: [ Download ] [ Hide ]
    <init-param>
      <param-name>externalCss</param-name>
      <param-value>../simpleapp.css</param-value>
    </init-param>

If you want to use the same UI after pressing Reload in your web browser, simply set following:

Syntax: [ Download ] [ Hide ]
    <init-param>
      <param-name>preserveOnRefresh</param-name>
      <param-value>true | false</param-value>
    </init-param>

UI redirection, e.g. from http://localhost/simpleapp/ to http://localhost/simpleapp/ui/

Syntax: [ Download ] [ Hide ]
  <servlet>
    <servlet-name>UIRedirector</servlet-name>
    <servlet-class>com.sibvisions.rad.ui.vaadin.server.UIRedirectorServlet</servlet-class>
    <init-param>
      <param-name>redirectPath</param-name>
      <param-value>/ui/</param-value>
    </init-param>
  </servlet>
 
  <servlet-mapping>
    <servlet-name>UIRedirector</servlet-name>
    <url-pattern>/index.html</url-pattern>
  </servlet-mapping>


Only for Portlets

Use following parameter to decide whether vaadin libraries should be loaded from ROOT context (shared) or from application context.

Syntax: [ Download ] [ Hide ]
    <init-param>
      <param-name>vaadin.shared</param-name>
      <param-value>true | false</param-value>
    </init-param>

It's possible to change the static file location, e.g. if you redirect http requests via mod_proxy or similar:

Syntax: [ Download ] [ Hide ]
    <init-param>
      <param-name>vaadin.staticFileLocationPrefix</param-name>
      <param-value>/cust</param-value>
    </init-param>


ProjX

We have some special features in ProjX.

Use following parameter to change the menu position.

Syntax: [ Download ] [ Hide ]
    <init-param>
      <param-name>Application.Menu.position</param-name>
      <param-value>left | right</param-value>
    </init-param>

It's possible to hide the whole menu or toolbar.

Syntax: [ Download ] [ Hide ]
    <init-param>
      <param-name>Application.Menu.visible</param-name>
      <param-value>true | false</param-value>
    </init-param>

    <init-param>
      <param-name>Application.Menu.ToolBar.visible</param-name>
      <param-value>true | false</param-value>
    </init-param>


Hint

It's also possible to use most init parameters as URL parameter, e.g.
http://localhost/simpleapp/ui/?Application.Menu.position=right
User avatar
Development@SIB
 
Posts: 310
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation