This sounds fine, but I'm worried about introducing configuration in faces-config.xml that might ordinarily be in web.xml without a plan for how we handle existing parameters. Consistency is really important, especially for frameworks, and adding the configuration for this feature to faces-config.xml opens the door to having half of the configuration in faces-config.xml and half in web.xml with no obvious justification other than "these parameters are newer". <div>
<br></div><div>So I think we should implement this as a standard web.xml context parameter, _or_ provide faces-config.xml support for all existing context parameters.<br><div><br></div><div>---<br>Kito D. Mann | twitter: kito99 | Author, JSF in Action<br>
Virtua, Inc. | <a href="http://www.virtua.com">http://www.virtua.com</a> | JSF/Java EE training and consulting<br><a href="http://www.JSFCentral.com">http://www.JSFCentral.com</a> - JavaServer Faces FAQ, news, and info | twitter: jsfcentral<br>
+1 203-404-4848 x3<br><br>Sign up for the JSFCentral newsletter: <a href="http://oi.vresp.com/?fid=ac048d0e17">http://oi.vresp.com/?fid=ac048d0e17</a><br><br>
<br><br><div class="gmail_quote">On Thu, Sep 30, 2010 at 11:22 PM, Edward Burns <span dir="ltr"><<a href="mailto:edward.burns@oracle.com">edward.burns@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
<a href="https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=490" target="_blank">https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=490</a><br>
<br>
As a first step towards making JSPX files runable as Facelets, this<br>
commit introduces a new configuration syntax.<br>
<br>
Andy Schwartz requested this feature.<br>
<br>
For the first time ever, we are using the faces-config to specify<br>
context-param like configuration options. In this case, we're<br>
leveraging the faces-config-extension facility. Andy also suggested<br>
this config concept.<br>
<br>
The automated test for this feature has the following faces-config.<br>
<br>
<?xml version='1.0' encoding='UTF-8'?><br>
<faces-config<br>
xmlns="<a href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a>"<br>
xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"<br>
xsi:schemaLocation="<a href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" target="_blank">http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd</a>"<br>
version="2.0"><br>
<br>
<faces-config-extension><br>
<facelets-processing><br>
<file-extension>.jspx</file-extension><br>
<process-as>jspx</process-as><br>
</facelets-processing><br>
<facelets-processing><br>
<file-extension>.view.xml</file-extension><br>
<process-as>xml</process-as><br>
</facelets-processing><br>
</faces-config-extension><br>
<br>
</faces-config><br>
<br>
The <facelets-processing> elements are new.<br>
<br>
The sample app also has these context params:<br>
<br>
<context-param><br>
<param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name><br>
<param-value>*.xhtml;*.view.xml;*.jspx</param-value><br>
</context-param><br>
<br>
<context-param><br>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name><br>
<param-value>.xhtml .view.xml .jsp .jspx</param-value><br>
</context-param><br>
<br>
PENDING(edburns): Currently this feature relies on the existing<br>
<xsd:any> declaration for the children of faces-config-extension. I<br>
would like to tighten this up to allow validaiton but will do it after<br>
the 30 Sept deadline.<br>
<br>
The preceding faces-config and web.xml example must cause the<br>
implementation to behave as follows.<br>
<br>
The web.xml says that jspx should be considered as one of the default<br>
suffixes for JSF. It also says that files with a .jspx extension must<br>
be treated as facelets, not JSPs.<br>
<br>
The faces-config.xml says that files with the .jspx extension should be<br>
treated as if they are running in Facelets for JSPX mode, as specified<br>
in the following table. It also says that files ending in .view.xml<br>
must be handled as if they are running in Facelets for XML mode, also<br>
specified in the table.<br>
<br>
<br>
XML construct process-as mode<br>
------------- ---------------<br>
<br>
xhtml xml jspx<br>
XML Declaration passed through consumed consumed<br>
Processing Instructions passed through consumed consumed<br>
CDATA passed through consumed consumed<br>
Inline text escaping escaped escaped not escaped<br>
Comments passed through consumed consumed<br>
<br>
PENDING(edburns): should the table specified above be the default, even<br>
if no facelets-processing elements appear? Right now, the<br>
facelets-processing elements must appear, otherwise the legacy facelets<br>
format is used in all facelet cases. I think that's correct, but I am<br>
open to suggestions.<br>
<br>
SECTION: Modified Files<br>
----------------------------<br>
M jsf-ri/src/main/java/com/sun/faces/config/WebConfiguration.java<br>
<br>
- enhance this class, which previously only handled web.xml style<br>
configuration, to also handle faces-config.xml style<br>
configuration. The first manifestation of this is the new pair of<br>
getFacesConfigOptionValue() methods, one with a boolean create<br>
parameter.<br>
<br>
- To make the intent of the feature more clear, a define a read-only<br>
singleton helper class, FaceletsConfiguration, which is owned by the<br>
WebConfiguration.<br>
<br>
A jsf-ri/src/main/java/com/sun/faces/config/FaceletsConfiguration.java<br>
<br>
- A place to hang methods that allow the runtime to query the facelets<br>
configuration. Currently this only includes config options conveyed<br>
via the new faces-config-extension/facelets-processing elements.<br>
<br>
M jsf-ri/src/main/java/com/sun/faces/facelets/compiler/LiteralTextInstruction.java<br>
<br>
- When writing inline text, use the new config facility to determine if<br>
the text should be escaped or not.<br>
<br>
M jsf-ri/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java<br>
<br>
- add some ivars and getters.<br>
<br>
M jsf-ri/src/main/java/com/sun/faces/facelets/compiler/TextUnit.java<br>
<br>
- To ease migration from JSPX to facelets, allow the new <faces-view><br>
markup element to exist in XHTML or XML pages, but make sure it gets<br>
swallowed and does not appear in the output. The startTag() and<br>
endTag() methods were hit.<br>
<br>
M jsf-ri/src/main/java/com/sun/faces/facelets/compiler/SAXCompiler.java<br>
<br>
- Take the correct action regarding CDATA, comments,<br>
processingInstructions, and the XML declaration.<br>
<br>
M jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/XmlLibrary.java<br>
<br>
- Clean imports<br>
<br>
M jsf-ri/src/main/java/com/sun/faces/config/ConfigManager.java<br>
<br>
- Add a new config processor for the faces-config-extension content.<br>
<br>
M jsf-ri/src/main/java/com/sun/faces/config/ConfigureListener.java<br>
M jsf-ri/systest-per-webapp/build.xml<br>
M jsf-ri/systest-per-webapp/build-tests.xml<br>
<br>
- new automated test<br>
<br>
A jsf-ri/src/main/java/com/sun/faces/config/processor/FacesConfigExtensionProcessor.java<br>
<br>
- expose xml config to runtime.<br>
<br>
A jsf-ri/systest-per-webapp/process-as-jspx<br>
A jsf-ri/systest-per-webapp/process-as-jspx/src<br>
A jsf-ri/systest-per-webapp/process-as-jspx/src/java<br>
A jsf-ri/systest-per-webapp/process-as-jspx/src/java/com<br>
A jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun<br>
A jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces<br>
A jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest<br>
A jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxTestCase.java<br>
A jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxBean.java<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web/jspxview.jspx<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web/xhtmlview.xhtml<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web/jspview.jsp<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web/xmlview.view.xml<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF/faces-config.xml<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF/web.xml<br>
A jsf-ri/systest-per-webapp/process-as-jspx/web/index.html<br>
<br>
- Automated test.<br>
<br>
<br>
SECTION: Diffs<br>
----------------------------<br>
Index: jsf-ri/src/main/java/com/sun/faces/facelets/compiler/LiteralTextInstruction.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/facelets/compiler/LiteralTextInstruction.java (revision 8624)<br>
+++ jsf-ri/src/main/java/com/sun/faces/facelets/compiler/LiteralTextInstruction.java (working copy)<br>
@@ -55,10 +55,11 @@<br>
<br>
package com.sun.faces.facelets.compiler;<br>
<br>
+import com.sun.faces.config.FaceletsConfiguration;<br>
+import javax.faces.context.FacesContext;<br>
+import java.io.IOException;<br>
import javax.el.ELContext;<br>
import javax.el.ExpressionFactory;<br>
-import javax.faces.context.FacesContext;<br>
-import java.io.IOException;<br>
<br>
final class LiteralTextInstruction implements Instruction {<br>
private final String text;<br>
@@ -68,7 +69,11 @@<br>
}<br>
<br>
public void write(FacesContext context) throws IOException {<br>
- context.getResponseWriter().writeText(this.text, null);<br>
+ if (FaceletsConfiguration.getInstance(context).isEscapeInlineText(context)) {<br>
+ context.getResponseWriter().writeText(this.text, null);<br>
+ } else {<br>
+ context.getResponseWriter().write(this.text);<br>
+ }<br>
}<br>
<br>
public Instruction apply(ExpressionFactory factory, ELContext ctx) {<br>
Index: jsf-ri/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java (revision 8624)<br>
+++ jsf-ri/src/main/java/com/sun/faces/facelets/compiler/CompilationManager.java (working copy)<br>
@@ -56,6 +56,7 @@<br>
<br>
package com.sun.faces.facelets.compiler;<br>
<br>
+import com.sun.faces.config.WebConfiguration;<br>
import com.sun.faces.facelets.tag.TagAttributesImpl;<br>
import com.sun.faces.facelets.tag.TagLibrary;<br>
import com.sun.faces.facelets.tag.composite.CompositeLibrary;<br>
@@ -102,6 +103,8 @@<br>
private final String alias;<br>
<br>
private CompilationMessageHolder messageHolder = null;<br>
+<br>
+ private WebConfiguration config;<br>
<br>
public CompilationManager(String alias, Compiler compiler) {<br>
<br>
@@ -125,6 +128,8 @@<br>
// our compilationunit stack<br>
this.units = new Stack<CompilationUnit>();<br>
this.units.push(new CompilationUnit());<br>
+<br>
+ config = WebConfiguration.getInstance();<br>
<br>
}<br>
<br>
@@ -139,6 +144,14 @@<br>
}<br>
return messageHolder;<br>
}<br>
+<br>
+ public String getAlias() {<br>
+ return alias;<br>
+ }<br>
+<br>
+ public WebConfiguration getWebConfiguration() {<br>
+ return config;<br>
+ }<br>
<br>
public void setCompilationMessageHolder(CompilationMessageHolder messageHolder) {<br>
this.messageHolder = messageHolder;<br>
Index: jsf-ri/src/main/java/com/sun/faces/facelets/compiler/TextUnit.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/facelets/compiler/TextUnit.java (revision 8624)<br>
+++ jsf-ri/src/main/java/com/sun/faces/facelets/compiler/TextUnit.java (working copy)<br>
@@ -54,13 +54,16 @@<br>
<br>
package com.sun.faces.facelets.compiler;<br>
<br>
+import com.sun.faces.config.FaceletsConfiguration;<br>
import com.sun.faces.facelets.el.ELText;<br>
<br>
import javax.el.ELException;<br>
import javax.faces.view.facelets.*;<br>
import java.util.ArrayList;<br>
import java.util.List;<br>
+import java.util.Map;<br>
import java.util.Stack;<br>
+import java.util.concurrent.ConcurrentHashMap;<br>
<br>
/**<br>
*<br>
@@ -85,6 +88,14 @@<br>
<br>
private final String id;<br>
<br>
+ private final static Map<String, Boolean> qNamesToSwallow;<br>
+<br>
+<br>
+ static {<br>
+ qNamesToSwallow = new ConcurrentHashMap<String, Boolean>(1);<br>
+ qNamesToSwallow.put("faces-view", Boolean.TRUE);<br>
+ }<br>
+<br>
public TextUnit(String alias, String id) {<br>
this.alias = alias;<br>
<a href="http://this.id" target="_blank">this.id</a> = id;<br>
@@ -168,16 +179,16 @@<br>
public void writeComment(String text) {<br>
this.finishStartTag();<br>
<br>
- ELText el = ELText.parse(text);<br>
- if (el.isLiteral()) {<br>
- this.addInstruction(new LiteralCommentInstruction(text));<br>
- } else {<br>
- this.addInstruction(new CommentInstruction(el));<br>
+ ELText el = ELText.parse(text);<br>
+ if (el.isLiteral()) {<br>
+ this.addInstruction(new LiteralCommentInstruction(text));<br>
+ } else {<br>
+ this.addInstruction(new CommentInstruction(el));<br>
+ }<br>
+<br>
+ this.buffer.append("<!--" + text + "-->");<br>
}<br>
<br>
- this.buffer.append("<!--" + text + "-->");<br>
- }<br>
-<br>
public void startTag(Tag tag) {<br>
<br>
// finish any previously written tags<br>
@@ -185,36 +196,39 @@<br>
<br>
// push this tag onto the stack<br>
this.tags.push(tag);<br>
+ String qName = tag.getQName();<br>
<br>
- // write it out<br>
- this.buffer.append('<');<br>
- this.buffer.append(tag.getQName());<br>
+ if (!qNamesToSwallow.containsKey(qName)) {<br>
+ // write it out<br>
+ this.buffer.append('<');<br>
+ this.buffer.append(qName);<br>
<br>
- this.addInstruction(new StartElementInstruction(tag.getQName()));<br>
+ this.addInstruction(new StartElementInstruction(tag.getQName()));<br>
<br>
- TagAttribute[] attrs = tag.getAttributes().getAll();<br>
- if (attrs.length > 0) {<br>
- for (int i = 0; i < attrs.length; i++) {<br>
- String qname = attrs[i].getQName();<br>
- String value = attrs[i].getValue();<br>
- this.buffer.append(' ').append(qname).append("=\"").append(<br>
+ TagAttribute[] attrs = tag.getAttributes().getAll();<br>
+ if (attrs.length > 0) {<br>
+ for (int i = 0; i < attrs.length; i++) {<br>
+ String qname = attrs[i].getQName();<br>
+ String value = attrs[i].getValue();<br>
+ this.buffer.append(' ').append(qname).append("=\"").append(<br>
value).append("\"");<br>
<br>
- ELText txt = ELText.parse(value);<br>
- if (txt != null) {<br>
- if (txt.isLiteral()) {<br>
- this.addInstruction(new LiteralAttributeInstruction(<br>
- qname, txt.toString()));<br>
- } else {<br>
- this.addInstruction(new AttributeInstruction(<br>
- this.alias, qname, txt));<br>
+ ELText txt = ELText.parse(value);<br>
+ if (txt != null) {<br>
+ if (txt.isLiteral()) {<br>
+ this.addInstruction(new LiteralAttributeInstruction(<br>
+ qname, txt.toString()));<br>
+ } else {<br>
+ this.addInstruction(new AttributeInstruction(<br>
+ this.alias, qname, txt));<br>
+ }<br>
}<br>
}<br>
}<br>
+ // notify that we have an open tag<br>
+ this.startTagOpen = true;<br>
}<br>
<br>
- // notify that we have an open tag<br>
- this.startTagOpen = true;<br>
}<br>
<br>
private void finishStartTag() {<br>
@@ -227,13 +241,17 @@<br>
public void endTag() {<br>
Tag tag = (Tag) this.tags.pop();<br>
<br>
- this.addInstruction(new EndElementInstruction(tag.getQName()));<br>
+ String qName = tag.getQName();<br>
<br>
- if (this.startTagOpen) {<br>
- this.buffer.append("/>");<br>
- this.startTagOpen = false;<br>
- } else {<br>
- this.buffer.append("</").append(tag.getQName()).append('>');<br>
+ if (!qNamesToSwallow.containsKey(qName)) {<br>
+ this.addInstruction(new EndElementInstruction(qName));<br>
+<br>
+ if (this.startTagOpen) {<br>
+ this.buffer.append("/>");<br>
+ this.startTagOpen = false;<br>
+ } else {<br>
+ this.buffer.append("</").append(tag.getQName()).append('>');<br>
+ }<br>
}<br>
}<br>
<br>
Index: jsf-ri/src/main/java/com/sun/faces/facelets/compiler/SAXCompiler.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/facelets/compiler/SAXCompiler.java (revision 8624)<br>
+++ jsf-ri/src/main/java/com/sun/faces/facelets/compiler/SAXCompiler.java (working copy)<br>
@@ -55,6 +55,7 @@<br>
package com.sun.faces.facelets.compiler;<br>
<br>
import com.sun.faces.RIConstants;<br>
+import com.sun.faces.config.FaceletsConfiguration;<br>
import com.sun.faces.config.WebConfiguration;<br>
import com.sun.faces.facelets.tag.TagAttributeImpl;<br>
import com.sun.faces.facelets.tag.TagAttributesImpl;<br>
@@ -71,6 +72,7 @@<br>
import java.io.IOException;<br>
import java.io.InputStream;<br>
import java.net.URL;<br>
+import java.util.Map;<br>
import java.util.regex.Matcher;<br>
import java.util.regex.Pattern;<br>
<br>
@@ -96,6 +98,8 @@<br>
protected Locator locator;<br>
<br>
protected final CompilationManager unit;<br>
+<br>
+ private boolean inSuppressedCDATA;<br>
<br>
public CompilationHandler(CompilationManager unit, String alias) {<br>
this.unit = unit;<br>
@@ -105,14 +109,18 @@<br>
public void characters(char[] ch, int start, int length)<br>
throws SAXException {<br>
if (this.inDocument) {<br>
- this.unit.writeText(new String(ch, start, length));<br>
+ if (!inSuppressedCDATA) {<br>
+ this.unit.writeText(new String(ch, start, length));<br>
+ }<br>
}<br>
}<br>
<br>
public void comment(char[] ch, int start, int length)<br>
throws SAXException {<br>
if (this.inDocument) {<br>
- this.unit.writeComment(new String(ch, start, length));<br>
+ if (!unit.getWebConfiguration().getFaceletsConfiguration().isConsumeComments(alias)) {<br>
+ this.unit.writeComment(new String(ch, start, length));<br>
+ }<br>
}<br>
}<br>
<br>
@@ -134,7 +142,10 @@<br>
<br>
public void endCDATA() throws SAXException {<br>
if (this.inDocument) {<br>
- this.unit.writeInstruction("]]>");<br>
+ if (!unit.getWebConfiguration().getFaceletsConfiguration().isConsumeCDATA(alias)) {<br>
+ this.unit.writeInstruction("]]>");<br>
+ }<br>
+ this.inSuppressedCDATA = false;<br>
}<br>
}<br>
<br>
@@ -192,7 +203,12 @@<br>
<br>
public void startCDATA() throws SAXException {<br>
if (this.inDocument) {<br>
- this.unit.writeInstruction("<![CDATA[");<br>
+ if (!unit.getWebConfiguration().getFaceletsConfiguration().isConsumeCDATA(alias)) {<br>
+ inSuppressedCDATA = false;<br>
+ this.unit.writeInstruction("<![CDATA[");<br>
+ } else {<br>
+ inSuppressedCDATA = true;<br>
+ }<br>
}<br>
}<br>
<br>
@@ -241,10 +257,18 @@<br>
public void processingInstruction(String target, String data)<br>
throws SAXException {<br>
if (this.inDocument) {<br>
- StringBuffer sb = new StringBuffer(64);<br>
- sb.append("<?").append(target).append(' ').append(data).append(<br>
- "?>\n");<br>
- this.unit.writeInstruction(sb.toString());<br>
+<br>
+ // If there is a process-as value for the extension, only allow<br>
+ // the PI to be written if its value is xhtml<br>
+ boolean processAsXhtml =<br>
+ this.unit.getWebConfiguration().getFaceletsConfiguration().isProcessCurrentDocumentAsFaceletsXhtml(alias);<br>
+<br>
+ if (processAsXhtml) {<br>
+ StringBuffer sb = new StringBuffer(64);<br>
+ sb.append("<?").append(target).append(' ').append(data).append(<br>
+ "?>\n");<br>
+ this.unit.writeInstruction(sb.toString());<br>
+ }<br>
}<br>
}<br>
}<br>
@@ -418,8 +442,16 @@<br>
String r = new String(b);<br>
Matcher m = XmlDeclaration.matcher(r);<br>
if (m.find()) {<br>
- WebConfiguration config = WebConfiguration.getInstance();<br>
- if (!config.isOptionEnabled(WebConfiguration.BooleanWebContextInitParameter.SuppressXmlDeclaration)) {<br>
+ WebConfiguration config = mngr.getWebConfiguration();<br>
+ FaceletsConfiguration faceletsConfig = config.getFaceletsConfiguration();<br>
+ boolean suppressXmlDeclIsEnabled = config.isOptionEnabled(WebConfiguration.BooleanWebContextInitParameter.SuppressXmlDeclaration);<br>
+ boolean currentModeIsXhtml = faceletsConfig.isProcessCurrentDocumentAsFaceletsXhtml(mngr.getAlias());<br>
+<br>
+ // We want to write the XML declaration if and only if<br>
+ // The SuppressXmlDeclaration context-param is NOT enabled<br>
+ // and the file extension for the current file has a mapping<br>
+ // with the value of XHTML<br>
+ if (!suppressXmlDeclIsEnabled && currentModeIsXhtml) {<br>
mngr.writeInstruction(m.group(0) + "\n");<br>
if (m.group(3) != null) {<br>
encoding = m.group(3);<br>
Index: jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/XmlLibrary.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/XmlLibrary.java (revision 8624)<br>
+++ jsf-ri/src/main/java/com/sun/faces/facelets/tag/xml/XmlLibrary.java (working copy)<br>
@@ -54,7 +54,6 @@<br>
<br>
package com.sun.faces.facelets.tag.xml;<br>
<br>
-import com.sun.faces.facelets.tag.composite.*;<br>
import com.sun.faces.facelets.tag.AbstractTagLibrary;<br>
<br>
/**<br>
Index: jsf-ri/src/main/java/com/sun/faces/config/processor/FacesConfigExtensionProcessor.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/config/processor/FacesConfigExtensionProcessor.java (revision 0)<br>
+++ jsf-ri/src/main/java/com/sun/faces/config/processor/FacesConfigExtensionProcessor.java (revision 0)<br>
@@ -0,0 +1,183 @@<br>
+/*<br>
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.<br>
+ *<br>
+ * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.<br>
+ *<br>
+ * The contents of this file are subject to the terms of either the GNU<br>
+ * General Public License Version 2 only ("GPL") or the Common Development<br>
+ * and Distribution License("CDDL") (collectively, the "License"). You<br>
+ * may not use this file except in compliance with the License. You can obtain<br>
+ * a copy of the License at <a href="https://glassfish.dev.java.net/public/CDDL+GPL.html" target="_blank">https://glassfish.dev.java.net/public/CDDL+GPL.html</a><br>
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific<br>
+ * language governing permissions and limitations under the License.<br>
+ *<br>
+ * When distributing the software, include this License Header Notice in each<br>
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.<br>
+ * Sun designates this particular file as subject to the "Classpath" exception<br>
+ * as provided by Sun in the GPL Version 2 section of the License file that<br>
+ * accompanied this code. If applicable, add the following below the License<br>
+ * Header, with the fields enclosed by brackets [] replaced by your own<br>
+ * identifying information: "Portions Copyrighted [year]<br>
+ * [name of copyright owner]"<br>
+ *<br>
+ * Contributor(s):<br>
+ *<br>
+ * If you wish your version of this file to be governed by only the CDDL or<br>
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]<br>
+ * elects to include this software in this distribution under the [CDDL or GPL<br>
+ * Version 2] license." If you don't indicate a single choice of license, a<br>
+ * recipient has the option to distribute your version of this file under<br>
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to<br>
+ * its licensees as provided above. However, if you add GPL Version 2 code<br>
+ * and therefore, elected the GPL Version 2 license, then the option applies<br>
+ * only if the new code is made subject to such option by the copyright<br>
+ * holder.<br>
+ */<br>
+<br>
+package com.sun.faces.config.processor;<br>
+<br>
+import com.sun.faces.config.DocumentInfo;<br>
+import com.sun.faces.config.WebConfiguration;<br>
+import com.sun.faces.util.FacesLogger;<br>
+import org.w3c.dom.Element;<br>
+import org.w3c.dom.Node;<br>
+import org.w3c.dom.NodeList;<br>
+import org.w3c.dom.Document;<br>
+<br>
+import javax.servlet.ServletContext;<br>
+<br>
+import java.text.MessageFormat;<br>
+import java.util.Map;<br>
+import java.util.logging.Level;<br>
+import java.util.logging.Logger;<br>
+<br>
+<br>
+/**<br>
+ * <p><br>
+ * This <code>ConfigProcessor</code> handles all elements defined under<br>
+ * <code>/faces-config/factory</code>.<br>
+ * </p><br>
+ */<br>
+public class FacesConfigExtensionProcessor extends AbstractConfigProcessor {<br>
+<br>
+ private static final Logger LOGGER = FacesLogger.CONFIG.getLogger();<br>
+<br>
+ /**<br>
+ * <code>/faces-config/faces-config-extension</code><br>
+ */<br>
+ private static final String FACES_CONFIG_EXTENSION = "faces-config-extension";<br>
+<br>
+ /**<br>
+ * <code>/faces-config/faces-config-extension/facelets-processing</code><br>
+ */<br>
+ private static final String FACELETS_PROCESSING = "facelets-processing";<br>
+<br>
+ /**<br>
+ * <code>/faces-config/faces-config-extension/facelets-processing/file-extension</code><br>
+ */<br>
+ private static final String FILE_EXTENSION = "file-extension";<br>
+<br>
+ /**<br>
+ * <code>/faces-config/faces-config-extension/facelets-processing/process-as</code><br>
+ */<br>
+ private static final String PROCESS_AS = "process-as";<br>
+<br>
+ // ------------------------------------------------------------ Constructors<br>
+<br>
+<br>
+ public FacesConfigExtensionProcessor() { }<br>
+<br>
+<br>
+ // -------------------------------------------- Methods from ConfigProcessor<br>
+<br>
+<br>
+ /**<br>
+ * @see ConfigProcessor#process(javax.servlet.ServletContext,com.sun.faces.config.DocumentInfo[])<br>
+ */<br>
+ public void process(ServletContext sc, DocumentInfo[] documentInfos)<br>
+ throws Exception {<br>
+<br>
+ for (int i = 0; i < documentInfos.length; i++) {<br>
+ if (LOGGER.isLoggable(Level.FINE)) {<br>
+ LOGGER.log(Level.FINE,<br>
+ MessageFormat.format(<br>
+ "Processing faces-config-extension elements for document: ''{0}''",<br>
+ documentInfos[i].getSourceURL()));<br>
+ }<br>
+ Document document = documentInfos[i].getDocument();<br>
+ String namespace = document.getDocumentElement()<br>
+ .getNamespaceURI();<br>
+ NodeList facesConfigExtensions = document.getDocumentElement()<br>
+ .getElementsByTagNameNS(namespace, FACES_CONFIG_EXTENSION);<br>
+ if (facesConfigExtensions != null && facesConfigExtensions.getLength() > 0) {<br>
+ processFacesConfigExtensions(facesConfigExtensions,<br>
+ namespace, documentInfos[i]);<br>
+ }<br>
+ }<br>
+<br>
+ // invoke the next config processor<br>
+ invokeNext(sc, documentInfos);<br>
+<br>
+ }<br>
+<br>
+ // --------------------------------------------------------- Private Methods<br>
+<br>
+<br>
+ private void processFacesConfigExtensions(NodeList facesConfigExtensions,<br>
+ String namespace, DocumentInfo info) {<br>
+ WebConfiguration config = null;<br>
+<br>
+ for (int i = 0, size = facesConfigExtensions.getLength(); i < size; i++) {<br>
+ Node facesConfigExtension = facesConfigExtensions.item(i);<br>
+ NodeList children = ((Element) facesConfigExtension)<br>
+ .getElementsByTagNameNS(namespace, "*");<br>
+ for (int c = 0, csize = children.getLength(); c < csize; c++) {<br>
+ Node n = children.item(c);<br>
+ if (FACELETS_PROCESSING.equals(n.getLocalName())) {<br>
+ Node faceletsProcessing = n;<br>
+ NodeList faceletsProcessingChildren = ((Element) faceletsProcessing)<br>
+ .getElementsByTagNameNS(namespace, "*");<br>
+ String fileExtension = null, processAs = null;<br>
+ for (int fp = 0, fpsize = faceletsProcessingChildren.getLength(); fp < fpsize; fp++) {<br>
+ Node childOfInterset = faceletsProcessingChildren.item(fp);<br>
+ if (null == fileExtension &&<br>
+ FILE_EXTENSION.equals(childOfInterset.getLocalName())) {<br>
+ fileExtension = getNodeText(childOfInterset);<br>
+ } else if (null == processAs &&<br>
+ PROCESS_AS.equals(childOfInterset.getLocalName())) {<br>
+ processAs = getNodeText(childOfInterset);<br>
+ } else {<br>
+ if (LOGGER.isLoggable(Level.WARNING)) {<br>
+ LOGGER.log(Level.WARNING,<br>
+ MessageFormat.format(<br>
+ "Processing faces-config-extension elements for document: ''{0}'', encountered unexpected configuration ''{1}'', ignoring and continuing",<br>
+ info.getSourceURL(), getNodeText(childOfInterset)));<br>
+ }<br>
+ }<br>
+<br>
+ }<br>
+<br>
+ if (null != fileExtension && null != processAs) {<br>
+ if (null == config) {<br>
+ config = WebConfiguration.getInstance();<br>
+ }<br>
+ Map<String, String> faceletsProcessingMappings =<br>
+ config.getFacesConfigOptionValue(WebConfiguration.WebContextInitParameter.FaceletsProcessingFileExtensionProcessAs, true);<br>
+ faceletsProcessingMappings.put(fileExtension, processAs);<br>
+<br>
+ } else {<br>
+ if (LOGGER.isLoggable(Level.WARNING)) {<br>
+ LOGGER.log(Level.WARNING,<br>
+ MessageFormat.format(<br>
+ "Processing faces-config-extension elements for document: ''{0}'', encountered <facelets-processing> elemnet without expected children",<br>
+ info.getSourceURL()));<br>
+ }<br>
+ }<br>
+ }<br>
+ }<br>
+ }<br>
+<br>
+ }<br>
+<br>
+<br>
+}<br>
Index: jsf-ri/src/main/java/com/sun/faces/config/ConfigManager.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/config/ConfigManager.java (revision 8624)<br>
+++ jsf-ri/src/main/java/com/sun/faces/config/ConfigManager.java (working copy)<br>
@@ -62,6 +62,7 @@<br>
import com.sun.faces.config.processor.RenderKitConfigProcessor;<br>
import com.sun.faces.config.processor.ValidatorConfigProcessor;<br>
import com.sun.faces.config.processor.FaceletTaglibConfigProcessor;<br>
+import com.sun.faces.config.processor.FacesConfigExtensionProcessor;<br>
import com.sun.faces.util.FacesLogger;<br>
import com.sun.faces.util.Timer;<br>
import org.xml.sax.InputSource;<br>
@@ -252,6 +253,7 @@<br>
new RenderKitConfigProcessor(),<br>
new NavigationConfigProcessor(),<br>
new BehaviorConfigProcessor(),<br>
+ new FacesConfigExtensionProcessor()<br>
};<br>
for (int i = 0; i < configProcessors.length; i++) {<br>
ConfigProcessor p = configProcessors[i];<br>
Index: jsf-ri/src/main/java/com/sun/faces/config/WebConfiguration.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/config/WebConfiguration.java (revision 8624)<br>
+++ jsf-ri/src/main/java/com/sun/faces/config/WebConfiguration.java (working copy)<br>
@@ -40,7 +40,6 @@<br>
import java.util.EnumMap;<br>
import java.util.Enumeration;<br>
import java.util.HashSet;<br>
-import java.util.List;<br>
import java.util.Map;<br>
import java.util.Set;<br>
import java.util.logging.Level;<br>
@@ -59,8 +58,10 @@<br>
<br>
import com.sun.faces.util.FacesLogger;<br>
import com.sun.faces.util.Util;<br>
+import java.util.Collections;<br>
<br>
import java.util.HashMap;<br>
+import java.util.concurrent.ConcurrentHashMap;<br>
import javax.faces.component.UIInput;<br>
import javax.faces.validator.BeanValidator;<br>
import javax.faces.view.facelets.ResourceResolver;<br>
@@ -90,6 +91,9 @@<br>
private Map<WebContextInitParameter, String> contextParameters =<br>
new EnumMap<WebContextInitParameter, String>(WebContextInitParameter.class);<br>
<br>
+ private Map<WebContextInitParameter, Map<String, String>> facesConfigParameters =<br>
+ new EnumMap<WebContextInitParameter, Map<String, String>>(WebContextInitParameter.class);<br>
+<br>
private Map<WebEnvironmentEntry, String> envEntries =<br>
new EnumMap<WebEnvironmentEntry, String>(WebEnvironmentEntry.class);<br>
<br>
@@ -101,7 +105,9 @@<br>
<br>
private ArrayList<DeferredLoggingAction> deferredLoggingActions;<br>
<br>
+ private FaceletsConfiguration faceletsConfig;<br>
<br>
+<br>
// ------------------------------------------------------------ Constructors<br>
<br>
<br>
@@ -228,6 +234,39 @@<br>
return result;<br>
<br>
}<br>
+<br>
+ public FaceletsConfiguration getFaceletsConfiguration() {<br>
+<br>
+ if (null == faceletsConfig) {<br>
+ faceletsConfig = new FaceletsConfiguration(this);<br>
+ }<br>
+ return faceletsConfig;<br>
+<br>
+ }<br>
+<br>
+ public Map<String, String> getFacesConfigOptionValue(WebContextInitParameter param, boolean create) {<br>
+ Map<String, String> result = null;<br>
+<br>
+ assert(null != facesConfigParameters);<br>
+<br>
+ result = facesConfigParameters.get(param);<br>
+ if (null == result) {<br>
+ if (create) {<br>
+ result = new ConcurrentHashMap<String, String>(3);<br>
+ facesConfigParameters.put(param, result);<br>
+ } else {<br>
+ result = Collections.emptyMap();<br>
+ }<br>
+ }<br>
+<br>
+ return result;<br>
+<br>
+ }<br>
+<br>
+ public Map<String, String> getFacesConfigOptionValue(WebContextInitParameter param) {<br>
+ return getFacesConfigOptionValue(param, false);<br>
+ }<br>
+<br>
<br>
public String[] getOptionValue(WebContextInitParameter param, String sep) {<br>
String [] result;<br>
@@ -335,7 +374,7 @@<br>
}<br>
<br>
<br>
- public void doLoggingActions() {<br>
+ public void doPostBringupActions() {<br>
<br>
if (deferredLoggingActions != null) {<br>
for (DeferredLoggingAction loggingAction : deferredLoggingActions) {<br>
@@ -892,6 +931,10 @@<br>
FaceletCache(<br>
"com.sun.faces.faceletCache",<br>
""<br>
+ ),<br>
+ FaceletsProcessingFileExtensionProcessAs(<br>
+ "",<br>
+ ""<br>
);<br>
<br>
<br>
Index: jsf-ri/src/main/java/com/sun/faces/config/FaceletsConfiguration.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/config/FaceletsConfiguration.java (revision 0)<br>
+++ jsf-ri/src/main/java/com/sun/faces/config/FaceletsConfiguration.java (revision 0)<br>
@@ -0,0 +1,191 @@<br>
+<br>
+/*<br>
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.<br>
+ *<br>
+ * Copyright 1997-2010 Sun Microsystems, Inc. All rights reserved.<br>
+ *<br>
+ * The contents of this file are subject to the terms of either the GNU<br>
+ * General Public License Version 2 only ("GPL") or the Common Development<br>
+ * and Distribution License("CDDL") (collectively, the "License"). You<br>
+ * may not use this file except in compliance with the License. You can obtain<br>
+ * a copy of the License at <a href="https://glassfish.dev.java.net/public/CDDL+GPL.html" target="_blank">https://glassfish.dev.java.net/public/CDDL+GPL.html</a><br>
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific<br>
+ * language governing permissions and limitations under the License.<br>
+ *<br>
+ * When distributing the software, include this License Header Notice in each<br>
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.<br>
+ * Sun designates this particular file as subject to the "Classpath" exception<br>
+ * as provided by Sun in the GPL Version 2 section of the License file that<br>
+ * accompanied this code. If applicable, add the following below the License<br>
+ * Header, with the fields enclosed by brackets [] replaced by your own<br>
+ * identifying information: "Portions Copyrighted [year]<br>
+ * [name of copyright owner]"<br>
+ *<br>
+ * Contributor(s):<br>
+ *<br>
+ * If you wish your version of this file to be governed by only the CDDL or<br>
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]<br>
+ * elects to include this software in this distribution under the [CDDL or GPL<br>
+ * Version 2] license." If you don't indicate a single choice of license, a<br>
+ * recipient has the option to distribute your version of this file under<br>
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to<br>
+ * its licensees as provided above. However, if you add GPL Version 2 code<br>
+ * and therefore, elected the GPL Version 2 license, then the option applies<br>
+ * only if the new code is made subject to such option by the copyright<br>
+ * holder.<br>
+ */<br>
+<br>
+package com.sun.faces.config;<br>
+<br>
+import java.util.Map;<br>
+import javax.faces.context.FacesContext;<br>
+<br>
+<br>
+/*<br>
+ * This read-only singleton class is vended by the WebConfiguration.<br>
+ * It is queried from any point in the program that needs to take action based<br>
+ * on configuration options pertaining to facelets.<br>
+ *<br>
+ */<br>
+public class FaceletsConfiguration {<br>
+<br>
+ public static final String FACELETS_CONFIGURATION_ATTRIBUTE_NAME = "com.sun.faces.config.FaceletsConfiguration";<br>
+<br>
+ private static final String ESCAPE_INLINE_TEXT_ATTRIBUTE_NAME = "com.sun.faces.config.EscapeInlineText";<br>
+<br>
+ private static final String CONSUME_COMMENTS_ATTRIBUTE_NAME = "com.sun.faces.config.ConsumeComments";<br>
+<br>
+ private WebConfiguration config;<br>
+<br>
+ private Map<String, String> faceletsProcessingMappings;<br>
+<br>
+<br>
+ public FaceletsConfiguration(WebConfiguration config) {<br>
+ this.config = config;<br>
+<br>
+ faceletsProcessingMappings =<br>
+ config.getFacesConfigOptionValue(WebConfiguration.WebContextInitParameter.FaceletsProcessingFileExtensionProcessAs);<br>
+<br>
+ }<br>
+<br>
+ public boolean isProcessCurrentDocumentAsFaceletsXhtml(String alias) {<br>
+ // We want to write the XML declaration if and only if<br>
+ // The SuppressXmlDeclaration context-param is NOT enabled<br>
+ // and the file extension for the current file has a mapping<br>
+ // with the value of XHTML<br>
+ boolean currentModeIsXhtml = true;<br>
+ String extension = alias;<br>
+ if (null == extension) {<br>
+ extension = ".xhtml";<br>
+ }<br>
+ int i = extension.indexOf(".");<br>
+ if (-1 != i && 1 < extension.length()) {<br>
+ extension = extension.substring(i);<br>
+ } else {<br>
+ extension = ".xhtml";<br>
+ }<br>
+<br>
+ assert (null != faceletsProcessingMappings);<br>
+ if (faceletsProcessingMappings.containsKey(extension)) {<br>
+ String value = faceletsProcessingMappings.get(extension);<br>
+ currentModeIsXhtml = value.equals("xhtml");<br>
+ }<br>
+<br>
+ return currentModeIsXhtml;<br>
+ }<br>
+<br>
+ public boolean isConsumeComments(String alias) {<br>
+ boolean consumeComments = false;<br>
+ String extension = alias;<br>
+ if (null == extension) {<br>
+ extension = ".xhtml";<br>
+ }<br>
+ int i = extension.indexOf(".");<br>
+ if (-1 != i && 1 < extension.length()) {<br>
+ extension = extension.substring(i);<br>
+ } else {<br>
+ extension = ".xhtml";<br>
+ }<br>
+<br>
+ assert (null != faceletsProcessingMappings);<br>
+ if (faceletsProcessingMappings.containsKey(extension)) {<br>
+ String value = faceletsProcessingMappings.get(extension);<br>
+ consumeComments = value.equals("xml") || value.equals("jspx");<br>
+ }<br>
+<br>
+ return consumeComments;<br>
+<br>
+ }<br>
+<br>
+ public boolean isConsumeCDATA(String alias) {<br>
+ boolean consumeCDATA = false;<br>
+ String extension = alias;<br>
+ if (null == extension) {<br>
+ extension = ".xhtml";<br>
+ }<br>
+ int i = extension.indexOf(".");<br>
+ if (-1 != i && 1 < extension.length()) {<br>
+ extension = extension.substring(i);<br>
+ } else {<br>
+ extension = ".xhtml";<br>
+ }<br>
+<br>
+ assert (null != faceletsProcessingMappings);<br>
+ if (faceletsProcessingMappings.containsKey(extension)) {<br>
+ String value = faceletsProcessingMappings.get(extension);<br>
+ consumeCDATA = value.equals("jspx") || value.equals("xml");<br>
+ }<br>
+<br>
+ return consumeCDATA;<br>
+<br>
+ }<br>
+<br>
+ public boolean isEscapeInlineText(FacesContext context) {<br>
+ Boolean result = Boolean.TRUE;<br>
+<br>
+ result = (Boolean) context.getAttributes().get(ESCAPE_INLINE_TEXT_ATTRIBUTE_NAME);<br>
+ if (null == result) {<br>
+ String extension = context.getViewRoot().getViewId();<br>
+ if (null == extension) {<br>
+ extension = ".xhtml";<br>
+ }<br>
+ int i = extension.indexOf(".");<br>
+ if (-1 != i && 1 < extension.length()) {<br>
+ extension = extension.substring(i);<br>
+ } else {<br>
+ extension = ".xhtml";<br>
+ }<br>
+<br>
+ assert (null != faceletsProcessingMappings);<br>
+ if (faceletsProcessingMappings.containsKey(extension)) {<br>
+ String value = faceletsProcessingMappings.get(extension);<br>
+ result = value.equals("xml") || value.equals("xhtml");<br>
+ } else {<br>
+ result = Boolean.TRUE;<br>
+ }<br>
+ context.getAttributes().put(ESCAPE_INLINE_TEXT_ATTRIBUTE_NAME,<br>
+ result);<br>
+ }<br>
+<br>
+ return result;<br>
+ }<br>
+<br>
+ public static FaceletsConfiguration getInstance(FacesContext context) {<br>
+ FaceletsConfiguration result = null;<br>
+ Map<Object, Object> attrs = context.getAttributes();<br>
+ result = (FaceletsConfiguration) attrs.get(FaceletsConfiguration.FACELETS_CONFIGURATION_ATTRIBUTE_NAME);<br>
+ if (null == result) {<br>
+ WebConfiguration config = WebConfiguration.getInstance(context.getExternalContext());<br>
+ result = config.getFaceletsConfiguration();<br>
+ attrs.put(FaceletsConfiguration.FACELETS_CONFIGURATION_ATTRIBUTE_NAME, result);<br>
+ }<br>
+ return result;<br>
+ }<br>
+<br>
+ public static FaceletsConfiguration getInstance() {<br>
+ FacesContext context = FacesContext.getCurrentInstance();<br>
+ return FaceletsConfiguration.getInstance(context);<br>
+ }<br>
+<br>
+<br>
+}<br>
Index: jsf-ri/src/main/java/com/sun/faces/config/ConfigureListener.java<br>
===================================================================<br>
--- jsf-ri/src/main/java/com/sun/faces/config/ConfigureListener.java (revision 8624)<br>
+++ jsf-ri/src/main/java/com/sun/faces/config/ConfigureListener.java (working copy)<br>
@@ -266,7 +266,7 @@<br>
UIViewRoot.class,<br>
webAppListener);<br>
<br>
- webConfig.doLoggingActions();<br>
+ webConfig.doPostBringupActions();<br>
<br>
} catch (Throwable t) {<br>
if (LOGGER.isLoggable(Level.SEVERE)) {<br>
Index: jsf-ri/systest-per-webapp/build.xml<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/build.xml (revision 8624)<br>
+++ jsf-ri/systest-per-webapp/build.xml (working copy)<br>
@@ -106,7 +106,8 @@<br>
flash,<br>
jsp-flash,<br>
suppress-xml-decl,<br>
- replace-vdl"/><br>
+ replace-vdl,<br>
+ process-as-jspx"/><br>
<!--<br>
<br>
EXCLUDED APPLICATIONS:<br>
Index: jsf-ri/systest-per-webapp/build-tests.xml<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/build-tests.xml (revision 8624)<br>
+++ jsf-ri/systest-per-webapp/build-tests.xml (working copy)<br>
@@ -123,6 +123,8 @@<br>
<br>
value="com/sun/faces/systest/replacevdl/ReplaceViewDeclarationLanguageTestCase.class" /><br>
<property name="myfaces-uidata-component-state-test"<br>
<br>
value="com/sun/faces/systest/myfaces_uidata_component_state_test/MyFacesUIDataTestCase.class" /><br>
+ <property name="process-as-jspx"<br>
+ value="com/sun/faces/systest/ProcessAsJspxTestCase.class" /><br>
<br>
<!--<br>
EXCLUDED APPLICATIONS:<br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxTestCase.java<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxTestCase.java (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxTestCase.java (revision 0)<br>
@@ -0,0 +1,132 @@<br>
+/*<br>
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.<br>
+ *<br>
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.<br>
+ *<br>
+ * The contents of this file are subject to the terms of either the GNU<br>
+ * General Public License Version 2 only ("GPL") or the Common Development<br>
+ * and Distribution License("CDDL") (collectively, the "License"). You<br>
+ * may not use this file except in compliance with the License. You can obtain<br>
+ * a copy of the License at <a href="https://glassfish.dev.java.net/public/CDDL+GPL.html" target="_blank">https://glassfish.dev.java.net/public/CDDL+GPL.html</a><br>
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific<br>
+ * language governing permissions and limitations under the License.<br>
+ *<br>
+ * When distributing the software, include this License Header Notice in each<br>
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.<br>
+ * Sun designates this particular file as subject to the "Classpath" exception<br>
+ * as provided by Sun in the GPL Version 2 section of the License file that<br>
+ * accompanied this code. If applicable, add the following below the License<br>
+ * Header, with the fields enclosed by brackets [] replaced by your own<br>
+ * identifying information: "Portions Copyrighted [year]<br>
+ * [name of copyright owner]"<br>
+ *<br>
+ * Contributor(s):<br>
+ *<br>
+ * If you wish your version of this file to be governed by only the CDDL or<br>
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]<br>
+ * elects to include this software in this distribution under the [CDDL or GPL<br>
+ * Version 2] license." If you don't indicate a single choice of license, a<br>
+ * recipient has the option to distribute your version of this file under<br>
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to<br>
+ * its licensees as provided above. However, if you add GPL Version 2 code<br>
+ * and therefore, elected the GPL Version 2 license, then the option applies<br>
+ * only if the new code is made subject to such option by the copyright<br>
+ * holder.<br>
+ */<br>
+<br>
+package com.sun.faces.systest;<br>
+<br>
+<br>
+import com.gargoylesoftware.htmlunit.html.HtmlPage;<br>
+import com.sun.faces.htmlunit.AbstractTestCase;<br>
+import java.io.BufferedReader;<br>
+import java.io.InputStreamReader;<br>
+import java.net.URL;<br>
+import java.util.regex.Pattern;<br>
+import junit.framework.Test;<br>
+import junit.framework.TestSuite;<br>
+<br>
+<br>
+public class ProcessAsJspxTestCase extends AbstractTestCase {<br>
+<br>
+ private final static Pattern XmlDeclaration = Pattern.compile("(?s)^<\\?xml(\\s)*version=.*\\?>.*");<br>
+ private final static Pattern XmlPI = Pattern.compile("(?s).*<\\?xml-stylesheet.*\\?>.*");<br>
+ private final static Pattern CDATASection = Pattern.compile("(?s).*<!\\[CDATA\\[ .*\\]\\]>.*");<br>
+ private final static Pattern Comment = Pattern.compile("(?s).*<!--.*-->.*");<br>
+ private final static Pattern EscapedText = Pattern.compile("(?s).*&amp;lt;context-param&amp;gt;.*");<br>
+ private final static Pattern NotEscapedText = Pattern.compile("(?s).*&lt;context-param&gt;.*");<br>
+<br>
+<br>
+ public ProcessAsJspxTestCase(String name) {<br>
+ super(name);<br>
+ }<br>
+<br>
+ /**<br>
+ * Set up instance variables required by this test case.<br>
+ */<br>
+ public void setUp() throws Exception {<br>
+ super.setUp();<br>
+ }<br>
+<br>
+<br>
+ /**<br>
+ * Return the tests included in this test suite.<br>
+ */<br>
+ public static Test suite() {<br>
+ return (new TestSuite(ProcessAsJspxTestCase.class));<br>
+ }<br>
+<br>
+<br>
+ /**<br>
+ * Tear down instance variables required by this test case.<br>
+ */<br>
+ public void tearDown() {<br>
+ super.tearDown();<br>
+ }<br>
+<br>
+ private String getRawMarkup(String path) throws Exception {<br>
+ URL url = getURL(path);<br>
+ BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));<br>
+ StringBuilder builder = new StringBuilder();<br>
+ String cur;<br>
+ while (null != (cur = reader.readLine())) {<br>
+ builder.append(cur);<br>
+ }<br>
+<br>
+ String xml = builder.toString();<br>
+ return xml;<br>
+ }<br>
+<br>
+ // ------------------------------------------------------------ Test Methods<br>
+<br>
+ public void testProcessAsXhtml() throws Exception {<br>
+<br>
+ String xml = getRawMarkup("/faces/xhtmlview.xhtml");<br>
+ assertTrue(XmlDeclaration.matcher(xml).matches());<br>
+ assertTrue(XmlPI.matcher(xml).matches());<br>
+ assertTrue(CDATASection.matcher(xml).matches());<br>
+ assertTrue(EscapedText.matcher(xml).matches());<br>
+ assertTrue(Comment.matcher(xml).matches());<br>
+ }<br>
+<br>
+ public void testProcessAsXml() throws Exception {<br>
+<br>
+ String xml = getRawMarkup("/faces/xmlview.view.xml");<br>
+ assertFalse(XmlDeclaration.matcher(xml).matches());<br>
+ assertFalse(XmlPI.matcher(xml).matches());<br>
+ assertFalse(CDATASection.matcher(xml).matches());<br>
+ assertTrue(EscapedText.matcher(xml).matches());<br>
+ assertFalse(Comment.matcher(xml).matches());<br>
+ }<br>
+<br>
+ public void testProcessAsJspx() throws Exception {<br>
+<br>
+ String xml = getRawMarkup("/faces/jspxview.jspx");<br>
+ assertFalse(XmlDeclaration.matcher(xml).matches());<br>
+ assertFalse(XmlPI.matcher(xml).matches());<br>
+ assertFalse(CDATASection.matcher(xml).matches());<br>
+ assertTrue(NotEscapedText.matcher(xml).matches());<br>
+ assertFalse(Comment.matcher(xml).matches());<br>
+ }<br>
+<br>
+}<br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxBean.java<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxBean.java (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/src/java/com/sun/faces/systest/ProcessAsJspxBean.java (revision 0)<br>
@@ -0,0 +1,14 @@<br>
+package com.sun.faces.systest;<br>
+<br>
+import javax.faces.bean.ManagedBean;<br>
+import javax.faces.bean.RequestScoped;<br>
+<br>
+@ManagedBean<br>
+@RequestScoped<br>
+public class ProcessAsJspxBean {<br>
+<br>
+ public String getProp() {<br>
+ return "Hello < World";<br>
+ }<br>
+<br>
+}<br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/web/jspxview.jspx<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/web/jspxview.jspx (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/web/jspxview.jspx (revision 0)<br>
@@ -0,0 +1,67 @@<br>
+<?xml version='1.0' encoding='utf-8'?><br>
+<!-- Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. --><br>
+<jsp:root xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>"<br>
+ xmlns:jsp="<a href="http://java.sun.com/JSP/Page" target="_blank">http://java.sun.com/JSP/Page</a>"<br>
+ xmlns:f="<a href="http://java.sun.com/jsf/core" target="_blank">http://java.sun.com/jsf/core</a>"<br>
+ xmlns:h="<a href="http://java.sun.com/jsf/html" target="_blank">http://java.sun.com/jsf/html</a>"<br>
+ version="1.2"><br>
+ <jsp:directive.page contentType="text/html;charset=utf-8"/><br>
+ <f:view><br>
+<br>
+<br>
+ <f:attribute name="mode" value="index"/><br>
+<br>
+<h2>XML declaration: consumed</h2><br>
+<br>
+<h2>Processing instruction: consumed</h2><br>
+<br>
+<?xml-stylesheet href="funky.xsl" type="text/xml" alternate="yes"?><br>
+<br>
+<h2>CDATA section: consumed</h2><br>
+<br>
+<![CDATA[ <p>This is CDATA</p> ]]><br>
+<br>
+<h2>Inline text escaping: not escaped</h2><br>
+<br>
+<br>
+ <code><br>
+ <br/><br>
+ &amp;lt;context-param&amp;gt;<br>
+ <br/><br>
+<br>
+&amp;nbsp;&amp;nbsp;&amp;lt;param-name&amp;gt;javax.faces.PARTIAL_STATE_SAVING <br>
+<br>
+&amp;lt;/param-name&amp;gt;<br>
+ <br/><br>
+<br>
+&amp;nbsp;&amp;nbsp;&amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt <br>
+<br>
+;<br>
+ <br/><br>
+ &amp;lt;/context-param&amp;gt;<br>
+ </code><br>
+<br>
+<h2>Comments: consumed</h2><br>
+<br>
+<br>
+<p>HTML Template Text</p><br>
+<br>
+<br>
+<br>
+<p><h:outputText value="#{processAsJspxBean.prop}" /></p><br>
+<br>
+<h:form prependId="false"><br>
+<br>
+<h:commandButton value="reload" /><br>
+<br>
+</h:form><br>
+<br>
+<br>
+<!-- comments consumed --><br>
+<br>
+<br>
+<br>
+<br>
+<br>
+ </f:view><br>
+</jsp:root><br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/web/xhtmlview.xhtml<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/web/xhtmlview.xhtml (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/web/xhtmlview.xhtml (revision 0)<br>
@@ -0,0 +1,103 @@<br>
+<?xml version="1.0" encoding="UTF-8" standalone="no" ?><br>
+<!--<br>
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.<br>
+<br>
+ Copyright 2009 Sun Microsystems, Inc. All rights reserved.<br>
+<br>
+ The contents of this file are subject to the terms of either the GNU<br>
+ General Public License Version 2 only ("GPL") or the Common Development<br>
+ and Distribution License("CDDL") (collectively, the "License"). You<br>
+ may not use this file except in compliance with the License. You can obtain<br>
+ a copy of the License at <a href="https://glassfish.dev.java.net/public/CDDL+GPL.html" target="_blank">https://glassfish.dev.java.net/public/CDDL+GPL.html</a><br>
+ or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific<br>
+ language governing permissions and limitations under the License.<br>
+<br>
+ When distributing the software, include this License Header Notice in each<br>
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.<br>
+ Sun designates this particular file as subject to the "Classpath" exception<br>
+ as provided by Sun in the GPL Version 2 section of the License file that<br>
+ accompanied this code. If applicable, add the following below the License<br>
+ Header, with the fields enclosed by brackets [] replaced by your own<br>
+ identifying information: "Portions Copyrighted [year]<br>
+ [name of copyright owner]"<br>
+<br>
+ Contributor(s):<br>
+<br>
+ If you wish your version of this file to be governed by only the CDDL or<br>
+ only the GPL Version 2, indicate your decision by adding "[Contributor]<br>
+ elects to include this software in this distribution under the [CDDL or GPL<br>
+ Version 2] license." If you don't indicate a single choice of license, a<br>
+ recipient has the option to distribute your version of this file under<br>
+ either the CDDL, the GPL Version 2 or to extend the choice of license to<br>
+ its licensees as provided above. However, if you add GPL Version 2 code<br>
+ and therefore, elected the GPL Version 2 license, then the option applies<br>
+ only if the new code is made subject to such option by the copyright<br>
+ holder.<br>
+--><br>
+<br>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"><br>
+<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>"<br>
+ xmlns:h="<a href="http://java.sun.com/jsf/html" target="_blank">http://java.sun.com/jsf/html</a>"><br>
+<h:head><br>
+ <title>Process JSPX as Facelets for JSPX mode</title><br>
+</h:head><br>
+<h:body bgcolor="white"><br>
+<br>
+<h2>XML declaration: passed through</h2><br>
+<br>
+<h2>Processing instruction: passed through</h2><br>
+<br>
+<?xml-stylesheet href="funky.xsl" type="text/xml" alternate="yes"?><br>
+<br>
+<h2>CDATA section: passed through</h2><br>
+<br>
+<![CDATA[ <h2>This is CDATA</h2> ]]><br>
+<br>
+<h2>Inline text escaping: escaped</h2><br>
+<br>
+ <code><br>
+ <br/><br>
+ &amp;lt;context-param&amp;gt;<br>
+ <br/><br>
+<br>
+&amp;nbsp;&amp;nbsp;&amp;lt;param-name&amp;gt;javax.faces.PARTIAL_STATE_SAVING <br>
+<br>
+&amp;lt;/param-name&amp;gt;<br>
+ <br/><br>
+<br>
+&amp;nbsp;&amp;nbsp;&amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt <br>
+<br>
+;<br>
+ <br/><br>
+ &amp;lt;/context-param&amp;gt;<br>
+ </code><br>
+<br>
+<h2>Comments: passed through</h2><br>
+<br>
+<!-- comments pass through --><br>
+<br>
+<hr /><br>
+<br>
+ <h:form prependId="false" id="form1"><br>
+<br>
+ <h:panelGrid columns="2" border="1" width="600"><br>
+<br>
+ <h:outputText value="column1" /><br>
+<br>
+ <h:outputText value="column2" /><br>
+<br>
+ </h:panelGrid><br>
+<br>
+ <h2><h:messages id="messages"/></h2><br>
+<br>
+<br>
+<br>
+ #{processAsJspxBean.prop}<br>
+<br>
+<br>
+<br>
+<br>
+ </h:form><br>
+<br>
+</h:body><br>
+</html><br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/web/jspview.jsp<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/web/jspview.jsp (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/web/jspview.jsp (revision 0)<br>
@@ -0,0 +1,86 @@<br>
+<%--<br>
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.<br>
+<br>
+ Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.<br>
+<br>
+ The contents of this file are subject to the terms of either the GNU<br>
+ General Public License Version 2 only ("GPL") or the Common Development<br>
+ and Distribution License("CDDL") (collectively, the "License"). You<br>
+ may not use this file except in compliance with the License. You can obtain<br>
+ a copy of the License at <a href="https://glassfish.dev.java.net/public/CDDL+GPL.html" target="_blank">https://glassfish.dev.java.net/public/CDDL+GPL.html</a><br>
+ or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific<br>
+ language governing permissions and limitations under the License.<br>
+<br>
+ When distributing the software, include this License Header Notice in each<br>
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.<br>
+ Sun designates this particular file as subject to the "Classpath" exception<br>
+ as provided by Sun in the GPL Version 2 section of the License file that<br>
+ accompanied this code. If applicable, add the following below the License<br>
+ Header, with the fields enclosed by brackets [] replaced by your own<br>
+ identifying information: "Portions Copyrighted [year]<br>
+ [name of copyright owner]"<br>
+<br>
+ Contributor(s):<br>
+<br>
+ If you wish your version of this file to be governed by only the CDDL or<br>
+ only the GPL Version 2, indicate your decision by adding "[Contributor]<br>
+ elects to include this software in this distribution under the [CDDL or GPL<br>
+ Version 2] license." If you don't indicate a single choice of license, a<br>
+ recipient has the option to distribute your version of this file under<br>
+ either the CDDL, the GPL Version 2 or to extend the choice of license to<br>
+ its licensees as provided above. However, if you add GPL Version 2 code<br>
+ and therefore, elected the GPL Version 2 license, then the option applies<br>
+ only if the new code is made subject to such option by the copyright<br>
+ holder.<br>
+--%><br>
+<br>
+<!--<br>
+ Copyright 2004 Sun Microsystems, Inc. All rights reserved.<br>
+ SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.<br>
+--><br>
+<br>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><br>
+<html><br>
+ <head><br>
+ <title>JSP view</title><br>
+ <%@ taglib uri="<a href="http://java.sun.com/jsf/core" target="_blank">http://java.sun.com/jsf/core</a>" prefix="f" %><br>
+ <%@ taglib uri="<a href="http://java.sun.com/jsf/html" target="_blank">http://java.sun.com/jsf/html</a>" prefix="h" %><br>
+ </head><br>
+<br>
+ <body><br>
+<f:view><br>
+<br>
+<p>HTML Template Text</p><br>
+<br>
+<p><h:outputText value="#{processAsJspxBean.prop}" /></p><br>
+<br>
+<h:form prependId="false"><br>
+<br>
+<h:commandButton value="reload" /><br>
+<br>
+</h:form><br>
+<br>
+ <code><br>
+ <br/><br>
+ &amp;lt;context-param&amp;gt;<br>
+ <br/><br>
+<br>
+&amp;nbsp;&amp;nbsp;&amp;lt;param-name&amp;gt;javax.faces.PARTIAL_STATE_SAVING <br>
+<br>
+&amp;lt;/param-name&amp;gt;<br>
+ <br/><br>
+<br>
+&amp;nbsp;&amp;nbsp;&amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt <br>
+<br>
+;<br>
+ <br/><br>
+ &amp;lt;/context-param&amp;gt;<br>
+ </code><br>
+<br>
+<br>
+<br>
+</f:view><br>
+<br>
+ <hr><br>
+ </body><br>
+</html><br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/web/xmlview.view.xml<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/web/xmlview.view.xml (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/web/xmlview.view.xml (revision 0)<br>
@@ -0,0 +1,103 @@<br>
+<?xml version="1.0" encoding="UTF-8"?><br>
+<!--<br>
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.<br>
+<br>
+ Copyright 2010 Sun Microsystems, Inc. All rights reserved.<br>
+<br>
+ The contents of this file are subject to the terms of either the GNU<br>
+ General Public License Version 2 only ("GPL") or the Common Development<br>
+ and Distribution License("CDDL") (collectively, the "License"). You<br>
+ may not use this file except in compliance with the License. You can obtain<br>
+ a copy of the License at <a href="https://glassfish.dev.java.net/public/CDDL+GPL.html" target="_blank">https://glassfish.dev.java.net/public/CDDL+GPL.html</a><br>
+ or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific<br>
+ language governing permissions and limitations under the License.<br>
+<br>
+ When distributing the software, include this License Header Notice in each<br>
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.<br>
+ Sun designates this particular file as subject to the "Classpath" exception<br>
+ as provided by Sun in the GPL Version 2 section of the License file that<br>
+ accompanied this code. If applicable, add the following below the License<br>
+ Header, with the fields enclosed by brackets [] replaced by your own<br>
+ identifying information: "Portions Copyrighted [year]<br>
+ [name of copyright owner]"<br>
+<br>
+ Contributor(s):<br>
+<br>
+ If you wish your version of this file to be governed by only the CDDL or<br>
+ only the GPL Version 2, indicate your decision by adding "[Contributor]<br>
+ elects to include this software in this distribution under the [CDDL or GPL<br>
+ Version 2] license." If you don't indicate a single choice of license, a<br>
+ recipient has the option to distribute your version of this file under<br>
+ either the CDDL, the GPL Version 2 or to extend the choice of license to<br>
+ its licensees as provided above. However, if you add GPL Version 2 code<br>
+ and therefore, elected the GPL Version 2 license, then the option applies<br>
+ only if the new code is made subject to such option by the copyright<br>
+ holder.<br>
+--><br>
+<faces-view xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>"<br>
+ xmlns:h="<a href="http://java.sun.com/jsf/html" target="_blank">http://java.sun.com/jsf/html</a>"><br>
+<br>
+ <h:html><br>
+<br>
+ <h:head><h:title>Raw XML View</h:title></h:head><br>
+<br>
+ <h:body><br>
+<br>
+<h2>XML declaration: consumed</h2><br>
+<br>
+<h2>Processing instruction: consumed</h2><br>
+<br>
+<?xml-stylesheet href="funky.xsl" type="text/xml" alternate="yes"?><br>
+<br>
+<h2>CDATA section: consumed</h2><br>
+<br>
+<![CDATA[ <p>This is CDATA</p> ]]><br>
+<br>
+<h2>Inline text escaping: escaped</h2><br>
+<br>
+ <code><br>
+ <br/><br>
+ &amp;lt;context-param&amp;gt;<br>
+ <br/><br>
+<br>
+&amp;nbsp;&amp;nbsp;&amp;lt;param-name&amp;gt;javax.faces.PARTIAL_STATE_SAVING <br>
+<br>
+&amp;lt;/param-name&amp;gt;<br>
+ <br/><br>
+<br>
+&amp;nbsp;&amp;nbsp;&amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt <br>
+<br>
+;<br>
+ <br/><br>
+ &amp;lt;/context-param&amp;gt;<br>
+ </code><br>
+<br>
+<h2>Comments: consumed</h2><br>
+<br>
+<!-- comments consumed --><br>
+<br>
+ <h:form prependId="false" id="form"><br>
+<br>
+ <h:panelGrid id="grid" column="2"><br>
+<br>
+ <h:outputText id="text" value="hello"></h:outputText><br>
+<br>
+ <h:commandButton id="button" value="reload"></h:commandButton><br>
+<br>
+<br>
+ </h:panelGrid><br>
+<br>
+ #{processAsJspxBean.prop}<br>
+<br>
+<p>html template text</p><br>
+<br>
+<br>
+ </h:form><br>
+<br>
+ </h:body><br>
+<br>
+ </h:html><br>
+<br>
+</faces-view><br>
+<br>
+<br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF/faces-config.xml<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF/faces-config.xml (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF/faces-config.xml (revision 0)<br>
@@ -0,0 +1,19 @@<br>
+<?xml version='1.0' encoding='UTF-8'?><br>
+<faces-config<br>
+ xmlns="<a href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a>"<br>
+ xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"<br>
+ xsi:schemaLocation="<a href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" target="_blank">http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd</a>"<br>
+ version="2.0"><br>
+<br>
+ <faces-config-extension><br>
+ <facelets-processing><br>
+ <file-extension>.jspx</file-extension><br>
+ <process-as>jspx</process-as><br>
+ </facelets-processing><br>
+ <facelets-processing><br>
+ <file-extension>.view.xml</file-extension><br>
+ <process-as>xml</process-as><br>
+ </facelets-processing><br>
+ </faces-config-extension><br>
+<br>
+</faces-config><br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF/web.xml<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF/web.xml (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/web/WEB-INF/web.xml (revision 0)<br>
@@ -0,0 +1,72 @@<br>
+<?xml version="1.0" encoding="ISO-8859-1"?><br>
+<br>
+<!--<br>
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.<br>
+<br>
+ Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.<br>
+<br>
+ The contents of this file are subject to the terms of either the GNU<br>
+ General Public License Version 2 only ("GPL") or the Common Development<br>
+ and Distribution License("CDDL") (collectively, the "License"). You<br>
+ may not use this file except in compliance with the License. You can obtain<br>
+ a copy of the License at <a href="https://glassfish.dev.java.net/public/CDDL+GPL.html" target="_blank">https://glassfish.dev.java.net/public/CDDL+GPL.html</a><br>
+ or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific<br>
+ language governing permissions and limitations under the License.<br>
+<br>
+ When distributing the software, include this License Header Notice in each<br>
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.<br>
+ Sun designates this particular file as subject to the "Classpath" exception<br>
+ as provided by Sun in the GPL Version 2 section of the License file that<br>
+ accompanied this code. If applicable, add the following below the License<br>
+ Header, with the fields enclosed by brackets [] replaced by your own<br>
+ identifying information: "Portions Copyrighted [year]<br>
+ [name of copyright owner]"<br>
+<br>
+ Contributor(s):<br>
+<br>
+ If you wish your version of this file to be governed by only the CDDL or<br>
+ only the GPL Version 2, indicate your decision by adding "[Contributor]<br>
+ elects to include this software in this distribution under the [CDDL or GPL<br>
+ Version 2] license." If you don't indicate a single choice of license, a<br>
+ recipient has the option to distribute your version of this file under<br>
+ either the CDDL, the GPL Version 2 or to extend the choice of license to<br>
+ its licensees as provided above. However, if you add GPL Version 2 code<br>
+ and therefore, elected the GPL Version 2 license, then the option applies<br>
+ only if the new code is made subject to such option by the copyright<br>
+ holder.<br>
+--><br>
+<br>
+<web-app version="2.5"<br>
+ xmlns="<a href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a>"<br>
+ xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>"<br>
+ xsi:schemaLocation="<a href="http://java.sun.com/xml/ns/javaee" target="_blank">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" target="_blank">http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd</a>"><br>
+<br>
+ <description><br>
+ JSPX Compatibility<br>
+ </description><br>
+ <display-name>JSPX Compatibility</display-name><br>
+<br>
+ <context-param><br>
+ <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name><br>
+ <param-value>*.xhtml;*.view.xml;*.jspx</param-value><br>
+ </context-param><br>
+<br>
+ <context-param><br>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name><br>
+ <param-value>.xhtml .view.xml .jsp .jspx</param-value><br>
+ </context-param><br>
+<br>
+ <!-- Faces Servlet --><br>
+ <servlet><br>
+ <servlet-name>Faces Servlet</servlet-name><br>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class><br>
+ <load-on-startup> 1 </load-on-startup><br>
+ </servlet><br>
+<br>
+ <!-- Faces Servlet Mapping --><br>
+ <servlet-mapping><br>
+ <servlet-name>Faces Servlet</servlet-name><br>
+ <url-pattern>/faces/*</url-pattern><br>
+ </servlet-mapping><br>
+<br>
+</web-app><br>
Index: jsf-ri/systest-per-webapp/process-as-jspx/web/index.html<br>
===================================================================<br>
--- jsf-ri/systest-per-webapp/process-as-jspx/web/index.html (revision 0)<br>
+++ jsf-ri/systest-per-webapp/process-as-jspx/web/index.html (revision 0)<br>
@@ -0,0 +1,124 @@<br>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><br>
+<html><br>
+ <head><br>
+ <title>Test all permutations of facelets processing modes</title><br>
+ </head><br>
+<br>
+ <body><br>
+ <h1>Test all permutations of facelets processing modes</h1><br>
+<br>
+<table border="1"><br>
+<br>
+<tr><br>
+<br>
+<td>&nbsp;<br>
+</td><br>
+<br>
+<th>xhtml<br>
+</th><br>
+<br>
+<th>xml<br>
+</th><br>
+<br>
+<th>jspx<br>
+</th><br>
+<br>
+</tr><br>
+<br>
+<tr><br>
+<br>
+<th>XML Declaration<br>
+</th><br>
+<br>
+<td>passed through<br>
+</td><br>
+<br>
+<td>consumed<br>
+</td><br>
+<br>
+<td>consumed<br>
+</td><br>
+<br>
+</tr><br>
+<br>
+<tr><br>
+<br>
+<th>Processing Instructions<br>
+</th><br>
+<br>
+<td>passed through<br>
+</td><br>
+<br>
+<td>consumed<br>
+</td><br>
+<br>
+<td>consumed<br>
+</td><br>
+<br>
+</tr><br>
+<br>
+<tr><br>
+<br>
+<th>CDATA<br>
+</th><br>
+<br>
+<td>passed through<br>
+</td><br>
+<br>
+<td>consumed<br>
+</td><br>
+<br>
+<td>consumed<br>
+</td><br>
+<br>
+</tr><br>
+<br>
+<tr><br>
+<br>
+<th>Inline text escaping<br>
+</th><br>
+<br>
+<td>escaped<br>
+</td><br>
+<br>
+<td>escaped<br>
+</td><br>
+<br>
+<td>not escaped<br>
+</td><br>
+<br>
+</tr><br>
+<br>
+<tr><br>
+<br>
+<th>Comments<br>
+</th><br>
+<br>
+<td>passed through<br>
+</td><br>
+<br>
+<td>consumed<br>
+</td><br>
+<br>
+<td>consumed<br>
+</td><br>
+<br>
+</tr><br>
+<br>
+<br>
+</table><br>
+<br>
+<br>
+<br>
+<p><a href="/jsf-process-as-jspx/faces/xhtmlview.xhtml">Classic Facelets processed as Facelets in XHTML mode</a></p><br>
+<p><a href="/jsf-process-as-jspx/faces/xmlview.view.xml">XML processed as Facelets in XML mode</a></p><br>
+<p><a href="/jsf-process-as-jspx/faces/jspxview.jspx">JSPX processed as Facelets in JSPX mode</a></p><br>
+<p><a href="/jsf-process-as-jspx/faces/jspview.jsp">JSP processed as JSP</a></p><br>
+<br>
+ <hr><br>
+<!-- Created: Wed Sep 29 12:17:11 EDT 2010 --><br>
+<!-- hhmts start --><br>
+Last modified: Thu Sep 30 17:01:18 EDT 2010<br>
+<!-- hhmts end --><br>
+ </body><br>
+</html><br>
</blockquote></div><br></div></div>