JBossWeb SVN: r2178 - branches/8.0.x/src/main/java/org/apache/catalina/core.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-03-25 12:18:31 -0400 (Mon, 25 Mar 2013)
New Revision: 2178
Modified:
branches/8.0.x/src/main/java/org/apache/catalina/core/ApplicationContext.java
Log:
Port trivial spec addition.
Modified: branches/8.0.x/src/main/java/org/apache/catalina/core/ApplicationContext.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/core/ApplicationContext.java 2013-03-20 17:30:48 UTC (rev 2177)
+++ branches/8.0.x/src/main/java/org/apache/catalina/core/ApplicationContext.java 2013-03-25 16:18:31 UTC (rev 2178)
@@ -1230,7 +1230,11 @@
context.addSecurityRole(role);
}
}
-
+
+ public String getVirtualServerName() {
+ return ((Host) context.getParent()).getName();
+ }
+
// -------------------------------------------------------- Package Methods
protected void checkListenerType(EventListener listener) {
11 years, 9 months
JBossWeb SVN: r2177 - in branches/8.0.x/src/main/java/org: apache/catalina/core and 3 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-03-20 13:30:48 -0400 (Wed, 20 Mar 2013)
New Revision: 2177
Modified:
branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteInputStream.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteOutputStream.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/HttpEventImpl.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/InputBuffer.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/OutputBuffer.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/Request.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/Response.java
branches/8.0.x/src/main/java/org/apache/catalina/core/StandardWrapperValve.java
branches/8.0.x/src/main/java/org/apache/coyote/ActionCode.java
branches/8.0.x/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java
branches/8.0.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
branches/8.0.x/src/main/java/org/jboss/web/CatalinaMessages.java
Log:
Start experimenting with 3.1.
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteInputStream.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteInputStream.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteInputStream.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -243,8 +243,8 @@
@Override
- public void setReadListener(ReadListener arg0) {
- // TODO Auto-generated method stub
+ public void setReadListener(ReadListener readListener) {
+ ib.setReadListener(readListener);
}
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteOutputStream.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteOutputStream.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteOutputStream.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -112,9 +112,8 @@
@Override
- public void setWriteListener(WriteListener arg0) {
- // TODO Auto-generated method stub
-
+ public void setWriteListener(WriteListener writeListener) {
+ ob.setWriteListener(writeListener);
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/HttpEventImpl.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/HttpEventImpl.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/HttpEventImpl.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -20,12 +20,15 @@
import java.io.IOException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.WebConnection;
import org.jboss.servlet.http.HttpEvent;
-public class HttpEventImpl implements HttpEvent {
+public class HttpEventImpl implements HttpEvent, WebConnection {
public HttpEventImpl(Request request, Response response) {
this.request = request;
@@ -85,6 +88,14 @@
return response.getResponse();
}
+ public ServletInputStream getInputStream() throws IOException {
+ return request.getInputStream();
+ }
+
+ public ServletOutputStream getOutputStream() throws IOException {
+ return response.getOutputStream();
+ }
+
public void setTimeout(int timeout) {
request.setTimeout(timeout);
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/InputBuffer.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/InputBuffer.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/InputBuffer.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -27,6 +27,8 @@
import java.util.HashMap;
import java.util.Locale;
+import javax.servlet.ReadListener;
+
import org.apache.catalina.security.SecurityUtil;
import org.apache.coyote.ActionCode;
import org.apache.coyote.Request;
@@ -143,6 +145,12 @@
private int size = -1;
+ /**
+ * Read listener.
+ */
+ private ReadListener readListener = null;
+
+
// ----------------------------------------------------------- Constructors
@@ -229,6 +237,7 @@
gotEnc = false;
enc = null;
+ readListener = null;
}
@@ -575,4 +584,16 @@
}
+ public ReadListener getReadListener() {
+ return readListener;
+ }
+
+ public void setReadListener(ReadListener readListener) {
+ if (this.readListener != null) {
+ throw MESSAGES.readListenerAlreadySet();
+ }
+ this.readListener = readListener;
+ coyoteRequest.action(ActionCode.ACTION_EVENT_READ_BEGIN, null);
+ }
+
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/OutputBuffer.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/OutputBuffer.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/OutputBuffer.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -18,6 +18,8 @@
package org.apache.catalina.connector;
+import static org.jboss.web.CatalinaMessages.MESSAGES;
+
import java.io.IOException;
import java.io.Writer;
import java.security.AccessController;
@@ -26,6 +28,8 @@
import java.util.HashMap;
import java.util.Locale;
+import javax.servlet.WriteListener;
+
import org.apache.coyote.ActionCode;
import org.apache.coyote.Response;
import org.apache.catalina.Globals;
@@ -148,6 +152,12 @@
private boolean suspended = false;
+ /**
+ * Write listener.
+ */
+ private WriteListener writeListener = null;
+
+
// ----------------------------------------------------------- Constructors
@@ -257,6 +267,7 @@
gotEnc = false;
enc = null;
+ writeListener = null;
}
@@ -662,5 +673,16 @@
return bb.getLimit();
}
+ public WriteListener getWriteListener() {
+ return writeListener;
+ }
+ public void setWriteListener(WriteListener writeListener) {
+ if (this.writeListener != null) {
+ throw MESSAGES.writeListenerAlreadySet();
+ }
+ this.writeListener = writeListener;
+ coyoteResponse.action(ActionCode.ACTION_EVENT_WRITE_BEGIN, null);
+ }
+
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/Request.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/Request.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/Request.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -49,6 +49,7 @@
import javax.servlet.AsyncEvent;
import javax.servlet.AsyncListener;
import javax.servlet.DispatcherType;
+import javax.servlet.ReadListener;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -94,9 +95,9 @@
import org.apache.tomcat.util.http.Parameters;
import org.apache.tomcat.util.http.ServerCookie;
import org.apache.tomcat.util.http.fileupload.FileItem;
-import org.apache.tomcat.util.http.fileupload.FileUploadException;
import org.apache.tomcat.util.http.fileupload.FileUploadBase.FileSizeLimitExceededException;
import org.apache.tomcat.util.http.fileupload.FileUploadBase.SizeLimitExceededException;
+import org.apache.tomcat.util.http.fileupload.FileUploadException;
import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory;
import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;
import org.apache.tomcat.util.http.mapper.MappingData;
@@ -488,6 +489,12 @@
protected LinkedList<AsyncListener> asyncListenerInstances = new LinkedList<AsyncListener>();
+ /**
+ * Upgrade handler.
+ */
+ protected HttpUpgradeHandler upgradeHandler = null;
+
+
// --------------------------------------------------------- Public Methods
@@ -519,6 +526,7 @@
event.clear();
event = null;
}
+ upgradeHandler = null;
sslAttributes = false;
asyncContext = null;
@@ -3312,14 +3320,34 @@
return sessionId;
}
+ @SuppressWarnings("unchecked")
@Override
- public <T extends HttpUpgradeHandler> T upgrade(Class<T> arg0)
+ public <T extends HttpUpgradeHandler> T upgrade(Class<T> upgradeHandlerClass)
throws IOException {
- // TODO Auto-generated method stub
- return null;
+ T ugradeHandler = null;
+ Throwable upgradeError = null;
+ try {
+ ugradeHandler = (T) context.getInstanceManager().newInstance(upgradeHandlerClass);
+ } catch (Throwable t) {
+ upgradeError = t;
+ }
+ if (ugradeHandler == null) {
+ throw new IOException(MESSAGES.upgradeError(), upgradeError);
+ }
+ response.sendUpgrade();
+ ugradeHandler.init(getEvent());
+ this.upgradeHandler = ugradeHandler;
+ return ugradeHandler;
}
+ public HttpUpgradeHandler getUpgradeHandler() {
+ return upgradeHandler;
+ }
+ public ReadListener getReadListener() {
+ return inputBuffer.getReadListener();
+ }
+
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("Current Servlet stack for thread ").append(Thread.currentThread().getName());
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/Response.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/Response.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/Response.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -40,6 +40,7 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.SessionTrackingMode;
+import javax.servlet.WriteListener;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;
@@ -1339,9 +1340,6 @@
if (!connector.hasIoEvents())
throw MESSAGES.cannotUpgradeWithoutEvents();
- if (!request.isEventMode() || request.getAsyncContext() != null)
- throw MESSAGES.cannotUpgradeWithoutEventServlet();
-
// Ignore any call from an included servlet
if (included)
return;
@@ -1360,9 +1358,6 @@
if (!connector.hasIoEvents())
throw MESSAGES.cannotUpgradeWithoutEvents();
- if (!request.isEventMode() || request.getAsyncContext() != null)
- throw MESSAGES.cannotUpgradeWithoutEventServlet();
-
// Ignore any call from an included servlet
if (included)
return;
@@ -1797,5 +1792,8 @@
}
-}
+ public WriteListener getWriteListener() {
+ return outputBuffer.getWriteListener();
+ }
+}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/core/StandardWrapperValve.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/core/StandardWrapperValve.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/catalina/core/StandardWrapperValve.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -509,8 +509,8 @@
if (event.getType() == EventType.END || event.getType() == EventType.ERROR
|| event.getType() == EventType.TIMEOUT) {
// Invoke the listeners with onComplete or onTimeout
- boolean timeout = (event.getType() == EventType.TIMEOUT) ? true : false;
- boolean error = (event.getType() == EventType.ERROR) ? true : false;
+ boolean timeout = (event.getType() == EventType.TIMEOUT);
+ boolean error = (event.getType() == EventType.ERROR);
Iterator<AsyncListenerRegistration> asyncListenerRegistrations =
asyncContext.getAsyncListeners().values().iterator();
while (asyncListenerRegistrations.hasNext()) {
@@ -535,12 +535,67 @@
exception(request, response, e);
}
}
+ boolean end = (event.getType() == EventType.END) || error;
if (timeout && request.isEventMode() && asyncContext.getPath() == null) {
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ end = true;
}
+ try {
+ // Call error notifications for IO listeners
+ if (error) {
+ if (request.getReadListener() != null) {
+ request.getReadListener().onError(asyncContext.getError());
+ }
+ if (response.getWriteListener() != null) {
+ response.getWriteListener().onError(asyncContext.getError());
+ }
+ }
+ } catch (Throwable e) {
+ container.getLogger().error(MESSAGES.ioListenerError(getContainer().getName()), e);
+ exception(request, response, e);
+ }
+ if (end && (request.getUpgradeHandler() != null)) {
+ try {
+ // FIXME: Examine if need to call elsewhere
+ request.getUpgradeHandler().destroy();
+ } catch (Throwable e) {
+ container.getLogger().error(MESSAGES.upgradeHandlerDestroyError(getContainer().getName()), e);
+ exception(request, response, e);
+ }
+ }
if (error && request.isEventMode() && asyncContext.getPath() == null) {
exception(request, response, asyncContext.getError());
}
+ } else if (event.getType() == EventType.READ) {
+ // Read notification
+ if (request.getReadListener() != null) {
+ try {
+ request.getReadListener().onDataAvailable();
+ } catch (Throwable e) {
+ container.getLogger().error(MESSAGES.ioListenerError(getContainer().getName()), e);
+ exception(request, response, e);
+ }
+ }
+ } else if (event.getType() == EventType.EOF) {
+ // End of stream notification
+ if (request.getReadListener() != null) {
+ try {
+ request.getReadListener().onAllDataRead();
+ } catch (Throwable e) {
+ container.getLogger().error(MESSAGES.ioListenerError(getContainer().getName()), e);
+ exception(request, response, e);
+ }
+ }
+ } else if (event.getType() == EventType.WRITE) {
+ // Write notification
+ if (response.getWriteListener() != null) {
+ try {
+ response.getWriteListener().onWritePossible();
+ } catch (Throwable e) {
+ container.getLogger().error(MESSAGES.ioListenerError(getContainer().getName()), e);
+ exception(request, response, e);
+ }
+ }
} else if (asyncContext.getRunnable() != null) {
// Execute the runnable
try {
Modified: branches/8.0.x/src/main/java/org/apache/coyote/ActionCode.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/coyote/ActionCode.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/coyote/ActionCode.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -181,6 +181,16 @@
*/
public static final ActionCode ACTION_EVENT_WAKEUP = new ActionCode(29);
+ /**
+ * Ask for read callbacks
+ */
+ public static final ActionCode ACTION_EVENT_READ_BEGIN = new ActionCode(30);
+
+ /**
+ * Ask for a write callbacks
+ */
+ public static final ActionCode ACTION_EVENT_WRITE_BEGIN = new ActionCode(31);
+
// ----------------------------------------------------------- Constructors
int code;
Modified: branches/8.0.x/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/coyote/http11/Http11AprProcessor.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -1288,6 +1288,17 @@
writeNotification = true;
} else if (actionCode == ActionCode.ACTION_EVENT_TIMEOUT) {
timeout = ((Integer) param).intValue();
+ } else if (actionCode == ActionCode.ACTION_EVENT_READ_BEGIN) {
+ Socket.timeoutSet(socket, 0);
+ inputBuffer.setNonBlocking(true);
+ readNotifications = true;
+ } else if (actionCode == ActionCode.ACTION_EVENT_WRITE_BEGIN) {
+ Socket.timeoutSet(socket, 0);
+ outputBuffer.setNonBlocking(true);
+ if (!eventProcessing && !writeNotification) {
+ endpoint.getEventPoller().add(socket, timeout, false, true, false, true);
+ }
+ writeNotification = true;
} else if (actionCode == ActionCode.UPGRADE) {
// Switch to raw bytes mode
inputBuffer.removeActiveFilters();
Modified: branches/8.0.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/apache/coyote/http11/Http11NioProcessor.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -38,6 +38,7 @@
import org.apache.coyote.http11.filters.SavedRequestInputFilter;
import org.apache.coyote.http11.filters.VoidInputFilter;
import org.apache.coyote.http11.filters.VoidOutputFilter;
+import org.apache.tomcat.jni.Socket;
import org.apache.tomcat.util.buf.ByteChunk;
import org.apache.tomcat.util.buf.HexUtils;
import org.apache.tomcat.util.buf.MessageBytes;
@@ -855,6 +856,12 @@
} else if (actionCode == ActionCode.ACTION_EVENT_TIMEOUT) {
// Timeout event
timeoutEvent(param);
+ } else if (actionCode == ActionCode.ACTION_EVENT_READ_BEGIN) {
+ inputBuffer.setNonBlocking(true);
+ readNotifications = true;
+ } else if (actionCode == ActionCode.ACTION_EVENT_WRITE_BEGIN) {
+ outputBuffer.setNonBlocking(true);
+ writeEvent(param);
} else if (actionCode == ActionCode.UPGRADE) {
// Switch to raw bytes mode
inputBuffer.removeActiveFilters();
Modified: branches/8.0.x/src/main/java/org/jboss/web/CatalinaMessages.java
===================================================================
--- branches/8.0.x/src/main/java/org/jboss/web/CatalinaMessages.java 2013-03-18 16:16:55 UTC (rev 2176)
+++ branches/8.0.x/src/main/java/org/jboss/web/CatalinaMessages.java 2013-03-20 17:30:48 UTC (rev 2177)
@@ -141,9 +141,6 @@
@Message(id = 34, value = "Cannot upgrade from HTTP/1.1 without IO events")
IllegalStateException cannotUpgradeWithoutEvents();
- @Message(id = 35, value = "Cannot upgrade from HTTP/1.1 is not using an HttpEventServlet")
- IllegalStateException cannotUpgradeWithoutEventServlet();
-
@Message(id = 36, value = "Cannot call sendFile() after the response has been committed")
IllegalStateException cannotSendFile();
@@ -975,4 +972,19 @@
@Message(id = 360, value = "No session")
IllegalStateException nullSession();
+ @Message(id = 361, value = "Read listener already set")
+ IllegalStateException readListenerAlreadySet();
+
+ @Message(id = 362, value = "Write listener already set")
+ IllegalStateException writeListenerAlreadySet();
+
+ @Message(id = 363, value = "Upgrade error")
+ String upgradeError();
+
+ @Message(id = 364, value = "Upgrade destroy processing for servlet %s threw exception")
+ String upgradeHandlerDestroyError(String servletName);
+
+ @Message(id = 365, value = "IO listener processing for servlet %s threw exception")
+ String ioListenerError(String servletName);
+
}
11 years, 9 months
JBossWeb SVN: r2176 - in branches: 7.0.x/java/org/apache/tomcat/bayeux and 2 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-03-18 12:16:55 -0400 (Mon, 18 Mar 2013)
New Revision: 2176
Modified:
branches/2.1.x/java/org/apache/tomcat/bayeux/RequestBase.java
branches/7.0.x/java/org/apache/tomcat/bayeux/RequestBase.java
branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java
branches/8.0.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java
Log:
Fix minor XSS issue with Bayeux; probably not actually used.
Modified: branches/2.1.x/java/org/apache/tomcat/bayeux/RequestBase.java
===================================================================
--- branches/2.1.x/java/org/apache/tomcat/bayeux/RequestBase.java 2013-03-12 16:54:51 UTC (rev 2175)
+++ branches/2.1.x/java/org/apache/tomcat/bayeux/RequestBase.java 2013-03-18 16:16:55 UTC (rev 2176)
@@ -29,6 +29,7 @@
import javax.servlet.ServletException;
+import org.apache.catalina.util.RequestUtil;
import org.apache.cometd.bayeux.Bayeux;
import org.apache.cometd.bayeux.Message;
import org.apache.tomcat.util.json.JSONArray;
@@ -179,7 +180,7 @@
String jsonp = event.getHttpServletRequest().getParameter(Bayeux.JSONP_PARAMETER);
if (jsonp == null)
jsonp = Bayeux.JSONP_DEFAULT_NAME;
- out.print(jsonp);
+ out.print(RequestUtil.filter(jsonp));
out.print('(');
} else {
throw new BayeuxException("Client doesn't support any appropriate connection type.");
Modified: branches/7.0.x/java/org/apache/tomcat/bayeux/RequestBase.java
===================================================================
--- branches/7.0.x/java/org/apache/tomcat/bayeux/RequestBase.java 2013-03-12 16:54:51 UTC (rev 2175)
+++ branches/7.0.x/java/org/apache/tomcat/bayeux/RequestBase.java 2013-03-18 16:16:55 UTC (rev 2176)
@@ -29,6 +29,7 @@
import javax.servlet.ServletException;
+import org.apache.catalina.util.RequestUtil;
import org.apache.cometd.bayeux.Bayeux;
import org.apache.cometd.bayeux.Message;
import org.apache.tomcat.util.json.JSONArray;
@@ -179,7 +180,7 @@
String jsonp = event.getHttpServletRequest().getParameter(Bayeux.JSONP_PARAMETER);
if (jsonp == null)
jsonp = Bayeux.JSONP_DEFAULT_NAME;
- out.print(jsonp);
+ out.print(RequestUtil.filter(jsonp));
out.print('(');
} else {
throw new BayeuxException("Client doesn't support any appropriate connection type.");
Modified: branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java
===================================================================
--- branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java 2013-03-12 16:54:51 UTC (rev 2175)
+++ branches/7.2.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java 2013-03-18 16:16:55 UTC (rev 2176)
@@ -31,6 +31,7 @@
import javax.servlet.ServletException;
+import org.apache.catalina.util.RequestUtil;
import org.apache.cometd.bayeux.Bayeux;
import org.apache.cometd.bayeux.Message;
import org.apache.tomcat.util.json.JSONArray;
@@ -180,7 +181,7 @@
String jsonp = event.getHttpServletRequest().getParameter(Bayeux.JSONP_PARAMETER);
if (jsonp == null)
jsonp = Bayeux.JSONP_DEFAULT_NAME;
- out.print(jsonp);
+ out.print(RequestUtil.filter(jsonp));
out.print('(');
} else {
throw new BayeuxException(MESSAGES.noBayeuxConnectionType());
Modified: branches/8.0.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java 2013-03-12 16:54:51 UTC (rev 2175)
+++ branches/8.0.x/src/main/java/org/apache/tomcat/bayeux/RequestBase.java 2013-03-18 16:16:55 UTC (rev 2176)
@@ -31,6 +31,7 @@
import javax.servlet.ServletException;
+import org.apache.catalina.util.RequestUtil;
import org.apache.cometd.bayeux.Bayeux;
import org.apache.cometd.bayeux.Message;
import org.apache.tomcat.util.json.JSONArray;
@@ -180,7 +181,7 @@
String jsonp = event.getHttpServletRequest().getParameter(Bayeux.JSONP_PARAMETER);
if (jsonp == null)
jsonp = Bayeux.JSONP_DEFAULT_NAME;
- out.print(jsonp);
+ out.print(RequestUtil.filter(jsonp));
out.print('(');
} else {
throw new BayeuxException(MESSAGES.noBayeuxConnectionType());
11 years, 9 months
JBossWeb SVN: r2175 - branches/8.0.x/src/main/java/org/apache/tomcat/util/buf.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-03-12 12:54:51 -0400 (Tue, 12 Mar 2013)
New Revision: 2175
Modified:
branches/8.0.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java
Log:
Port minor fix: some encodings take a lot of bytes ...
Modified: branches/8.0.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java 2013-03-06 16:31:29 UTC (rev 2174)
+++ branches/8.0.x/src/main/java/org/apache/tomcat/util/buf/B2CConverter.java 2013-03-12 16:54:51 UTC (rev 2175)
@@ -52,7 +52,7 @@
} catch (UnsupportedCharsetException e) {
throw new UnsupportedEncodingException(charset);
}
- byte[] left = new byte[4];
+ byte[] left = new byte[9];
leftovers = ByteBuffer.wrap(left);
}
11 years, 9 months
JBossWeb SVN: r2174 - in branches/8.0.x: src/main/java/org/apache/catalina/connector and 7 other directories.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-03-06 11:31:29 -0500 (Wed, 06 Mar 2013)
New Revision: 2174
Modified:
branches/8.0.x/.classpath
branches/8.0.x/pom.xml
branches/8.0.x/src/main/java/org/apache/catalina/connector/Connector.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteInputStream.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteOutputStream.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/Request.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/RequestFacade.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/Response.java
branches/8.0.x/src/main/java/org/apache/catalina/connector/ResponseFacade.java
branches/8.0.x/src/main/java/org/apache/catalina/core/DummyRequest.java
branches/8.0.x/src/main/java/org/apache/catalina/core/DummyResponse.java
branches/8.0.x/src/main/java/org/apache/catalina/filters/ExpiresFilter.java
branches/8.0.x/src/main/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java
branches/8.0.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java
branches/8.0.x/src/main/java/org/apache/jasper/tagplugins/jstl/Util.java
branches/8.0.x/src/main/java/org/jboss/web/CatalinaMessages.java
branches/8.0.x/webapps/docs/changelog.xml
Log:
Dependencies updates, plus do the basics so that it builds.
Modified: branches/8.0.x/.classpath
===================================================================
--- branches/8.0.x/.classpath 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/.classpath 2013-03-06 16:31:29 UTC (rev 2174)
@@ -3,9 +3,9 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="/home/remm/.m2/repository/org/jboss/logging/jboss-logging/3.1.1.GA/jboss-logging-3.1.1.GA.jar"/>
- <classpathentry kind="lib" path="/home/remm/.m2/repository/org/jboss/spec/javax/servlet/jboss-servlet-api_3.0_spec/1.0.1.Final/jboss-servlet-api_3.0_spec-1.0.1.Final.jar"/>
<classpathentry kind="lib" path="/home/remm/.m2/repository/org/jboss/spec/javax/servlet/jsp/jboss-jsp-api_2.2_spec/1.0.1.Final/jboss-jsp-api_2.2_spec-1.0.1.Final.jar"/>
<classpathentry kind="lib" path="/home/remm/.m2/repository/org/jboss/spec/javax/el/jboss-el-api_2.2_spec/1.0.1.Final/jboss-el-api_2.2_spec-1.0.1.Final.jar"/>
- <classpathentry kind="lib" path="/home/remm/.m2/repository/org/jboss/web/jasper-jdt/7.0.3.Final/jasper-jdt-7.0.3.Final.jar"/>
+ <classpathentry kind="lib" path="/home/remm/.m2/repository/org/jboss/spec/javax/servlet/jboss-servlet-api_3.1_spec/1.0.0.Alpha1/jboss-servlet-api_3.1_spec-1.0.0.Alpha1.jar"/>
+ <classpathentry kind="lib" path="/home/remm/.m2/repository/org/eclipse/jdt/core/compiler/ecj/4.2.1/ecj-4.2.1.jar"/>
<classpathentry kind="output" path=".settings/output"/>
</classpath>
Modified: branches/8.0.x/pom.xml
===================================================================
(Binary files differ)
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/Connector.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/Connector.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/Connector.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -585,18 +585,8 @@
}
} else {
if ("HTTP/1.1".equals(protocol) || "http".equals(protocol)) {
- /*try {
- Class.forName("java.nio.channels.CompletionHandler");
- setProtocolHandlerClassName
- ("org.apache.coyote.http11.Http11NioProtocol");
- } catch (Exception e) {
- // NIO 2 is not available
- setProtocolHandlerClassName
- ("org.apache.coyote.http11.Http11Protocol");
- CatalinaLogger.CONNECTOR_LOGGER.usingJavaIoConnector();
- }*/
setProtocolHandlerClassName
- ("org.apache.coyote.http11.Http11Protocol");
+ ("org.apache.coyote.http11.Http11NioProtocol");
} else if ("AJP/1.3".equals(protocol) || "ajp".equals(protocol)) {
setProtocolHandlerClassName
("org.apache.coyote.ajp.AjpProtocol");
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteInputStream.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteInputStream.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteInputStream.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -23,6 +23,7 @@
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
+import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import org.apache.catalina.security.SecurityUtil;
@@ -107,7 +108,6 @@
}
public int available() throws IOException {
-
if (SecurityUtil.isPackageProtectionEnabled()){
try{
Integer result =
@@ -231,4 +231,20 @@
}
}
+
+ public boolean isFinished() {
+ return ib.isEof();
+ }
+
+
+ public boolean isReady() {
+ return (ib.available() > 0);
+ }
+
+
+ @Override
+ public void setReadListener(ReadListener arg0) {
+ // TODO Auto-generated method stub
+ }
+
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteOutputStream.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteOutputStream.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/CoyoteOutputStream.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -21,6 +21,7 @@
import java.io.IOException;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
/**
* Coyote implementation of the servlet output stream.
@@ -105,5 +106,17 @@
}
+ public boolean isReady() {
+ return (ob.lastWrite() > 0);
+ }
+
+
+ @Override
+ public void setWriteListener(WriteListener arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/Request.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/Request.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/Request.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -62,6 +62,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpUpgradeHandler;
import javax.servlet.http.Part;
import org.apache.catalina.Container;
@@ -3295,6 +3296,30 @@
}
+ public long getContentLengthLong() {
+ return (coyoteRequest.getContentLengthLong());
+ }
+
+ public String changeSessionId() {
+ Session session = getSessionInternal(false);
+ if (session == null) {
+ throw MESSAGES.nullSession();
+ }
+ Manager manager = context.getManager();
+ manager.changeSessionId(session, getRandom());
+ String sessionId = session.getId();
+ changeSessionId(sessionId);
+ return sessionId;
+ }
+
+ @Override
+ public <T extends HttpUpgradeHandler> T upgrade(Class<T> arg0)
+ throws IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("Current Servlet stack for thread ").append(Thread.currentThread().getName());
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/RequestFacade.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/RequestFacade.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/RequestFacade.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -41,6 +41,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpUpgradeHandler;
import javax.servlet.http.Part;
import org.apache.catalina.Globals;
@@ -1044,4 +1045,32 @@
return request.hasSendfile();
}
+
+ public long getContentLengthLong() {
+ if (request == null) {
+ throw MESSAGES.nullRequestFacade();
+ }
+
+ return request.getContentLengthLong();
+ }
+
+
+ public String changeSessionId() {
+ if (request == null) {
+ throw MESSAGES.nullRequestFacade();
+ }
+
+ return request.changeSessionId();
+ }
+
+
+ public <T extends HttpUpgradeHandler> T upgrade(Class<T> upgradeHandler)
+ throws IOException {
+ if (request == null) {
+ throw MESSAGES.nullRequestFacade();
+ }
+
+ return request.upgrade(upgradeHandler);
+ }
+
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/Response.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/Response.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/Response.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -1781,5 +1781,21 @@
}
+ @Override
+ public void setContentLengthLong(long length) {
+ if (isCommitted())
+ return;
+
+ // Ignore any call from an included servlet
+ if (included)
+ return;
+
+ if (usingWriter)
+ return;
+
+ coyoteResponse.setContentLength(length);
+
+ }
+
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/connector/ResponseFacade.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/connector/ResponseFacade.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/connector/ResponseFacade.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -605,4 +605,13 @@
return response.getStatus();
}
+
+ public void setContentLengthLong(long contentLength) {
+ if (response == null) {
+ throw MESSAGES.nullResponseFacade();
+ }
+
+ response.setContentLengthLong(contentLength);
+ }
+
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/core/DummyRequest.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/core/DummyRequest.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/core/DummyRequest.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -45,6 +45,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpUpgradeHandler;
import javax.servlet.http.Part;
import org.apache.catalina.Context;
@@ -293,6 +294,10 @@
public long getAsyncTimeout() { return 0; }
public Part getPart(String name) throws IllegalArgumentException { return null; }
public Collection<Part> getParts() { return null; }
+
+ public long getContentLengthLong() { return -1; }
+ public String changeSessionId() { return null; }
+ public <T extends HttpUpgradeHandler> T upgrade(Class<T> upgradeHandler) throws IOException { return null; }
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/core/DummyResponse.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/core/DummyResponse.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/core/DummyResponse.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -125,6 +125,6 @@
public void enable() {}
public boolean isDisabled() { return false; }
public Collection<String> getHeaders(String name) { return null; }
+ public void setContentLengthLong(long contentLength) {}
-
}
Modified: branches/8.0.x/src/main/java/org/apache/catalina/filters/ExpiresFilter.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/filters/ExpiresFilter.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/filters/ExpiresFilter.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -39,6 +39,7 @@
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -1008,6 +1009,16 @@
servletOutputStream.write(b);
}
+ @Override
+ public boolean isReady() {
+ return servletOutputStream.isReady();
+ }
+
+ @Override
+ public void setWriteListener(WriteListener listener) {
+ servletOutputStream.setWriteListener(listener);
+ }
+
}
/**
Modified: branches/8.0.x/src/main/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/catalina/ssi/ByteArrayServletOutputStream.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -19,6 +19,7 @@
import java.io.ByteArrayOutputStream;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
/**
@@ -60,4 +61,13 @@
public void write(int b) {
buf.write(b);
}
+
+
+ public boolean isReady() {
+ return true;
+ }
+
+
+ public void setWriteListener(WriteListener listener) {
+ }
}
Modified: branches/8.0.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/jasper/compiler/JDTCompiler.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -155,6 +155,10 @@
}
return result;
}
+
+ public boolean ignoreOptionalProblems() {
+ return false;
+ }
}
final INameEnvironment env = new INameEnvironment() {
Modified: branches/8.0.x/src/main/java/org/apache/jasper/tagplugins/jstl/Util.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/jasper/tagplugins/jstl/Util.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/apache/jasper/tagplugins/jstl/Util.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -28,6 +28,7 @@
import java.util.Locale;
import javax.servlet.ServletOutputStream;
+import javax.servlet.WriteListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;
@@ -260,6 +261,11 @@
public void write(int b) throws IOException {
bos.write(b);
}
+ public boolean isReady() {
+ return true;
+ }
+ public void setWriteListener(WriteListener listener) {
+ }
};
private boolean isWriterUsed;
private boolean isStreamUsed;
@@ -268,7 +274,6 @@
public ImportResponseWrapper(HttpServletResponse arg0) {
super(arg0);
- // TODO Auto-generated constructor stub
}
public PrintWriter getWriter() {
Modified: branches/8.0.x/src/main/java/org/jboss/web/CatalinaMessages.java
===================================================================
--- branches/8.0.x/src/main/java/org/jboss/web/CatalinaMessages.java 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/src/main/java/org/jboss/web/CatalinaMessages.java 2013-03-06 16:31:29 UTC (rev 2174)
@@ -972,4 +972,7 @@
@Message(id = 359, value = "Exception releasing filter %s")
String errorStoppingFilter(String filterName);
+ @Message(id = 360, value = "No session")
+ IllegalStateException nullSession();
+
}
Modified: branches/8.0.x/webapps/docs/changelog.xml
===================================================================
--- branches/8.0.x/webapps/docs/changelog.xml 2013-03-05 10:51:21 UTC (rev 2173)
+++ branches/8.0.x/webapps/docs/changelog.xml 2013-03-06 16:31:29 UTC (rev 2174)
@@ -16,6 +16,16 @@
<body>
+<section name="JBoss Web 8.0.0.Alpha1 (remm)">
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ <jboss-jira>AS7-6670</jboss-jira>: Port missing PA on JspFactoryImpl. (remm).
+ </fix>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 7.2.1.Final (remm)">
<subsection name="Catalina">
<changelog>
11 years, 9 months
JBossWeb SVN: r2173 - branches/8.0.x/src/main/java/org/apache/jasper/runtime.
by jbossweb-commits@lists.jboss.org
Author: remy.maucherat(a)jboss.com
Date: 2013-03-05 05:51:21 -0500 (Tue, 05 Mar 2013)
New Revision: 2173
Modified:
branches/8.0.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java
Log:
AS7-6670: Port missing PA on JspFactoryImpl.
Modified: branches/8.0.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java
===================================================================
--- branches/8.0.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java 2013-02-26 17:07:11 UTC (rev 2172)
+++ branches/8.0.x/src/main/java/org/apache/jasper/runtime/JspFactoryImpl.java 2013-03-05 10:51:21 UTC (rev 2173)
@@ -193,7 +193,17 @@
}
- public JspApplicationContext getJspApplicationContext(ServletContext context) {
- return JspApplicationContextImpl.getInstance(context);
+ public JspApplicationContext getJspApplicationContext(final ServletContext context) {
+ if (Constants.IS_SECURITY_ENABLED) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<JspApplicationContext>() {
+ @Override
+ public JspApplicationContext run() {
+ return JspApplicationContextImpl.getInstance(context);
+ }
+ });
+ } else {
+ return JspApplicationContextImpl.getInstance(context);
+ }
}
}
11 years, 9 months