06-09-2011 09:51 AM
06-14-2011 03:53 AM
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class LocaleLoggerInterceptor extends HandlerInterceptorAdapter
{
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
{
LogFactory.getLog(LocaleLoggerInterceptor.class).error("Default locale = " + Locale.getDefault());
return true;
}
}
The easiest way to do that is to copy that code into a file named "LocaleLoggerInterceptor.java" in the folder "webapps\wcmqs\WEB-INF\classes" in your server's Tomcat installation. Then open a command prompt in that folder and run this command:
javac -classpath .;..\..\..\..\lib\servlet-api.jar;..\lib\org.springframework.webmvc-3.0.0.jar;..\lib\commons-logging-1.1.1.jar LocaleLoggerInterceptor.java
Hopefully this will compile without error or warning and you'll end up with a file named "LocaleLoggerInterceptor.class" in the same folder. The next step is to find a file named "surf-config.xml". This will be in exactly the same folder as you're currently in (<tomcat home>\webapps\wcmqs\WEB-INF\classes). Open this file in a text editor, and find this section:
<!– Override list of interceptors defined in webframeworkHandlerMappings so that we can add our own. –>
<property name="interceptors">
<list>
<ref bean="requestContextInterceptor"/>
<!–
<ref bean="themeInterceptor"/>
<ref bean="previewContextInterceptor"/>
–>
<!– Interceptors added to apply application-wide processing to requests. See also quickstart-request.xml –>
<ref bean="cmisSessionInterceptor"/>
<ref bean="applicationDataInterceptor"/>
</list>
</property>
Add one line near the top of this section so it becomes:
<!– Override list of interceptors defined in webframeworkHandlerMappings so that we can add our own. –>
<property name="interceptors">
<list>
<bean class="LocaleLoggerInterceptor" />
<ref bean="requestContextInterceptor"/>
<!–
<ref bean="themeInterceptor"/>
<ref bean="previewContextInterceptor"/>
–>
<!– Interceptors added to apply application-wide processing to requests. See also quickstart-request.xml –>
<ref bean="cmisSessionInterceptor"/>
<ref bean="applicationDataInterceptor"/>
</list>
</property>
Save the file and restart Tomcat. When you request a page from your site now you should see a line like this in your log file:08:33:29,898 ERROR [LocaleLoggerInterceptor] Default locale = en_GBIf you get to that point then let me know what the line in your log file looks like.
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.