Merge remote-tracking branch 'origin/master' into jetty-9.1

This commit is contained in:
Jan Bartel 2013-10-28 18:01:43 +11:00
commit f4e95be443
1 changed files with 25 additions and 12 deletions

View File

@ -35,12 +35,12 @@ public class MultiPartOutputStream extends FilterOutputStream
private static final byte[] __CRLF={'\r','\n'};
private static final byte[] __DASHDASH={'-','-'};
public static String MULTIPART_MIXED="multipart/mixed";
public static String MULTIPART_X_MIXED_REPLACE="multipart/x-mixed-replace";
public static final String MULTIPART_MIXED="multipart/mixed";
public static final String MULTIPART_X_MIXED_REPLACE="multipart/x-mixed-replace";
/* ------------------------------------------------------------ */
private String boundary;
private byte[] boundaryBytes;
private final String boundary;
private final byte[] boundaryBytes;
/* ------------------------------------------------------------ */
private boolean inPart=false;
@ -54,8 +54,15 @@ public class MultiPartOutputStream extends FilterOutputStream
boundary = "jetty"+System.identityHashCode(this)+
Long.toString(System.currentTimeMillis(),36);
boundaryBytes=boundary.getBytes(StringUtil.__ISO_8859_1);
}
inPart=false;
public MultiPartOutputStream(OutputStream out, String boundary)
throws IOException
{
super(out);
this.boundary = boundary;
boundaryBytes=boundary.getBytes(StringUtil.__ISO_8859_1);
}
/* ------------------------------------------------------------ */
@ -65,6 +72,8 @@ public class MultiPartOutputStream extends FilterOutputStream
@Override
public void close()
throws IOException
{
try
{
if (inPart)
out.write(__CRLF);
@ -73,8 +82,12 @@ public class MultiPartOutputStream extends FilterOutputStream
out.write(__DASHDASH);
out.write(__CRLF);
inPart=false;
}
finally
{
super.close();
}
}
/* ------------------------------------------------------------ */
public String getBoundary()