You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Sean Schofield <se...@gmail.com> on 2006/03/05 17:36:24 UTC

Re: svn commit: r382918 - in /myfaces: core/trunk/impl/src/main/java/org/apache/myfaces/webapp/filter/JavaScriptDetectorFilter.java shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java

Did you rebuild shared on the trunk?  I will attempt to do a build
later tonight when I get home.

Sean

On 3/4/06, Dennis Byrne <de...@dbyrne.net> wrote:
> I checked out
>
> https://svn.apache.org/repos/asf/myfaces/core/branches/1_1_2
>
> and get the following when running 'mvn install' in the base dir.
>
> [ERROR] BUILD FAILURE
> [INFO] ----------------------------------------------------------------------------
> [INFO] Compilation failure
>
> D:\co\myFaces_release\impl\src\main\java\org\apache\myfaces\webapp\filter\JavaScriptDetectorFilter.java:[58,23] set
> JavascriptDetected(javax.servlet.http.HttpSession,boolean) in org.apache.myfaces.shared_impl.renderkit.html.util.Ja
> vascriptUtils cannot be applied to (javax.faces.context.ExternalContext,boolean)
>
> Dennis Byrne
>
> >-----Original Message-----
> >From: imario@apache.org [mailto:imario@apache.org]
> >Sent: Friday, March 3, 2006 02:53 PM
> >To: commits@myfaces.apache.org
> >Subject: svn commit: r382918 - in /myfaces: core/trunk/impl/src/main/java/org/apache/myfaces/webapp/filter/JavaScriptDetectorFilter.java shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java
> >
> >Author: imario
> >Date: Fri Mar  3 11:53:12 2006
> >New Revision: 382918
> >
> >URL: http://svn.apache.org/viewcvs?rev=382918&view=rev
> >Log:
> >get rid of dependency on ServletExternalContextImpl
> >
> >Modified:
> >    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/filter/JavaScriptDetectorFilter.java
> >    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java
> >
> >Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/filter/JavaScriptDetectorFilter.java
> >URL: http://svn.apache.org/viewcvs/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/filter/JavaScriptDetectorFilter.java?rev=382918&r1=382917&r2=382918&view=diff
> >==============================================================================
> >--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/filter/JavaScriptDetectorFilter.java (original)
> >+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/filter/JavaScriptDetectorFilter.java Fri Mar  3 11:53:12 2006
> >@@ -15,17 +15,20 @@
> >  */
> > package org.apache.myfaces.webapp.filter;
> >
> >-import org.apache.myfaces.context.servlet.ServletExternalContextImpl;
> >-import org.apache.myfaces.shared_impl.renderkit.html.util.JavascriptUtils;
> >-
> >-import org.apache.commons.logging.Log;
> >-import org.apache.commons.logging.LogFactory;
> >+import java.io.IOException;
> >
> >-import javax.faces.context.ExternalContext;
> >-import javax.servlet.*;
> >+import javax.servlet.Filter;
> >+import javax.servlet.FilterChain;
> >+import javax.servlet.FilterConfig;
> >+import javax.servlet.ServletException;
> >+import javax.servlet.ServletRequest;
> >+import javax.servlet.ServletResponse;
> > import javax.servlet.http.HttpServletRequest;
> > import javax.servlet.http.HttpServletResponse;
> >-import java.io.IOException;
> >+
> >+import org.apache.commons.logging.Log;
> >+import org.apache.commons.logging.LogFactory;
> >+import org.apache.myfaces.shared_impl.renderkit.html.util.JavascriptUtils;
> >
> >
> > /**
> >@@ -39,31 +42,22 @@
> > {
> >     private static final Log log = LogFactory.getLog(JavaScriptDetectorFilter.class);
> >
> >-    private ServletContext _servletContext;
> >-
> >     public void init(FilterConfig filterConfig) throws ServletException
> >     {
> >-        _servletContext = filterConfig.getServletContext();
> >     }
> >
> >-
> >     public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException
> >     {
> >         HttpServletRequest request = (HttpServletRequest) servletRequest;
> >         HttpServletResponse response = (HttpServletResponse) servletResponse;
> >
> >-        ExternalContext externalContext = new ServletExternalContextImpl(_servletContext,
> >-                                                                         servletRequest,
> >-                                                                         servletResponse);
> >-        JavascriptUtils.setJavascriptDetected(externalContext, true); // mark the session to use javascript
> >+        JavascriptUtils.setJavascriptDetected(request.getSession(true), true); // mark the session to use javascript
> >
> >         log.info("Enabled JavaScript for session - redirect to" + request.getParameter("goto"));
> >         response.sendRedirect(request.getParameter("goto"));
> >     }
> >
> >-
> >     public void destroy()
> >     {
> >-
> >     }
> >-}
> >+}
> >\ No newline at end of file
> >
> >Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java
> >URL: http://svn.apache.org/viewcvs/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java?rev=382918&r1=382917&r2=382918&view=diff
> >==============================================================================
> >--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java (original)
> >+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java Fri Mar  3 11:53:12 2006
> >@@ -25,6 +25,8 @@
> > import javax.faces.context.ExternalContext;
> > import javax.faces.context.FacesContext;
> > import javax.faces.context.ResponseWriter;
> >+import javax.servlet.http.HttpSession;
> >+
> > import java.io.IOException;
> > import java.io.UnsupportedEncodingException;
> > import java.util.Arrays;
> >@@ -251,12 +253,11 @@
> >         }
> >     }
> >
> >-
> >-    public static void setJavascriptDetected(ExternalContext externalContext, boolean value)
> >+    public static void setJavascriptDetected(HttpSession session, boolean value)
> >     {
> >-        externalContext.getSessionMap().put(JAVASCRIPT_DETECTED, Boolean.valueOf(value));
> >+      session.setAttribute(JAVASCRIPT_DETECTED, Boolean.valueOf(value));
> >     }
> >-
> >+
> >     public static boolean isJavascriptDetected(ExternalContext externalContext)
> >     {
> >         //TODO/FIXME (manolito): This info should be better stored in the viewroot component and not in the session
> >
> >
> >
>
>
>