com.mortbay.HTTP
Class MultiPartResponse
java.lang.Object
|
+--com.mortbay.HTTP.MultiPartResponse
- public class MultiPartResponse
- extends java.lang.Object
Handle a multipart MIME response
Usage
public class MultiPartCount extends Servlet
{
public void init(){}
public void service(ServletRequest req, ServletResponse res)
throws Exception
{
MultiPartResponse multi=new MultiPartResponse(res);
multi.startNextPart("text/plain");
multi.out.write("One\n");
multi.endPart();
Thread.sleep(2000);
multi.startNextPart("text/plain");
multi.out.write("Two\n");
multi.endPart();
Thread.sleep(2000);
multi.startNextPart("text/plain");
multi.out.write("Three\n");
multi.endLastPart();
}
}
- Version:
- $Id: MultiPartResponse.java,v 2.7 1999/10/09 15:07:26 gregw Exp $
- Author:
- Greg Wilkins
Field Summary |
java.io.Writer |
out
PrintWriter to write content too |
Constructor Summary |
MultiPartResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
MultiPartResponse constructor |
MultiPartResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
boolean alwaysExpire)
MultiPartResponse constructor |
Method Summary |
void |
endLastPart()
End the current part and the whole response. |
void |
endPart()
End the current part |
void |
endPart(boolean lastPart)
End the current part |
void |
startNextPart(java.lang.String contentType)
Start creation of the next Content |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
out
public java.io.Writer out
- PrintWriter to write content too
MultiPartResponse
public MultiPartResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException
- MultiPartResponse constructor
- Parameters:
response
- The ServletResponse to which this multipart
response will be sent.
MultiPartResponse
public MultiPartResponse(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
boolean alwaysExpire)
throws java.io.IOException
- MultiPartResponse constructor
- Parameters:
response
- The ServletResponse to which this multipart
response will be sent.
startNextPart
public void startNextPart(java.lang.String contentType)
throws java.io.IOException
- Start creation of the next Content
endPart
public void endPart()
throws java.io.IOException
- End the current part
- Throws:
- java.io.IOException - IOException
endLastPart
public void endLastPart()
throws java.io.IOException
- End the current part and the whole response.
- Throws:
- java.io.IOException - IOException
endPart
public void endPart(boolean lastPart)
throws java.io.IOException
- End the current part
- Parameters:
lastPart
- True if this is the last part- Throws:
- java.io.IOException - IOException