In this post I will show how you can run ADF application developed by JDeveloper 11g in Internet Explorer 11 (IE11).
- In ADF application create new java class (e.g IECompatibilityFilter.java)
- In web.xml add this
- Run the application using IE11.
- In ADF application create new java class (e.g IECompatibilityFilter.java)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
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.HttpServletRequestWrapper; | |
public class IECompatibilityFilter implements Filter | |
{ | |
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException | |
{ | |
String userAgentStr = ((HttpServletRequest) request).getHeader("user-agent"); | |
if (userAgentStr != null && (userAgentStr.contains("MSIE 1") || userAgentStr.contains("Trident"))) | |
{ | |
ServletRequest wrappedRequest = new WrapperRequest((HttpServletRequest) request); | |
chain.doFilter(wrappedRequest, response); | |
} | |
else | |
{ | |
chain.doFilter(request, response); | |
} | |
} | |
public void destroy() | |
{ | |
} | |
public void init(FilterConfig arg0) | |
throws ServletException | |
{ | |
} | |
private class WrapperRequest extends HttpServletRequestWrapper | |
{ | |
public WrapperRequest(HttpServletRequest request) | |
{ | |
super(request); | |
} | |
public String getHeader(String name) | |
{ | |
HttpServletRequest request = (HttpServletRequest) getRequest(); | |
if ("user-agent".equalsIgnoreCase(name) && request.getHeader("user-agent").contains("MSIE 10")) | |
{ | |
return request.getHeader("user-agent").replaceAll("MSIE [^;]*;", "MSIE 9.0;"); | |
} | |
if ("user-agent".equalsIgnoreCase(name) && request.getHeader("user-agent").contains("Trident")) | |
{ | |
String newAgentStr = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.2; Trident/6.0)"; | |
return newAgentStr; | |
} | |
return request.getHeader(name); | |
} | |
} | |
} |
- In web.xml add this
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<filter> | |
<filter-name>IECompatibilityFilter</filter-name> | |
<filter-class>packageName.IECompatibilityFilter</filter-class> | |
</filter> | |
<filter-mapping> | |
<filter-name>IECompatibilityFilter</filter-name> | |
<servlet-name>Faces Servlet</servlet-name> | |
</filter-mapping> | |
<filter-mapping> | |
<filter-name>IECompatibilityFilter</filter-name> | |
<url-pattern>*.jsp</url-pattern> | |
<dispatcher>FORWARD</dispatcher> | |
<dispatcher>REQUEST</dispatcher> | |
<dispatcher>INCLUDE</dispatcher> | |
</filter-mapping> | |
<filter-mapping> | |
<filter-name>IECompatibilityFilter</filter-name> | |
<url-pattern>*.jspx</url-pattern> | |
<dispatcher>FORWARD</dispatcher> | |
<dispatcher>REQUEST</dispatcher> | |
<dispatcher>INCLUDE</dispatcher> | |
</filter-mapping> | |
<filter-mapping> | |
<filter-name>IECompatibilityFilter</filter-name> | |
<url-pattern>*.jsf</url-pattern> | |
<dispatcher>FORWARD</dispatcher> | |
<dispatcher>REQUEST</dispatcher> | |
<dispatcher>INCLUDE</dispatcher> | |
</filter-mapping> |
- Run the application using IE11.
No comments:
Post a Comment