You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2008/07/06 12:09:29 UTC
svn commit: r674280 - in /myfaces/tomahawk/trunk/sandbox:
core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/
core12/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/
Author: imario
Date: Sun Jul 6 03:09:28 2008
New Revision: 674280
URL: http://svn.apache.org/viewvc?rev=674280&view=rev
Log:
make InputSuggestAjaxRenderer compatible with systems where the response
stream is parsed if it is a text/html response. Now, that
InputSuggestAjaxRenderer does not send such a context, any html parser might
screw up the output.
Now marking the context as text/plain (what it actually is)
Modified:
myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java
myfaces/tomahawk/trunk/sandbox/core12/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java
Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java?rev=674280&r1=674279&r2=674280&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java Sun Jul 6 03:09:28 2008
@@ -33,18 +33,19 @@
import javax.faces.context.ResponseWriter;
import javax.faces.convert.Converter;
import javax.faces.el.MethodBinding;
+import javax.servlet.ServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
/**
- *
+ *
* @JSFRenderer
- * renderKitId = "HTML_BASIC"
+ * renderKitId = "HTML_BASIC"
* family = "javax.faces.Input"
* type = "org.apache.myfaces.InputSuggestAjax"
- *
+ *
* @author Gerald Müllan
* @author Martin Marinschek
* @version $Revision: 177984 $ $Date: 2005-05-23 19:39:37 +0200 (Mon, 23 May 2005) $
@@ -246,6 +247,11 @@
public void encodeAjax(FacesContext context, UIComponent uiComponent)
throws IOException
{
+ // we are not sending html, xml or json, so notify the system about that else any filter
+ // trying to parse the result as html (e.g. richfaces) will fail
+ ServletResponse response = (ServletResponse) context.getExternalContext().getResponse();
+ response.setContentType("text/plain");
+
InputSuggestAjax inputSuggestAjax = (InputSuggestAjax) uiComponent;
Collection suggesteds = getSuggestedItems(context, uiComponent);
Modified: myfaces/tomahawk/trunk/sandbox/core12/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core12/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java?rev=674280&r1=674279&r2=674280&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core12/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core12/src/main/java/org/apache/myfaces/custom/suggestajax/inputsuggestajax/InputSuggestAjaxRenderer.java Sun Jul 6 03:09:28 2008
@@ -34,18 +34,19 @@
import javax.faces.convert.Converter;
import javax.el.MethodExpression;
import javax.el.MethodNotFoundException;
+import javax.servlet.ServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
/**
- *
+ *
* @JSFRenderer
- * renderKitId = "HTML_BASIC"
+ * renderKitId = "HTML_BASIC"
* family = "javax.faces.Input"
* type = "org.apache.myfaces.InputSuggestAjax"
- *
+ *
* @author Gerald Müllan
* @author Martin Marinschek
* @version $Revision$ $Date$
@@ -247,6 +248,11 @@
public void encodeAjax(FacesContext context, UIComponent uiComponent)
throws IOException
{
+ // we are not sending html, xml or json, so notify the system about that else any filter
+ // trying to parse the result as html (e.g. richfaces) will fail
+ ServletResponse response = (ServletResponse) context.getExternalContext().getResponse();
+ response.setContentType("text/plain");
+
InputSuggestAjax inputSuggestAjax = (InputSuggestAjax) uiComponent;
Collection suggesteds = getSuggestedItems(context, uiComponent);