You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/07/24 15:03:12 UTC
svn commit: r978865 [3/4] - in /tomcat/trunk: ./ java/org/apache/jasper/
java/org/apache/jasper/compiler/ java/org/apache/jasper/el/
java/org/apache/jasper/runtime/ java/org/apache/jasper/servlet/
java/org/apache/jasper/tagplugins/jstl/ java/org/apache...
Modified: tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java Sat Jul 24 13:03:11 2010
@@ -70,919 +70,919 @@ import org.apache.jasper.util.Enumerator
*/
public class PageContextImpl extends PageContext {
- private static final JspFactory jspf = JspFactory.getDefaultFactory();
+ private static final JspFactory jspf = JspFactory.getDefaultFactory();
- private BodyContentImpl[] outs;
+ private BodyContentImpl[] outs;
- private int depth;
+ private int depth;
- // per-servlet state
- private Servlet servlet;
+ // per-servlet state
+ private Servlet servlet;
- private ServletConfig config;
+ private ServletConfig config;
- private ServletContext context;
+ private ServletContext context;
- private JspApplicationContextImpl applicationContext;
+ private JspApplicationContextImpl applicationContext;
- private String errorPageURL;
+ private String errorPageURL;
- // page-scope attributes
- private transient HashMap<String, Object> attributes;
+ // page-scope attributes
+ private transient HashMap<String, Object> attributes;
- // per-request state
- private transient ServletRequest request;
+ // per-request state
+ private transient ServletRequest request;
- private transient ServletResponse response;
+ private transient ServletResponse response;
- private transient HttpSession session;
-
- private transient ELContextImpl elContext;
+ private transient HttpSession session;
+
+ private transient ELContextImpl elContext;
- private boolean isIncluded;
-
-
- // initial output stream
- private transient JspWriter out;
+ private boolean isIncluded;
+
+
+ // initial output stream
+ private transient JspWriter out;
- private transient JspWriterImpl baseOut;
+ private transient JspWriterImpl baseOut;
- /*
- * Constructor.
- */
- PageContextImpl() {
- this.outs = new BodyContentImpl[0];
- this.attributes = new HashMap<String, Object>(16);
- this.depth = -1;
- }
+ /*
+ * Constructor.
+ */
+ PageContextImpl() {
+ this.outs = new BodyContentImpl[0];
+ this.attributes = new HashMap<String, Object>(16);
+ this.depth = -1;
+ }
- @Override
+ @Override
public void initialize(Servlet servlet, ServletRequest request,
- ServletResponse response, String errorPageURL,
- boolean needsSession, int bufferSize, boolean autoFlush)
- throws IOException {
-
- _initialize(servlet, request, response, errorPageURL, needsSession,
- bufferSize, autoFlush);
- }
-
- private void _initialize(Servlet servlet, ServletRequest request,
- ServletResponse response, String errorPageURL,
- boolean needsSession, int bufferSize, boolean autoFlush) {
-
- // initialize state
- this.servlet = servlet;
- this.config = servlet.getServletConfig();
- this.context = config.getServletContext();
- this.errorPageURL = errorPageURL;
- this.request = request;
- this.response = response;
-
- // initialize application context
- this.applicationContext = JspApplicationContextImpl.getInstance(context);
-
- // Setup session (if required)
- if (request instanceof HttpServletRequest && needsSession)
- this.session = ((HttpServletRequest) request).getSession();
- if (needsSession && session == null)
- throw new IllegalStateException(
- "Page needs a session and none is available");
-
- // initialize the initial out ...
- depth = -1;
- if (this.baseOut == null) {
- this.baseOut = new JspWriterImpl(response, bufferSize, autoFlush);
- } else {
- this.baseOut.init(response, bufferSize, autoFlush);
- }
- this.out = baseOut;
-
- // register names/values as per spec
- setAttribute(OUT, this.out);
- setAttribute(REQUEST, request);
- setAttribute(RESPONSE, response);
-
- if (session != null)
- setAttribute(SESSION, session);
-
- setAttribute(PAGE, servlet);
- setAttribute(CONFIG, config);
- setAttribute(PAGECONTEXT, this);
- setAttribute(APPLICATION, context);
+ ServletResponse response, String errorPageURL,
+ boolean needsSession, int bufferSize, boolean autoFlush)
+ throws IOException {
+
+ _initialize(servlet, request, response, errorPageURL, needsSession,
+ bufferSize, autoFlush);
+ }
+
+ private void _initialize(Servlet servlet, ServletRequest request,
+ ServletResponse response, String errorPageURL,
+ boolean needsSession, int bufferSize, boolean autoFlush) {
+
+ // initialize state
+ this.servlet = servlet;
+ this.config = servlet.getServletConfig();
+ this.context = config.getServletContext();
+ this.errorPageURL = errorPageURL;
+ this.request = request;
+ this.response = response;
+
+ // initialize application context
+ this.applicationContext = JspApplicationContextImpl.getInstance(context);
+
+ // Setup session (if required)
+ if (request instanceof HttpServletRequest && needsSession)
+ this.session = ((HttpServletRequest) request).getSession();
+ if (needsSession && session == null)
+ throw new IllegalStateException(
+ "Page needs a session and none is available");
+
+ // initialize the initial out ...
+ depth = -1;
+ if (this.baseOut == null) {
+ this.baseOut = new JspWriterImpl(response, bufferSize, autoFlush);
+ } else {
+ this.baseOut.init(response, bufferSize, autoFlush);
+ }
+ this.out = baseOut;
+
+ // register names/values as per spec
+ setAttribute(OUT, this.out);
+ setAttribute(REQUEST, request);
+ setAttribute(RESPONSE, response);
+
+ if (session != null)
+ setAttribute(SESSION, session);
- isIncluded = request.getAttribute("javax.servlet.include.servlet_path") != null;
- }
+ setAttribute(PAGE, servlet);
+ setAttribute(CONFIG, config);
+ setAttribute(PAGECONTEXT, this);
+ setAttribute(APPLICATION, context);
- @Override
+ isIncluded = request.getAttribute("javax.servlet.include.servlet_path") != null;
+ }
+
+ @Override
public void release() {
- out = baseOut;
- try {
- if (isIncluded) {
- ((JspWriterImpl) out).flushBuffer();
- // push it into the including jspWriter
- } else {
- // Old code:
- // out.flush();
- // Do not flush the buffer even if we're not included (i.e.
- // we are the main page. The servlet will flush it and close
- // the stream.
- ((JspWriterImpl) out).flushBuffer();
- }
- } catch (IOException ex) {
+ out = baseOut;
+ try {
+ if (isIncluded) {
+ ((JspWriterImpl) out).flushBuffer();
+ // push it into the including jspWriter
+ } else {
+ // Old code:
+ // out.flush();
+ // Do not flush the buffer even if we're not included (i.e.
+ // we are the main page. The servlet will flush it and close
+ // the stream.
+ ((JspWriterImpl) out).flushBuffer();
+ }
+ } catch (IOException ex) {
IllegalStateException ise = new IllegalStateException(Localizer.getMessage("jsp.error.flush"), ex);
throw ise;
- } finally {
- servlet = null;
- config = null;
- context = null;
- applicationContext = null;
- elContext = null;
- errorPageURL = null;
- request = null;
- response = null;
- depth = -1;
- baseOut.recycle();
- session = null;
- attributes.clear();
+ } finally {
+ servlet = null;
+ config = null;
+ context = null;
+ applicationContext = null;
+ elContext = null;
+ errorPageURL = null;
+ request = null;
+ response = null;
+ depth = -1;
+ baseOut.recycle();
+ session = null;
+ attributes.clear();
}
- }
+ }
- @Override
+ @Override
public Object getAttribute(final String name) {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
-
- if (SecurityUtil.isPackageProtectionEnabled()) {
- return AccessController.doPrivileged(
- new PrivilegedAction<Object>() {
- public Object run() {
- return doGetAttribute(name);
- }
- });
- } else {
- return doGetAttribute(name);
- }
-
- }
-
- private Object doGetAttribute(String name) {
- return attributes.get(name);
- }
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
- @Override
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ public Object run() {
+ return doGetAttribute(name);
+ }
+ });
+ } else {
+ return doGetAttribute(name);
+ }
+
+ }
+
+ private Object doGetAttribute(String name) {
+ return attributes.get(name);
+ }
+
+ @Override
public Object getAttribute(final String name, final int scope) {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
-
- if (SecurityUtil.isPackageProtectionEnabled()) {
- return AccessController.doPrivileged(
- new PrivilegedAction<Object>() {
- public Object run() {
- return doGetAttribute(name, scope);
- }
- });
- } else {
- return doGetAttribute(name, scope);
- }
-
- }
-
- private Object doGetAttribute(String name, int scope) {
- switch (scope) {
- case PAGE_SCOPE:
- return attributes.get(name);
-
- case REQUEST_SCOPE:
- return request.getAttribute(name);
-
- case SESSION_SCOPE:
- if (session == null) {
- throw new IllegalStateException(Localizer
- .getMessage("jsp.error.page.noSession"));
- }
- return session.getAttribute(name);
-
- case APPLICATION_SCOPE:
- return context.getAttribute(name);
-
- default:
- throw new IllegalArgumentException("Invalid scope");
- }
- }
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
- @Override
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ public Object run() {
+ return doGetAttribute(name, scope);
+ }
+ });
+ } else {
+ return doGetAttribute(name, scope);
+ }
+
+ }
+
+ private Object doGetAttribute(String name, int scope) {
+ switch (scope) {
+ case PAGE_SCOPE:
+ return attributes.get(name);
+
+ case REQUEST_SCOPE:
+ return request.getAttribute(name);
+
+ case SESSION_SCOPE:
+ if (session == null) {
+ throw new IllegalStateException(Localizer
+ .getMessage("jsp.error.page.noSession"));
+ }
+ return session.getAttribute(name);
+
+ case APPLICATION_SCOPE:
+ return context.getAttribute(name);
+
+ default:
+ throw new IllegalArgumentException("Invalid scope");
+ }
+ }
+
+ @Override
public void setAttribute(final String name, final Object attribute) {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
-
- if (SecurityUtil.isPackageProtectionEnabled()) {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- doSetAttribute(name, attribute);
- return null;
- }
- });
- } else {
- doSetAttribute(name, attribute);
- }
- }
-
- private void doSetAttribute(String name, Object attribute) {
- if (attribute != null) {
- attributes.put(name, attribute);
- } else {
- removeAttribute(name, PAGE_SCOPE);
- }
- }
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
+
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
+ doSetAttribute(name, attribute);
+ return null;
+ }
+ });
+ } else {
+ doSetAttribute(name, attribute);
+ }
+ }
+
+ private void doSetAttribute(String name, Object attribute) {
+ if (attribute != null) {
+ attributes.put(name, attribute);
+ } else {
+ removeAttribute(name, PAGE_SCOPE);
+ }
+ }
- @Override
+ @Override
public void setAttribute(final String name, final Object o, final int scope) {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
-
- if (SecurityUtil.isPackageProtectionEnabled()) {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- doSetAttribute(name, o, scope);
- return null;
- }
- });
- } else {
- doSetAttribute(name, o, scope);
- }
-
- }
-
- private void doSetAttribute(String name, Object o, int scope) {
- if (o != null) {
- switch (scope) {
- case PAGE_SCOPE:
- attributes.put(name, o);
- break;
-
- case REQUEST_SCOPE:
- request.setAttribute(name, o);
- break;
-
- case SESSION_SCOPE:
- if (session == null) {
- throw new IllegalStateException(Localizer
- .getMessage("jsp.error.page.noSession"));
- }
- session.setAttribute(name, o);
- break;
-
- case APPLICATION_SCOPE:
- context.setAttribute(name, o);
- break;
-
- default:
- throw new IllegalArgumentException("Invalid scope");
- }
- } else {
- removeAttribute(name, scope);
- }
- }
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
+
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
+ doSetAttribute(name, o, scope);
+ return null;
+ }
+ });
+ } else {
+ doSetAttribute(name, o, scope);
+ }
+
+ }
- @Override
+ private void doSetAttribute(String name, Object o, int scope) {
+ if (o != null) {
+ switch (scope) {
+ case PAGE_SCOPE:
+ attributes.put(name, o);
+ break;
+
+ case REQUEST_SCOPE:
+ request.setAttribute(name, o);
+ break;
+
+ case SESSION_SCOPE:
+ if (session == null) {
+ throw new IllegalStateException(Localizer
+ .getMessage("jsp.error.page.noSession"));
+ }
+ session.setAttribute(name, o);
+ break;
+
+ case APPLICATION_SCOPE:
+ context.setAttribute(name, o);
+ break;
+
+ default:
+ throw new IllegalArgumentException("Invalid scope");
+ }
+ } else {
+ removeAttribute(name, scope);
+ }
+ }
+
+ @Override
public void removeAttribute(final String name, final int scope) {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
- if (SecurityUtil.isPackageProtectionEnabled()) {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- doRemoveAttribute(name, scope);
- return null;
- }
- });
- } else {
- doRemoveAttribute(name, scope);
- }
- }
-
- private void doRemoveAttribute(String name, int scope) {
- switch (scope) {
- case PAGE_SCOPE:
- attributes.remove(name);
- break;
-
- case REQUEST_SCOPE:
- request.removeAttribute(name);
- break;
-
- case SESSION_SCOPE:
- if (session == null) {
- throw new IllegalStateException(Localizer
- .getMessage("jsp.error.page.noSession"));
- }
- session.removeAttribute(name);
- break;
-
- case APPLICATION_SCOPE:
- context.removeAttribute(name);
- break;
-
- default:
- throw new IllegalArgumentException("Invalid scope");
- }
- }
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
+ doRemoveAttribute(name, scope);
+ return null;
+ }
+ });
+ } else {
+ doRemoveAttribute(name, scope);
+ }
+ }
- @Override
+ private void doRemoveAttribute(String name, int scope) {
+ switch (scope) {
+ case PAGE_SCOPE:
+ attributes.remove(name);
+ break;
+
+ case REQUEST_SCOPE:
+ request.removeAttribute(name);
+ break;
+
+ case SESSION_SCOPE:
+ if (session == null) {
+ throw new IllegalStateException(Localizer
+ .getMessage("jsp.error.page.noSession"));
+ }
+ session.removeAttribute(name);
+ break;
+
+ case APPLICATION_SCOPE:
+ context.removeAttribute(name);
+ break;
+
+ default:
+ throw new IllegalArgumentException("Invalid scope");
+ }
+ }
+
+ @Override
public int getAttributesScope(final String name) {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
-
- if (SecurityUtil.isPackageProtectionEnabled()) {
- return (AccessController
- .doPrivileged(new PrivilegedAction<Integer>() {
- public Integer run() {
- return new Integer(doGetAttributeScope(name));
- }
- })).intValue();
- } else {
- return doGetAttributeScope(name);
- }
- }
-
- private int doGetAttributeScope(String name) {
- if (attributes.get(name) != null)
- return PAGE_SCOPE;
-
- if (request.getAttribute(name) != null)
- return REQUEST_SCOPE;
-
- if (session != null) {
- try {
- if (session.getAttribute(name) != null)
- return SESSION_SCOPE;
- } catch(IllegalStateException ise) {
- // Session has been invalidated.
- // Ignore and fall through to application scope.
- }
- }
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
+
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return (AccessController
+ .doPrivileged(new PrivilegedAction<Integer>() {
+ public Integer run() {
+ return new Integer(doGetAttributeScope(name));
+ }
+ })).intValue();
+ } else {
+ return doGetAttributeScope(name);
+ }
+ }
+
+ private int doGetAttributeScope(String name) {
+ if (attributes.get(name) != null)
+ return PAGE_SCOPE;
+
+ if (request.getAttribute(name) != null)
+ return REQUEST_SCOPE;
+
+ if (session != null) {
+ try {
+ if (session.getAttribute(name) != null)
+ return SESSION_SCOPE;
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall through to application scope.
+ }
+ }
- if (context.getAttribute(name) != null)
- return APPLICATION_SCOPE;
+ if (context.getAttribute(name) != null)
+ return APPLICATION_SCOPE;
- return 0;
- }
+ return 0;
+ }
- @Override
+ @Override
public Object findAttribute(final String name) {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- return AccessController.doPrivileged(
- new PrivilegedAction<Object>() {
- public Object run() {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
-
- return doFindAttribute(name);
- }
- });
- } else {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
-
- return doFindAttribute(name);
- }
- }
-
- private Object doFindAttribute(String name) {
-
- Object o = attributes.get(name);
- if (o != null)
- return o;
-
- o = request.getAttribute(name);
- if (o != null)
- return o;
-
- if (session != null) {
- try {
- o = session.getAttribute(name);
- } catch(IllegalStateException ise) {
- // Session has been invalidated.
- // Ignore and fall through to application scope.
- }
- if (o != null)
- return o;
- }
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<Object>() {
+ public Object run() {
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
+
+ return doFindAttribute(name);
+ }
+ });
+ } else {
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
+
+ return doFindAttribute(name);
+ }
+ }
+
+ private Object doFindAttribute(String name) {
+
+ Object o = attributes.get(name);
+ if (o != null)
+ return o;
+
+ o = request.getAttribute(name);
+ if (o != null)
+ return o;
+
+ if (session != null) {
+ try {
+ o = session.getAttribute(name);
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall through to application scope.
+ }
+ if (o != null)
+ return o;
+ }
- return context.getAttribute(name);
- }
+ return context.getAttribute(name);
+ }
- @Override
+ @Override
public Enumeration<String> getAttributeNamesInScope(final int scope) {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- return AccessController.doPrivileged(
- new PrivilegedAction<Enumeration<String>>() {
- public Enumeration<String> run() {
- return doGetAttributeNamesInScope(scope);
- }
- });
- } else {
- return doGetAttributeNamesInScope(scope);
- }
- }
-
- private Enumeration<String> doGetAttributeNamesInScope(int scope) {
- switch (scope) {
- case PAGE_SCOPE:
- return new Enumerator<String>(attributes.keySet().iterator());
-
- case REQUEST_SCOPE:
- return request.getAttributeNames();
-
- case SESSION_SCOPE:
- if (session == null) {
- throw new IllegalStateException(Localizer
- .getMessage("jsp.error.page.noSession"));
- }
- return session.getAttributeNames();
-
- case APPLICATION_SCOPE:
- return context.getAttributeNames();
-
- default:
- throw new IllegalArgumentException("Invalid scope");
- }
- }
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<Enumeration<String>>() {
+ public Enumeration<String> run() {
+ return doGetAttributeNamesInScope(scope);
+ }
+ });
+ } else {
+ return doGetAttributeNamesInScope(scope);
+ }
+ }
+
+ private Enumeration<String> doGetAttributeNamesInScope(int scope) {
+ switch (scope) {
+ case PAGE_SCOPE:
+ return new Enumerator<String>(attributes.keySet().iterator());
+
+ case REQUEST_SCOPE:
+ return request.getAttributeNames();
+
+ case SESSION_SCOPE:
+ if (session == null) {
+ throw new IllegalStateException(Localizer
+ .getMessage("jsp.error.page.noSession"));
+ }
+ return session.getAttributeNames();
+
+ case APPLICATION_SCOPE:
+ return context.getAttributeNames();
+
+ default:
+ throw new IllegalArgumentException("Invalid scope");
+ }
+ }
- @Override
+ @Override
public void removeAttribute(final String name) {
- if (name == null) {
- throw new NullPointerException(Localizer
- .getMessage("jsp.error.attribute.null_name"));
- }
-
- if (SecurityUtil.isPackageProtectionEnabled()) {
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
- public Void run() {
- doRemoveAttribute(name);
- return null;
- }
- });
- } else {
- doRemoveAttribute(name);
- }
- }
-
- private void doRemoveAttribute(String name) {
- removeAttribute(name, PAGE_SCOPE);
- removeAttribute(name, REQUEST_SCOPE);
- if( session != null ) {
- try {
- removeAttribute(name, SESSION_SCOPE);
- } catch(IllegalStateException ise) {
- // Session has been invalidated.
- // Ignore and fall throw to application scope.
- }
- }
- removeAttribute(name, APPLICATION_SCOPE);
- }
+ if (name == null) {
+ throw new NullPointerException(Localizer
+ .getMessage("jsp.error.attribute.null_name"));
+ }
+
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
+ doRemoveAttribute(name);
+ return null;
+ }
+ });
+ } else {
+ doRemoveAttribute(name);
+ }
+ }
+
+ private void doRemoveAttribute(String name) {
+ removeAttribute(name, PAGE_SCOPE);
+ removeAttribute(name, REQUEST_SCOPE);
+ if( session != null ) {
+ try {
+ removeAttribute(name, SESSION_SCOPE);
+ } catch(IllegalStateException ise) {
+ // Session has been invalidated.
+ // Ignore and fall throw to application scope.
+ }
+ }
+ removeAttribute(name, APPLICATION_SCOPE);
+ }
- @Override
+ @Override
public JspWriter getOut() {
- return out;
- }
+ return out;
+ }
- @Override
+ @Override
public HttpSession getSession() {
- return session;
- }
+ return session;
+ }
- public Servlet getServlet() {
- return servlet;
- }
+ public Servlet getServlet() {
+ return servlet;
+ }
- @Override
+ @Override
public ServletConfig getServletConfig() {
- return config;
- }
+ return config;
+ }
- @Override
+ @Override
public ServletContext getServletContext() {
- return config.getServletContext();
- }
+ return config.getServletContext();
+ }
- @Override
+ @Override
public ServletRequest getRequest() {
- return request;
- }
+ return request;
+ }
- @Override
+ @Override
public ServletResponse getResponse() {
- return response;
- }
+ return response;
+ }
- /**
- * Returns the exception associated with this page context, if any. <p/>
- * Added wrapping for Throwables to avoid ClassCastException: see Bugzilla
- * 31171 for details.
- *
- * @return The Exception associated with this page context, if any.
- */
- @Override
+ /**
+ * Returns the exception associated with this page context, if any. <p/>
+ * Added wrapping for Throwables to avoid ClassCastException: see Bugzilla
+ * 31171 for details.
+ *
+ * @return The Exception associated with this page context, if any.
+ */
+ @Override
public Exception getException() {
- Throwable t = JspRuntimeLibrary.getThrowable(request);
+ Throwable t = JspRuntimeLibrary.getThrowable(request);
- // Only wrap if needed
- if ((t != null) && (!(t instanceof Exception))) {
- t = new JspException(t);
- }
+ // Only wrap if needed
+ if ((t != null) && (!(t instanceof Exception))) {
+ t = new JspException(t);
+ }
- return (Exception) t;
- }
+ return (Exception) t;
+ }
- @Override
+ @Override
public Object getPage() {
- return servlet;
- }
+ return servlet;
+ }
- private final String getAbsolutePathRelativeToContext(String relativeUrlPath) {
- String path = relativeUrlPath;
+ private final String getAbsolutePathRelativeToContext(String relativeUrlPath) {
+ String path = relativeUrlPath;
- if (!path.startsWith("/")) {
- String uri = (String) request
- .getAttribute("javax.servlet.include.servlet_path");
- if (uri == null)
- uri = ((HttpServletRequest) request).getServletPath();
- String baseURI = uri.substring(0, uri.lastIndexOf('/'));
- path = baseURI + '/' + path;
- }
+ if (!path.startsWith("/")) {
+ String uri = (String) request
+ .getAttribute("javax.servlet.include.servlet_path");
+ if (uri == null)
+ uri = ((HttpServletRequest) request).getServletPath();
+ String baseURI = uri.substring(0, uri.lastIndexOf('/'));
+ path = baseURI + '/' + path;
+ }
- return path;
- }
+ return path;
+ }
- @Override
+ @Override
public void include(String relativeUrlPath) throws ServletException,
- IOException {
- JspRuntimeLibrary
- .include(request, response, relativeUrlPath, out, true);
- }
+ IOException {
+ JspRuntimeLibrary
+ .include(request, response, relativeUrlPath, out, true);
+ }
- @Override
+ @Override
public void include(final String relativeUrlPath, final boolean flush)
- throws ServletException, IOException {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- try {
- AccessController.doPrivileged(
- new PrivilegedExceptionAction<Void>() {
- public Void run() throws Exception {
- doInclude(relativeUrlPath, flush);
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- Exception ex = e.getException();
- if (ex instanceof IOException) {
- throw (IOException) ex;
- } else {
- throw (ServletException) ex;
- }
- }
- } else {
- doInclude(relativeUrlPath, flush);
- }
- }
-
- private void doInclude(String relativeUrlPath, boolean flush)
- throws ServletException, IOException {
- JspRuntimeLibrary.include(request, response, relativeUrlPath, out,
- flush);
- }
+ throws ServletException, IOException {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ try {
+ AccessController.doPrivileged(
+ new PrivilegedExceptionAction<Void>() {
+ public Void run() throws Exception {
+ doInclude(relativeUrlPath, flush);
+ return null;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ Exception ex = e.getException();
+ if (ex instanceof IOException) {
+ throw (IOException) ex;
+ } else {
+ throw (ServletException) ex;
+ }
+ }
+ } else {
+ doInclude(relativeUrlPath, flush);
+ }
+ }
- @Override
- @Deprecated
+ private void doInclude(String relativeUrlPath, boolean flush)
+ throws ServletException, IOException {
+ JspRuntimeLibrary.include(request, response, relativeUrlPath, out,
+ flush);
+ }
+
+ @Override
+ @Deprecated
public VariableResolver getVariableResolver() {
- return new VariableResolverImpl(this.getELContext());
- }
+ return new VariableResolverImpl(this.getELContext());
+ }
- @Override
+ @Override
public void forward(final String relativeUrlPath) throws ServletException,
- IOException {
- if (SecurityUtil.isPackageProtectionEnabled()) {
- try {
- AccessController.doPrivileged(
- new PrivilegedExceptionAction<Void>() {
- public Void run() throws Exception {
- doForward(relativeUrlPath);
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- Exception ex = e.getException();
- if (ex instanceof IOException) {
- throw (IOException) ex;
- } else {
- throw (ServletException) ex;
- }
- }
- } else {
- doForward(relativeUrlPath);
- }
- }
-
- private void doForward(String relativeUrlPath) throws ServletException,
- IOException {
-
- // JSP.4.5 If the buffer was flushed, throw IllegalStateException
- try {
- out.clear();
- } catch (IOException ex) {
- IllegalStateException ise = new IllegalStateException(Localizer
- .getMessage("jsp.error.attempt_to_clear_flushed_buffer"));
- ise.initCause(ex);
- throw ise;
- }
-
- // Make sure that the response object is not the wrapper for include
- while (response instanceof ServletResponseWrapperInclude) {
- response = ((ServletResponseWrapperInclude) response).getResponse();
- }
-
- final String path = getAbsolutePathRelativeToContext(relativeUrlPath);
- String includeUri = (String) request
- .getAttribute(Constants.INC_SERVLET_PATH);
-
- if (includeUri != null)
- request.removeAttribute(Constants.INC_SERVLET_PATH);
- try {
- context.getRequestDispatcher(path).forward(request, response);
- } finally {
- if (includeUri != null)
- request.setAttribute(Constants.INC_SERVLET_PATH, includeUri);
- }
- }
+ IOException {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ try {
+ AccessController.doPrivileged(
+ new PrivilegedExceptionAction<Void>() {
+ public Void run() throws Exception {
+ doForward(relativeUrlPath);
+ return null;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ Exception ex = e.getException();
+ if (ex instanceof IOException) {
+ throw (IOException) ex;
+ } else {
+ throw (ServletException) ex;
+ }
+ }
+ } else {
+ doForward(relativeUrlPath);
+ }
+ }
+
+ private void doForward(String relativeUrlPath) throws ServletException,
+ IOException {
+
+ // JSP.4.5 If the buffer was flushed, throw IllegalStateException
+ try {
+ out.clear();
+ } catch (IOException ex) {
+ IllegalStateException ise = new IllegalStateException(Localizer
+ .getMessage("jsp.error.attempt_to_clear_flushed_buffer"));
+ ise.initCause(ex);
+ throw ise;
+ }
+
+ // Make sure that the response object is not the wrapper for include
+ while (response instanceof ServletResponseWrapperInclude) {
+ response = ((ServletResponseWrapperInclude) response).getResponse();
+ }
+
+ final String path = getAbsolutePathRelativeToContext(relativeUrlPath);
+ String includeUri = (String) request
+ .getAttribute(Constants.INC_SERVLET_PATH);
+
+ if (includeUri != null)
+ request.removeAttribute(Constants.INC_SERVLET_PATH);
+ try {
+ context.getRequestDispatcher(path).forward(request, response);
+ } finally {
+ if (includeUri != null)
+ request.setAttribute(Constants.INC_SERVLET_PATH, includeUri);
+ }
+ }
- @Override
+ @Override
public BodyContent pushBody() {
- return (BodyContent) pushBody(null);
- }
+ return (BodyContent) pushBody(null);
+ }
- @Override
+ @Override
public JspWriter pushBody(Writer writer) {
- depth++;
- if (depth >= outs.length) {
- BodyContentImpl[] newOuts = new BodyContentImpl[depth + 1];
- for (int i = 0; i < outs.length; i++) {
- newOuts[i] = outs[i];
- }
- newOuts[depth] = new BodyContentImpl(out);
- outs = newOuts;
- }
-
- outs[depth].setWriter(writer);
- out = outs[depth];
-
- // Update the value of the "out" attribute in the page scope
- // attribute namespace of this PageContext
- setAttribute(OUT, out);
+ depth++;
+ if (depth >= outs.length) {
+ BodyContentImpl[] newOuts = new BodyContentImpl[depth + 1];
+ for (int i = 0; i < outs.length; i++) {
+ newOuts[i] = outs[i];
+ }
+ newOuts[depth] = new BodyContentImpl(out);
+ outs = newOuts;
+ }
+
+ outs[depth].setWriter(writer);
+ out = outs[depth];
+
+ // Update the value of the "out" attribute in the page scope
+ // attribute namespace of this PageContext
+ setAttribute(OUT, out);
- return outs[depth];
- }
+ return outs[depth];
+ }
- @Override
+ @Override
public JspWriter popBody() {
- depth--;
- if (depth >= 0) {
- out = outs[depth];
- } else {
- out = baseOut;
- }
-
- // Update the value of the "out" attribute in the page scope
- // attribute namespace of this PageContext
- setAttribute(OUT, out);
-
- return out;
- }
-
- /**
- * Provides programmatic access to the ExpressionEvaluator. The JSP
- * Container must return a valid instance of an ExpressionEvaluator that can
- * parse EL expressions.
- */
- @Override
- @Deprecated
+ depth--;
+ if (depth >= 0) {
+ out = outs[depth];
+ } else {
+ out = baseOut;
+ }
+
+ // Update the value of the "out" attribute in the page scope
+ // attribute namespace of this PageContext
+ setAttribute(OUT, out);
+
+ return out;
+ }
+
+ /**
+ * Provides programmatic access to the ExpressionEvaluator. The JSP
+ * Container must return a valid instance of an ExpressionEvaluator that can
+ * parse EL expressions.
+ */
+ @Override
+ @Deprecated
public ExpressionEvaluator getExpressionEvaluator() {
- return new ExpressionEvaluatorImpl(this.applicationContext.getExpressionFactory());
- }
+ return new ExpressionEvaluatorImpl(this.applicationContext.getExpressionFactory());
+ }
- @Override
+ @Override
public void handlePageException(Exception ex) throws IOException,
- ServletException {
- // Should never be called since handleException() called with a
- // Throwable in the generated servlet.
- handlePageException((Throwable) ex);
- }
+ ServletException {
+ // Should never be called since handleException() called with a
+ // Throwable in the generated servlet.
+ handlePageException((Throwable) ex);
+ }
- @Override
+ @Override
public void handlePageException(final Throwable t) throws IOException,
- ServletException {
- if (t == null)
- throw new NullPointerException("null Throwable");
-
- if (SecurityUtil.isPackageProtectionEnabled()) {
- try {
- AccessController.doPrivileged(
- new PrivilegedExceptionAction<Void>() {
- public Void run() throws Exception {
- doHandlePageException(t);
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- Exception ex = e.getException();
- if (ex instanceof IOException) {
- throw (IOException) ex;
- } else {
- throw (ServletException) ex;
- }
- }
- } else {
- doHandlePageException(t);
- }
-
- }
-
- private void doHandlePageException(Throwable t) throws IOException,
- ServletException {
-
- if (errorPageURL != null && !errorPageURL.equals("")) {
-
- /*
- * Set request attributes. Do not set the
- * javax.servlet.error.exception attribute here (instead, set in the
- * generated servlet code for the error page) in order to prevent
- * the ErrorReportValve, which is invoked as part of forwarding the
- * request to the error page, from throwing it if the response has
- * not been committed (the response will have been committed if the
- * error page is a JSP page).
- */
- request.setAttribute("javax.servlet.jsp.jspException", t);
- request.setAttribute("javax.servlet.error.status_code",
- new Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
- request.setAttribute("javax.servlet.error.request_uri",
- ((HttpServletRequest) request).getRequestURI());
- request.setAttribute("javax.servlet.error.servlet_name", config
- .getServletName());
- try {
- forward(errorPageURL);
- } catch (IllegalStateException ise) {
- include(errorPageURL);
- }
-
- // The error page could be inside an include.
-
- Object newException = request
- .getAttribute("javax.servlet.error.exception");
-
- // t==null means the attribute was not set.
- if ((newException != null) && (newException == t)) {
- request.removeAttribute("javax.servlet.error.exception");
- }
-
- // now clear the error code - to prevent double handling.
- request.removeAttribute("javax.servlet.error.status_code");
- request.removeAttribute("javax.servlet.error.request_uri");
- request.removeAttribute("javax.servlet.error.status_code");
- request.removeAttribute("javax.servlet.jsp.jspException");
-
- } else {
- // Otherwise throw the exception wrapped inside a ServletException.
- // Set the exception as the root cause in the ServletException
- // to get a stack trace for the real problem
- if (t instanceof IOException)
- throw (IOException) t;
- if (t instanceof ServletException)
- throw (ServletException) t;
- if (t instanceof RuntimeException)
- throw (RuntimeException) t;
-
- Throwable rootCause = null;
- if (t instanceof JspException) {
- rootCause = ((JspException) t).getCause();
- } else if (t instanceof ELException) {
- rootCause = ((ELException) t).getCause();
- }
-
- if (rootCause != null) {
- throw new ServletException(t.getClass().getName() + ": "
- + t.getMessage(), rootCause);
- }
-
- throw new ServletException(t);
- }
- }
-
- private static String XmlEscape(String s) {
- if (s == null)
- return null;
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
- if (c == '<') {
- sb.append("<");
- } else if (c == '>') {
- sb.append(">");
- } else if (c == '\'') {
- sb.append("'"); // '
- } else if (c == '&') {
- sb.append("&");
- } else if (c == '"') {
- sb.append("""); // "
- } else {
- sb.append(c);
- }
- }
- return sb.toString();
- }
-
- /**
- * Proprietary method to evaluate EL expressions. XXX - This method should
- * go away once the EL interpreter moves out of JSTL and into its own
- * project. For now, this is necessary because the standard machinery is too
- * slow.
- *
- * @param expression
- * The expression to be evaluated
- * @param expectedType
- * The expected resulting type
- * @param pageContext
- * The page context
- * @param functionMap
- * Maps prefix and name to Method
- * @return The result of the evaluation
- */
- public static Object proprietaryEvaluate(final String expression,
- final Class<?> expectedType, final PageContext pageContext,
- final ProtectedFunctionMapper functionMap, final boolean escape)
- throws ELException {
- Object retValue;
+ ServletException {
+ if (t == null)
+ throw new NullPointerException("null Throwable");
+
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ try {
+ AccessController.doPrivileged(
+ new PrivilegedExceptionAction<Void>() {
+ public Void run() throws Exception {
+ doHandlePageException(t);
+ return null;
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ Exception ex = e.getException();
+ if (ex instanceof IOException) {
+ throw (IOException) ex;
+ } else {
+ throw (ServletException) ex;
+ }
+ }
+ } else {
+ doHandlePageException(t);
+ }
+
+ }
+
+ private void doHandlePageException(Throwable t) throws IOException,
+ ServletException {
+
+ if (errorPageURL != null && !errorPageURL.equals("")) {
+
+ /*
+ * Set request attributes. Do not set the
+ * javax.servlet.error.exception attribute here (instead, set in the
+ * generated servlet code for the error page) in order to prevent
+ * the ErrorReportValve, which is invoked as part of forwarding the
+ * request to the error page, from throwing it if the response has
+ * not been committed (the response will have been committed if the
+ * error page is a JSP page).
+ */
+ request.setAttribute("javax.servlet.jsp.jspException", t);
+ request.setAttribute("javax.servlet.error.status_code",
+ new Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
+ request.setAttribute("javax.servlet.error.request_uri",
+ ((HttpServletRequest) request).getRequestURI());
+ request.setAttribute("javax.servlet.error.servlet_name", config
+ .getServletName());
+ try {
+ forward(errorPageURL);
+ } catch (IllegalStateException ise) {
+ include(errorPageURL);
+ }
+
+ // The error page could be inside an include.
+
+ Object newException = request
+ .getAttribute("javax.servlet.error.exception");
+
+ // t==null means the attribute was not set.
+ if ((newException != null) && (newException == t)) {
+ request.removeAttribute("javax.servlet.error.exception");
+ }
+
+ // now clear the error code - to prevent double handling.
+ request.removeAttribute("javax.servlet.error.status_code");
+ request.removeAttribute("javax.servlet.error.request_uri");
+ request.removeAttribute("javax.servlet.error.status_code");
+ request.removeAttribute("javax.servlet.jsp.jspException");
+
+ } else {
+ // Otherwise throw the exception wrapped inside a ServletException.
+ // Set the exception as the root cause in the ServletException
+ // to get a stack trace for the real problem
+ if (t instanceof IOException)
+ throw (IOException) t;
+ if (t instanceof ServletException)
+ throw (ServletException) t;
+ if (t instanceof RuntimeException)
+ throw (RuntimeException) t;
+
+ Throwable rootCause = null;
+ if (t instanceof JspException) {
+ rootCause = ((JspException) t).getCause();
+ } else if (t instanceof ELException) {
+ rootCause = ((ELException) t).getCause();
+ }
+
+ if (rootCause != null) {
+ throw new ServletException(t.getClass().getName() + ": "
+ + t.getMessage(), rootCause);
+ }
+
+ throw new ServletException(t);
+ }
+ }
+
+ private static String XmlEscape(String s) {
+ if (s == null)
+ return null;
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < s.length(); i++) {
+ char c = s.charAt(i);
+ if (c == '<') {
+ sb.append("<");
+ } else if (c == '>') {
+ sb.append(">");
+ } else if (c == '\'') {
+ sb.append("'"); // '
+ } else if (c == '&') {
+ sb.append("&");
+ } else if (c == '"') {
+ sb.append("""); // "
+ } else {
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Proprietary method to evaluate EL expressions. XXX - This method should
+ * go away once the EL interpreter moves out of JSTL and into its own
+ * project. For now, this is necessary because the standard machinery is too
+ * slow.
+ *
+ * @param expression
+ * The expression to be evaluated
+ * @param expectedType
+ * The expected resulting type
+ * @param pageContext
+ * The page context
+ * @param functionMap
+ * Maps prefix and name to Method
+ * @return The result of the evaluation
+ */
+ public static Object proprietaryEvaluate(final String expression,
+ final Class<?> expectedType, final PageContext pageContext,
+ final ProtectedFunctionMapper functionMap, final boolean escape)
+ throws ELException {
+ Object retValue;
final ExpressionFactory exprFactory = jspf.getJspApplicationContext(pageContext.getServletContext()).getExpressionFactory();
- if (SecurityUtil.isPackageProtectionEnabled()) {
- try {
- retValue = AccessController
- .doPrivileged(new PrivilegedExceptionAction<Object>() {
+ if (SecurityUtil.isPackageProtectionEnabled()) {
+ try {
+ retValue = AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
+ public Object run() throws Exception {
ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
ctx.setFunctionMapper(new FunctionMapperImpl(functionMap));
- ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
+ ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
return ve.getValue(ctx);
- }
- });
- } catch (PrivilegedActionException ex) {
- Exception realEx = ex.getException();
- if (realEx instanceof ELException) {
- throw (ELException) realEx;
- } else {
- throw new ELException(realEx);
- }
- }
- } else {
+ }
+ });
+ } catch (PrivilegedActionException ex) {
+ Exception realEx = ex.getException();
+ if (realEx instanceof ELException) {
+ throw (ELException) realEx;
+ } else {
+ throw new ELException(realEx);
+ }
+ }
+ } else {
ELContextImpl ctx = (ELContextImpl) pageContext.getELContext();
ctx.setFunctionMapper(new FunctionMapperImpl(functionMap));
ValueExpression ve = exprFactory.createValueExpression(ctx, expression, expectedType);
retValue = ve.getValue(ctx);
- }
- if (escape && retValue != null) {
- retValue = XmlEscape(retValue.toString());
- }
+ }
+ if (escape && retValue != null) {
+ retValue = XmlEscape(retValue.toString());
+ }
- return retValue;
- }
+ return retValue;
+ }
- @Override
+ @Override
public ELContext getELContext() {
- if (this.elContext == null) {
- this.elContext = this.applicationContext.createELContext(this);
- }
- return this.elContext;
- }
+ if (this.elContext == null) {
+ this.elContext = this.applicationContext.createELContext(this);
+ }
+ return this.elContext;
+ }
}
Modified: tomcat/trunk/java/org/apache/jasper/runtime/PerThreadTagHandlerPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/PerThreadTagHandlerPool.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/PerThreadTagHandlerPool.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/PerThreadTagHandlerPool.java Sat Jul 24 13:03:11 2010
@@ -93,12 +93,12 @@ public class PerThreadTagHandlerPool ext
if(ptd.current >=0 ) {
return ptd.handlers[ptd.current--];
} else {
- try {
- return handlerClass.newInstance();
- } catch (Exception e) {
- throw new JspException(e.getMessage(), e);
- }
- }
+ try {
+ return handlerClass.newInstance();
+ } catch (Exception e) {
+ throw new JspException(e.getMessage(), e);
+ }
+ }
}
/**
@@ -111,8 +111,8 @@ public class PerThreadTagHandlerPool ext
@Override
public void reuse(Tag handler) {
PerThreadData ptd = perThread.get();
- if (ptd.current < (ptd.handlers.length - 1)) {
- ptd.handlers[++ptd.current] = handler;
+ if (ptd.current < (ptd.handlers.length - 1)) {
+ ptd.handlers[++ptd.current] = handler;
} else {
handler.release();
}
@@ -125,12 +125,12 @@ public class PerThreadTagHandlerPool ext
public void release() {
Enumeration<PerThreadData> enumeration = perThreadDataVector.elements();
while (enumeration.hasMoreElements()) {
- PerThreadData ptd = enumeration.nextElement();
+ PerThreadData ptd = enumeration.nextElement();
if (ptd.handlers != null) {
for (int i=ptd.current; i>=0; i--) {
if (ptd.handlers[i] != null) {
ptd.handlers[i].release();
- }
+ }
}
}
}
Modified: tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/ServletResponseWrapperInclude.java Sat Jul 24 13:03:11 2010
@@ -46,10 +46,10 @@ public class ServletResponseWrapperInclu
private JspWriter jspWriter;
public ServletResponseWrapperInclude(ServletResponse response,
- JspWriter jspWriter) {
- super((HttpServletResponse)response);
- this.printWriter = new PrintWriter(jspWriter);
- this.jspWriter = jspWriter;
+ JspWriter jspWriter) {
+ super((HttpServletResponse)response);
+ this.printWriter = new PrintWriter(jspWriter);
+ this.jspWriter = jspWriter;
}
/**
@@ -57,12 +57,12 @@ public class ServletResponseWrapperInclu
*/
@Override
public PrintWriter getWriter() throws IOException {
- return printWriter;
+ return printWriter;
}
@Override
public ServletOutputStream getOutputStream() throws IOException {
- throw new IllegalStateException();
+ throw new IllegalStateException();
}
/**
@@ -71,9 +71,9 @@ public class ServletResponseWrapperInclu
*/
@Override
public void resetBuffer() {
- try {
- jspWriter.clearBuffer();
- } catch (IOException ioe) {
- }
+ try {
+ jspWriter.clearBuffer();
+ } catch (IOException ioe) {
+ }
}
}
Modified: tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/TagHandlerPool.java Sat Jul 24 13:03:11 2010
@@ -85,7 +85,7 @@ public class TagHandlerPool {
* Constructs a tag handler pool with the default capacity.
*/
public TagHandlerPool() {
- // Nothing - jasper generated servlets call the other constructor,
+ // Nothing - jasper generated servlets call the other constructor,
// this should be used in future + init .
}
@@ -100,7 +100,7 @@ public class TagHandlerPool {
* @throws JspException if a tag handler cannot be instantiated
*/
public Tag get(Class<? extends Tag> handlerClass) throws JspException {
- Tag handler;
+ Tag handler;
synchronized( this ) {
if (current >= 0) {
handler = handlers[current--];
@@ -111,13 +111,13 @@ public class TagHandlerPool {
// Out of sync block - there is no need for other threads to
// wait for us to construct a tag for this thread.
try {
- if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
- return (Tag) instanceManager.newInstance(handlerClass.getName(), handlerClass.getClassLoader());
- } else {
+ if (Constants.USE_INSTANCE_MANAGER_FOR_TAGS) {
+ return (Tag) instanceManager.newInstance(handlerClass.getName(), handlerClass.getClassLoader());
+ } else {
Tag instance = handlerClass.newInstance();
instanceManager.newInstance(instance);
return instance;
- }
+ }
} catch (Exception e) {
throw new JspException(e.getMessage(), e);
}
Modified: tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java (original)
+++ tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java Sat Jul 24 13:03:11 2010
@@ -194,11 +194,11 @@ public class JspServlet extends HttpServ
if (value.equals("true")) {
return (true); // ?jsp_precompile=true
} else if (value.equals("false")) {
- // Spec says if jsp_precompile=false, the request should not
- // be delivered to the JSP page; the easiest way to implement
- // this is to set the flag to true, and precompile the page anyway.
- // This still conforms to the spec, since it says the
- // precompilation request can be ignored.
+ // Spec says if jsp_precompile=false, the request should not
+ // be delivered to the JSP page; the easiest way to implement
+ // this is to set the flag to true, and precompile the page anyway.
+ // This still conforms to the spec, since it says the
+ // precompilation request can be ignored.
return (true); // ?jsp_precompile=false
} else {
throw new ServletException("Cannot have request parameter " +
@@ -211,7 +211,7 @@ public class JspServlet extends HttpServ
@Override
public void service (HttpServletRequest request,
- HttpServletResponse response)
+ HttpServletResponse response)
throws ServletException, IOException {
String jspUri = null;
@@ -228,7 +228,7 @@ public class JspServlet extends HttpServ
jspUri = (String) request.getAttribute(Constants.INC_SERVLET_PATH);
if (jspUri != null) {
/*
- * Requested JSP has been target of
+ * Requested JSP has been target of
* RequestDispatcher.include(). Its path is assembled from the
* relevant javax.servlet.include.* request attributes
*/
@@ -251,7 +251,7 @@ public class JspServlet extends HttpServ
}
}
- if (log.isDebugEnabled()) {
+ if (log.isDebugEnabled()) {
log.debug("JspEngine --> " + jspUri);
log.debug("\t ServletPath: " + request.getServletPath());
log.debug("\t PathInfo: " + request.getPathInfo());
Modified: tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/Util.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/Util.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/Util.java (original)
+++ tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/Util.java Sat Jul 24 13:03:11 2010
@@ -156,7 +156,7 @@ public class Util {
int sessionEnd = u.toString().indexOf(";", sessionStart + 1);
if (sessionEnd == -1)
sessionEnd = u.toString().indexOf("?", sessionStart + 1);
- if (sessionEnd == -1) // still
+ if (sessionEnd == -1) // still
sessionEnd = u.length();
u.delete(sessionStart, sessionEnd);
}
@@ -328,7 +328,7 @@ public class Util {
else
return bos.toString("ISO-8859-1");
} else
- return ""; // target didn't write anything
+ return ""; // target didn't write anything
}
}
Modified: tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java (original)
+++ tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/ForEach.java Sat Jul 24 13:03:11 2010
@@ -193,7 +193,7 @@ public final class ForEach implements Ta
}
ctxt.generateJavaSource("break;");
}
- ctxt.generateJavaSource("}"); // while
+ ctxt.generateJavaSource("}"); // while
}
/**
Modified: tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/Param.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/Param.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/Param.java (original)
+++ tomcat/trunk/java/org/apache/jasper/tagplugins/jstl/core/Param.java Sat Jul 24 13:03:11 2010
@@ -72,6 +72,6 @@ public class Param implements TagPlugin
ctxt.generateJavaSource(" " + urlName + " = " + urlName + " + \"&\" + " + nameName + " + \"=\" + " + valueName + ";");
ctxt.generateJavaSource(" }");
ctxt.generateJavaSource(" pageContext.setAttribute(\"url_without_param\"," + urlName + ");");
- ctxt.generateJavaSource("}");
+ ctxt.generateJavaSource("}");
}
}
Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/ASCIIReader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/ASCIIReader.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/ASCIIReader.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/ASCIIReader.java Sat Jul 24 13:03:11 2010
@@ -88,7 +88,7 @@ public class ASCIIReader
int b0 = fInputStream.read();
if (b0 > 0x80) {
throw new IOException(Localizer.getMessage("jsp.error.xml.invalidASCII",
- Integer.toString(b0)));
+ Integer.toString(b0)));
}
return b0;
} // read():int
@@ -117,7 +117,7 @@ public class ASCIIReader
int b0 = (0xff & fBuffer[i]); // Convert to unsigned
if (b0 > 0x80) {
throw new IOException(Localizer.getMessage("jsp.error.xml.invalidASCII",
- Integer.toString(b0)));
+ Integer.toString(b0)));
}
ch[offset + i] = (char)b0;
}
@@ -150,7 +150,7 @@ public class ASCIIReader
*/
@Override
public boolean ready() throws IOException {
- return false;
+ return false;
} // ready()
/**
@@ -158,7 +158,7 @@ public class ASCIIReader
*/
@Override
public boolean markSupported() {
- return fInputStream.markSupported();
+ return fInputStream.markSupported();
} // markSupported()
/**
@@ -176,7 +176,7 @@ public class ASCIIReader
*/
@Override
public void mark(int readAheadLimit) throws IOException {
- fInputStream.mark(readAheadLimit);
+ fInputStream.mark(readAheadLimit);
} // mark(int)
/**
Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/EncodingMap.java Sat Jul 24 13:03:11 2010
@@ -705,7 +705,7 @@ public class EncodingMap {
fIANA2JavaMap.put("WINDOWS-31J", "MS932");
fIANA2JavaMap.put("CSWINDOWS31J", "MS932");
- // Add support for Cp1252 and its friends
+ // Add support for Cp1252 and its friends
fIANA2JavaMap.put("WINDOWS-1250", "Cp1250");
fIANA2JavaMap.put("WINDOWS-1251", "Cp1251");
fIANA2JavaMap.put("WINDOWS-1252", "Cp1252");
Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/ParserUtils.java Sat Jul 24 13:03:11 2010
@@ -94,23 +94,23 @@ public class ParserUtils {
builder.setEntityResolver(entityResolver);
builder.setErrorHandler(errorHandler);
document = builder.parse(is);
- } catch (ParserConfigurationException ex) {
+ } catch (ParserConfigurationException ex) {
throw new JasperException
(Localizer.getMessage("jsp.error.parse.xml", location), ex);
- } catch (SAXParseException ex) {
+ } catch (SAXParseException ex) {
throw new JasperException
(Localizer.getMessage("jsp.error.parse.xml.line",
- location,
- Integer.toString(ex.getLineNumber()),
- Integer.toString(ex.getColumnNumber())),
- ex);
- } catch (SAXException sx) {
+ location,
+ Integer.toString(ex.getLineNumber()),
+ Integer.toString(ex.getColumnNumber())),
+ ex);
+ } catch (SAXException sx) {
throw new JasperException
(Localizer.getMessage("jsp.error.parse.xml", location), sx);
} catch (IOException io) {
throw new JasperException
(Localizer.getMessage("jsp.error.parse.xml", location), io);
- }
+ }
// Convert the resulting document to a graph of TreeNodes
return (convert(null, document.getDocumentElement()));
Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/UCSReader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/UCSReader.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/UCSReader.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/UCSReader.java Sat Jul 24 13:03:11 2010
@@ -247,7 +247,7 @@ public class UCSReader extends Reader {
*/
@Override
public boolean ready() throws IOException {
- return false;
+ return false;
} // ready()
/**
@@ -255,7 +255,7 @@ public class UCSReader extends Reader {
*/
@Override
public boolean markSupported() {
- return fInputStream.markSupported();
+ return fInputStream.markSupported();
} // markSupported()
/**
@@ -273,7 +273,7 @@ public class UCSReader extends Reader {
*/
@Override
public void mark(int readAheadLimit) throws IOException {
- fInputStream.mark(readAheadLimit);
+ fInputStream.mark(readAheadLimit);
} // mark(int)
/**
Modified: tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java?rev=978865&r1=978864&r2=978865&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java (original)
+++ tomcat/trunk/java/org/apache/jasper/xmlparser/UTF8Reader.java Sat Jul 24 13:03:11 2010
@@ -545,7 +545,7 @@ public class UTF8Reader
*/
@Override
public boolean ready() throws IOException {
- return false;
+ return false;
} // ready()
/**
@@ -553,7 +553,7 @@ public class UTF8Reader
*/
@Override
public boolean markSupported() {
- return false;
+ return false;
} // markSupported()
/**
@@ -571,9 +571,9 @@ public class UTF8Reader
*/
@Override
public void mark(int readAheadLimit) throws IOException {
- throw new IOException(
+ throw new IOException(
Localizer.getMessage("jsp.error.xml.operationNotSupported",
- "mark()", "UTF-8"));
+ "mark()", "UTF-8"));
}
/**
@@ -617,8 +617,8 @@ public class UTF8Reader
throw new UTFDataFormatException(
Localizer.getMessage("jsp.error.xml.expectedByte",
- Integer.toString(position),
- Integer.toString(count)));
+ Integer.toString(position),
+ Integer.toString(count)));
}
@@ -628,8 +628,8 @@ public class UTF8Reader
throw new UTFDataFormatException(
Localizer.getMessage("jsp.error.xml.invalidByte",
- Integer.toString(position),
- Integer.toString(count)));
+ Integer.toString(position),
+ Integer.toString(count)));
}
/** Throws an exception for invalid surrogate bits. */
@@ -637,7 +637,7 @@ public class UTF8Reader
throw new UTFDataFormatException(
Localizer.getMessage("jsp.error.xml.invalidHighSurrogate",
- Integer.toHexString(uuuuu)));
+ Integer.toHexString(uuuuu)));
}
} // class UTF8Reader
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org