|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
com.infoengine.object.IeMultipartOutputStream
com.infoengine.soap.SOAPAttachmentOutputStream
this class is used to catch bytes from SOAP method invocation to be returned to a SOAP client as an attachment. bytes are buffered in memory while waiting to be written to the SOAP MIME stream. if the number of bytes written here exceeds a configurable threshold then the bytes will be temporarily redirected to a file. the threshold can be configured by setting the com.infoengine.soap.attachment.download.threshold System property. the property value must be a valid integer number of bytes. the default threshold is 100K.
Nested Class Summary | |
(package private) class |
SOAPAttachmentOutputStream.TemporaryFileInputStream
an extension to FileInputStream that deletes the underlying file when the stream is closed. |
Nested classes inherited from class com.infoengine.object.IeMultipartOutputStream |
|
Field Summary | |
private int |
bytesWritten
|
private String |
contentType
|
private InputStream |
dataSourceInput
|
private static int |
DEFAULT_THRESHOLD
|
private String |
name
|
private OutputStream |
os
|
private File |
overflowFile
|
private boolean |
streamClosed
|
private int |
threshold
|
Fields inherited from class com.infoengine.object.IeMultipartOutputStream |
boundary, contentLength, encoding, eof, forceEncoding, out |
Constructor Summary | |
SOAPAttachmentOutputStream()
create a SOAPAttachmentOutputStream that is used to catch bytes destined to be a SOAP attachment sent to a SOAP client |
Method Summary | |
void |
close()
close the underlying stream |
boolean |
eofWritten()
return the flag that determines if the eof was written |
void |
flush()
flush the underlying stream |
String |
getContentType()
get the content-type associated with this DataSource |
javax.activation.DataSource |
getDataSource()
get a javax.activation.DataSource implementation if there is some data to be supplied |
InputStream |
getInputStream()
get a stream that can be used to read the data from this DataSource. |
String |
getName()
get the name associated with this DataSource |
OutputStream |
getOutputStream()
this DataSource implementation does not support writing to writing only via exposed OutputStream methods |
protected void |
initialize(String contentType,
int contentLength,
String boundary)
|
protected void |
initialize(String contentType,
String boundary)
|
void |
print(String data)
Prints a string to the output stream. |
void |
println(String data)
Prints a string to the output stream with a CR/LF sequence appended. |
void |
setCharacterSet(String encoding)
since this class is only concerned with binary data this method is a no-op |
void |
setForceEncoding(String encoding)
since this class is only concerned with binary data this method is a no-op |
private void |
startOverFlow()
when the number of bytes written to this stream exceeds the configured threshold this method will be called to begin writing the data to file to avoid memory related issues. |
void |
write(byte[] b)
write an array of bytes to the underlying stream has same effect as write ( b, 0, b.length ) |
void |
write(byte[] b,
int off,
int len)
write an array of bytes or a subset of an aray of bytes to the underlying stream |
void |
write(int b)
write a single byte to the underlying stream |
void |
write(String name,
String filename,
String contentType)
set the name, filename and contentType associated with this multipart stream |
void |
write(String data,
String name,
String filename,
String contentType)
Writes one content object of a MIME multipart object to the output stream. |
void |
writeBlob(InputStream content,
String name,
String filename,
String contentType)
write the data on content with the associated MIME info |
void |
writeBlob(InputStream content,
String name,
String filename,
String contentType,
boolean flag)
Writes one content object of a MIME multipart object to the output stream. |
void |
writeEOF()
write end boundary. |
void |
writeRequest(IeRequest request)
Writes an Info*Engine request object to the output stream. |
void |
writeRequest(IeRequest request,
String contentType)
Writes an Info*Engine request object to the output stream serializing according to contentType. |
void |
writeRequest(IeRequest request,
String contentType,
boolean exception)
Writes an Info*Engine request object to the output stream serializing according to contentType. |
void |
writeVdb(IeCollection vdb,
String contentType)
Writes an Info*Engine VDB object to the output stream serializing according to contentType. |
void |
writeVdb(IeCollection vdb,
String contentType,
boolean exception)
Writes an Info*Engine VDB object to the output stream serializing according to contentType. |
Methods inherited from class com.infoengine.object.IeMultipartOutputStream |
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final int DEFAULT_THRESHOLD
private int threshold
private int bytesWritten
private InputStream dataSourceInput
private OutputStream os
private String name
private String contentType
private File overflowFile
private boolean streamClosed
Constructor Detail |
public SOAPAttachmentOutputStream() throws IOException
Method Detail |
public void close() throws IOException
close
in class IeMultipartOutputStream
IOException
- if buffered output is not flushed successfully.public boolean eofWritten()
eofWritten
in class IeMultipartOutputStream
writeEOF()
public void flush() throws IOException
flush
in class IeMultipartOutputStream
IOException
- if buffered output is not flushed successfully.protected void initialize(String contentType, String boundary)
initialize
in class IeMultipartOutputStream
protected void initialize(String contentType, int contentLength, String boundary)
initialize
in class IeMultipartOutputStream
public void setCharacterSet(String encoding)
setCharacterSet
in class IeMultipartOutputStream
encoding
- The character set encoding name.public void setForceEncoding(String encoding)
setForceEncoding
in class IeMultipartOutputStream
encoding
- The character set encoding name.public void write(byte[] b) throws IOException
write
in class IeMultipartOutputStream
b
- the bytes to write
IOException
- if the array is not written successfully.public void write(int b) throws IOException
write
in class IeMultipartOutputStream
b
- the byte to write
IOException
- if the segment is not written successfully.public void write(byte[] b, int off, int len) throws IOException
write
in class IeMultipartOutputStream
b
- - the array of bytes to writeoff
- - the offset into the byte array to start writing atlen
- - the number of bytes to write
IOException
- if the segment is not written successfully.public void write(String name, String filename, String contentType)
write
in class IeMultipartOutputStream
name
- - the MIME part namefilename
- - the MIME part filenamecontentType
- - the MIME part content-typepublic void writeBlob(InputStream content, String name, String filename, String contentType) throws IOException
writeBlob
in class IeMultipartOutputStream
content
- - the input stream to read the data fromname
- - the MIME part namefilename
- - the MIME part filenamecontentType
- - the MIME part content-type
IOException
- if the content object is not written
successfully.public void writeBlob(InputStream content, String name, String filename, String contentType, boolean flag) throws IOException
IeMultipartOutputStream
writeBlob
in class IeMultipartOutputStream
content
- The input stream containing the bytes to be written to
the output stream as the content data.name
- The name to be specified in the Content-Disposition header
of the content object.filename
- The filename to be specified in the Content-Disposition
header of the content object.contentType
- The MIME content type to be specified in the
Content-Type header of the content object.flag
- Ignored.
IOException
- if the content object is not written
successfully.writeBlob
public void writeEOF()
writeEOF
in class IeMultipartOutputStream
eofWritten()
public javax.activation.DataSource getDataSource()
private void startOverFlow() throws IOException
IOException
public String getContentType()
getContentType
in interface javax.activation.DataSource
public InputStream getInputStream() throws IOException
getInputStream
in interface javax.activation.DataSource
IOException
public String getName()
getName
in interface javax.activation.DataSource
public OutputStream getOutputStream() throws IOException
getOutputStream
in interface javax.activation.DataSource
UnsupportedOperationException
IOException
public void writeRequest(IeRequest request)
IeMultipartOutputStream
writeRequest
in class IeMultipartOutputStream
request
- The Info*Engine request object to be written.public void writeRequest(IeRequest request, String contentType)
IeMultipartOutputStream
writeRequest
in class IeMultipartOutputStream
request
- The Info*Engine request object to be written.contentType
- The MIME content type to associate with the request.
Currently accepts text/xml or
application/java-serialized-object. If null,
will use application/java-serialized-object.public void writeRequest(IeRequest request, String contentType, boolean exception)
IeMultipartOutputStream
writeRequest
in class IeMultipartOutputStream
request
- The Info*Engine request object to be written.contentType
- The MIME content type to associate with the request.
Currently accepts text/xml or
application/java-serialized-object. If null,
will use application/java-serialized-object.exception
- States whether this request is the result of an
exception or not. If true the MIME part for the
request will be named "exception". If false the MIME
part will be named "request".public void writeVdb(IeCollection vdb, String contentType)
IeMultipartOutputStream
writeVdb
in class IeMultipartOutputStream
vdb
- The Info*Engine VDB object to be written.contentType
- The MIME content type to associate with the request.
Currently accepts text/xml or
application/java-serialized-object. If null,
will use text/xml.public void writeVdb(IeCollection vdb, String contentType, boolean exception)
IeMultipartOutputStream
writeVdb
in class IeMultipartOutputStream
vdb
- The Info*Engine VDB object to be written.contentType
- The MIME content type to associate with the request.
Currently accepts text/xml or
application/java-serialized-object. If null,
will use text/xml.exception
- States whether this VDB is the result of an exception
or not. If true the MIME part for the VDB will be named
"exception". If false the MIME part will be named "object".public void print(String data)
IeMultipartOutputStream
print
in class IeMultipartOutputStream
data
- The string to be written.public void println(String data)
IeMultipartOutputStream
println
in class IeMultipartOutputStream
data
- The string to be written.public void write(String data, String name, String filename, String contentType) throws IOException
IeMultipartOutputStream
write
in class IeMultipartOutputStream
data
- The string to be written to the output stream as the
content data.name
- The name to be specified in the Content-Disposition header
of the content object.filename
- The filename to be specified in the Content-Disposition
header of the content object.contentType
- The MIME content type to be specified in the
Content-Type header of the content object.
IOException
- if the content object is not written
successfully.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |