Hi Bruno,

yes everything works again, thanks.

Regards,
  Volker

Bruno Aranda wrote:
> Thanks Volker for reporting that. I've changed the implementation of
> this stuff in order to not use the HtmlResponseWriterImpl again. It
> was used to held the information to render the dummyForm. Now this
> information is held in the request. Can you verify that everything
> works as expected?
> 
> Regards,
> 
> Bruno
> 
> 2006/1/28, Volker Weber <[EMAIL PROTECTED]>:
> 
>>Hi,
>>
>>this checkin breaks tobago and also any other implementation with own
>>ResponseWriter!
>>
>>I get a
>>java.lang.ClassCastException:
>>org.apache.myfaces.tobago.webapp.TobagoResponseWriter
>>        at
>>org.apache.myfaces.util.MyFacesJavascriptRendererUtil.renderCodeBeforeBodyEnd(MyFacesJavascriptRendererUtil.java:54)
>>        at org.apache.myfaces.taglib.core.ViewTag.doEndTag(ViewTag.java:129)
>> .
>> .
>> .
>>
>>line 54 in MyFacesJavascriptRendererUtil:
>>HtmlResponseWriterImpl responseWriterImpl = (HtmlResponseWriterImpl)
>>responseWriter;
>>
>>Why is this done in non tomahawk applications?
>>
>>Regards,
>>  Volker
>>
>>
>>[EMAIL PROTECTED] wrote:
>>
>>>Author: baranda
>>>Date: Mon Jan 23 16:31:36 2006
>>>New Revision: 371740
>>>
>>>URL: http://svn.apache.org/viewcvs?rev=371740&view=rev
>>>Log:
>>>Removed functionality from ResponseWriterImpl.endCode() that provoked 
>>>MYFACES-152 and MYFACES-883. Now it is possible to use the f:view tag before 
>>>the body tag. The myfaces javascript code is created in the 
>>>viewTag.doEndTag() method but it is not inserted in the response till the 
>>>ExtensionsFilter does the post-parsing.
>>>
>>>Added:
>>>    
>>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/MyFacesJavascriptRendererUtil.java
>>>    (with props)
>>>Modified:
>>>    
>>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/taglib/core/ViewTag.java
>>>
>>>Modified: 
>>>myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/taglib/core/ViewTag.java
>>>URL: 
>>>http://svn.apache.org/viewcvs/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/taglib/core/ViewTag.java?rev=371740&r1=371739&r2=371740&view=diff
>>>==============================================================================
>>>--- 
>>>myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/taglib/core/ViewTag.java
>>> (original)
>>>+++ 
>>>myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/taglib/core/ViewTag.java
>>> Mon Jan 23 16:31:36 2006
>>>@@ -18,7 +18,14 @@
>>> import org.apache.myfaces.application.MyfacesStateManager;
>>> import org.apache.myfaces.application.jsp.JspViewHandlerImpl;
>>> import org.apache.myfaces.renderkit.html.HtmlLinkRendererBase;
>>>+import org.apache.myfaces.renderkit.html.HTML;
>>>+import org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl;
>>>+import 
>>>org.apache.myfaces.renderkit.html.util.HtmlBufferResponseWriterWrapper;
>>>+import org.apache.myfaces.renderkit.html.util.DummyFormUtils;
>>>+import org.apache.myfaces.renderkit.html.util.JavascriptUtils;
>>> import org.apache.myfaces.util.LocaleUtils;
>>>+import org.apache.myfaces.util.MyFacesJavascriptRendererUtil;
>>>+import org.apache.myfaces.config.MyfacesConfig;
>>>
>>> import org.apache.commons.logging.Log;
>>> import org.apache.commons.logging.LogFactory;
>>>@@ -112,6 +119,16 @@
>>>         catch (IOException e)
>>>         {
>>>             log.error("Error writing endDocument", e);
>>>+            throw new JspException(e);
>>>+        }
>>>+
>>>+        try {
>>>+            // this will generate the javascript code that myfaces needs 
>>>(dummyform...)
>>>+            // and put it in the request. The extensionsFilter will get the 
>>>value from
>>>+            // the request and render it in the "post-parse"
>>>+            
>>>MyFacesJavascriptRendererUtil.renderCodeBeforeBodyEnd(facesContext);
>>>+        } catch (IOException e) {
>>>+            log.error("Error preparing MyFacesJavascript", e);
>>>             throw new JspException(e);
>>>         }
>>>
>>>
>>>Added: 
>>>myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/MyFacesJavascriptRendererUtil.java
>>>URL: 
>>>http://svn.apache.org/viewcvs/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/MyFacesJavascriptRendererUtil.java?rev=371740&view=auto
>>>==============================================================================
>>>--- 
>>>myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/MyFacesJavascriptRendererUtil.java
>>> (added)
>>>+++ 
>>>myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/MyFacesJavascriptRendererUtil.java
>>> Mon Jan 23 16:31:36 2006
>>>@@ -0,0 +1,84 @@
>>>+/*
>>>+ * Copyright 2006 The Apache Software Foundation.
>>>+ *
>>>+ * Licensed under the Apache License, Version 2.0 (the "License");
>>>+ * you may not use this file except in compliance with the License.
>>>+ * You may obtain a copy of the License at
>>>+ *
>>>+ *      http://www.apache.org/licenses/LICENSE-2.0
>>>+ *
>>>+ * Unless required by applicable law or agreed to in writing, software
>>>+ * distributed under the License is distributed on an "AS IS" BASIS,
>>>+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
>>>+ * See the License for the specific language governing permissions and
>>>+ * limitations under the License.
>>>+ */
>>>+package org.apache.myfaces.util;
>>>+
>>>+import org.apache.myfaces.config.MyfacesConfig;
>>>+import org.apache.myfaces.renderkit.html.HTML;
>>>+import org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl;
>>>+import org.apache.myfaces.renderkit.html.util.DummyFormUtils;
>>>+import 
>>>org.apache.myfaces.renderkit.html.util.HtmlBufferResponseWriterWrapper;
>>>+import org.apache.myfaces.renderkit.html.util.JavascriptUtils;
>>>+
>>>+import javax.faces.context.FacesContext;
>>>+import javax.faces.context.ResponseWriter;
>>>+import java.io.IOException;
>>>+
>>>+
>>>+/**
>>>+ * @author Bruno Aranda (latest modification by $Author$)
>>>+ * @version $Revision$ $Date$
>>>+ */
>>>+public class MyFacesJavascriptRendererUtil
>>>+{
>>>+
>>>+    /**
>>>+     * Renders stuff such as the dummy form and the autoscroll javascript, 
>>>which goes before the closing &lt;/body&gt;
>>>+     * @throws IOException
>>>+     */
>>>+    public static void renderCodeBeforeBodyEnd(FacesContext facesContext) 
>>>throws IOException
>>>+    {
>>>+        Object myFacesJavascript = 
>>>facesContext.getExternalContext().getRequestMap().get("org.apache.myfaces.myFacesJavascript");
>>>+
>>>+        if (myFacesJavascript != null)
>>>+        {
>>>+            return;
>>>+        }
>>>+
>>>+        ResponseWriter responseWriter = facesContext.getResponseWriter();
>>>+        HtmlBufferResponseWriterWrapper writerWrapper = 
>>>HtmlBufferResponseWriterWrapper
>>>+                    .getInstance(responseWriter);
>>>+
>>>+        HtmlResponseWriterImpl responseWriterImpl = 
>>>(HtmlResponseWriterImpl) responseWriter;
>>>+
>>>+        if (responseWriterImpl.isWriteDummyForm())
>>>+        {
>>>+            DummyFormUtils.writeDummyForm(writerWrapper, 
>>>responseWriterImpl.getDummyFormParams());
>>>+        }
>>>+
>>>+        MyfacesConfig myfacesConfig = 
>>>MyfacesConfig.getCurrentInstance(facesContext.getExternalContext());
>>>+        if (myfacesConfig.isDetectJavascript())
>>>+        {
>>>+            if (! 
>>>JavascriptUtils.isJavascriptDetected(facesContext.getExternalContext()))
>>>+            {
>>>+
>>>+                writerWrapper.startElement(HTML.SCRIPT_ELEM,null);
>>>+                
>>>writerWrapper.writeAttribute(HTML.SCRIPT_TYPE_ATTR,HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT,null);
>>>+                StringBuffer script = new StringBuffer();
>>>+                script.append("document.location.replace('").
>>>+                        
>>>append(facesContext.getApplication().getViewHandler().getResourceURL(facesContext,
>>> 
>>>"/_javascriptDetector_")).append("?goto=").append(facesContext.getApplication().getViewHandler().getActionURL(facesContext,
>>> facesContext.getViewRoot().getViewId())).append("');");
>>>+                writerWrapper.writeText(script.toString(),null);
>>>+                writerWrapper.endElement(HTML.SCRIPT_ELEM);
>>>+            }
>>>+        }
>>>+
>>>+        if (myfacesConfig.isAutoScroll())
>>>+        {
>>>+            JavascriptUtils.renderAutoScrollFunction(facesContext, 
>>>writerWrapper);
>>>+        }
>>>+
>>>+        
>>>facesContext.getExternalContext().getRequestMap().put("org.apache.myfaces.myFacesJavascript",
>>> "<!-- MYFACES JAVASCRIPT -->\n"+writerWrapper.toString()+"\n");
>>>+    }
>>>+}
>>>
>>>Propchange: 
>>>myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/MyFacesJavascriptRendererUtil.java
>>>------------------------------------------------------------------------------
>>>    svn:eol-style = native
>>>
>>>Propchange: 
>>>myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/util/MyFacesJavascriptRendererUtil.java
>>>------------------------------------------------------------------------------
>>>    svn:keywords = Date Author Id Revision HeadURL
>>>
>>>
>>
>>--
>>Don't answer to From: address!
>>Mail to this account are droped if not recieved via mailinglist.
>>To contact me direct create the mail address by
>>concatenating my forename to my senders domain.
>>
> 
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Reply via email to