Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 31553 invoked from network); 22 Apr 2005 12:12:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Apr 2005 12:12:03 -0000 Received: (qmail 25560 invoked by uid 500); 22 Apr 2005 12:12:25 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 25502 invoked by uid 500); 22 Apr 2005 12:12:24 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 25489 invoked by uid 99); 22 Apr 2005 12:12:24 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 22 Apr 2005 05:12:23 -0700 Received: (qmail 31517 invoked by uid 65534); 22 Apr 2005 12:11:59 -0000 Message-ID: <20050422121159.31514.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r164225 - in /cocoon/trunk/src/java/org/apache/cocoon: core/CoreUtil.java servlet/CocoonServlet.java servlet/multipart/MultipartHttpServletRequest.java servlet/multipart/MultipartParser.java servlet/multipart/PartInMemory.java servlet/multipart/PartOnDisk.java servlet/multipart/TokenStream.java Date: Fri, 22 Apr 2005 12:11:58 -0000 To: cvs@cocoon.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: cziegeler Date: Fri Apr 22 05:11:58 2005 New Revision: 164225 URL: http://svn.apache.org/viewcvs?rev=3D164225&view=3Drev Log: 2=2E2 is based on 2.3 of the servlet spec Modified: cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/MultipartHttp= ServletRequest.java cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/MultipartPars= er.java cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/PartInMemory.= java cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/PartOnDisk.ja= va cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/TokenStream.j= ava Modified: cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/= core/CoreUtil.java?rev=3D164225&r1=3D164224&r2=3D164225&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java Fri Apr 22 0= 5:11:58 2005 @@ -96,6 +96,11 @@ /** The time the cocoon instance was created. */ protected long creationTime; =20 + /** + * Setup a new instance. + * @param environment The hook back to the environment. + * @throws Exception + */ public CoreUtil(BootstrapEnvironment environment) throws Exception { this.env =3D environment; Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/= servlet/CocoonServlet.java?rev=3D164225&r1=3D164224&r2=3D164225&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java (ori= ginal) +++ cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java Fri = Apr 22 05:11:58 2005 @@ -226,7 +226,7 @@ } } =20 - this.containerEncoding =3D getInitParameter("container-encoding", = "ISO-8859-1"); + this.containerEncoding =3D this.getInitParameter("container-encodi= ng", "ISO-8859-1"); this.requestFactory =3D new RequestFactory(coreUtil.getCore().getS= ettings().isAutosaveUploads(), new File(coreUtil.getCore= ().getSettings().getUploadDirectory()), coreUtil.getCore().getSet= tings().isAllowOverwrite(), Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/Multipa= rtHttpServletRequest.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/= servlet/multipart/MultipartHttpServletRequest.java?rev=3D164225&r1=3D164224= &r2=3D164225&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/MultipartHttp= ServletRequest.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/MultipartHttp= ServletRequest.java Fri Apr 22 05:11:58 2005 @@ -15,43 +15,32 @@ */ package org.apache.cocoon.servlet.multipart; =20 -import java.io.BufferedReader; import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.Principal; import java.util.Enumeration; import java.util.Hashtable; -import java.util.Locale; -import java.util.Map; import java.util.Vector; =20 -import javax.servlet.RequestDispatcher; -import javax.servlet.ServletInputStream; -import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpSession; +import javax.servlet.http.HttpServletRequestWrapper; =20 /** * Servlet request wrapper for multipart parser. * * @author Jeroen ter Voorde * @author Stefano Mazzocchi - * @version CVS $Id: MultipartHttpServletRequest.java,v 1.7 2004/03/05 13:= 02:58 bdelacretaz Exp $ + * @version CVS $Id$ */ -public class MultipartHttpServletRequest implements HttpServletRequest { - - /** The wrapped request */ - private HttpServletRequest request =3D null; +public class MultipartHttpServletRequest extends HttpServletRequestWrapper= { =20 /** The submitted parts */ - private Hashtable values =3D null; + private Hashtable values; =20 /** * Create this wrapper around the given request and including the given * parts. */ public MultipartHttpServletRequest(HttpServletRequest request, Hashtab= le values) { - this.request =3D request; + super(request); this.values =3D values; } =20 @@ -86,12 +75,11 @@ if (result instanceof Vector) { if (((Vector) result).size() =3D=3D 1) { return ((Vector) result).elementAt(0); - } else { - return result; } + return result; } } else { - String[] array =3D request.getParameterValues(name); + String[] array =3D this.getRequest().getParameterValues(name); Vector vec =3D new Vector(); =20 if (array !=3D null) { @@ -117,9 +105,8 @@ public Enumeration getParameterNames() { if (values !=3D null) { return values.keys(); - } else { - return request.getParameterNames(); } + return this.getRequest().getParameterNames(); } =20 /** @@ -161,417 +148,13 @@ } return results; =20 - } else { - return new String[]{value.toString()}; } + return new String[]{value.toString()}; } =20 return null; - } else { - return request.getParameterValues(name); } + return this.getRequest().getParameterValues(name); } - - /** - * Method getAttribute - * - * @param name - * - */ - public Object getAttribute(String name) { - return request.getAttribute(name); - } - - /** - * Method getAttributeNames - * - */ - public Enumeration getAttributeNames() { - return request.getAttributeNames(); - } - - /** - * Method getCharacterEncoding - * - */ - public String getCharacterEncoding() { - return request.getCharacterEncoding(); - } - - /** - * Method getContentLength - * - */ - public int getContentLength() { - return request.getContentLength(); - } - - /** - * Method getContentType - * - */ - public String getContentType() { - return request.getContentType(); - } - - /** - * Method getInputStream - * - * - * @throws IOException - */ - public ServletInputStream getInputStream() throws IOException { - return request.getInputStream(); - } - - /** - * Method getProtocol - * - */ - public String getProtocol() { - return request.getProtocol(); - } - - /** - * Method getScheme - * - */ - public String getScheme() { - return request.getScheme(); - } - - /** - * Method getServerName - * - */ - public String getServerName() { - return request.getServerName(); - } - - /** - * Method getServerPort - * - */ - public int getServerPort() { - return request.getServerPort(); - } - - /** - * Method getReader - * - * - * @throws IOException - */ - public BufferedReader getReader() throws IOException { - return request.getReader(); - } - - /** - * Method getRemoteAddr - * - */ - public String getRemoteAddr() { - return request.getRemoteAddr(); - } - - /** - * Method getRemoteHost - * - */ - public String getRemoteHost() { - return request.getRemoteHost(); - } - - /** - * Method setAttribute - * - * @param name - * @param o - */ - public void setAttribute(String name, Object o) { - request.setAttribute(name, o); - } - - /** - * Method removeAttribute - * - * @param name - */ - public void removeAttribute(String name) { - request.removeAttribute(name); - } - - /** - * Method getLocale - * - */ - public Locale getLocale() { - return request.getLocale(); - } - - /** - * Method getLocales - * - */ - public Enumeration getLocales() { - return request.getLocales(); - } - - /** - * Method isSecure - * - */ - public boolean isSecure() { - return request.isSecure(); - } - - /** - * Method getRequestDispatcher - * - * @param path - * - */ - public RequestDispatcher getRequestDispatcher(String path) { - return request.getRequestDispatcher(path); - } - - /** - * Method getRealPath - * - * @param path - * - */ - public String getRealPath(String path) { - return request.getRealPath(path); - } - - /** - * Method getAuthType - * - */ - public String getAuthType() { - return request.getAuthType(); - } - - /** - * Method getCookies - * - */ - public Cookie[] getCookies() { - return request.getCookies(); - } - - /** - * Method getDateHeader - * - * @param name - * - */ - public long getDateHeader(String name) { - return request.getDateHeader(name); - } - - /** - * Method getHeader - * - * @param name - * - */ - public String getHeader(String name) { - return request.getHeader(name); - } - - /** - * Method getHeaders - * - * @param name - * - */ - public Enumeration getHeaders(String name) { - return request.getHeaders(name); - } - - /** - * Method getHeaderNames - * - */ - public Enumeration getHeaderNames() { - return request.getHeaderNames(); - } - - /** - * Method getIntHeader - * - * @param name - * - */ - public int getIntHeader(String name) { - return request.getIntHeader(name); - } - - /** - * Method getMethod - * - */ - public String getMethod() { - return request.getMethod(); - } - - /** - * Method getPathInfo - * - */ - public String getPathInfo() { - return request.getPathInfo(); - } - - /** - * Method getPathTranslated - * - */ - public String getPathTranslated() { - return request.getPathTranslated(); - } - - /** - * Method getContextPath - * - */ - public String getContextPath() { - return request.getContextPath(); - } - - /** - * Method getQueryString - * - */ - public String getQueryString() { - return request.getQueryString(); - } - - /** - * Method getRemoteUser - * - */ - public String getRemoteUser() { - return request.getRemoteUser(); - } - - /** - * Method isUserInRole - * - * @param role - * - */ - public boolean isUserInRole(String role) { - return request.isUserInRole(role); - } - - /** - * Method getUserPrincipal - * - */ - public Principal getUserPrincipal() { - return request.getUserPrincipal(); - } - - /** - * Method getRequestedSessionId - * - */ - public String getRequestedSessionId() { - return request.getRequestedSessionId(); - } - - /** - * Method getRequestURI - * - */ - public String getRequestURI() { - return request.getRequestURI(); - } - - /** - * Method getServletPath - * - */ - public String getServletPath() { - return request.getServletPath(); - } - - /** - * Method getSession - * - * @param create - * - */ - public HttpSession getSession(boolean create) { - return request.getSession(create); - } - - /** - * Method getSession - * - */ - public HttpSession getSession() { - return request.getSession(); - } - - /** - * Method isRequestedSessionIdValid - * - */ - public boolean isRequestedSessionIdValid() { - return request.isRequestedSessionIdValid(); - } - - /** - * Method isRequestedSessionIdFromCookie - * - */ - public boolean isRequestedSessionIdFromCookie() { - return request.isRequestedSessionIdFromCookie(); - } - - /** - * Method isRequestedSessionIdFromURL - * - */ - public boolean isRequestedSessionIdFromURL() { - return request.isRequestedSessionIdFromURL(); - } - - /** - * Method isRequestedSessionIdFromUrl - * @deprecated use {@link #isRequestedSessionIdFromURL()} instead - */ - public boolean isRequestedSessionIdFromUrl() { - return request.isRequestedSessionIdFromURL(); - } - - /* (non-Javadoc) - * @see javax.servlet.http.HttpServletRequest#getRequestURL() - */ - public StringBuffer getRequestURL() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see javax.servlet.ServletRequest#getParameterMap() - */ - public Map getParameterMap() { - // TODO Auto-generated method stub - return null; - } - - /* (non-Javadoc) - * @see javax.servlet.ServletRequest#setCharacterEncoding(java.lang.Strin= g) - */ - public void setCharacterEncoding(String arg0) - throws UnsupportedEncodingException { - // TODO Auto-generated method stub - - } =20 } Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/Multipa= rtParser.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/= servlet/multipart/MultipartParser.java?rev=3D164225&r1=3D164224&r2=3D164225= &view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/MultipartPars= er.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/MultipartPars= er.java Fri Apr 22 05:11:58 2005 @@ -39,7 +39,7 @@ * FilePart: file part * * @author Jeroen ter Voorde - * @version CVS $Id: MultipartParser.java,v 1.8 2004/03/11 18:21:48 joerg = Exp $ + * @version CVS $Id$ */ public class MultipartParser { =20 @@ -317,9 +317,8 @@ int start =3D hdr.toLowerCase().indexOf("boundary=3D"); if (start > -1) { return "--" + hdr.substring(start + 9); - } else { - return null; } + return null; } =20 /** Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/PartInM= emory.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/= servlet/multipart/PartInMemory.java?rev=3D164225&r1=3D164224&r2=3D164225&vi= ew=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/PartInMemory.= java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/PartInMemory.= java Fri Apr 22 05:11:58 2005 @@ -65,9 +65,8 @@ public InputStream getInputStream() throws Exception { if (this.in !=3D null) { return this.in; - } else { - throw new IllegalStateException("This part has already been di= sposed."); } + throw new IllegalStateException("This part has already been dispos= ed."); } =20 /** Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/PartOnD= isk.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/= servlet/multipart/PartOnDisk.java?rev=3D164225&r1=3D164224&r2=3D164225&view= =3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/PartOnDisk.ja= va (original) +++ cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/PartOnDisk.ja= va Fri Apr 22 05:11:58 2005 @@ -24,7 +24,7 @@ * This class represents a file part parsed from a http post stream. * * @author Jeroen ter Voorde - * @version CVS $Id: PartOnDisk.java,v 1.4 2004/03/05 13:02:58 bdelacretaz= Exp $ + * @version CVS $Id$ */ public class PartOnDisk extends Part { =20 @@ -77,9 +77,8 @@ public InputStream getInputStream() throws Exception { if (this.file !=3D null) { return new FileInputStream(file); - } else { - throw new IllegalStateException("This part has already been di= sposed."); } + throw new IllegalStateException("This part has already been dispos= ed."); } =20 /** Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/TokenSt= ream.java URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/= servlet/multipart/TokenStream.java?rev=3D164225&r1=3D164224&r2=3D164225&vie= w=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/TokenStream.j= ava (original) +++ cocoon/trunk/src/java/org/apache/cocoon/servlet/multipart/TokenStream.j= ava Fri Apr 22 05:11:58 2005 @@ -24,7 +24,7 @@ * * A newline is espected after each boundary and is parsed away. * @author Jeroen ter Voorde - * @version CVS $Id: TokenStream.java,v 1.4 2004/03/05 13:02:58 bdelacreta= z Exp $ + * @version CVS $Id$ */ class TokenStream extends PushbackInputStream { =20 @@ -178,17 +178,17 @@ state =3D STATE_ENDOFSTREAM; } return written; - } else { // did not match bo= undary - // bytes skipped, write first skipped byte, push back the = rest - if (b !=3D -1) { // b may be -1 - in.unread(b); // the non-matching= byte - } - in.unread(boundary, 1, - boundaryIndex - 1); // unread skipped bou= ndary data - out[written++] =3D boundary[0]; - if (written =3D=3D out.length) { - return written; - } + } + // did not match boundary + // bytes skipped, write first skipped byte, push back the rest + if (b !=3D -1) { // b may be -1 + in.unread(b); // the non-matching byte + } + in.unread(boundary, 1, + boundaryIndex - 1); // unread skipped boundar= y data + out[written++] =3D boundary[0]; + if (written =3D=3D out.length) { + return written; } b =3D in.read(); } @@ -252,8 +252,7 @@ =20 if (read =3D=3D 0) { return -1; - } else { - return buf[0]; } + return buf[0]; } }