Header issues with IDM Applications on Tomcat

Header issues with IDM Applications on Tomcat

We experienced two issues with User Application v4.5 running on Tomcat.

The first issue has been mentioned quite a few times on the forums and @ncisrael provided a fix for. This is the issue of Compatibility Mode in Internet Explorer where the Header Portlet does not show.

IECompatibility_Broken.png

The second issue was related to JQuery calls and appeared to be caused by the load timing of the page and what the client had cached. The result was often an annoying popup TypeError: $(...).tabs is not a function.

TabsIsNotAFunction.png

Both of these issues required a single fix, which was to alter the Headers that Tomcat sent to the client.

The first step is to create a com/domain/service/CacheControlFilter.java file:

package com.domain.service;

import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;

public class CacheControlFilter implements Filter
{
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
	{
		HttpServletResponse resp = (HttpServletResponse) response;
		/*
		 * Force all filtered items to not cache with revalidation
		 */
		resp.setHeader("Expires", "Tue, 03 Jul 2001 06:00:00 GMT");
		resp.setDateHeader("Last-Modified", new Date().getTime());
		resp.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
		resp.setHeader("Pragma", "no-cache");
		/*
		 * Force IE Compatibility mode fix
		 */
		resp.setHeader("X-UA-Compatible", "IE=edge");
		/*
		 * Send the headers
		 */
		chain.doFilter(request, response);
	}
	public void destroy()
	{
	}
	public void init(FilterConfig arg0) throws ServletException
	{
	}
}
/*
< filter>
	< filter-name>SetCacheControl< /filter-name>
	< filter-class>com.domain.service.CacheControlFilter< /filter-class>
< /filter>
< filter-mapping>
	< filter-name>SetCacheControl< /filter-name>
	< url-pattern>/*< /url-pattern>
< /filter-mapping>
*/

Next, grab servlet-api.jar from the /opt/netiq/idm/apps/tomcat/lib/ directory as this will be required to build the java file.

We use bash scripts to simplify building of the java file to a class and bundling it into a jar using JDK 8.

#!/bin/sh

export JARPREFIX=lib-cachecontrol

export JAVALIBS=`pwd`/CLASSPATH

jars=( servlet-api.jar )
jars_count=${#jars[@]}
index=0
while [ "$index" -lt "$jars_count" ]
 do
	export CLASSPATH=${CLASSPATH}:${JAVALIBS}/${jars[index]}
	((index++))
done

rm -f ${JARPREFIX}.jar

find ${JARPREFIX}.src -type f -iname *.class -exec rm -f '{}' \;

echo "Manifest-Version: 1.0">MANIFEST.MF
echo "Created-By: 1.8.0 (Oracle)">>MANIFEST.MF
echo "Author: address@domain.com - `date` - ${JARPREFIX}">>MANIFEST.MF
echo "Implementation-Version: 2.00">>MANIFEST.MF

cd ${JARPREFIX}.src

javac com/domain/service/*.java

jar -cvfm ../${JARPREFIX}.jar ../MANIFEST.MF com/domain/service/*.class

cd ..

find ${JARPREFIX}.src -type f -iname *.class -exec rm -f '{}' \;

rm -f MANIFEST.MF

Copy the lib-cachecontrol.jar to the /opt/netiq/idm/apps/tomcat/lib/ directory and fix ownership (novlua) and file attributes (644).

Next, edit the /opt/netiq/idm/apps/tomcat/conf/web.xml file and add the following just above the session-config section.

< filter>
	< filter-name>SetCacheControl< /filter-name>
	< filter-class>com.domain.service.CacheControlFilter< /filter-class>
< /filter>
< filter-mapping>
	< filter-name>SetCacheControl< /filter-name>
	< url-pattern>/*< /url-pattern>
< /filter-mapping>

Restart idmapps_tomcat_init and validate.

Labels (1)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Comments
Hi ,

We have IE 11 with enterprise mode on and its a need. I followed you document as we also saw headers missing in UA 4.5 .
I followed the steps mentioned in the doc , however I see the headers now but all messes up. Is there any other points I need to look into while working on IE 11.

Thank you,
Goutami
Top Contributors
Version history
Revision #:
4 of 4
Last update:
‎2019-10-08 22:28
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.