Package org.cip4.jdflib.util
Class UrlPart
- java.lang.Object
-
- org.cip4.jdflib.util.UrlPart
-
- All Implemented Interfaces:
IStreamWriter,IPollDetails
public class UrlPart extends java.lang.Object implements IPollDetails, IStreamWriter
simple struct to contain the stream and type of a bodypart
-
-
Field Summary
Fields Modifier and Type Field Description longcontentLengththe content length of this UrlPart
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuffer()buffer my input streamprotected voidfinalize()java.net.URLConnectiongetConnection()java.lang.StringgetContentType()get the content type of the polled stuffintgetResponseCode()get the new response code (e.g.java.io.InputStreamgetResponseStream()get the resulting stream - may be nulljava.lang.StringgetResponseString(int maxLen)static intgetReturnCode(UrlPart p)XMLDocgetXMLDoc()returns an xmldoc corresponding to this partbooleanisPush()we are pollingstatic booleanisReturnCodeOK(UrlPart p)voidsetInStream(java.io.InputStream inStream)java.lang.StringtoString()voidwriteStream(java.io.OutputStream os)write myself to a stream
-
-
-
Constructor Detail
-
UrlPart
public UrlPart(java.net.HttpURLConnection connection) throws java.io.IOException- Parameters:
connection-- Throws:
java.io.IOException
-
UrlPart
public UrlPart(java.net.URLConnection connection, boolean isHttp) throws java.io.IOException- Parameters:
connection-isHttp-- Throws:
java.io.IOException
-
UrlPart
public UrlPart(javax.mail.BodyPart part) throws javax.mail.MessagingException, java.io.IOException- Parameters:
part-- Throws:
javax.mail.MessagingExceptionjava.io.IOException
-
UrlPart
public UrlPart(java.io.File f) throws java.io.IOException- Parameters:
f-- Throws:
java.io.IOException
-
-
Method Detail
-
getResponseCode
public int getResponseCode()
Description copied from interface:IPollDetailsget the new response code (e.g. 200 for success)- Specified by:
getResponseCodein interfaceIPollDetails- Returns:
- the response code
-
writeStream
public void writeStream(java.io.OutputStream os) throws java.io.IOExceptionDescription copied from interface:IStreamWriterwrite myself to a stream- Specified by:
writeStreamin interfaceIStreamWriter- Parameters:
os- the output stream- Throws:
java.io.IOException- if io snafu...
-
getContentType
public java.lang.String getContentType()
Description copied from interface:IPollDetailsget the content type of the polled stuff- Specified by:
getContentTypein interfaceIPollDetails- Returns:
- the contentType
-
setInStream
public void setInStream(java.io.InputStream inStream)
- Parameters:
inStream- the inStream to set
-
getResponseStream
public java.io.InputStream getResponseStream()
Description copied from interface:IPollDetailsget the resulting stream - may be null- Specified by:
getResponseStreamin interfaceIPollDetails- Returns:
- the response stream
- See Also:
IPollDetails.getResponseStream()
-
getResponseString
public java.lang.String getResponseString(int maxLen)
- Parameters:
maxLen-- Returns:
-
getXMLDoc
public XMLDoc getXMLDoc()
returns an xmldoc corresponding to this part- Returns:
- the doc, null if not xml
-
buffer
public void buffer()
buffer my input stream
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- the string representation
- See Also:
Object.toString()
-
getConnection
public java.net.URLConnection getConnection()
- Returns:
- the connection
-
isPush
public boolean isPush()
we are polling- Specified by:
isPushin interfaceIPollDetails- Returns:
- false if polling; true if push environment
- See Also:
IPollDetails.isPush()
-
finalize
protected void finalize() throws java.lang.Throwable- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
isReturnCodeOK
public static boolean isReturnCodeOK(UrlPart p)
-
getReturnCode
public static int getReturnCode(UrlPart p)
-
-