Author: alexsmirnov
Date: 2007-07-10 14:37:56 -0400 (Tue, 10 Jul 2007)
New Revision: 1586
Added:
trunk/framework/impl/src/main/java/org/richfaces/skin/
Removed:
trunk/framework/impl/src/main/java/org/ajax4jsf/ajax/repeat/
trunk/framework/impl/src/main/java/org/ajax4jsf/dnd/taglib/
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/ajax/xmlfilter/
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/renderer/
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/resource/
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin/
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoXMLFilter.java
trunk/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java
trunk/framework/impl/src/main/java/org/richfaces/skin/DummySkinConfiguration.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinBean.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinPropertyResolver.java
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinVariableResolver.java
trunk/framework/impl/src/main/java/org/richfaces/skin/VersionBean.java
trunk/framework/impl/src/main/resources/org/ajax4jsf/xml/serializer/output_xhtml.properties
trunk/framework/test/src/main/java/org/ajax4jsf/tests/AbstractAjax4JsfTestCase.java
trunk/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTestCase.java
Log:
packages and classes refactor
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -138,6 +138,7 @@
// If tidy not handle all requests, disable reorganising
// of html
// parser.setMoveElements(isForcexml());
+ parser.init();
}
// TODO - set header scripts/styles filter.
return parser;
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -68,32 +68,34 @@
/**
* @author shura
- *
+ *
*/
-public class NekkoParser implements HtmlParser {
+public class NekkoParser implements HtmlParser {
private static final Log _log = LogFactory.getLog(NekkoParser.class);
-
+
private HtmlSAXParser _parser;
-
-// private HtmlWriter _writer= new HtmlWriter();
-
+
+ // private HtmlWriter _writer= new HtmlWriter();
+
private ElementRemover remover = new ElementRemover();
-
- private XMLDocumentFilter[] _filters = { new ViewStateFilter()/*,remover */, new
HtmlCorrectionFilter(), new Purifier() /*, _writer*/ };
- private DOMFragmentParser viewStateParser ;//= new DOMFragmentParser();
+ private XMLDocumentFilter[] _filters = {
+ new ViewStateFilter()/* ,remover */, new HtmlCorrectionFilter(),
+ new Purifier() /* , _writer */};
- private Document viewStateDocument ;//= new HTMLDocumentImpl();
+ private DOMFragmentParser viewStateParser;// = new DOMFragmentParser();
+ private Document viewStateDocument;// = new HTMLDocumentImpl();
+
private DocumentFragment fragment = null;
private Set _scripts;
-
+
private Set _styles;
-
+
private String _viewState;
-
+
private String _encoding;
private Serializer _serializer;
@@ -103,68 +105,86 @@
private String _namespace = "http://www.w3.org/1999/xhtml";
private String _outputEncoding;
+
/**
*
*/
public NekkoParser() {
- _parser=new HtmlSAXParser(getHtmlConfig());
-// Properties properties =
OutputPropertiesFactory.getDefaultMethodProperties(Method.XHTML);
- Properties properties =
OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
-// properties.put("encoding",_encoding);
+ }
+
+ /**
+ *
+ */
+ public void init() {
+ _parser = new HtmlSAXParser(getHtmlConfig());
+ Properties properties = OutputPropertiesFactory
+ .getDefaultMethodProperties(Method.XHTML);
+ // Properties properties =
+ // OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
+ // properties.put("encoding",_encoding);
_serializer = SerializerFactory.getSerializer(properties);
-// serializer.setOutputStream(output);
-// _parser.setContentHandler(serializer.asContentHandler());
+ // serializer.setOutputStream(output);
+ // _parser.setContentHandler(serializer.asContentHandler());
viewStateParser = new DOMFragmentParser();
// Set parser features
try {
- viewStateParser.setProperty(
- "http://cyberneko.org/html/properties/names/elems",
- "lower");
- viewStateParser.setProperty(
- "http://cyberneko.org/html/properties/names/attrs",
- "lower");
+ viewStateParser
+ .setProperty(
+ "http://cyberneko.org/html/properties/names/elems",
+ "lower");
+ viewStateParser
+ .setProperty(
+ "http://cyberneko.org/html/properties/names/attrs",
+ "lower");
} catch (SAXException e) {
_log.error("Exception in DOM parser configuration", e);
- }
+ }
try {
// Create Document Builder Factory
DocumentBuilderFactory docFactory = DocumentBuilderFactory
- .newInstance();
+ .newInstance();
// Create Document Builder
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
viewStateDocument = docBuilder.newDocument();
} catch (ParserConfigurationException e) {
viewStateDocument = new HTMLDocumentImpl();
- _log.error("Error on create DOM Document by JAXP, use Xerxes implementation.
Check JAXP configuration ",e);
+ _log
+ .error(
+ "Error on create DOM Document by JAXP, use Xerxes implementation. Check JAXP
configuration ",
+ e);
}
-// viewStateDocument = new HTMLDocumentImpl();
+ // viewStateDocument = new HTMLDocumentImpl();
remover.removeElement("style");
}
-
+
/**
* Reset parser state
*/
- public void reset(){
- _scripts=null;
- _styles=null;
- _viewState=null;
+ public void reset() {
+ _scripts = null;
+ _styles = null;
+ _viewState = null;
_parser.reset();
_serializer.reset();
}
- /* (non-Javadoc)
- * @see org.ajax4jsf.webapp.HtmlParser#parseHtml(java.io.InputStream,
java.io.OutputStream)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.webapp.HtmlParser#parseHtml(java.io.InputStream,
+ * java.io.OutputStream)
*/
public void parseHtml(InputStream input, java.io.Writer output)
throws IOException {
InputSource src = new InputSource(input);
- parseSAXSource(src,output);
+ parseSAXSource(src, output);
}
- private void parseSAXSource(InputSource src, java.io.Writer output) throws IOException
{
-// PrintWriter printWriter = null;
+ private void parseSAXSource(InputSource src, java.io.Writer output)
+ throws IOException {
+ // PrintWriter printWriter = null;
fragment = null;
- if(null != _viewState){
+ if (null != _viewState) {
fragment = viewStateDocument.createDocumentFragment();
try {
viewStateParser.parse(new InputSource(new StringReader(
@@ -175,46 +195,60 @@
// TODO - parse view state to DOM Fragment.
}
try {
-
_parser.setProperty("http://cyberneko.org/html/properties/default-en...;,
- _encoding);
+ if (null != _encoding) {
+ _parser
+ .setProperty(
+ "http://cyberneko.org/html/properties/default-encoding",
+ _encoding);
+
+ }
Properties properties = _serializer.getOutputFormat();
- properties.put("encoding",_outputEncoding);
+ if (null != _outputEncoding) {
+ properties.put("encoding", _outputEncoding);
+
+ }
_serializer.setOutputFormat(properties);
_serializer.setWriter(output);
-// _serializer.setOutputStream(new OutputStream(){
-//
-// public void write(int b) throws IOException {
-// // TODO Auto-generated method stub
-//
-// }});
+ // _serializer.setOutputStream(new OutputStream(){
+ //
+ // public void write(int b) throws IOException {
+ // // TODO Auto-generated method stub
+ //
+ // }});
_parser.setContentHandler(_serializer.asContentHandler());
-// printWriter = new PrintWriter(output);
-// _writer.setWriter(printWriter);
-// _writer.setEncoding(_encoding);
+ // printWriter = new PrintWriter(output);
+ // _writer.setWriter(printWriter);
+ // _writer.setEncoding(_encoding);
_parser.parse(src);
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
-// _writer.setWriter(null);
-// if(null != printWriter){
-// printWriter.flush();
-// printWriter.close();
-// }
-
+ // _writer.setWriter(null);
+ // if(null != printWriter){
+ // printWriter.flush();
+ // printWriter.close();
+ // }
+
}
-
+
}
- /* (non-Javadoc)
- * @see org.ajax4jsf.webapp.HtmlParser#parseHtml(java.io.Reader, java.io.OutputStream)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.webapp.HtmlParser#parseHtml(java.io.Reader,
+ * java.io.OutputStream)
*/
- public void parseHtml(Reader input, java.io.Writer output) throws IOException {
+ public void parseHtml(Reader input, java.io.Writer output)
+ throws IOException {
InputSource src = new InputSource(input);
- parseSAXSource(src,output);
+ parseSAXSource(src, output);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.ajax4jsf.webapp.HtmlParser#setEncoding(java.lang.String)
*/
public void setInputEncoding(String encoding) {
@@ -224,7 +258,10 @@
public void setOutputEncoding(String encoding) {
_outputEncoding = encoding;
}
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.ajax4jsf.webapp.HtmlParser#setMoveElements(boolean)
*/
public void setMoveElements(boolean move) {
@@ -232,7 +269,9 @@
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.ajax4jsf.webapp.HtmlParser#setScripts(java.util.Set)
*/
public void setScripts(Set scripts) {
@@ -240,7 +279,9 @@
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.ajax4jsf.webapp.HtmlParser#setStyles(java.util.Set)
*/
public void setStyles(Set styles) {
@@ -248,7 +289,9 @@
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.ajax4jsf.webapp.HtmlParser#setDoctype(java.lang.String)
*/
public void setDoctype(String doctype) {
@@ -256,35 +299,41 @@
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.ajax4jsf.webapp.HtmlParser#setViewState(java.lang.String)
*/
public void setViewState(String viewState) {
_viewState = viewState;
}
-
- private static class HtmlSAXParser extends AbstractSAXParser {
- /** Default constructor.
- * @throws ServletException */
- public HtmlSAXParser(HTMLConfiguration config) {
- super(config);
-
- }
+
+ private static class HtmlSAXParser extends AbstractSAXParser {
+ /**
+ * Default constructor.
+ *
+ * @throws ServletException
+ */
+ public HtmlSAXParser(HTMLConfiguration config) {
+ super(config);
+
+ }
}
-
- private class ViewStateFilter extends DefaultFilter{
+
+ private class ViewStateFilter extends DefaultFilter {
private boolean haveHtml = false;
private boolean haveHead = false;
private boolean headParsed = false;
private int stateMarkerLevel = -1;
-
-
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see
org.cyberneko.html.filters.DefaultFilter#reset(org.apache.xerces.xni.parser.XMLComponentManager)
*/
- public void reset(XMLComponentManager componentManager) throws
XMLConfigurationException {
+ public void reset(XMLComponentManager componentManager)
+ throws XMLConfigurationException {
haveHead = false;
haveHtml = false;
headParsed = false;
@@ -292,27 +341,31 @@
super.reset(componentManager);
}
-
- /* (non-Javadoc)
- * @see
org.cyberneko.html.filters.DefaultFilter#startElement(org.apache.xerces.xni.QName,
org.apache.xerces.xni.XMLAttributes, org.apache.xerces.xni.Augmentations)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cyberneko.html.filters.DefaultFilter#startElement(org.apache.xerces.xni.QName,
+ * org.apache.xerces.xni.XMLAttributes,
+ * org.apache.xerces.xni.Augmentations)
*/
- public void startElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {
- if(stateMarkerLevel >=0){
+ public void startElement(QName element, XMLAttributes attributes,
+ Augmentations augs) throws XNIException {
+ if (stateMarkerLevel >= 0) {
stateMarkerLevel++;
- if(null != fragment){
+ if (null != fragment) {
return;
}
}
if (!headParsed) {
- if("html".equalsIgnoreCase(element.rawname)){
+ if ("html".equalsIgnoreCase(element.rawname)) {
haveHtml = true;
- } else if("head".equalsIgnoreCase(element.rawname)){
+ } else if ("head".equalsIgnoreCase(element.rawname)) {
haveHead = true;
super.startElement(element, attributes, augs);
insertResources();
return;
} else {
- if(!haveHtml){
+ if (!haveHtml) {
insertStartElement("html");
}
insertStartElement("head");
@@ -321,82 +374,97 @@
}
}
- if(isStateMarker(element, attributes)){
+ if (isStateMarker(element, attributes)) {
stateMarkerLevel = 0;
return;
- };
+ }
+ ;
super.startElement(element, attributes, augs);
}
-
- /* (non-Javadoc)
- * @see
org.cyberneko.html.filters.DefaultFilter#characters(org.apache.xerces.xni.XMLString,
org.apache.xerces.xni.Augmentations)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cyberneko.html.filters.DefaultFilter#characters(org.apache.xerces.xni.XMLString,
+ * org.apache.xerces.xni.Augmentations)
*/
- public void characters(XMLString text, Augmentations augs) throws XNIException {
- if(stateMarkerLevel >=0){
- if(null != fragment){
+ public void characters(XMLString text, Augmentations augs)
+ throws XNIException {
+ if (stateMarkerLevel >= 0) {
+ if (null != fragment) {
return;
}
}
super.characters(text, augs);
}
-
- /* (non-Javadoc)
- * @see
org.cyberneko.html.filters.DefaultFilter#endElement(org.apache.xerces.xni.QName,
org.apache.xerces.xni.Augmentations)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cyberneko.html.filters.DefaultFilter#endElement(org.apache.xerces.xni.QName,
+ * org.apache.xerces.xni.Augmentations)
*/
- public void endElement(QName element, Augmentations augs) throws XNIException {
- if(stateMarkerLevel >=0){
+ public void endElement(QName element, Augmentations augs)
+ throws XNIException {
+ if (stateMarkerLevel >= 0) {
stateMarkerLevel--;
- if(null != fragment || stateMarkerLevel == -1){
+ if (null != fragment || stateMarkerLevel == -1) {
return;
}
}
super.endElement(element, augs);
}
-
private void insertResources() {
headParsed = true;
- if(null != _styles){
+ if (null != _styles) {
for (Iterator iter = _styles.iterator(); iter.hasNext();) {
String style = (String) iter.next();
- QName element = new QName(null,"link","link",null);
+ QName element = new QName(null, "link", "link", null);
XMLAttributes attrs = new XMLAttributesImpl();
- attrs.addAttribute(new QName(null,"href","href",null),
"CDATA", style);
- attrs.addAttribute(new QName(null,"type","type",null),
"CDATA", "text/css");
- attrs.addAttribute(new QName(null,"rel","rel",null),
"CDATA", "stylesheet");
+ attrs.addAttribute(new QName(null, "href", "href", null),
+ "CDATA", style);
+ attrs.addAttribute(new QName(null, "type", "type", null),
+ "CDATA", "text/css");
+ attrs.addAttribute(new QName(null, "rel", "rel", null),
+ "CDATA", "stylesheet");
Augmentations augs = new HTMLAugmentations();
- super.emptyElement(element,attrs,augs);
+ super.emptyElement(element, attrs, augs);
}
}
- if(null != _scripts){
+ if (null != _scripts) {
for (Iterator iter = _scripts.iterator(); iter.hasNext();) {
String script = (String) iter.next();
- QName element = new QName(null,"script","script",null);
+ QName element = new QName(null, "script", "script", null);
XMLAttributes attrs = new XMLAttributesImpl();
- attrs.addAttribute(new QName(null,"src","src",null),
"CDATA", script);
- attrs.addAttribute(new QName(null,"type","type",null),
"CDATA", "text/javascript");
+ attrs.addAttribute(new QName(null, "src", "src", null),
+ "CDATA", script);
+ attrs.addAttribute(new QName(null, "type", "type", null),
+ "CDATA", "text/javascript");
Augmentations augs = new HTMLAugmentations();
- super.startElement(element,attrs,augs);
+ super.startElement(element, attrs, augs);
super.endElement(element, augs);
}
}
-
+
}
-
- /* (non-Javadoc)
- * @see
org.cyberneko.html.filters.DefaultFilter#emptyElement(org.apache.xerces.xni.QName,
org.apache.xerces.xni.XMLAttributes, org.apache.xerces.xni.Augmentations)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cyberneko.html.filters.DefaultFilter#emptyElement(org.apache.xerces.xni.QName,
+ * org.apache.xerces.xni.XMLAttributes,
+ * org.apache.xerces.xni.Augmentations)
*/
- public void emptyElement(QName name, XMLAttributes attributes, Augmentations
augmentation) throws XNIException {
- if(stateMarkerLevel >=0){
- if(null != fragment){
+ public void emptyElement(QName name, XMLAttributes attributes,
+ Augmentations augmentation) throws XNIException {
+ if (stateMarkerLevel >= 0) {
+ if (null != fragment) {
return;
}
}
if (!headParsed) {
- if("head".equalsIgnoreCase(name.rawname)){
+ if ("head".equalsIgnoreCase(name.rawname)) {
haveHead = true;
super.startElement(name, attributes, augmentation);
insertResources();
@@ -404,21 +472,23 @@
return;
}
}
- if(isStateMarker(name, attributes)){
+ if (isStateMarker(name, attributes)) {
return;
- };
+ }
+ ;
super.emptyElement(name, attributes, augmentation);
}
-
/**
* @param name
* @param attributes
*/
private boolean isStateMarker(QName name, XMLAttributes attributes) {
- if(name.rawname.equalsIgnoreCase("span") &&
AjaxViewHandler.STATE_MARKER_KEY.equals(attributes.getValue("id"))){
+ if (name.rawname.equalsIgnoreCase("span")
+ && AjaxViewHandler.STATE_MARKER_KEY.equals(attributes
+ .getValue("id"))) {
// STATE marker element - out real content.
- if(null != fragment){
+ if (null != fragment) {
try {
_serializer.asDOMSerializer().serialize(fragment);
} catch (IOException e) {
@@ -429,38 +499,36 @@
}
return false;
}
-
- void insertStartElement(String name) {
- QName element = new QName(null,name,name,null);
- XMLAttributes attrs = new XMLAttributesImpl();
- Augmentations augs = new HTMLAugmentations();
- super.startElement(element,attrs,augs);
- }
-
-
- void insertEndElement(String name) {
- QName element = new QName(null,name,name,null);
-// XMLAttributes attrs = new XMLAttributesImpl();
- Augmentations augs = new HTMLAugmentations();
- super.endElement(element,augs);
- }
+ void insertStartElement(String name) {
+ QName element = new QName(null, name, name, null);
+ XMLAttributes attrs = new XMLAttributesImpl();
+ Augmentations augs = new HTMLAugmentations();
+ super.startElement(element, attrs, augs);
+ }
- /* (non-Javadoc)
- * @see
org.cyberneko.html.filters.DefaultFilter#endDocument(org.apache.xerces.xni.Augmentations)
- */
- public void endDocument(Augmentations augs) throws XNIException {
- if (!haveHtml) {
- insertEndElement("html");
- }
- super.endDocument(augs);
+ void insertEndElement(String name) {
+ QName element = new QName(null, name, name, null);
+ // XMLAttributes attrs = new XMLAttributesImpl();
+ Augmentations augs = new HTMLAugmentations();
+ super.endElement(element, augs);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.cyberneko.html.filters.DefaultFilter#endDocument(org.apache.xerces.xni.Augmentations)
+ */
+ public void endDocument(Augmentations augs) throws XNIException {
+ if (!haveHtml) {
+ insertEndElement("html");
}
-
-
+ super.endDocument(augs);
+ }
}
- private static class HtmlWriter extends Writer {
+ private static class HtmlWriter extends Writer {
/**
*
@@ -469,25 +537,32 @@
super();
fEncoding = "UTF-8";
}
-
- public void setEncoding(String encoding){
+
+ public void setEncoding(String encoding) {
this.fEncoding = encoding;
}
-
- public void setWriter( PrintWriter writer){
+
+ public void setWriter(PrintWriter writer) {
this.fPrinter = writer;
}
- /* (non-Javadoc)
- * @see org.cyberneko.html.filters.Writer#emptyElement(org.apache.xerces.xni.QName,
org.apache.xerces.xni.XMLAttributes, org.apache.xerces.xni.Augmentations)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.cyberneko.html.filters.Writer#emptyElement(org.apache.xerces.xni.QName,
+ * org.apache.xerces.xni.XMLAttributes,
+ * org.apache.xerces.xni.Augmentations)
*/
- public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
throws XNIException {
+ public void emptyElement(QName element, XMLAttributes attributes,
+ Augmentations augs) throws XNIException {
// TODO Auto-generated method stub
super.emptyElement(element, attributes, augs);
printEndElement(element);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see
org.cyberneko.html.filters.DefaultFilter#endCDATA(org.apache.xerces.xni.Augmentations)
*/
public void endCDATA(Augmentations augs) throws XNIException {
@@ -495,7 +570,9 @@
super.endCDATA(augs);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see
org.cyberneko.html.filters.DefaultFilter#startCDATA(org.apache.xerces.xni.Augmentations)
*/
public void startCDATA(Augmentations augs) throws XNIException {
@@ -503,147 +580,163 @@
super.startCDATA(augs);
}
- /* (non-Javadoc)
- * @see org.cyberneko.html.filters.DefaultFilter#textDecl(java.lang.String,
java.lang.String, org.apache.xerces.xni.Augmentations)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.cyberneko.html.filters.DefaultFilter#textDecl(java.lang.String,
+ * java.lang.String, org.apache.xerces.xni.Augmentations)
*/
- public void textDecl(String version, String encoding, Augmentations augs) throws
XNIException {
+ public void textDecl(String version, String encoding, Augmentations augs)
+ throws XNIException {
// TODO Auto-generated method stub
super.textDecl(version, encoding, augs);
}
- /* (non-Javadoc)
- * @see org.cyberneko.html.filters.DefaultFilter#xmlDecl(java.lang.String,
java.lang.String, java.lang.String, org.apache.xerces.xni.Augmentations)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.cyberneko.html.filters.DefaultFilter#xmlDecl(java.lang.String,
+ * java.lang.String, java.lang.String,
+ * org.apache.xerces.xni.Augmentations)
*/
- public void xmlDecl(String version, String encoding, String standalone, Augmentations
augs) throws XNIException {
+ public void xmlDecl(String version, String encoding, String standalone,
+ Augmentations augs) throws XNIException {
// TODO Auto-generated method stub
super.xmlDecl(version, encoding, standalone, augs);
}
-
-
+
}
+
/**
- * Factory method for create and configure HTML parser configuration.
- * Create configuration for use in parsing, set nessesary features and properties
- * @return
- * @throws ServletException
- */
- protected HTMLConfiguration getHtmlConfig() {
- HTMLConfiguration _config = new HTMLConfiguration();
- try {
- if (this.getPublicid() != null || this.getSystemid() != null) {
- _config.setFeature(
- "http://cyberneko.org/html/features/insert-doctype",
+ * Factory method for create and configure HTML parser configuration. Create
+ * configuration for use in parsing, set nessesary features and properties
+ *
+ * @return
+ * @throws ServletException
+ */
+ protected HTMLConfiguration getHtmlConfig() {
+ HTMLConfiguration _config = new HTMLConfiguration();
+ try {
+ if (this.getPublicid() != null || this.getSystemid() != null) {
+ _config.setFeature(
+ "http://cyberneko.org/html/features/insert-doctype",
+ true);
+ _config.setFeature(
+ "http://cyberneko.org/html/features/override-doctype",
+ true);
+ }
+ if (this.getPublicid() != null) {
+ _config.setProperty(
+ "http://cyberneko.org/html/properties/doctype/pubid",
+ getPublicid());
+
+ }
+ if (this.getSystemid() != null) {
+ _config.setProperty(
+ "http://cyberneko.org/html/properties/doctype/sysid",
+ getSystemid());
+
+ }
+ if (this.getNamespace() != null) {
+
_config.setFeature("http://xml.org/sax/features/namespaces",
+ true);
+ _config
+ .setFeature(
+ "http://cyberneko.org/html/features/override-namespaces",
+ true);
+ _config.setFeature(
+ "http://cyberneko.org/html/features/insert-namespaces",
+ true);
+ _config.setProperty(
+ "http://cyberneko.org/html/properties/namespaces-uri",
+ getNamespace());
+
+ }
+ // config
+ // .setFeature(
+ //
"http://cyberneko.org/html/features/balance-tags/ignore-outside-content",
+ // true);
+ _config
+ .setFeature(
+ "http://cyberneko.org/html/features/scanner/cdata-sections",
true);
- _config.setFeature(
- "http://cyberneko.org/html/features/override-doctype",
+ _config
+ .setFeature(
+ "http://cyberneko.org/html/features/scanner/script/strip-comment-delims",
true);
- }
- if (this.getPublicid() != null) {
- _config.setProperty(
- "http://cyberneko.org/html/properties/doctype/pubid",
- getPublicid());
-
- }
- if (this.getSystemid() != null) {
- _config.setProperty(
- "http://cyberneko.org/html/properties/doctype/sysid",
- getSystemid());
-
- }
- if (this.getNamespace() != null) {
- _config.setFeature(
- "http://xml.org/sax/features/namespaces",
+ _config
+ .setFeature(
+ "http://cyberneko.org/html/features/scanner/style/strip-comment-delims",
true);
- _config.setFeature(
- "http://cyberneko.org/html/features/override-namespaces",
- true);
- _config.setFeature(
- "http://cyberneko.org/html/features/insert-namespaces",
- true);
- _config.setProperty(
- "http://cyberneko.org/html/properties/namespaces-uri",
- getNamespace());
-
- }
- // config
- // .setFeature(
- //
"http://cyberneko.org/html/features/balance-tags/ignore-outside-content",
- // true);
- _config
- .setFeature(
- "http://cyberneko.org/html/features/scanner/cdata-sections",
- true);
- _config
- .setFeature(
- "http://cyberneko.org/html/features/scanner/script/strip-comment-delims",
- true);
- _config
- .setFeature(
- "http://cyberneko.org/html/features/scanner/style/strip-comment-delims",
- true);
- _config.setFeature(
- "http://cyberneko.org/html/features/insert-doctype",
- true);
- _config.setFeature(
- "http://cyberneko.org/html/features/insert-namespaces",
- true);
- //
- // Set properties
http://cyberneko.org/html/features/insert-namespaces
- // _config
- // .setProperty(
- // "http://cyberneko.org/html/properties/default-encoding",
- // encoding);
- _config.setProperty(
+ _config.setFeature(
+ "http://cyberneko.org/html/features/insert-doctype", true);
+ _config.setFeature(
+ "http://cyberneko.org/html/features/insert-namespaces",
+ true);
+ //
+ // Set properties
+ //
http://cyberneko.org/html/features/insert-namespaces
+ // _config
+ // .setProperty(
+ // "http://cyberneko.org/html/properties/default-encoding",
+ // encoding);
+ _config
+ .setProperty(
"http://cyberneko.org/html/properties/names/elems",
"lower");
- _config.setProperty(
+ _config
+ .setProperty(
"http://cyberneko.org/html/properties/names/attrs",
"lower");
-
_config.setProperty("http://cyberneko.org/html/properties/filters",
_filters);
- } catch (XMLConfigurationException e) {
-// throw new ServletException("error set Neko feature ", e);
- }
- return _config;
- }
-
- private String getNamespace() {
- // TODO Auto-generated method stub
- return this._namespace;
+
_config.setProperty("http://cyberneko.org/html/properties/filters",
+ _filters);
+ } catch (XMLConfigurationException e) {
+ // throw new ServletException("error set Neko feature ", e);
}
+ return _config;
+ }
- private String getSystemid() {
- // TODO Auto-generated method stub
- return this._systemid;
- }
+ private String getNamespace() {
+ // TODO Auto-generated method stub
+ return this._namespace;
+ }
- private String getPublicid() {
- // TODO Auto-generated method stub
- return this._publicId;
- }
+ private String getSystemid() {
+ // TODO Auto-generated method stub
+ return this._systemid;
+ }
- /**
- * @param namespace The namespace to set.
- */
- public void setNamespace(String namespace) {
- _namespace = namespace;
- }
+ private String getPublicid() {
+ // TODO Auto-generated method stub
+ return this._publicId;
+ }
- /**
- * @param publicId The publicId to set.
- */
- public void setPublicId(String publicId) {
- _publicId = publicId;
- }
+ /**
+ * @param namespace
+ * The namespace to set.
+ */
+ public void setNamespace(String namespace) {
+ _namespace = namespace;
+ }
- /**
- * @param systemid The systemid to set.
- */
- public void setSystemid(String systemid) {
- _systemid = systemid;
- }
+ /**
+ * @param publicId
+ * The publicId to set.
+ */
+ public void setPublicId(String publicId) {
+ _publicId = publicId;
+ }
- public boolean setMime(String mimeType) {
- return false;
- }
+ /**
+ * @param systemid
+ * The systemid to set.
+ */
+ public void setSystemid(String systemid) {
+ _systemid = systemid;
+ }
+ public boolean setMime(String mimeType) {
+ return false;
+ }
+
}
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoXMLFilter.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoXMLFilter.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoXMLFilter.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -88,6 +88,7 @@
parser.setNamespace(getNamespace());
// If tidy not handle all requests, disable reorganising of html
// parser.setMoveElements(isForcexml());
+ parser.init();
}
// TODO - set header scripts/styles filter.
return parser;
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -77,7 +77,8 @@
*/
private static final CharInfo m_htmlcharInfo =
// new CharInfo(CharInfo.HTML_ENTITIES_RESOURCE);
- CharInfo.getCharInfo(CharInfo.HTML_ENTITIES_RESOURCE, Method.HTML);
+ // Asmirnov - disable HTML Entities.
+ CharInfo.getCharInfo(CharInfo.XML_ENTITIES_RESOURCE, Method.XHTML);
/** A digital search trie for fast, case insensitive lookup of ElemDesc objects. */
static final Trie m_elementFlags = new Trie();
@@ -538,6 +539,8 @@
*/
static private final ElemDesc m_dummy = new ElemDesc(0 | ElemDesc.BLOCK);
+ public static final String XHTML_NAMESPACE_URI =
"http://www.w3.org/1999/xhtml";
+
/** True if URLs should be specially escaped with the %xx form. */
private boolean m_specialEscapeURLs = true;
@@ -838,7 +841,7 @@
// if this element has a namespace then treat it like XML
- if (null != namespaceURI && namespaceURI.length() > 0)
+ if (null != namespaceURI && namespaceURI.length() > 0 &&
(!XHTML_NAMESPACE_URI.equals(namespaceURI)))
{
super.startElement(namespaceURI, localName, name, atts);
@@ -952,7 +955,7 @@
closeCDATA();
// if the element has a namespace, treat it like XML, not HTML
- if (null != namespaceURI && namespaceURI.length() > 0)
+ if (null != namespaceURI && namespaceURI.length() > 0 &&
(!XHTML_NAMESPACE_URI.equals(namespaceURI)))
{
super.endElement(namespaceURI, localName, name);
Copied: trunk/framework/impl/src/main/java/org/richfaces/skin (from rev 1585,
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin)
Modified:
trunk/framework/impl/src/main/java/org/richfaces/skin/DummySkinConfiguration.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin/DummySkinConfiguration.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/impl/src/main/java/org/richfaces/skin/DummySkinConfiguration.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.framework.skin;
+package org.richfaces.skin;
import javax.faces.context.FacesContext;
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinBean.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin/SkinBean.java 2007-07-10
16:14:12 UTC (rev 1585)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinBean.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.framework.skin;
+package org.richfaces.skin;
import java.nio.ByteBuffer;
import java.util.AbstractMap;
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin/SkinFactoryImpl.java 2007-07-10
16:14:12 UTC (rev 1585)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinFactoryImpl.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.framework.skin;
+package org.richfaces.skin;
import java.io.IOException;
import java.io.InputStream;
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin/SkinImpl.java 2007-07-10
16:14:12 UTC (rev 1585)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.framework.skin;
+package org.richfaces.skin;
import java.util.HashMap;
import java.util.Iterator;
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinPropertyResolver.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin/SkinPropertyResolver.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinPropertyResolver.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.framework.skin;
+package org.richfaces.skin;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/SkinVariableResolver.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin/SkinVariableResolver.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/impl/src/main/java/org/richfaces/skin/SkinVariableResolver.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.framework.skin;
+package org.richfaces.skin;
import javax.faces.context.FacesContext;
import javax.faces.el.EvaluationException;
Modified: trunk/framework/impl/src/main/java/org/richfaces/skin/VersionBean.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/framework/skin/VersionBean.java 2007-07-10
16:14:12 UTC (rev 1585)
+++ trunk/framework/impl/src/main/java/org/richfaces/skin/VersionBean.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -19,7 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-package org.ajax4jsf.framework.skin;
+package org.richfaces.skin;
/**
* Vendor and version information for A4J project
Modified:
trunk/framework/impl/src/main/resources/org/ajax4jsf/xml/serializer/output_xhtml.properties
===================================================================
---
trunk/framework/impl/src/main/resources/org/ajax4jsf/xml/serializer/output_xhtml.properties 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/impl/src/main/resources/org/ajax4jsf/xml/serializer/output_xhtml.properties 2007-07-10
18:37:56 UTC (rev 1586)
@@ -22,7 +22,8 @@
# XSLT properties do not need namespace qualification.
method=xhtml
-indent=yes
+indent=no
+omit-xml-declaration=yes
media-type=application/xml+xhtml
version=1.0
@@ -37,6 +38,8 @@
# Note that the colon after the protocol needs to be escaped.
{http\u003a//xml.apache.org/xalan}indent-amount=0
{http\u003a//xml.apache.org/xalan}content-handler=org.ajax4jsf.xml.serializer.ToXHTMLStream
-{http\u003a//xml.apache.org/xalan}entities=org/ajax4jsf/xml/serializer/HTMLEntities
+# XMLHttpRequest can't resolve HTTP entities.
+# {http\u003a//xml.apache.org/xalan}entities=org/ajax4jsf/xml/serializer/HTMLEntities
+{http\u003a//xml.apache.org/xalan}entities=org/ajax4jsf/xml/serializer/XMLEntities
{http\u003a//xml.apache.org/xalan}use-url-escaping=yes
{http\u003a//xml.apache.org/xalan}omit-meta-tag=yes
Modified:
trunk/framework/test/src/main/java/org/ajax4jsf/tests/AbstractAjax4JsfTestCase.java
===================================================================
---
trunk/framework/test/src/main/java/org/ajax4jsf/tests/AbstractAjax4JsfTestCase.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/test/src/main/java/org/ajax4jsf/tests/AbstractAjax4JsfTestCase.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -46,8 +46,6 @@
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.context.AjaxContextImpl;
-import org.ajax4jsf.framework.skin.SkinBean;
-import org.ajax4jsf.framework.skin.VersionBean;
import org.ajax4jsf.framework.util.config.WebXml;
import org.ajax4jsf.renderkit.AjaxViewRootRenderer;
import org.ajax4jsf.renderkit.ChameleonRenderKitImpl;
@@ -58,7 +56,9 @@
import org.apache.shale.test.mock.MockPrintWriter;
import org.apache.shale.test.mock.MockResponseWriter;
import org.apache.shale.test.mock.MockServletOutputStream;
+import org.richfaces.skin.SkinBean;
import org.richfaces.skin.SkinFactory;
+import org.richfaces.skin.VersionBean;
import com.gargoylesoftware.htmlunit.MockWebConnection;
import com.gargoylesoftware.htmlunit.Page;
Modified:
trunk/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTestCase.java
===================================================================
---
trunk/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTestCase.java 2007-07-10
16:14:12 UTC (rev 1585)
+++
trunk/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTestCase.java 2007-07-10
18:37:56 UTC (rev 1586)
@@ -38,6 +38,8 @@
import org.easymock.classextension.MockClassControl;
import org.richfaces.skin.Skin;
import org.richfaces.skin.SkinFactory;
+import org.richfaces.skin.SkinFactoryImpl;
+import org.richfaces.skin.SkinImpl;
/**
* Test for Skin/skin factory methods.