Dear all,
I have some of my Tomahawk component encounter problems to be displayed.
More specificaly, components such as
- t:inputFileUpload,
- t:swapImage
- t:popup
- t:inputDate
generate the following javascript error :
Error: xxx_3AtoolsPopupPopup is undefined
Error: SI_MM_swapImage is not defined
Error: SI_MM_swapImgRestore is not defined
Error: orgApacheMyfacesPopup is not defined
and so on....
Everything worked well until I added a new filter to my application :
My web.xml :
<filter>
<filter-name>localLanguageFilter</filter-name>
<filter-class>ec.ep.eo.eoweb.filter.LocalLanguageFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>localLanguageFilter</filter-name>
<url-pattern>*.faces</url-pattern>
</filter-mapping>
This filter, parse the url and try to localize the language code at the
begining of it. Then it set the application local languge to this lanaguage and
finaly redirect to the appropriate âge.
Here is the code :
public void doFilter(ServletRequest servletRequest, ServletResponse
servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
boolean redirect = false;
String currentURL = formatURL(request.getServletPath());
String originalUri = request.getRequestURI();
String uri = originalUri;
String contextPath = request.getContextPath();
if (uri.startsWith(contextPath)) {
uri = uri.substring(contextPath.length());
}
String[] parts = uri.split(Constants.PATTERN_SLASH);
if (parts.length>0 && parts[1].length()==2) {
String languageCode=parts[1];
uri = uri.substring(3);
ILanguage language = getServices().findLanguageByBusinessKey(languageCode);
if (language==null) {
language=Constants.ENGLISH;
}
request.getSession().setAttribute(Constants.SYSTEM_LANGUAGE, language);
}
RequestDispatcher requestDispatcher = request.getRequestDispatcher(uri);
requestDispatcher.forward(request, response);
}
As i specified, if I remove the filter, everything goes well. But as soon as
the filter is active, the tomahawk components are altered :-(
Do someone have an idea ?
Thank in advance,
Marc
Médiateur européen
Marc Kamran Amir-Tahmasseb
Unité Communication - Développeur web
T. +33 (0)3 88 17 44 10
[email protected]
<mailto:[email protected]>
1 avenue du Président Robert Schuman
CS 30403
F - 67001 Strasbourg Cedex
T. + 33 (0)3 88 17 23 13
F. + 33 (0)3 88 17 90 62
www.ombudsman.europa.eu <http://www.ombudsman.europa.eu/>