myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "Trinidad_and_SpringWebFlow" by Markus Schmitt
Date Thu, 05 Nov 2009 08:41:08 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The "Trinidad_and_SpringWebFlow" page has been changed by Markus Schmitt.
http://wiki.apache.org/myfaces/Trinidad_and_SpringWebFlow

--------------------------------------------------

New page:
= Using Trinidad with Spring Web Flow =

== Coverage of Trinidad UI Component widgets using the example of tr:inputDate ==

When using Trinidad in Spring Web Flow based applications developers unfortunately run into
problems when using UI components like tr:inputDate.

=== Actual State ===

while loading the calendar popup of trinidad SpringWebFlow's controller generates a request
uri like this:

   '''<myapp>/someflow?execution=e2s2& _t=fred&_red=cd&value=1256825236538&loc=de-DE&enc=UTF-8'''

instead of

   '''<myapp>/faces/__ADFv__?_t=fred&_red=cd&value=1256825236538&loc=d e-DE&enc=UTF-8'''
 

=== Workaraound ===

So the solution is a '''servlet filter''' that intercepts requests like this and redirects
to the faces servlet.
Yes, indeed this isn't very nice but it works:

{{{
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
  if (request instanceof HttpServletRequest && response instanceof HttpServletResponse)
{
    HttpServletRequest httpRequest = (HttpServletRequest) request;
    String requestURI = httpRequest.getRequestURI();
    String queryString = httpRequest.getQueryString();
    int idx = 0;
    if ( (idx = StringUtils.indexOf(queryString, this.searchString)) >= 0 &&
        requestURI.contains(this.facesServletMapping) == false ) {
      String forwardUri = httpRequest.getContextPath();
      forwardUri = forwardUri + this.facesServletMapping + "/__ADFv__?" + queryString.substring(idx+1);
      ((HttpServletResponse) response).sendRedirect(forwardUri);
    } else {
      chain.doFilter(request, response);
    }
  } else {
      chain.doFilter(request, response);
  }
}

public void init(FilterConfig config) throws ServletException {
  this.facesServletMapping = StringUtils.defaultIfEmpty(config.getInitParameter("facesServletMapping"),
"/faces");
  this.searchString = StringUtils.defaultIfEmpty(config.getInitParameter("searchString"),
"&_t=fred&_red");
}

}}}

As an '''alternative''' one could replace the single '''searchString''' filter param with
a comma separated list of search strings.

Mime
View raw message