Class URLWriter

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    UrlUtil.URLWriter

    public class URLWriter
    extends java.lang.Object
    implements java.lang.Runnable
    • Constructor Summary

      Constructors 
      Constructor Description
      URLWriter​(java.io.InputStream is, java.lang.String strUrl, java.lang.String method, java.lang.String contentType, HTTPDetails details)  
      URLWriter​(java.io.InputStream is, java.net.URL url, java.lang.String method, java.lang.String contentType, HTTPDetails details)  
      URLWriter​(java.lang.String strUrl, IStreamWriter streamWriter, java.lang.String method, java.lang.String contentType, HTTPDetails details)  
      URLWriter​(java.net.URL url, IStreamWriter streamWriter, java.lang.String method, java.lang.String contentType, HTTPDetails details)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected UrlPart callProxy​(java.net.Proxy proxy)  
      protected UrlPart callProxy​(java.net.Proxy proxy, boolean bWantLog)  
      java.lang.Throwable getLastException()  
      protected java.util.List<java.net.Proxy> getProxies​(java.net.URI uri)  
      boolean isAddDirect()  
      void run()
      useful for asynchronous sending to a url
      void setAddDirect​(boolean addDirect)  
      java.lang.String toString()  
      UrlPart writeToURL()
      write a Stream to an output URL File: and http: are currently supported Use HttpURLConnection.getInputStream() to retrieve the http response
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • URLWriter

        public URLWriter​(java.net.URL url,
                         IStreamWriter streamWriter,
                         java.lang.String method,
                         java.lang.String contentType,
                         HTTPDetails details)
        Parameters:
        strUrl - the URL to write to
        stream - the input stream to read from
        streamWriter -
        method - HEAD, GET or POST
        contentType - the contenttype to set, if NULL defaults to TEXT/UNKNOWN
        details -
      • URLWriter

        public URLWriter​(java.lang.String strUrl,
                         IStreamWriter streamWriter,
                         java.lang.String method,
                         java.lang.String contentType,
                         HTTPDetails details)
        Parameters:
        strUrl - the URL to write to
        stream - the input stream to read from
        streamWriter -
        method - HEAD, GET or POST
        contentType - the contenttype to set, if NULL defaults to TEXT/UNKNOWN
        details -
      • URLWriter

        public URLWriter​(java.io.InputStream is,
                         java.lang.String strUrl,
                         java.lang.String method,
                         java.lang.String contentType,
                         HTTPDetails details)
        Parameters:
        strUrl - the URL to write to
        stream - the input stream to read from
        streamWriter -
        method - HEAD, GET or POST
        contentType - the contenttype to set, if NULL defaults to TEXT/UNKNOWN
        details -
      • URLWriter

        public URLWriter​(java.io.InputStream is,
                         java.net.URL url,
                         java.lang.String method,
                         java.lang.String contentType,
                         HTTPDetails details)
        Parameters:
        strUrl - the URL to write to
        stream - the input stream to read from
        streamWriter -
        method - HEAD, GET or POST
        contentType - the contenttype to set, if NULL defaults to TEXT/UNKNOWN
        details -
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • isAddDirect

        public boolean isAddDirect()
      • setAddDirect

        public void setAddDirect​(boolean addDirect)
      • writeToURL

        public UrlPart writeToURL()
        write a Stream to an output URL File: and http: are currently supported Use HttpURLConnection.getInputStream() to retrieve the http response
        Returns:
        UrlPart the opened http connection, null in case of error
      • getProxies

        protected java.util.List<java.net.Proxy> getProxies​(java.net.URI uri)
      • callProxy

        protected UrlPart callProxy​(java.net.Proxy proxy,
                                    boolean bWantLog)
        Parameters:
        proxy -
        bWantLog -
        Returns:
      • callProxy

        protected UrlPart callProxy​(java.net.Proxy proxy)
                             throws java.io.IOException,
                                    java.net.ProtocolException
        Throws:
        java.io.IOException
        java.net.ProtocolException
      • getLastException

        public java.lang.Throwable getLastException()
      • run

        public void run()
        useful for asynchronous sending to a url
        Specified by:
        run in interface java.lang.Runnable
        See Also:
        Runnable.run()