jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt RequestEncodingSupport.java
Date Tue, 02 Apr 2002 23:01:56 GMT
luehe       02/04/02 15:01:56

  Modified:    standard/src/org/apache/taglibs/standard/tag/common/fmt
                        RequestEncodingSupport.java
  Log:
  Search for javax.servlet.jsp.jstl.fmt.request.charset in session scope only
  
  Revision  Changes    Path
  1.5       +18 -13    jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/RequestEncodingSupport.java
  
  Index: RequestEncodingSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/RequestEncodingSupport.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RequestEncodingSupport.java	1 Apr 2002 20:24:06 -0000	1.4
  +++ RequestEncodingSupport.java	2 Apr 2002 23:01:56 -0000	1.5
  @@ -107,23 +107,28 @@
       // Tag logic
   
       public int doEndTag() throws JspException {
  -	if (value == null) {
  -	    // Use charset from request's Content-Type header
  -	    value = pageContext.getRequest().getCharacterEncoding();
  +	if ((value == null)
  +	        && (pageContext.getRequest().getCharacterEncoding() == null)) {
  +	    // Use charset from session-scoped attribute
  +	    value = (String)
  +		pageContext.getAttribute(REQUEST_CHAR_SET,
  +					 PageContext.SESSION_SCOPE);
   	    if (value == null) {
  -		// Use charset from scoped attribute
  -		value = (String) pageContext.findAttribute(REQUEST_CHAR_SET);
  -		if (value == null) {
  -		    // Use default encoding
  -		    value = DEFAULT_ENCODING;
  -		}
  +		// Use default encoding
  +		value = DEFAULT_ENCODING;
   	    }
   	}
   
  -	try {
  -	    pageContext.getRequest().setCharacterEncoding(value);
  -	} catch (UnsupportedEncodingException uee) {
  -	    throw new JspTagException(uee.getMessage());
  +	/*
  +	 * If char encoding was already set in the request, we don't need to 
  +	 * set it again.
  +	 */
  +	if (value != null) {
  +	    try {
  +		pageContext.getRequest().setCharacterEncoding(value);
  +	    } catch (UnsupportedEncodingException uee) {
  +		throw new JspTagException(uee.getMessage());
  +	    }
   	}
   
   	return EVAL_PAGE;
  
  
  

--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message