Author: alexsmirnov
Date: 2008-04-11 16:41:59 -0400 (Fri, 11 Apr 2008)
New Revision: 7777
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/NamespaceMappings.java
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java
Log:
fix problem with two or more parameters for an outputLink
Modified: branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java
===================================================================
---
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2008-04-11
18:05:38 UTC (rev 7776)
+++
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/BaseFilter.java 2008-04-11
20:41:59 UTC (rev 7777)
@@ -140,6 +140,9 @@
/** Session bean name to store max files count allowed to upload */
public static final String UPLOADED_COUNTER =
"_richfaces_uploaded_file_counter";
+
+ /** Request parameter name indicated that file was uploaded by RF component */
+ public static final String FILE_UPLOAD_INDICATOR =
"_richfaces_upload_file_indicator";
/**
* Initialize the filter.
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java
===================================================================
---
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java 2008-04-11
18:05:38 UTC (rev 7776)
+++
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/ConfigurableXMLFilter.java 2008-04-11
20:41:59 UTC (rev 7777)
@@ -136,24 +136,25 @@
private class NekoParserConfig extends ParserConfig {
protected HtmlParser createParser(String mime) {
- NekkoParser parser;
- try {
- synchronized (_xhtmlParsersPool) {
- parser = (NekkoParser) _xhtmlParsersPool.pop();
+ NekkoParser parser;
+ try {
+ synchronized (_xhtmlParsersPool) {
+ parser = (NekkoParser) _xhtmlParsersPool.pop();
+ }
+ } catch (EmptyStackException e) {
+ parser = new NekkoParser();
+ parser.setPublicId(getPublicid());
+ parser.setSystemid(getSystemid());
+ parser.setNamespace(getNamespace());
+ // If tidy not handle all requests, disable reorganising
+ // of html
+ // parser.setMoveElements(isForcexml());
+ parser.init();
+ }
+ parser.setMime(mime);
+ // TODO - set header scripts/styles filter.
+ return parser;
}
- } catch (EmptyStackException e) {
- parser = new NekkoParser();
- parser.setPublicId(getPublicid());
- parser.setSystemid(getSystemid());
- 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;
- }
boolean storeParser(HtmlParser parser) {
if (null != parser && parser instanceof NekkoParser) {
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
---
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-04-11
18:05:38 UTC (rev 7776)
+++
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2008-04-11
20:41:59 UTC (rev 7777)
@@ -36,6 +36,7 @@
import javax.xml.parsers.ParserConfigurationException;
import org.ajax4jsf.application.AjaxViewHandler;
+import org.ajax4jsf.webapp.BaseXMLFilter;
import org.ajax4jsf.webapp.HtmlParser;
import org.ajax4jsf.xml.serializer.Method;
import org.ajax4jsf.xml.serializer.OutputPropertiesFactory;
@@ -108,6 +109,12 @@
private String _outputEncoding;
+ private Serializer _XHTMLserializer;
+
+ private Serializer _XMLserialiser;
+
+ private Serializer _HTMLserialiser;
+
/**
*
*/
@@ -121,10 +128,12 @@
_parser = new HtmlSAXParser(getHtmlConfig());
Properties properties = OutputPropertiesFactory
.getDefaultMethodProperties(Method.XHTML);
- // Properties properties =
- // OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
- // properties.put("encoding",_encoding);
- _serializer = SerializerFactory.getSerializer(properties);
+ _XHTMLserializer = SerializerFactory.getSerializer(properties);
+ properties = OutputPropertiesFactory.getDefaultMethodProperties(Method.XML);
+ _XMLserialiser = SerializerFactory.getSerializer(properties);
+ properties = OutputPropertiesFactory.getDefaultMethodProperties(Method.HTML);
+ _HTMLserialiser = SerializerFactory.getSerializer(properties);
+ _serializer = _HTMLserialiser;
// serializer.setOutputStream(output);
// _parser.setContentHandler(serializer.asContentHandler());
viewStateParser = new DOMFragmentParser();
@@ -168,7 +177,10 @@
_userStyles = null;
_viewState = null;
_parser.reset();
- _serializer.reset();
+ _XMLserialiser.reset();
+ _HTMLserialiser.reset();
+ _XHTMLserializer.reset();
+ _serializer = _HTMLserialiser;
}
/*
@@ -772,6 +784,18 @@
}
public boolean setMime(String mimeType) {
+ if(null != mimeType) {
+ if(mimeType.startsWith(BaseXMLFilter.TEXT_HTML)){
+ _serializer = _HTMLserialiser;
+ } else if (mimeType.startsWith(BaseXMLFilter.APPLICATION_XHTML_XML)) {
+ _serializer = _XHTMLserializer;
+ } else if (mimeType.startsWith("text/xml")) {
+ _serializer = _XMLserialiser;
+ } else {
+ return false;
+ }
+ return true;
+ }
return false;
}
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/NamespaceMappings.java
===================================================================
---
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/NamespaceMappings.java 2008-04-11
18:05:38 UTC (rev 7776)
+++
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/NamespaceMappings.java 2008-04-11
20:41:59 UTC (rev 7777)
@@ -221,8 +221,10 @@
Stack stack;
if ((stack = (Stack) m_namespaces.get(prefix)) != null)
{
- stack.pop();
- return true;
+ if (!stack.isEmpty()) {
+ stack.pop();
+ }
+ return true;
}
return false;
}
Modified:
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java
===================================================================
---
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java 2008-04-11
18:05:38 UTC (rev 7776)
+++
branches/3.2.x/framework/impl/src/main/java/org/ajax4jsf/xml/serializer/ToXHTMLStream.java 2008-04-11
20:41:59 UTC (rev 7777)
@@ -1326,7 +1326,7 @@
// Since
http://www.ietf.org/rfc/rfc2396.txt refers to the URI grammar as
// not allowing quotes in the URI proper syntax, nor in the fragment
// identifier, we believe that it's OK to double escape quotes.
- else if (ch == '"')
+ else if (ch == '"' || ch == '<' || ch ==
'>' || ch == '&')
{
// If the character is a '%' number number, try to avoid
double-escaping.
// There is a question if this is legal behavior.
@@ -1346,11 +1346,18 @@
// Mike Kay encodes this as ", so he may know something I
don't?
- if (doURLEscaping)
- writer.write("%22");
- else
- writer.write("""); // we have to escape this, I
guess.
+ if (doURLEscaping){
+ writer.write('%');
+ writer.write(makeHHString(ch));
+ } else {
+ int pos = accumDefaultEntity(writer, ch, i, chars, end, false,
true);
+ if (i != pos)
+ {
+ i = pos - 1;
+ }
+// writer.write("""); // we have to escape this, I
guess.
+ }
// We have written out any clean characters, then the escaped '%'
and now we
// We now we reset the next possible clean character.
cleanStart = i + 1;