cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
costin 2003/03/25 09:48:42 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: Get the Host from the Context, it simplifies the mapping and registration of Hosts Revision ChangesPath 1.22 +13 -5 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- CoyoteRequest.java5 Mar 2003 02:31:47 - 1.21 +++ CoyoteRequest.java25 Mar 2003 17:48:42 - 1.22 @@ -127,6 +127,7 @@ import org.apache.catalina.util.RequestUtil; import org.apache.catalina.util.StringManager; import org.apache.catalina.util.StringParser; +import org.apache.commons.logging.Log; /** * Wrapper object for the Coyote request. @@ -385,6 +386,11 @@ */ protected String localAddr = null; +/** After the request is mapped to a ServletContext, we can also + * map it to a logger. + */ +protected Log log=null; + // - Public Methods @@ -423,6 +429,7 @@ requestedSessionCookie = false; requestedSessionId = null; requestedSessionURL = false; +log = null; parameterMap.setLocked(false); parameterMap.clear(); @@ -531,7 +538,8 @@ * Return the Host within which this Request is being processed. */ public Host getHost() { -return ((Host) mappingData.host); +return (Host)getContext().getParent(); +//return ((Host) mappingData.host); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
remm2003/01/30 06:22:15 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: - Improve code. Revision ChangesPath 1.19 +6 -7 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- CoyoteRequest.java29 Jan 2003 20:57:28 - 1.18 +++ CoyoteRequest.java30 Jan 2003 14:22:15 - 1.19 @@ -1293,12 +1293,11 @@ if (readOnlyAttributes.containsKey(name)) { return; } -oldValue = attributes.get(name); + +oldValue = attributes.put(name, value); if (oldValue != null) { replaced = true; } - -attributes.put(name, value); // Notify interested application event listeners Object listeners[] = context.getApplicationListeners(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
remm2003/01/30 10:22:58 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: - Add optimized processing for request dispatcher state (which are done using Catalina proprietary request attributes). - No notifications will be sent for these attributes changes to listeners (if that's contrary to the spec, let me know; it looks ok as these are proprietary internal attributes). Revision ChangesPath 1.20 +34 -4 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- CoyoteRequest.java30 Jan 2003 14:22:15 - 1.19 +++ CoyoteRequest.java30 Jan 2003 18:22:58 - 1.20 @@ -242,6 +242,12 @@ /** + * The current dispatcher type. + */ +protected Object dispatcherType = null; + + +/** * The associated input buffer. */ protected InputBuffer inputBuffer = new InputBuffer(); @@ -316,6 +322,12 @@ /** + * The current request dispatcher path. + */ +protected Object requestDispatcherPath = null; + + +/** * Was the requested session ID received in a cookie? */ protected boolean requestedSessionCookie = false; @@ -375,6 +387,9 @@ context = null; wrapper = null; +dispatcherType = null; +requestDispatcherPath = null; + authType = null; inputBuffer.recycle(); usingInputStream = false; @@ -870,6 +885,13 @@ * @param name Name of the request attribute to return */ public Object getAttribute(String name) { + +if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) { +return dispatcherType; +} else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) { +return requestDispatcherPath.toString(); +} + Object attr=attributes.get(name); if(attr!=null) @@ -1281,6 +1303,14 @@ // Null value is the same as removeAttribute() if (value == null) { removeAttribute(name); +return; +} + +if (name.equals(Globals.DISPATCHER_TYPE_ATTR)) { +dispatcherType = value; +return; +} else if (name.equals(Globals.DISPATCHER_REQUEST_PATH_ATTR)) { +requestDispatcherPath = value; return; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
remm2003/01/29 12:57:28 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: - Add request path field (basically, it's servletPath + pathInfo, which is very convinient to have rather than compute it over and over). Revision ChangesPath 1.18 +14 -4 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- CoyoteRequest.java29 Jan 2003 16:39:11 - 1.17 +++ CoyoteRequest.java29 Jan 2003 20:57:28 - 1.18 @@ -1824,6 +1824,16 @@ /** + * Get the request path. + * + * @return the request path + */ +public MessageBytes getRequestPathMB() { +return (mappingData.requestPath); +} + + +/** * Return the session identifier included in this request, if any. */ public String getRequestedSessionId() { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java CoyoteResponse.java
remm2003/01/03 11:31:54 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java CoyoteResponse.java Log: - Implement getDateHeader and setDateHeader using FastHttpDateFormat. Revision ChangesPath 1.13 +22 -15 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- CoyoteRequest.java17 Dec 2002 20:07:38 - 1.12 +++ CoyoteRequest.java3 Jan 2003 19:31:54 - 1.13 @@ -82,6 +82,7 @@ import java.util.Iterator; import java.util.Locale; import java.util.Map; +import java.util.TimeZone; import java.util.TreeMap; import javax.servlet.FilterChain; @@ -99,6 +100,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.apache.tomcat.util.http.FastHttpDateFormat; import org.apache.tomcat.util.http.Parameters; import org.apache.coyote.ActionCode; @@ -134,6 +136,19 @@ public class CoyoteRequest implements HttpRequest, HttpServletRequest { + +// --- Constructors + + +public CoyoteRequest() { + +formats[0].setTimeZone(TimeZone.getTimeZone(GMT)); +formats[1].setTimeZone(TimeZone.getTimeZone(GMT)); +formats[2].setTimeZone(TimeZone.getTimeZone(GMT)); + +} + + // - Properties @@ -1618,18 +1633,10 @@ if (value == null) return (-1L); -// Work around a bug in SimpleDateFormat in pre-JDK1.2b4 -// (Bug Parade bug #4106807) -value += ; - // Attempt to convert the date header in a variety of formats -for (int i = 0; i formats.length; i++) { -try { -Date date = formats[i].parse(value); -return (date.getTime()); -} catch (ParseException e) { -; -} +long result = FastHttpDateFormat.parseDate(value, formats); +if (result != (-1L)) { +return result; } throw new IllegalArgumentException(value); 1.17 +7 -6 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteResponse.java Index: CoyoteResponse.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteResponse.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- CoyoteResponse.java 19 Dec 2002 09:08:50 - 1.16 +++ CoyoteResponse.java 3 Jan 2003 19:31:54 - 1.17 @@ -92,6 +92,7 @@ import org.apache.tomcat.util.buf.CharChunk; import org.apache.tomcat.util.buf.UEncoder; +import org.apache.tomcat.util.http.FastHttpDateFormat; import org.apache.tomcat.util.http.MimeHeaders; import org.apache.tomcat.util.http.ServerCookie; import org.apache.tomcat.util.net.URL; @@ -941,7 +942,7 @@ if (included) return; -addHeader(name, format.format(new Date(value))); +addHeader(name, FastHttpDateFormat.formatDate(value, format)); } @@ -1192,7 +1193,7 @@ if (included) return; -setHeader(name, format.format(new Date(value))); +setHeader(name, FastHttpDateFormat.formatDate(value, format)); } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
jfarcand2002/12/17 12:07:38 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: Servlet 2.4 Specification addition -- SRV.8.4.2 Forwarded Request Parameters Except for servlets obtained by using the getNamedDispatcher method, a servlet being used from a servlet that has been invoked by another servlet using the forward method of RequestDispatcher. The following request attributes must be set: - javax.servlet.forward.request_uri - javax.servlet.forward.context_path - javax.servlet.forward.servlet_path - javax.servlet.forward.path_info - javax.servlet.forward.query_stringCVS: -- Revision ChangesPath 1.12 +5 -5 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- CoyoteRequest.java26 Nov 2002 11:09:40 - 1.11 +++ CoyoteRequest.java17 Dec 2002 20:07:38 - 1.12 @@ -1118,7 +1118,7 @@ return (context.getServletContext().getRequestDispatcher(path)); // Convert a request-relative path to a context-relative one -String servletPath = (String) getAttribute(Globals.SERVLET_PATH_ATTR); +String servletPath = (String) getAttribute(Globals.INCLUDE_SERVLET_PATH_ATTR); if (servletPath == null) servletPath = getServletPath(); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
remm2002/11/26 03:09:41 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: - Remove debug code. Revision ChangesPath 1.11 +5 -6 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- CoyoteRequest.java26 Nov 2002 11:06:23 - 1.10 +++ CoyoteRequest.java26 Nov 2002 11:09:40 - 1.11 @@ -424,8 +424,7 @@ * @param authorization The new authorization credentials */ public void setAuthorization(String authorization) { -System.out.println(SA); -//this.authorization = authorization; +// Not used } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
remm2002/11/25 13:04:42 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: - Add methods to optimize valves and filters processing (more optimization of the filter part coming). Revision ChangesPath 1.9 +50 -4 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- CoyoteRequest.java24 Nov 2002 11:56:15 - 1.8 +++ CoyoteRequest.java25 Nov 2002 21:04:42 - 1.9 @@ -84,6 +84,7 @@ import java.util.Map; import java.util.TreeMap; +import javax.servlet.FilterChain; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -111,6 +112,7 @@ import org.apache.catalina.Manager; import org.apache.catalina.Realm; import org.apache.catalina.Session; +import org.apache.catalina.ValveContext; import org.apache.catalina.Wrapper; import org.apache.catalina.util.Enumerator; @@ -482,6 +484,28 @@ /** + * Filter chain associated with the request. + */ +protected FilterChain filterChain = null; + +/** + * Get filter chain associated with the request. + */ +public FilterChain getFilterChain() { +return (this.filterChain); +} + +/** + * Set filter chain associated with the request. + * + * @param filterChain new filter chain + */ +public void setFilterChain(FilterChain filterChain) { +this.filterChain = filterChain; +} + + +/** * Descriptive information about this Request implementation. */ protected static final String info = @@ -572,6 +596,28 @@ */ public void setStream(InputStream stream) { // Ignore +} + + +/** + * The valve context associated with this request. + */ +protected ValveContext valveContext = null; + +/** + * Get valve context. + */ +public ValveContext getValveContext() { +return (this.valveContext); +} + +/** + * Set valve context. + * + * @param valveContext New valve context object + */ +public void setValveContext(ValveContext valveContext) { +this.valveContext = valveContext; } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
remm2002/11/24 03:56:15 Modified:coyote/src/java/org/apache/coyote ActionCode.java coyote/src/java/org/apache/coyote/tomcat3 Tomcat3Request.java coyote/src/java/org/apache/coyote/tomcat4 CoyoteRequest.java coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: - Optmization: lazy evaluation of the remote address. Revision ChangesPath 1.10 +18 -7 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ActionCode.java Index: ActionCode.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/ActionCode.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- ActionCode.java 21 Sep 2002 04:45:35 - 1.9 +++ ActionCode.java 24 Nov 2002 11:56:14 - 1.10 @@ -79,8 +79,9 @@ public static final ActionCode ACTION_COMMIT = new ActionCode(); -/* A flush() operation originated by the client ( i.e. a flush() on - the servlet output stream or writer, called by a servlet ). +/** + * A flush() operation originated by the client ( i.e. a flush() on + * the servlet output stream or writer, called by a servlet ). */ public static final ActionCode ACTION_CLIENT_FLUSH = new ActionCode(); @@ -99,23 +100,33 @@ public static final ActionCode ACTION_WEBAPP = new ActionCode(); -/** Hook called after request, but before recycling. Can be used -for logging, to update counters, custom cleanup - the request -is still visible -*/ + +/** + * Hook called after request, but before recycling. Can be used + * for logging, to update counters, custom cleanup - the request + * is still visible + */ public static final ActionCode ACTION_POST_REQUEST = new ActionCode(); /** - * Callback for lazy evaluation - extract the remote host address. + * Callback for lazy evaluation - extract the remote host name. */ public static final ActionCode ACTION_REQ_HOST_ATTRIBUTE = new ActionCode(); /** + * Callback for lazy evaluation - extract the remote host address. + */ +public static final ActionCode ACTION_REQ_HOST_ADDR_ATTRIBUTE = +new ActionCode(); + + +/** * Callback for lazy evaluation - extract the SSL-related attributes. */ public static final ActionCode ACTION_REQ_SSL_ATTRIBUTE = new ActionCode(); + /** * Callback for lazy evaluation - extract the SSL-certificate 1.12 +1 -1 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java Index: Tomcat3Request.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat3/Tomcat3Request.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- Tomcat3Request.java 8 Nov 2002 06:19:51 - 1.11 +++ Tomcat3Request.java 24 Nov 2002 11:56:14 - 1.12 @@ -210,7 +210,7 @@ public MessageBytes remoteAddr() { if( remoteAddrMB.isNull() ) { - coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ATTRIBUTE, coyoteRequest ); + coyoteRequest.action( ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest ); } return remoteAddrMB; } 1.28 +6 -4 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- CoyoteRequest.java20 Oct 2002 22:48:49 - 1.27 +++ CoyoteRequest.java24 Nov 2002 11:56:15 - 1.28 @@ -1046,6 +1046,8 @@ InetAddress inet = socket.getInetAddress(); remoteAddr = inet.getHostAddress(); } else { +coyoteRequest.action +(ActionCode.ACTION_REQ_HOST_ADDR_ATTRIBUTE, coyoteRequest); remoteAddr = coyoteRequest.remoteAddr().toString(); } } 1.8 +6 -4 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 ---
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
bobh2002/11/18 10:36:05 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: - Servlet 2.4, section 10.6 talks about how to handle Listener Exceptions. It says a listener exception should cause the error page handling stuff to be triggered. This change does that. Revision ChangesPath 1.7 +8 -6 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- CoyoteRequest.java18 Oct 2002 21:37:08 - 1.6 +++ CoyoteRequest.java18 Nov 2002 18:36:05 - 1.7 @@ -1167,8 +1167,9 @@ try { listener.attributeRemoved(event); } catch (Throwable t) { -// FIXME - should we do anything besides log these? log(sm.getString(coyoteRequest.attributeEvent), t); +// Error valve will pick this execption up and display it to user +attributes.put( Globals.EXCEPTION_ATTR, t ); } } } @@ -1235,8 +1236,9 @@ listener.attributeAdded(event); } } catch (Throwable t) { -// FIXME - should we do anything besides log these? log(sm.getString(coyoteRequest.attributeEvent), t); +// Error valve will pick this execption up and display it to user +attributes.put( Globals.EXCEPTION_ATTR, t ); } } } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
jfarcand2002/10/18 14:37:08 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: Security Audit. Remove the doPrivilege block. Delegate the security check to o.a.catalina.Manager instance. Revision ChangesPath 1.6 +5 -31 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- CoyoteRequest.java10 Oct 2002 09:45:30 - 1.5 +++ CoyoteRequest.java18 Oct 2002 21:37:08 - 1.6 -72,9 +72,7 import java.io.UnsupportedEncodingException; import java.net.InetAddress; import java.net.Socket; -import java.security.AccessController; import java.security.Principal; -import java.security.PrivilegedAction; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; -134,26 +132,6 public class CoyoteRequest implements HttpRequest, HttpServletRequest { - -// --- PrivilegedGetSession Inner Class - - -protected class PrivilegedGetSession -implements PrivilegedAction { - -private boolean create; - -PrivilegedGetSession(boolean create) { -this.create = create; -} - -public Object run() { -return doGetSession(create); -} - -} - - // - Properties -1810,11 +1788,7 * param create Create a new session if one does not exist */ public HttpSession getSession(boolean create) { - -if (System.getSecurityManager() != null) { -PrivilegedGetSession dp = new PrivilegedGetSession(create); -return (HttpSession) AccessController.doPrivileged(dp); -} + return doGetSession(create); } -- To unsubscribe, e-mail: mailto:tomcat-dev-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
horwat 2002/08/09 09:58:43 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java Log: Synchronization is unnecessary since requests are per-thread. Submitted by: Bill Barker Revision ChangesPath 1.3 +25 -23 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CoyoteRequest.java9 Aug 2002 02:10:10 - 1.2 +++ CoyoteRequest.java9 Aug 2002 16:58:43 - 1.3 @@ -1151,17 +1151,17 @@ boolean found = false; // Remove the specified attribute -synchronized (attributes) { -// Check for read only attribute - if (readOnlyAttributes.containsKey(name)) -return; -found = attributes.containsKey(name); -if (found) { -value = attributes.get(name); -attributes.remove(name); -} else { -return; -} +// Check for read only attribute +// requests are per thread so synchronization unnecessary +if (readOnlyAttributes.containsKey(name)) { +return; +} +found = attributes.containsKey(name); +if (found) { +value = attributes.get(name); +attributes.remove(name); +} else { +return; } // Notify interested application event listeners @@ -1209,15 +1209,17 @@ boolean replaced = false; // Add or replace the specified attribute -synchronized (attributes) { -// Check for read only attribute -if (readOnlyAttributes.containsKey(name)) -return; -oldValue = attributes.get(name); -if (oldValue != null) -replaced = true; -attributes.put(name, value); +// Check for read only attribute +// requests are per thread so synchronization unnecessary +if (readOnlyAttributes.containsKey(name)) { +return; +} +oldValue = attributes.get(name); +if (oldValue != null) { +replaced = true; } + +attributes.put(name, value); // Notify interested application event listeners Object listeners[] = context.getApplicationListeners(); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java LocalStrings.properties
horwat 2002/08/08 19:10:10 Modified:coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java LocalStrings.properties Log: Add servlet request attribute change event support. Revision ChangesPath 1.2 +130 -6 jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java Index: CoyoteRequest.java === RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CoyoteRequest.java4 Aug 2002 19:39:49 - 1.1 +++ CoyoteRequest.java9 Aug 2002 02:10:10 - 1.2 @@ -91,6 +91,10 @@ import javax.servlet.ServletException; import javax.servlet.ServletInputStream; import javax.servlet.ServletRequest; +import javax.servlet.ServletRequestEvent; +import javax.servlet.ServletRequestListener; +import javax.servlet.ServletRequestAttributeEvent; +import javax.servlet.ServletRequestAttributeListener; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -105,6 +109,7 @@ import org.apache.catalina.Context; import org.apache.catalina.Globals; import org.apache.catalina.HttpRequest; +import org.apache.catalina.Logger; import org.apache.catalina.Manager; import org.apache.catalina.Realm; import org.apache.catalina.Session; @@ -214,6 +219,12 @@ /** + * List of read only attributes for this Request. + */ +private HashMap readOnlyAttributes = new HashMap(); + + +/** * The preferred Locales assocaited with this Request. */ protected ArrayList locales = new ArrayList(); @@ -1136,7 +1147,42 @@ * @param name Name of the request attribute to remove */ public void removeAttribute(String name) { -attributes.remove(name); +Object value = null; +boolean found = false; + +// Remove the specified attribute +synchronized (attributes) { +// Check for read only attribute + if (readOnlyAttributes.containsKey(name)) +return; +found = attributes.containsKey(name); +if (found) { +value = attributes.get(name); +attributes.remove(name); +} else { +return; +} +} + +// Notify interested application event listeners +Object listeners[] = context.getApplicationListeners(); +if ((listeners == null) || (listeners.length == 0)) +return; +ServletRequestAttributeEvent event = + new ServletRequestAttributeEvent(context.getServletContext(), + getRequest(), name, value); +for (int i = 0; i listeners.length; i++) { +if (!(listeners[i] instanceof ServletRequestAttributeListener)) +continue; +ServletRequestAttributeListener listener = +(ServletRequestAttributeListener) listeners[i]; +try { +listener.attributeRemoved(event); +} catch (Throwable t) { +// FIXME - should we do anything besides log these? +log(sm.getString(coyoteRequest.attributeEvent), t); +} +} } @@ -1159,8 +1205,50 @@ return; } -attributes.put(name, value); +Object oldValue = null; +boolean replaced = false; +// Add or replace the specified attribute +synchronized (attributes) { +// Check for read only attribute +if (readOnlyAttributes.containsKey(name)) +return; +oldValue = attributes.get(name); +if (oldValue != null) +replaced = true; +attributes.put(name, value); +} + +// Notify interested application event listeners +Object listeners[] = context.getApplicationListeners(); +if ((listeners == null) || (listeners.length == 0)) +return; +ServletRequestAttributeEvent event = null; +if (replaced) +event = +new ServletRequestAttributeEvent(context.getServletContext(), + getRequest(), name, oldValue); +else +event = +new ServletRequestAttributeEvent(context.getServletContext(), + getRequest(), name, value); + +for (int i = 0; i listeners.length; i++) { +if (!(listeners[i] instanceof
Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java LocalStrings.properties
+// Remove the specified attribute +synchronized (attributes) { +// Check for read only attribute + if (readOnlyAttributes.containsKey(name)) +return; +found = attributes.containsKey(name); +if (found) { +value = attributes.get(name); +attributes.remove(name); +} else { +return; +} +} Requests are per-thread, so the synchronized is unnecessary. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]