You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/07/29 13:24:27 UTC

svn commit: r1693240 - in /myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main: java/org/apache/myfaces/tobago/example/demo/XUaCompatibleIe11Filter.java webapp/WEB-INF/web.xml webapp/style/style.css

Author: lofwyr
Date: Wed Jul 29 11:24:27 2015
New Revision: 1693240

URL: http://svn.apache.org/r1693240
Log:
TOBAGO-1478: Accesskeys doesn't work with Tobago 1.0 and IE11

Added:
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/XUaCompatibleIe11Filter.java
Modified:
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/WEB-INF/web.xml
    myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/style/style.css

Added: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/XUaCompatibleIe11Filter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/XUaCompatibleIe11Filter.java?rev=1693240&view=auto
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/XUaCompatibleIe11Filter.java (added)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/XUaCompatibleIe11Filter.java Wed Jul 29 11:24:27 2015
@@ -0,0 +1,50 @@
+package org.apache.myfaces.tobago.example.demo;
+
+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;
+
+/**
+ * This is a workaround for IE11 with Tobago 1.0.x
+ * You need also a CSS in a style.css file:
+ * * {
+ * box-sizing: border-box;
+ * }
+ */
+public class XUaCompatibleIe11Filter implements Filter {
+
+  public void init(FilterConfig filterConfig) throws ServletException {
+  }
+
+  public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
+      throws IOException, ServletException {
+    final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
+    final String userAgent = httpServletRequest.getHeader("User-Agent");
+    if (userAgent != null && userAgent.contains("Trident") && userAgent.contains("rv:11")) { // is IE 11
+      final HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;
+      httpServletResponse.setHeader("X-UA-Compatible", "IE=9");
+      // known problems
+      //                 box of input    menu arrow key     access-key
+      // EmulateIE11     +               -                  -
+      // EmulateIE10     +               -                  +
+      // 10              +               -                  +
+      // EmulateIE9      -               +                  +
+      // 9               +               -                  +
+      // EmulateIE8      -               +                  +
+      // 8               -               +                  +
+      // EmulateIE7      -               +                  +
+      // 7               -               +                  +
+      // 5               -               +                  +
+    }
+    filterChain.doFilter(servletRequest, servletResponse);
+  }
+
+  public void destroy() {
+  }
+}
\ No newline at end of file

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/WEB-INF/web.xml?rev=1693240&r1=1693239&r2=1693240&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/WEB-INF/web.xml (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/WEB-INF/web.xml Wed Jul 29 11:24:27 2015
@@ -59,6 +59,15 @@
     </servlet>
   -->
 
+  <filter>
+    <filter-name>XUaCompatibleIe11Filter</filter-name>
+    <filter-class>org.apache.myfaces.tobago.example.demo.XUaCompatibleIe11Filter</filter-class>
+  </filter>
+  <filter-mapping>
+    <filter-name>XUaCompatibleIe11Filter</filter-name>
+    <url-pattern>/faces/*</url-pattern>
+  </filter-mapping>
+
   <servlet>
     <servlet-name>FacesServlet</servlet-name>
     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

Modified: myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/style/style.css?rev=1693240&r1=1693239&r2=1693240&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/style/style.css (original)
+++ myfaces/tobago/branches/tobago-1.0.x/example/demo/src/main/webapp/style/style.css Wed Jul 29 11:24:27 2015
@@ -24,3 +24,8 @@
 .tobago-column-markup-moon {
   background-color: #6495ed;
 }
+
+/* needed for IE11 */
+* {
+  box-sizing: border-box;
+}