Modifying the web.xml with Ext Plugins

A supported use case for using Ext Plugins in Liferay DXP is modifying its web.xml file. Before beginning, make sure you’ve reviewed the generalized Customization with Ext Plugins section.

As an example, you’ll create a sample Ext plugin that modifies Liferay DXP’s existing web.xml file (e.g., in the /tomcat-[version]/webapps/ROOT/WEB-INF folder). You’ll modify the session timeout configuration, which is set to 30 (minutes) by default:

<session-config>
    <session-timeout>30</session-timeout>
    <cookie-config>
        <http-only>true</http-only>
    </cookie-config>
</session-config>

The Ext plugin will update the session timeout to one minute.

  1. Navigate into your Liferay Workspace’s /ext folder and run the following command:

    blade create -t war-core-ext modify-session-timeout
    

    Your Ext plugin is generated and now resides in the workspace’s /ext folder with the name you assigned.

  2. In the ext-web/docroot/WEB-INF folder, open the web.xml file, which was generated for you by default.

  3. Insert the following logic between the <web-app> tags:

    <session-config>
        <session-timeout>1</session-timeout>
        <cookie-config>
            <http-only>true</http-only>
        </cookie-config>
    </session-config>
    

Notice that the <session-timeout> tag has been updated to 1.

That’s it! Now when your Ext plugin is deployed, your Liferay DXP installation will timeout after one minute of inactivity. Follow the instructions in the Deploy the Plugin article for help deploying the Ext plugin to your server.

« Adding to the web.xml with Ext Plugins
Was this article helpful?
0 out of 1 found this helpful