Author: markt Date: Wed May 16 10:03:30 2018 New Revision: 1831691 URL: http://svn.apache.org/viewvc?rev=1831691&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=50234 Add the capability to generate a web-fragment.xml file to JspC.
Modified: tomcat/trunk/java/org/apache/jasper/JspC.java tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/jasper/JspC.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/JspC.java?rev=1831691&r1=1831690&r2=1831691&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/JspC.java (original) +++ tomcat/trunk/java/org/apache/jasper/JspC.java Wed May 16 10:03:30 2018 @@ -121,6 +121,7 @@ public class JspC extends Task implement protected static final String SWITCH_URI_ROOT = "-uriroot"; protected static final String SWITCH_FILE_WEBAPP = "-webapp"; protected static final String SWITCH_WEBAPP_INC = "-webinc"; + protected static final String SWITCH_WEBAPP_FRG = "-webfrg"; protected static final String SWITCH_WEBAPP_XML = "-webxml"; protected static final String SWITCH_WEBAPP_XML_ENCODING = "-webxmlencoding"; protected static final String SWITCH_ADD_WEBAPP_XML_MAPPINGS = "-addwebxmlmappings"; @@ -142,6 +143,7 @@ public class JspC extends Task implement protected static final String SHOW_SUCCESS ="-s"; protected static final String LIST_ERRORS = "-l"; protected static final int INC_WEBXML = 10; + protected static final int FRG_WEBXML = 15; protected static final int ALL_WEBXML = 20; protected static final int DEFAULT_DIE_LEVEL = 1; protected static final int NO_DIE_LEVEL = 0; @@ -996,13 +998,36 @@ public class JspC extends Task implement /** * File where we generate a web.xml fragment with the class definitions. * @param s New value + * @deprecated Will be removed in Tomcat 10. + * Use {@link #setWebXmlInclude(String)} */ + @Deprecated public void setWebXmlFragment( String s ) { webxmlFile=resolveFile(s).getAbsolutePath(); webxmlLevel=INC_WEBXML; } /** + * File where we generate configuration with the class definitions to be + * included in a web.xml file. + * @param s New value + */ + public void setWebXmlInclude( String s ) { + webxmlFile=resolveFile(s).getAbsolutePath(); + webxmlLevel=INC_WEBXML; + } + + /** + * File where we generate a complete web-fragment.xml with the class + * definitions. + * @param s New value + */ + public void setWebFragmentXml( String s ) { + webxmlFile=resolveFile(s).getAbsolutePath(); + webxmlLevel=FRG_WEBXML; + } + + /** * File where we generate a complete web.xml with the class definitions. * @param s New value */ @@ -1513,6 +1538,9 @@ public class JspC extends Task implement if (webxmlLevel >= ALL_WEBXML) { mapout.write(Localizer.getMessage("jspc.webxml.header", webxmlEncoding)); mapout.flush(); + } else if (webxmlLevel >= FRG_WEBXML) { + mapout.write(Localizer.getMessage("jspc.webfrg.header", webxmlEncoding)); + mapout.flush(); } else if ((webxmlLevel>= INC_WEBXML) && !addWebXmlMappings) { mapout.write(Localizer.getMessage("jspc.webinc.header")); mapout.flush(); @@ -1532,6 +1560,8 @@ public class JspC extends Task implement mappingout.writeTo(mapout); if (webxmlLevel >= ALL_WEBXML) { mapout.write(Localizer.getMessage("jspc.webxml.footer")); + } else if (webxmlLevel >= FRG_WEBXML) { + mapout.write(Localizer.getMessage("jspc.webfrg.footer")); } else if ((webxmlLevel >= INC_WEBXML) && !addWebXmlMappings) { mapout.write(Localizer.getMessage("jspc.webinc.footer")); } Modified: tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties?rev=1831691&r1=1831690&r2=1831691&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/jasper/resources/LocalStrings.properties Wed May 16 10:03:30 2018 @@ -178,6 +178,7 @@ where options include:\n\ \ -compile Compiles generated servlets\n\ \ -failFast Stop on first compile error\n\ \ -webinc <file> Creates a partial servlet mappings in the file\n\ +\ -webfrg <file> Creates a complete web-fragment.xml the file\n\ \ -webxml <file> Creates a complete web.xml in the file\n\ \ -webxmlencoding <enc> Set the encoding charset used to read and write the web.xml\n\ \ file (default is UTF-8)\n\ @@ -205,6 +206,22 @@ Automatically created by Apache Tomcat J jspc.webxml.footer=\n\ </web-app>\n\ \n +jspc.webfrg.header=<?xml version="1.0" encoding="{0}"?>\n\ +<web-fragment xmlns="http://java.sun.com/xml/ns/javaee"\n\ +\ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n\ +\ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee\n\ +\ http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd"\n\ +\ version="3.0"\n\ +\ metadata-complete="true">\n\ +\ <name>org_apache_jasper.jspc</name>\n\ +\ <distributable/>\n\ +<!--\n\ +Automatically created by Apache Tomcat JspC.\n\ +-->\n\ +\n +jspc.webfrg.footer=\n\ +</web-fragment>\n\ +\n jspc.webinc.header=\n\ <!--\n\ Automatically created by Apache Tomcat JspC.\n\ Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1831691&r1=1831690&r2=1831691&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed May 16 10:03:30 2018 @@ -123,6 +123,10 @@ </subsection> <subsection name="Jasper"> <changelog> + <add> + <bug>50234</bug>: Add the capability to generate a web-fragment.xml file + to JspC. (markt) + </add> <fix> <bug>62350</bug>: Refactor <code>org.apache.jasper.runtime.BodyContentImpl</code> so a --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org