dev@jsftemplating.java.net

review request

From: Senthil Chidambaram <cchidamb_at_sun.com>
Date: Mon, 12 Feb 2007 11:44:00 -0800

I'm attaching the diffs to take of UTF-8 enc. type in
LayoutViewHandler.java, could you please review it, and let me know. I
can checkin the fix.

I would also like to know whether I've to checkin the fix into the
branch, or tip is fine. What is our plan about branching jsftemplating
is it like every time glassfish is branched, we plan to do the same here
to sync. up with glassfish releases.

thx
Senthil


Index: LayoutViewHandler.java
===================================================================
RCS file: /cvs/jsftemplating/src/java/com/sun/jsftemplating/layout/LayoutViewHandler.java,v
retrieving revision 1.15
diff -c -r1.15 LayoutViewHandler.java
*** LayoutViewHandler.java 11 Dec 2006 18:26:51 -0000 1.15
--- LayoutViewHandler.java 12 Feb 2007 19:38:47 -0000
***************
*** 452,457 ****
--- 452,458 ----
          ExternalContext extCtx = context.getExternalContext();
  // FIXME: Portlet?
          ServletResponse response = (ServletResponse) extCtx.getResponse();
+ ServletRequest request = (ServletRequest) extCtx.getRequest();
  
          RenderKitFactory renderFactory = (RenderKitFactory)
              FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
***************
*** 464,491 ****
  // FIXME: Provide a way for the user to specify this...
  // FIXME: Test multiple browsers against this code!!
          String userContentType = "text/html";
! boolean responseCTSet = false;
! if ((userContentType != null) && (userContentType.length() > 0)) {
! // User picked this, use it...
! response.setContentType(userContentType);
! responseCTSet = true;
! } else {
! // No explicit Content-type, find best match...
! contentTypeList = (String) extCtx.getRequestHeaderMap().get("Accept");
! if (contentTypeList == null) {
! contentTypeList = "text/html;q=1.0";
! // Ryan Lubke thinks I don't need this... taking out to see if it's true
! // } else if (!contentTypeList.toLowerCase().contains("text/html")) {
! // contentTypeList += ",text/html;q=1.0";
! }
          }
  
  // FIXME: Portlet?
          writer =
              renderKit.createResponseWriter(
                  new OutputStreamWriter(response.getOutputStream()),
! contentTypeList,
! ((ServletRequest) extCtx.getRequest()).getCharacterEncoding());
          context.setResponseWriter(writer);
  // Not setting the contentType here results in XHTML which formats differently
  // than text/html in Mozilla.. even though the documentation claims this
--- 465,484 ----
  // FIXME: Provide a way for the user to specify this...
  // FIXME: Test multiple browsers against this code!!
          String userContentType = "text/html";
! response.setContentType(userContentType);
! String encType = request.getCharacterEncoding();
! if(encType != null && encType.length() > 0) {
! response.setCharacterEncoding(encType);
! }
! else {
! response.setCharacterEncoding("UTF-8");
          }
  
  // FIXME: Portlet?
          writer =
              renderKit.createResponseWriter(
                  new OutputStreamWriter(response.getOutputStream()),
! contentTypeList, request.getCharacterEncoding());
          context.setResponseWriter(writer);
  // Not setting the contentType here results in XHTML which formats differently
  // than text/html in Mozilla.. even though the documentation claims this