JBossWeb SVN: r1787 - in branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794: src/share/classes/org/apache/catalina/connector and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: mmusaji
Date: 2011-07-20 11:00:36 -0400 (Wed, 20 Jul 2011)
New Revision: 1787
Modified:
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/javax/el/BeanELResolver.java
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/catalina/connector/Request.java
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/lang/ExpressionBuilder.java
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/util/ConcurrentCache.java
branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/xdocs/news/changelog.xml
Log:
Fix for [JBPAPP-6794]
Modified: branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/javax/el/BeanELResolver.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/javax/el/BeanELResolver.java 2011-07-20 12:29:40 UTC (rev 1786)
+++ branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/javax/el/BeanELResolver.java 2011-07-20 15:00:36 UTC (rev 1787)
@@ -25,6 +25,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
@@ -34,10 +36,28 @@
public class BeanELResolver extends ELResolver {
+ private static final int CACHE_SIZE;
+ private static final String CACHE_SIZE_PROP =
+ "org.apache.el.BeanELResolver.CACHE_SIZE";
+
+ static {
+ if (System.getSecurityManager() == null) {
+ CACHE_SIZE = Integer.parseInt(
+ System.getProperty(CACHE_SIZE_PROP, "1000"));
+ } else {
+ CACHE_SIZE = AccessController.doPrivileged(
+ new PrivilegedAction<Integer>() {
+ public Integer run() {
+ return Integer.valueOf(
+ System.getProperty(CACHE_SIZE_PROP, "1000"));
+ }
+ }).intValue();
+ }
+ }
private final boolean readOnly;
- private final ConcurrentCache<String, BeanProperties> cache = new ConcurrentCache<String, BeanProperties>(
- 1000);
+ private final ConcurrentCache<String, BeanProperties> cache =
+ new ConcurrentCache<String, BeanProperties>(CACHE_SIZE);
public BeanELResolver() {
this.readOnly = false;
@@ -312,7 +332,9 @@
public V get(K key) {
V value = this.eden.get(key);
if (value == null) {
+ synchronized (longterm) {
value = this.longterm.get(key);
+ }
if (value != null) {
this.eden.put(key, value);
}
@@ -322,7 +344,9 @@
public void put(K key, V value) {
if (this.eden.size() >= this.size) {
+ synchronized (longterm) {
this.longterm.putAll(this.eden);
+ }
this.eden.clear();
}
this.eden.put(key, value);
Modified: branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/catalina/connector/Request.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/catalina/connector/Request.java 2011-07-20 12:29:40 UTC (rev 1786)
+++ branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/catalina/connector/Request.java 2011-07-20 15:00:36 UTC (rev 1787)
@@ -1341,6 +1341,9 @@
return;
}
+ if (context == null)
+ return;
+
// Notify interested application event listeners
Object listeners[] = context.getApplicationEventListeners();
if ((listeners == null) || (listeners.length == 0))
@@ -1410,6 +1413,9 @@
if (name.startsWith("org.apache.tomcat.")) {
coyoteRequest.setAttribute(name, value);
}
+
+ if (context == null)
+ return;
// Notify interested application event listeners
Object listeners[] = context.getApplicationEventListeners();
Modified: branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/lang/ExpressionBuilder.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/lang/ExpressionBuilder.java 2011-07-20 12:29:40 UTC (rev 1786)
+++ branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/lang/ExpressionBuilder.java 2011-07-20 15:00:36 UTC (rev 1787)
@@ -46,11 +46,11 @@
/**
* @author Jacob Hookom [jacob(a)hookom.net]
- * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: markt $
+ * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author: remy.maucherat(a)jboss.com $
*/
public final class ExpressionBuilder implements NodeVisitor {
- private static final ConcurrentCache cache = new ConcurrentCache(5000);
+ private static final ConcurrentCache cache = new ConcurrentCache(10000);
private FunctionMapper fnMapper;
Modified: branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/util/ConcurrentCache.java
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/util/ConcurrentCache.java 2011-07-20 12:29:40 UTC (rev 1786)
+++ branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/src/share/classes/org/apache/el/util/ConcurrentCache.java 2011-07-20 15:00:36 UTC (rev 1787)
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.el.util;
import java.util.Map;
@@ -21,7 +37,9 @@
public V get(K k) {
V v = this.eden.get(k);
if (v == null) {
+ synchronized (longterm) {
v = this.longterm.get(k);
+ }
if (v != null) {
this.eden.put(k, v);
}
@@ -31,7 +49,9 @@
public void put(K k, V v) {
if (this.eden.size() >= size) {
+ synchronized (longterm) {
this.longterm.putAll(this.eden);
+ }
this.eden.clear();
}
this.eden.put(k, v);
Modified: branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/xdocs/news/changelog.xml
===================================================================
--- branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/xdocs/news/changelog.xml 2011-07-20 12:29:40 UTC (rev 1786)
+++ branches/JBOSSWEB_2_0_0_GA_CP08_JBPAPP-6794/xdocs/news/changelog.xml 2011-07-20 15:00:36 UTC (rev 1787)
@@ -12,6 +12,30 @@
</properties>
<body>
+<section name="JBoss Web 2.1.11.GA (remm)">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ <jira>148</jira>: Fix possible NPE on request.set/removeAttribute. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ <jboss-jira>JBPAPP-5293</jboss-jira>: ConcurrentModificationException in HandshakeCompletedNotify-Thread. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <jira>185</jira>: Fix cache thread safety issue for EL expression builder.
+ Patch submitted by Takayoshi Kimura. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
<section name="JBossWeb 1.0">
<subsection name="General">
13 years, 5 months
JBossWeb SVN: r1786 - trunk/java/org/apache/tomcat/jni.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-07-20 08:29:40 -0400 (Wed, 20 Jul 2011)
New Revision: 1786
Modified:
trunk/java/org/apache/tomcat/jni/LibraryLoader.java
Log:
use hpux/parisc2W for 64... W :D
Modified: trunk/java/org/apache/tomcat/jni/LibraryLoader.java
===================================================================
--- trunk/java/org/apache/tomcat/jni/LibraryLoader.java 2011-07-20 09:55:32 UTC (rev 1785)
+++ trunk/java/org/apache/tomcat/jni/LibraryLoader.java 2011-07-20 12:29:40 UTC (rev 1786)
@@ -83,9 +83,12 @@
if (arch.endsWith("86"))
cpu = "x86";
- else if (arch.startsWith("PA_RISC"))
- cpu = "parisc2";
- else if (arch.startsWith("IA64"))
+ else if (arch.startsWith("PA_RISC")) {
+ if (arch.endsWith("W")
+ cpu = "parisc2W";
+ else
+ cpu = "parisc2";
+ } else if (arch.startsWith("IA64"))
cpu = "i64";
else if (arch.equals("x86_64"))
cpu = "x64";
13 years, 5 months
JBossWeb SVN: r1785 - tags.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-07-20 05:55:32 -0400 (Wed, 20 Jul 2011)
New Revision: 1785
Added:
tags/JBOSSWEB_7_0_1_FINAL/
Log:
7.0.1 release.
13 years, 5 months
JBossWeb SVN: r1784 - trunk/webapps/docs.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-07-20 05:21:36 -0400 (Wed, 20 Jul 2011)
New Revision: 1784
Modified:
trunk/webapps/docs/changelog.xml
Log:
Move to the right section.
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-07-19 13:01:16 UTC (rev 1783)
+++ trunk/webapps/docs/changelog.xml 2011-07-20 09:21:36 UTC (rev 1784)
@@ -23,9 +23,6 @@
<jira>205</jira>: Filter out some generic callback events which are not
relevant for Servlet 3 async. (remm)
</fix>
- <fix>
- Arrange solaris and macosx native logic (jfclere)
- </fix>
</changelog>
</subsection>
<subsection name="Coyote">
@@ -36,6 +33,9 @@
<update>
Refactor sendfile as its own API, similar to sendError. (remm)
</update>
+ <fix>
+ Arrange solaris and macosx native logic (jfclere)
+ </fix>
</changelog>
</subsection>
</section>
13 years, 5 months
JBossWeb SVN: r1783 - trunk/webapps/docs.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-07-19 09:01:16 -0400 (Tue, 19 Jul 2011)
New Revision: 1783
Modified:
trunk/webapps/docs/changelog.xml
Log:
Add missing information for r1782
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-07-18 15:33:35 UTC (rev 1782)
+++ trunk/webapps/docs/changelog.xml 2011-07-19 13:01:16 UTC (rev 1783)
@@ -23,6 +23,9 @@
<jira>205</jira>: Filter out some generic callback events which are not
relevant for Servlet 3 async. (remm)
</fix>
+ <fix>
+ Arrange solaris and macosx native logic (jfclere)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
13 years, 5 months
JBossWeb SVN: r1782 - trunk/java/org/apache/tomcat/jni.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-07-18 11:33:35 -0400 (Mon, 18 Jul 2011)
New Revision: 1782
Modified:
trunk/java/org/apache/tomcat/jni/Library.properties
trunk/java/org/apache/tomcat/jni/LibraryLoader.java
Log:
Arrange solaris and macosx.
Modified: trunk/java/org/apache/tomcat/jni/Library.properties
===================================================================
--- trunk/java/org/apache/tomcat/jni/Library.properties 2011-07-13 16:31:38 UTC (rev 1781)
+++ trunk/java/org/apache/tomcat/jni/Library.properties 2011-07-18 15:33:35 UTC (rev 1782)
@@ -56,3 +56,12 @@
hpux.4=?libcrypto.sl
hpux.5=?libssl.sl
hpux.6=libtcnative-1.sl
+
+macosx.count=7
+macosx.0=libapr-1.dylib
+macosx.1=?libexpat.dylib
+macosx.2=?libaprutil-1.dylib
+macosx.3=?libz.dylib
+macosx.4=?libcrypto.dylib
+macosx.5=?libssl.dylib
+macosx.6=libtcnative-1.dylib
Modified: trunk/java/org/apache/tomcat/jni/LibraryLoader.java
===================================================================
--- trunk/java/org/apache/tomcat/jni/LibraryLoader.java 2011-07-13 16:31:38 UTC (rev 1781)
+++ trunk/java/org/apache/tomcat/jni/LibraryLoader.java 2011-07-18 15:33:35 UTC (rev 1782)
@@ -54,6 +54,14 @@
else if (name.equals("AIX"))
platform = "aix";
+ return platform;
+ }
+
+ public static String getDefaultPlatformNameVersion()
+ {
+ String platform = getDefaultPlatformName();
+
+
if (platform.equals("solaris")) {
// Add the version...
String version = System.getProperty("os.version");
@@ -90,7 +98,7 @@
public static String getDefaultLibraryPath()
{
- String name = getDefaultPlatformName();
+ String name = getDefaultPlatformNameVersion();
String arch = getDefaultPlatformCpu();
return name + File.separator + arch;
@@ -136,7 +144,7 @@
count = Integer.parseInt(props.getProperty(name + ".count"));
}
catch (Throwable t) {
- throw new UnsatisfiedLinkError("Can't use Library.properties");
+ throw new UnsatisfiedLinkError("Can't use Library.properties for: " + name);
}
for (int i = 0; i < count; i++) {
boolean optional = false;
13 years, 5 months
JBossWeb SVN: r1781 - in trunk: java/org/apache/catalina/servlets and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-07-13 12:31:38 -0400 (Wed, 13 Jul 2011)
New Revision: 1781
Modified:
trunk/java/org/apache/catalina/connector/LocalStrings.properties
trunk/java/org/apache/catalina/connector/OutputBuffer.java
trunk/java/org/apache/catalina/connector/Request.java
trunk/java/org/apache/catalina/connector/RequestFacade.java
trunk/java/org/apache/catalina/connector/Response.java
trunk/java/org/apache/catalina/connector/ResponseFacade.java
trunk/java/org/apache/catalina/servlets/DefaultServlet.java
trunk/java/org/apache/coyote/Request.java
trunk/java/org/apache/coyote/Response.java
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/webapps/docs/changelog.xml
Log:
- Refactor sendfile as its own custom API, similar to sendError and sendRedirect.
Modified: trunk/java/org/apache/catalina/connector/LocalStrings.properties
===================================================================
--- trunk/java/org/apache/catalina/connector/LocalStrings.properties 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/catalina/connector/LocalStrings.properties 2011-07-13 16:31:38 UTC (rev 1781)
@@ -36,6 +36,9 @@
coyoteResponse.sendError.ise=Cannot call sendError() after the response has been committed
coyoteResponse.sendRedirect.ise=Cannot call sendRedirect() after the response has been committed
coyoteResponse.setBufferSize.ise=Cannot change buffer size after data has been written
+coyoteResponse.sendFile.ise=Cannot call sendFile() after the response has been committed
+coyoteResponse.sendFile.no=Sendfile is disabled
+coyoteResponse.sendFile.path=Invalid path
#
# CoyoteRequest
Modified: trunk/java/org/apache/catalina/connector/OutputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/OutputBuffer.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/catalina/connector/OutputBuffer.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -602,6 +602,10 @@
return -1;
}
+ public void setBytesWritten(long bytesWritten) {
+ this.bytesWritten = bytesWritten;
+ }
+
public int getCharsWritten() {
if (charsWritten < Integer.MAX_VALUE) {
return (int) charsWritten;
Modified: trunk/java/org/apache/catalina/connector/Request.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Request.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/catalina/connector/Request.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -3301,6 +3301,11 @@
}
+ public boolean hasSendfile() {
+ return coyoteRequest.hasSendfile();
+ }
+
+
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append(sm.getString("coyoteRequest.servletStack", Thread.currentThread().getName()));
Modified: trunk/java/org/apache/catalina/connector/RequestFacade.java
===================================================================
--- trunk/java/org/apache/catalina/connector/RequestFacade.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/catalina/connector/RequestFacade.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -1112,4 +1112,13 @@
return request.getParts();
}
+ public boolean hasSendfile() {
+ if (request == null) {
+ throw new IllegalStateException(
+ sm.getString("requestFacade.nullRequest"));
+ }
+
+ return request.hasSendfile();
+ }
+
}
Modified: trunk/java/org/apache/catalina/connector/Response.java
===================================================================
--- trunk/java/org/apache/catalina/connector/Response.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/catalina/connector/Response.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -19,6 +19,7 @@
package org.apache.catalina.connector;
+import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
@@ -46,6 +47,8 @@
import org.apache.catalina.util.CharsetMapper;
import org.apache.catalina.util.DateTool;
import org.apache.catalina.util.StringManager;
+import org.apache.naming.resources.CacheEntry;
+import org.apache.naming.resources.ProxyDirContext;
import org.apache.tomcat.util.buf.CharChunk;
import org.apache.tomcat.util.buf.UEncoder;
import org.apache.tomcat.util.http.FastHttpDateFormat;
@@ -1338,6 +1341,66 @@
}
+ public void sendFile(String path, String absolutePath, long start, long end) {
+
+ if (isCommitted())
+ throw new IllegalStateException
+ (sm.getString("coyoteResponse.sendFile.ise"));
+
+ // Ignore any call from an included servlet
+ if (included)
+ return;
+
+ if (!request.hasSendfile())
+ throw new IllegalStateException(sm.getString("coyoteResponse.sendFile.no"));
+
+ if (Globals.IS_SECURITY_ENABLED) {
+ if (path != null) {
+ CacheEntry cacheEntry =
+ ((ProxyDirContext) request.getContext().getResources()).lookupCache(path);
+ if (cacheEntry.exists && cacheEntry.resource != null && (end > start)
+ && cacheEntry.attributes.getCanonicalPath() != null) {
+ coyoteResponse.setSendfilePath(cacheEntry.attributes.getCanonicalPath());
+ coyoteResponse.setSendfileStart(start);
+ coyoteResponse.setSendfileEnd(end);
+ }
+ } else if (absolutePath != null) {
+ String canonicalPath = null;
+ try {
+ canonicalPath = new File(absolutePath).getCanonicalPath();
+ } catch (IOException e) {
+ throw new IllegalArgumentException(sm.getString("coyoteResponse.sendFile.path"));
+ }
+ System.getSecurityManager().checkRead(canonicalPath);
+ coyoteResponse.setSendfilePath(absolutePath);
+ coyoteResponse.setSendfileStart(start);
+ coyoteResponse.setSendfileEnd(end);
+ }
+ } else {
+ if (absolutePath != null) {
+ coyoteResponse.setSendfilePath(absolutePath);
+ coyoteResponse.setSendfileStart(start);
+ coyoteResponse.setSendfileEnd(end);
+ } else {
+ CacheEntry cacheEntry =
+ ((ProxyDirContext) request.getContext().getResources()).lookupCache(path);
+ if (cacheEntry.exists && cacheEntry.resource != null && (end > start)
+ && cacheEntry.attributes.getCanonicalPath() != null) {
+ coyoteResponse.setSendfilePath(cacheEntry.attributes.getCanonicalPath());
+ coyoteResponse.setSendfileStart(start);
+ coyoteResponse.setSendfileEnd(end);
+ }
+ }
+ }
+
+ outputBuffer.setBytesWritten(end - start);
+
+ // Cause the response to be finished (from the application perspective)
+ setSuspended(true);
+
+ }
+
+
/**
* Set the specified date header to the specified value.
*
Modified: trunk/java/org/apache/catalina/connector/ResponseFacade.java
===================================================================
--- trunk/java/org/apache/catalina/connector/ResponseFacade.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/catalina/connector/ResponseFacade.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -442,7 +442,18 @@
}
+ public void sendFile(String path, String absolutePath, long start, long end) {
+
+ if (isCommitted())
+ throw new IllegalStateException
+ (/*sm.getString("responseBase.reset.ise")*/);
+ response.setAppCommitted(true);
+
+ response.sendFile(path, absolutePath, start, end);
+
+ }
+
public void setDateHeader(String name, long date) {
if (isCommitted())
Modified: trunk/java/org/apache/catalina/servlets/DefaultServlet.java
===================================================================
--- trunk/java/org/apache/catalina/servlets/DefaultServlet.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/catalina/servlets/DefaultServlet.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -59,6 +59,8 @@
import javax.xml.transform.stream.StreamSource;
import org.apache.catalina.Globals;
+import org.apache.catalina.connector.RequestFacade;
+import org.apache.catalina.connector.ResponseFacade;
import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.ServerInfo;
import org.apache.catalina.util.StringManager;
@@ -805,7 +807,7 @@
// Silent catch
}
if (ostream != null) {
- if (!checkSendfile(request, response, cacheEntry, contentLength, null))
+ if (!checkSendfile(request, response, path, cacheEntry, contentLength, null))
copy(cacheEntry, renderResult, ostream);
} else {
copy(cacheEntry, renderResult, writer);
@@ -850,7 +852,7 @@
// Silent catch
}
if (ostream != null) {
- if (!checkSendfile(request, response, cacheEntry, range.end - range.start + 1, range))
+ if (!checkSendfile(request, response, path, cacheEntry, range.end - range.start + 1, range))
copy(cacheEntry, ostream, range);
} else {
copy(cacheEntry, writer, range);
@@ -1494,24 +1496,21 @@
*/
protected boolean checkSendfile(HttpServletRequest request,
HttpServletResponse response,
- CacheEntry entry,
+ String path, CacheEntry entry,
long length, Range range) {
if ((sendfileSize > 0)
&& (entry.resource != null)
&& ((length > sendfileSize) || (entry.resource.getContent() == null))
&& (entry.attributes.getCanonicalPath() != null)
- && (Boolean.TRUE == request.getAttribute("org.apache.tomcat.sendfile.support"))
&& (request.getClass().getName().equals("org.apache.catalina.connector.RequestFacade"))
- && (response.getClass().getName().equals("org.apache.catalina.connector.ResponseFacade"))) {
- request.setAttribute("org.apache.tomcat.sendfile.filename", entry.attributes.getCanonicalPath());
+ && (response.getClass().getName().equals("org.apache.catalina.connector.ResponseFacade"))
+ && ((RequestFacade) request).hasSendfile()) {
+ ResponseFacade responseFacade = (ResponseFacade) response;
if (range == null) {
- request.setAttribute("org.apache.tomcat.sendfile.start", new Long(0L));
- request.setAttribute("org.apache.tomcat.sendfile.end", new Long(length));
+ responseFacade.sendFile(path, entry.attributes.getCanonicalPath(), 0, length);
} else {
- request.setAttribute("org.apache.tomcat.sendfile.start", new Long(range.start));
- request.setAttribute("org.apache.tomcat.sendfile.end", new Long(range.end + 1));
+ responseFacade.sendFile(path, entry.attributes.getCanonicalPath(), range.start, range.end + 1);
}
- request.setAttribute("org.apache.tomcat.sendfile.token", this);
return true;
} else {
return false;
Modified: trunk/java/org/apache/coyote/Request.java
===================================================================
--- trunk/java/org/apache/coyote/Request.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/coyote/Request.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -144,6 +144,7 @@
// Time of the request - usefull to avoid repeated calls to System.currentTime
private long startTime = 0L;
private int available = 0;
+ private boolean sendfile = false;
private RequestInfo reqProcessorMX=new RequestInfo(this);
// ------------------------------------------------------------- Properties
@@ -170,6 +171,16 @@
return urlDecoder;
}
+ public boolean hasSendfile() {
+ return sendfile;
+ }
+
+
+ public void setSendfile(boolean sendfile) {
+ this.sendfile = sendfile;
+ }
+
+
// -------------------- Request data --------------------
Modified: trunk/java/org/apache/coyote/Response.java
===================================================================
--- trunk/java/org/apache/coyote/Response.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/coyote/Response.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -127,6 +127,10 @@
protected int lastWrite = 1;
protected boolean flushLeftovers = true;
+ protected String sendfilePath = null;
+ protected long sendfileStart = 0;
+ protected long sendfileEnd = 0;
+
// ------------------------------------------------------------- Properties
public Request getRequest() {
@@ -557,7 +561,30 @@
return contentLength;
}
+ public String getSendfilePath() {
+ return sendfilePath;
+ }
+ public void setSendfilePath(String sendfilePath) {
+ this.sendfilePath = sendfilePath;
+ }
+
+ public long getSendfileStart() {
+ return sendfileStart;
+ }
+
+ public void setSendfileStart(long sendfileStart) {
+ this.sendfileStart = sendfileStart;
+ }
+
+ public long getSendfileEnd() {
+ return sendfileEnd;
+ }
+
+ public void setSendfileEnd(long sendfileEnd) {
+ this.sendfileEnd = sendfileEnd;
+ }
+
/**
* Write a chunk of bytes.
*/
@@ -585,6 +612,8 @@
errorURI = null;
headers.clear();
+ sendfilePath = null;
+
// update counters
lastWrite = 1;
bytesWritten=0;
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2011-07-13 16:31:38 UTC (rev 1781)
@@ -94,13 +94,17 @@
request = new Request();
inputBuffer = new InternalAprInputBuffer(request, headerBufferSize, endpoint);
request.setInputBuffer(inputBuffer);
+ if (endpoint.getUseSendfile()) {
+ request.setSendfile(true);
+ }
response = new Response();
response.setHook(this);
outputBuffer = new InternalAprOutputBuffer(response, headerBufferSize, endpoint);
response.setOutputBuffer(outputBuffer);
+
request.setResponse(response);
-
+
ssl = endpoint.isSSLEnabled();
initializeFilters();
@@ -1495,11 +1499,6 @@
contentDelimitation = true;
}
- // Advertise sendfile support through a request attribute
- if (endpoint.getUseSendfile()) {
- request.setAttribute("org.apache.tomcat.sendfile.support", Boolean.TRUE);
- }
-
}
@@ -1672,20 +1671,15 @@
}
// Sendfile support
- if (endpoint.getUseSendfile()) {
- String fileName = (String) request.getAttribute("org.apache.tomcat.sendfile.filename");
- if (fileName != null) {
- // No entity body sent here
- outputBuffer.addActiveFilter
- (outputFilters[Constants.VOID_FILTER]);
- contentDelimitation = true;
- sendfileData = new AprEndpoint.SendfileData();
- sendfileData.fileName = fileName;
- sendfileData.start =
- ((Long) request.getAttribute("org.apache.tomcat.sendfile.start")).longValue();
- sendfileData.end =
- ((Long) request.getAttribute("org.apache.tomcat.sendfile.end")).longValue();
- }
+ if (response.getSendfilePath() != null) {
+ // No entity body sent here
+ outputBuffer.addActiveFilter
+ (outputFilters[Constants.VOID_FILTER]);
+ contentDelimitation = true;
+ sendfileData = new AprEndpoint.SendfileData();
+ sendfileData.fileName = response.getSendfilePath();
+ sendfileData.start = response.getSendfileStart();
+ sendfileData.end = response.getSendfileEnd();
}
// Check for compression
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-07-13 15:43:16 UTC (rev 1780)
+++ trunk/webapps/docs/changelog.xml 2011-07-13 16:31:38 UTC (rev 1781)
@@ -30,6 +30,9 @@
<fix>
Fix handling of sendfile errors when calling add. (markt)
</fix>
+ <update>
+ Refactor sendfile as its own API, similar to sendError. (remm)
+ </update>
</changelog>
</subsection>
</section>
13 years, 5 months
JBossWeb SVN: r1780 - trunk/webapps/docs.
by jbossweb-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2011-07-13 11:43:16 -0400 (Wed, 13 Jul 2011)
New Revision: 1780
Modified:
trunk/webapps/docs/deployer-howto.xml
Log:
Arrange deployer part.
Modified: trunk/webapps/docs/deployer-howto.xml
===================================================================
--- trunk/webapps/docs/deployer-howto.xml 2011-07-12 10:25:24 UTC (rev 1779)
+++ trunk/webapps/docs/deployer-howto.xml 2011-07-13 15:43:16 UTC (rev 1780)
@@ -8,6 +8,7 @@
<properties>
<author>Allistair Crossley</author>
+ <author>Jean-Frederic Clere</author>
<title>JBoss Web Web Application Deployment</title>
</properties>
@@ -39,53 +40,21 @@
<ul>
<li>Statically; the web application is setup before JBoss Web is started</li>
<li>
- Dynamically; in conjunction with the JBoss Web Manager web application or
- manipulating already deployed web applications
+ Dynamically; Using the command line or the Web Management Interface of AS7
+ or manipulating already deployed web applications
</li>
</ul>
</p>
- <p>
- The JBoss Web Manager is a tool that allows URL-based web application
- deployment features. There is also a tool called the Client Deployer,
- which is a command shell based script that interacts with the JBoss Web
- Manager but provides additional functionality such as compiling and
- validating web applications as well as packaging web application into
- web application resource (WAR) files.
- </p>
</section>
<section name="Installation">
<p>
- There is no installation required for static deployment of web
+ There is no installation required for static or dynamic deployment of web
applications as this is provided out of the box by JBoss Web. Nor is any
installation required for deployment functions with the JBoss Web Manager,
although some configuration is required as detailed in the
- JBoss Web Manager manual. An installation is however required if you wish
- to use the JBoss Web Client Deployer (TCD).
+ JBoss Web Manager manual.
</p>
- <p>
- The TCD is not packaged with the JBoss Web core
- distribution, and must therefore be downloaded separately from
- the Downloads area. The download is usually labelled
- <i>jbossweb-2.1.x-deployer</i>.
- </p>
- <p>
- TCD has prerequisites of Apache Ant 1.6.2+ and a Java installation.
- Your environment should define an ANT_HOME environment value pointing to
- the root of your Ant installation, and a JAVA_HOME value pointing to
- your Java installation. Additionally, you should ensure Ant's ant
- command, and the Java javac compiler command run from the command shell
- that your operating system provides.
- </p>
- <ol>
- <li>Download the TCD distribution</li>
- <li>
- The TCD package need not be extracted into any existing JBoss Web
- installation, it can be extracted to any location.
- </li>
- <li>Read Using the <a href="#Deploying using the Client Deployer Package">
- JBoss Web Client Deployer</a></li>
- </ol>
</section>
<section name="A word on Contexts">
@@ -98,26 +67,8 @@
In order to configure a Context within JBoss Web a <i>Context Descriptor</i>
is required. A Context Descriptor is simply an XML file that contains
JBoss Web related configuration for a Context, e.g naming resources or
- session manager configuration. In earlier versions of
- JBoss Web the content of a Context Descriptor configuration was often stored within
- JBoss Web's primary configuration file <i>server.xml</i> but this is now
- discouraged (although it currently still works).
+ session manager configuration.
</p>
- <p>
- Context Descriptors not only help JBoss Web to know how to configure
- Contexts but other tools such as the JBoss Web Manager and TDC often use
- these Context Descriptors to perform their roles properly.
- </p>
- <p>
- The locations for Context Descriptors are;
- <ol>
- <li>$CATALINA_HOME/conf/[enginename]/[hostname]/context.xml</li>
- <li>$CATALINA_HOME/webapps/[webappname]/META-INF/context.xml</li>
- </ol>
- Files in (1) are named [webappname].xml but files in (2) are named
- context.xml. If a Context Descriptor is not provided for a Context,
- JBoss Web configures the Context using default values.
- </p>
</section>
<section name="Deployment on JBoss Web startup">
@@ -131,30 +82,10 @@
location, or a compressed web application resource .WAR file.
</p>
<p>
- The web applications present in the location specified by the Host's
- (default Host is "localhost") <code>appBase</code> attribute (default
- appBase is "$CATALINA_HOME/webapps") will be deployed on JBoss Web startup
- only if the Host's <code>deployOnStartup</code> attribute is "true".
+ The web applications present in the location
+ ${jboss.server.base.dir}/standalone/deployments/
+ will be deployed on JBoss Web startup.
</p>
- <p>
- The following deployment sequence will occur on JBoss Web startup in that
- case:
- </p>
- <ol>
- <li>Any Context Descriptors will be deployed first.</li>
- <li>
- Exploded web applications not referenced by any Context
- Descriptor will then be deployed. If they have an associated
- .WAR file in the appBase and it is newer than the exploded web application,
- the exploded directory will be removed and the webapp will be
- redeployed from the .WAR
- </li>
- <li>.WAR files will be deployed</li>
- </ol>
- <p>
- Note again that for each deployed web application, a
- Context Descriptor will be created <i>unless one exists already</i>.
- </p>
</section>
<section name="Deploying on a running JBoss Web server">
@@ -162,167 +93,73 @@
It is possible to deploy web applications to a running JBoss Web server.
</p>
<p>
- If the Host <code>autoDeploy</code> attribute is "true", the Host will
- attempt to deploy and update web applications dynamically, as needed,
- for example if a new .WAR is dropped into the <code>appBase</code>.
- For this to work, the Host needs to have background processing
- enabled which is the default configuration.
+ Depending on the <code>deployment-scanner</code> configuration
+ the application web are deployed dynamicly and/or
+ updated, the <code>deployment-scanner</code> is a sub system:
+<source>
+[standalone@localhost:9999 /] ./subsystem=deployment-scanner:read-resource(recursive=true)
+{
+ "outcome" => "success",
+ "result" => {"scanner" => {"default" => {
+ "auto-deploy-exploded" => true,
+ "auto-deploy-zipped" => true,
+ "deployment-timeout" => 60L,
+ "name" => "default",
+ "path" => "deployments",
+ "relative-to" => "jboss.server.base.dir",
+ "scan-enabled" => true,
+ "scan-interval" => 5000
+ }}}
+}
+</source>
+ </p><p>
+ For example if a new .WAR is dropped into the <code>${jboss.server.base.dir}/standalone/deployments/</code>
+ directory it will be deployed automaticly.
</p>
-
- <p>
- <code>autoDeploy</code> set to "true" and a running JBoss Web allows for:
- </p>
+
+ <p>The webapps are deployed or redeployed in the following cases:</p>
<ul>
- <li>Deployment of .WAR files copied into the Host <code>appBase</code>.</li>
+ <li>Deployment of .WAR files copied into the <code>${jboss.server.base.dir}/standalone/deployments/</code> directory.
+ </li>
<li>
- Deployment of exploded web applications which are
- copied into the Host <code>appBase</code>.
+ Deployment of exploded web applications which that are copied there too.
</li>
<li>
Re-deployment of a web application which has already been deployed from
- a .WAR when the new .WAR is provided. In this case the exploded
- web application is removed, and the .WAR is expanded again.
- Note that the explosion will not occur if the Host is configured
- so that .WARs are not exploded with a <code>unpackWARs</code>
- attribute set to "false", in which case the web application
- will be simply redeployed as a compressed archive.
+ a .WAR when the new .WAR is provided.
</li>
<li>
Re-deployment of a web application if the /WEB-INF/web.xml file (or any
other resource defined as a WatchedResource) is updated.
</li>
<li>
- Re-deployment of a web application if the Context Descriptor file from which
- the web application has been deployed is updated.
+ Undeployment of a web application if the .WAR file is removed of the
+ exploded files are removed.
</li>
- <li>
- Re-deployment of a web application if a Context Descriptor file (with a
- filename corresponding to the Context path of the previously deployed
- web application) is added to the
- <code>$CATALINA_HOME/conf/[enginename]/[hostname]/</code>
- directory.
- </li>
- <li>
- Undeployment of a web application if its document base (docBase)
- is deleted. Note that on Windows, this assumes that anti-locking
- features (see Context configuration) are enabled, otherwise it is not
- possible to delete the resources of a running web application.
- </li>
</ul>
- <p>
- Note that web application reloading can also be configured in the loader, in which
- case loaded classes will be tracked for changes.
- </p>
</section>
- <section name="Deploying using the JBoss Web Manager">
+ <section name="Deploying using the command line">
<p>
- The JBoss Web Manager is covered in its <a href="manager-howto.html">own manual page</a>.
+ Use the command line:
+ <code>${jboss.server.base.dir}/bin/jboss-admin.sh</code>
+ For example:
+ <source>
+ bin/jboss-admin.sh
+ You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
+ [disconnected /] connect
+ Connected to standalone controller at localhost:9999
+ [standalone@localhost:9999 /] deploy /home/jfclere/jbossweb_sandbox/webapps/myapp.war
+ 'myapp.war' deployed successfully.
+ </source>
+ To undeploy:
+ <source>
+ [standalone@localhost:9999 /] undeploy myapp.war
+ Successfully undeployed myapp.war.
+ </source>
</p>
</section>
- <section name="Deploying using the Client Deployer Package">
- <p>
- Finally, deployment of web application may be achieved using the
- JBoss Web Client Deployer. This is a package which can be used to
- validate, compile, compress to .WAR, and deploy web applications to
- production or development JBoss Web servers. It should be noted that this feature
- uses the JBoss Web Manager and as such the target JBoss Web server should be
- running.
- </p>
-
- <p>
- It is assumed the user will be familar with Apache Ant for using the TCD.
- Apache Ant is a scripted build tool. The TCD comes pre-packaged with a
- build script to use. Only a modest understanding of Apache Ant is
- required (installation as listed earlier in this page, and familiarity
- with using the operating system command shell and configuring
- environment variables).
- </p>
-
- <p>
- The TCD includes Ant tasks, the Jasper page compiler for JSP compilation
- before deployment, as well as a task which
- validates the web application Context Descriptor. The validator task (class
- <code>org.apache.catalina.ant.ValidatorTask</code>) allows only one parameter:
- the base path of an exploded web application.
- </p>
-
- <p>
- The TCD uses an exploded web application as input (see the list of the
- properties used below). A web application that is programatically
- deployed with the deployer may include a Context Desciptor in
- <code>/META-INF/context.xml</code>.
- </p>
-
- <p>
- The TCD includes a ready-to-use Ant script, with the following targets:
- </p>
- <ul>
- <li>
- <code>compile</code> (default): Compile and validate the web
- application. This can be used standalone, and does not need a running
- JBoss Web server. The compiled application will only run on the associated
- JBoss Web server release, and is not guaranteed to work on another
- JBoss Web release, as the code generated by Jasper depends on its runtime
- component. It should also be noted that this target will also compile
- automatically any Java source file located in the
- <code>/WEB-INF/classes</code> folder of the web application.</li>
- <li>
- <code>deploy</code>: Deploy a web application (compiled or not) to
- a JBoss Web server.
- </li>
- <li><code>undeploy</code>: Undeploy a web application</li>
- <li><code>start</code>: Start web application</li>
- <li><code>reload</code>: Reload web application</li>
- <li><code>stop</code>: Stop web application</li>
- </ul>
-
- <p>
- In order for the deployment to be configured, create a file
- called <code>deployer.properties</code> in the TCD installation
- directory root. In this file, add the following name=value pairs per
- line:
- </p>
-
- <p>
- Additionally, you will need to ensure that a user has been
- setup for the target JBoss Web Manager (which TCD uses) otherwise the TCD
- will not authenticate with the JBoss Web Manager and the deployment will
- fail. To do this, see the JBoss Web Manager page.
- </p>
-
- <ul>
- <li>
- <code>build</code>: The build folder used will be, by default,
- <code>${build}/webapp/${path}</code>. After the end of the execution
- of the <code>compile</code> target, the web application .WAR will be
- located at <code>${build}/webapp/${path}.war</code>.
- </li>
- <li>
- <code>webapp</code>: The directory containing the exploded web application
- which will be compiled and validated. By default, the folder is
- <code>myapp</code>.
- </li>
- <li>
- <code>path</code>: Deployed context path of the web application,
- by default <code>/myapp</code>.
- </li>
- <li>
- <code>url</code>: Absolute URL to the JBoss Web Manager web application of a
- running JBoss Web server, which will be used to deploy and undeploy the
- web application. By default, the deployer will attempt to access
- a JBoss Web instance running on localhost, at
- <code>http://localhost:8080/manager</code>.
- </li>
- <li>
- <code>username</code>: JBoss Web Manager username (user should have a role of
- manager)
- </li>
- <li><code>password</code>: JBoss Web Manager password.</li>
- </ul>
- </section>
-
</body>
</document>
13 years, 5 months
JBossWeb SVN: r1779 - in trunk: java/org/apache/tomcat/util/net and 1 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-07-12 06:25:24 -0400 (Tue, 12 Jul 2011)
New Revision: 1779
Modified:
trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
trunk/webapps/docs/changelog.xml
Log:
- Fix double close when a sendfile error occurs.
Modified: trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2011-07-11 13:39:07 UTC (rev 1778)
+++ trunk/java/org/apache/coyote/http11/Http11AprProcessor.java 2011-07-12 10:25:24 UTC (rev 1779)
@@ -938,7 +938,11 @@
sendfileData.socket = socket;
sendfileData.keepAlive = keepAlive && !pipelined;
if (!endpoint.getSendfile().add(sendfileData)) {
- openSocket = true;
+ if (sendfileData.socket == 0) {
+ error = true;
+ } else {
+ openSocket = true;
+ }
break;
}
}
Modified: trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2011-07-11 13:39:07 UTC (rev 1778)
+++ trunk/java/org/apache/tomcat/util/net/AprEndpoint.java 2011-07-12 10:25:24 UTC (rev 1779)
@@ -2208,7 +2208,7 @@
data.pos, data.end - data.pos, 0);
if (nw < 0) {
if (!(-nw == Status.EAGAIN)) {
- Socket.destroy(data.socket);
+ Pool.destroy(data.fdpool);
data.socket = 0;
return false;
} else {
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2011-07-11 13:39:07 UTC (rev 1778)
+++ trunk/webapps/docs/changelog.xml 2011-07-12 10:25:24 UTC (rev 1779)
@@ -16,6 +16,24 @@
<body>
+<section name="JBoss Web 7.0.1.Final (remm)">
+ <subsection name="Catalina">
+ <changelog>
+ <fix>
+ <jira>205</jira>: Filter out some generic callback events which are not
+ relevant for Servlet 3 async. (remm)
+ </fix>
+ </changelog>
+ </subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ Fix handling of sendfile errors when calling add. (markt)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 7.0.0.Final (remm)">
<subsection name="Coyote">
<changelog>
13 years, 5 months
JBossWeb SVN: r1778 - branches/2.1.x/java/org/apache/catalina/authenticator.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2011-07-11 09:39:07 -0400 (Mon, 11 Jul 2011)
New Revision: 1778
Modified:
branches/2.1.x/java/org/apache/catalina/authenticator/SingleSignOnEntry.java
Log:
- Experiment with allowing to reauthenticate if the username and password are available (JBPAPP-6724).
This is not fully accurate (it is allowed that there's a null password), but would mostly work.
Modified: branches/2.1.x/java/org/apache/catalina/authenticator/SingleSignOnEntry.java
===================================================================
--- branches/2.1.x/java/org/apache/catalina/authenticator/SingleSignOnEntry.java 2011-07-08 15:19:03 UTC (rev 1777)
+++ branches/2.1.x/java/org/apache/catalina/authenticator/SingleSignOnEntry.java 2011-07-11 13:39:07 UTC (rev 1778)
@@ -184,7 +184,8 @@
this.password = password;
this.canReauthenticate =
(Constants.BASIC_METHOD.equals(authType)
- || Constants.FORM_METHOD.equals(authType));
+ || Constants.FORM_METHOD.equals(authType)
+ || (username != null && password != null));
}
}
13 years, 5 months