Does the JSR 286 spec require the presence of a web.xml file in WARs containing portlets? At first, I thought so but then I created a portlet without a web.xml, deployed it in Liferay and it worked flawlessly. So is it an extension (or a bug) of Liferay, or is it not necessary to have such a file?
Do JSR-286 portlets require a web.xml file in their WAR files?
1.2k views Asked by brandizzi AtThere are 2 answers
Olaf Kock
On
I'd really have to dig in the spec - but my assumption is that it's following the servlet spec in this regard: A portlet app is first and foremost deployed to an application server. If the servlet spec requires a web.xml to be there, this requirement would need to be fulfilled. Otherwise the Appserver would not deploy the WAR (it's more or less the question if the WAR file format requires or recommends web.xml
Liferay will only kick in once the Apperver has deployed a web application. Liferay itself doesn't care for web.xml
Based on this arguing (and without looking at the spec - so I'm giving an educated guess here) I expect JSR 286 to not make a statement about web.xml. However, it probably references the servlet spec and this in turn might require/recommend/mention web.xml.
And if the Appservers require it or how they behave if it's missing is yet another story.
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in LIFERAY
- Liferay DXP Service builder @BeanReference field is null
- How to customize mention notifications in liferay 7.3.5
- Could not find method compileOnly() for arguments
- "error: cannot find symbol import com.liferay.portal.kernel.uuid.PortalUUID;" in Liferay 7.4
- java:41: error: cannot find symbol import com.liferay.portal.kernel.uuid.PortalUUID; in liefray DXP
- liferay, how to add a new permission to liferay using admin panel portal
- Why jmeter/blazemeter is not recording web actions which are in angular?
- liferay-amd-loader - Missing react dependency error in Liferay react application
- Liferay 7.4 | How to Check File Entry Permissions in a Servlet?
- Liferay 7.4 GA107: Unresolved requirement: Import-Package: com.ironsoftware.ironpdf_ [Sanitized]
- Liferay 7.4 theme development with bootstrap/clay css variables in browser
- Liferay 7 Taglib issue with new module in Dev Studio
- Liferay 7.4 GA27+: DLURLHelperUtil.getPreviewURL returning old legacy URL format for Document and Media images
- Freemarker if statements inside html elements
- Uncaught TypeError: A.LiferayItemSelectorDialog is not a constructor - Liferay Portal 7.4 GA 105
Related Questions in PORTLET
- Liferay 7.4 development using SDK
- Change theme from portal to portlet using Vaadin 14 without reloading the portlet
- Can't use ironpdf library in MVC Portlet
- Radio button is not clickable in a Liferay portlet after migration from 6.1 to 6.2
- Maven plugin: I am haven this error when i try to run mvn dependentcy: tree in cmd
- Tomcat bootstrap behavior
- Error java.lang.IllegalStateException: Unable to obtain OutputStream because Writer is already in use
- How to use jboss portlet bridge or liferay bridge?
- How to debug error "No render mappings found for MVC render command name"
- Liferay: Obtain all possible article urls or/and titles
- Refreshing a single portlet in Liferay
- Migrating Java portlet to run on Wildfly
- IBM Script Portlet for WebSphere Portal 7
- Portlet error when upgrading Primefaces 8 to Primefaces 10
- Faces message stops working after page navigation
Related Questions in WEB.XML
- In Web.xml Getting error <?xml version="1.0" encoding="UTF-8"?>
- In a web.xml, can the url-pattern of servlet-mapping containing more than one path component? (e.g. /path/to/*))
- Richfaces 3.x - Spring Boot - Migrate web.xml
- Jersey Web.xml Configuration
- Problem with deploying a spring 6 + spring-security 6 + jsf 3.0 application to the payara 6 server
- Add a new JAX-RS resource to web.xml servlet mapping
- Is there a way to define required parameter in web.xml in java servlet
- Deny access to specfic route in web.xml - Java
- Spring Security - avoiding in-web-container role binding removes flexibility
- HSTS header missing error even its show in application with preload (and http port also disable)
- Eclipse web.xml "Referenced file contains errors"
- Eclipse web.xml "The error was detected when validating the file jakartaee_10.xsd"
- Swagger and Spring MVC (non-spring-boot)
- IntelliJ all of Controllers could not autowired all of Services after context seperation
- JasperReport PDF displayed unrecognized binary after hardening Tomcat 7 web.xml
Related Questions in JSR296
- Java Webstart Dist Folder Empty
- How force the program wait a Task and show Progress Bar to user?
- Why I obtain this error when I try to add the Container object to the main JFrame object using Swing?
- How to create a Java Desktop Application in NetBeans IDE 7.2.1?
- Java Application vs. Java Desktop Application in Netbeans
- java.lang.NullPointerException bug when trying to run an app on netbeans
- implementing a class in class
- Creating a Java Desktop UI which can be understood by Eclipse and Netbeans
- In FrameView is not showing JDesktopPane and JinternalFrame on Windows OS
- How do I port a Java Desktop Application to Netbeans 7.1
- org.jdesktop.swingbinding.JTableBinding$BindingTableModel cannot be cast to javax.swing.table.DefaultTableModel
- hiding and showing java desktop app with action listener
- launch() takes time to run
- java swing single application
- Get the application closing event
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
As Olaf rightly said portlet is nothing but a web application. Liferay has a listener that gets triggered when the portlet auto deploys. It explodes the war and adds web.xml and the content that is necessary. You can check the logic if you have source. The class name is PortletDeployer and the method is getServletContent. After add the web.xml and stuffing it, they just touch it using FileUtil.touch.