From: Juergen H. <jho...@us...> - 2006-04-21 00:14:04
|
Update of /cvsroot/springframework/spring/src/org/springframework/web/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19629/src/org/springframework/web/util Modified Files: Tag: mbranch-1-2 JavaScriptUtils.java NestedServletException.java WebUtils.java Log Message: backported fixes and enhancements from 2.0 M4 (HEAD) Index: WebUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/web/util/WebUtils.java,v retrieving revision 1.29.2.1 retrieving revision 1.29.2.2 diff -C2 -d -r1.29.2.1 -r1.29.2.2 *** WebUtils.java 17 Jan 2006 21:29:36 -0000 1.29.2.1 --- WebUtils.java 21 Apr 2006 00:13:51 -0000 1.29.2.2 *************** *** 51,59 **** /** * Standard Servlet spec context attribute that specifies a temporary ! * directory for the current web application, of type java.io.File */ public static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; /** * HTML escape parameter at the servlet context level * (i.e. a context-param in <code>web.xml</code>): "defaultHtmlEscape". --- 51,65 ---- /** * Standard Servlet spec context attribute that specifies a temporary ! * directory for the current web application, of type <code>java.io.File</code>. */ public static final String TEMP_DIR_CONTEXT_ATTRIBUTE = "javax.servlet.context.tempdir"; /** + * Standard Servlet spec request attribute that implies that we're within an include + * request. Any of the attributes associated with include paths does the job here. + */ + private static final String INCLUDE_REQUEST_ATTRIBUTE = "javax.servlet.include.request_uri"; + + /** * HTML escape parameter at the servlet context level * (i.e. a context-param in <code>web.xml</code>): "defaultHtmlEscape". *************** *** 70,79 **** public static final String DEFAULT_WEB_APP_ROOT_KEY = "webapp.root"; - /* Key for the mutex session attribute */ - public static final String SESSION_MUTEX_ATTRIBUTE = WebUtils.class.getName() + ".MUTEX"; - /** Name suffixes in case of image buttons */ public static final String[] SUBMIT_IMAGE_SUFFIXES = {".x", ".y"}; /** --- 76,85 ---- public static final String DEFAULT_WEB_APP_ROOT_KEY = "webapp.root"; /** Name suffixes in case of image buttons */ public static final String[] SUBMIT_IMAGE_SUFFIXES = {".x", ".y"}; + /* Key for the mutex session attribute */ + public static final String SESSION_MUTEX_ATTRIBUTE = WebUtils.class.getName() + ".MUTEX"; + /** *************** *** 346,349 **** --- 352,367 ---- /** + * Determine whether the given request is an include request, + * that is, not a top-level HTTP request coming in from the outside. + * <p>Checks the presence of the "javax.servlet.include.request_uri" + * request attribute. Could check any request attribute that is only + * present in an include request. + * @param request current servlet request + */ + public static boolean isIncludeRequest(ServletRequest request) { + return (request.getAttribute(INCLUDE_REQUEST_ATTRIBUTE) != null); + } + + /** * Check if a specific input type="submit" parameter was sent in the request, * either via a button (directly with name) or via an image (name + ".x" or Index: NestedServletException.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/web/util/NestedServletException.java,v retrieving revision 1.2 retrieving revision 1.2.4.1 diff -C2 -d -r1.2 -r1.2.4.1 *** NestedServletException.java 17 Sep 2005 17:05:34 -0000 1.2 --- NestedServletException.java 21 Apr 2006 00:13:51 -0000 1.2.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 59,62 **** --- 59,63 ---- } + /** * Return the nested cause, or <code>null</code> if none. *************** *** 75,85 **** */ public String getMessage() { ! if (getCause() == null) { ! return super.getMessage(); ! } ! else { ! return super.getMessage() + "; nested exception is " + getRootCause().getClass().getName() + ! ": " + getRootCause().getMessage(); } } --- 76,85 ---- */ public String getMessage() { ! String message = super.getMessage(); ! Throwable cause = getCause(); ! if (cause != null) { ! return message + "; nested exception is " + cause; } + return message; } *************** *** 94,97 **** --- 94,98 ---- else { ps.println(this); + ps.print("Caused by: "); getCause().printStackTrace(ps); } *************** *** 108,111 **** --- 109,113 ---- else { pw.println(this); + pw.print("Caused by: "); getCause().printStackTrace(pw); } Index: JavaScriptUtils.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/web/util/JavaScriptUtils.java,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** JavaScriptUtils.java 1 Aug 2005 09:52:27 -0000 1.3 --- JavaScriptUtils.java 21 Apr 2006 00:13:51 -0000 1.3.4.1 *************** *** 1,4 **** /* ! * Copyright 2002-2005 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 27,30 **** --- 27,31 ---- * * @author Juergen Hoeller + * @author Rob Harrop * @since 1.1.1 */ *************** *** 56,59 **** --- 57,63 ---- filtered.append("\\\\"); } + else if (c == '/') { + filtered.append("\\/"); + } else if (c == '\t') { filtered.append("\\t"); |