Legacy Knowledge Base
Published Jul. 2, 2025

Modifying Liferay DXP's web.xml file

Written By

Liferay Support

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

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

As an example, you'll create a sample Ext plugin that modifies your 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 Plugins SDK's /ext folder and run the following command:

    create.[bat|sh]  modify-session-timeout "Modify Session Timeout"
    

    Your Ext plugin is generated and now resides in the Plugins SDK's /ext folder with the name you assigned followed by -ext (e.g., modify-session-timeout-ext).

  2. In the docroot/WEB-INF/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 section for help deploying the Ext plugin to your server.

Did this article resolve your issue ?

Legacy Knowledge Base