<h2>org.das2.util.filesystem.HttpUtil</h2><p>Utilities for HTTP protocol, such as a cache for the HEAD metadata.</p> <h2>HttpUtil( )</h2> <p></p> <hr> <a name="checkRedirect"></a> <h2>checkRedirect</h2> checkRedirect( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URLConnection.html'>java.net.URLConnection</a> urlConnection ) → <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URLConnection.html'>java.net.URLConnection</a> <p>check for 301, 302 or 303 redirects, and return a new connection in this case. This should be called immediately before the urlConnection.connect call, as this must connect to get the response code.</p> <h3>Parameters</h3> urlConnection - if an HttpUrlConnection, check for 301 or 302; return connection otherwise. <h3>Returns:</h3> a connection, typically the same one as passed in. <br><br> <a href="https://github.com/autoplot/dev/search?q=checkRedirect&unscoped_q=checkRedirect">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/filesystem/HttpUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/filesystem/HttpUtil.html#checkRedirect">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/filesystem/HttpUtil.java">[view source]</a> <br> <br> <hr> <a name="consumeStream"></a> <h2>consumeStream</h2> consumeStream( <a href='https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html'>java.io.InputStream</a> err ) → void <p>nice clients consume both the stderr and stdout coming from websites. This reads everything off of the stream and closes it. http://docs.oracle.com/javase/1.5.0/docs/guide/net/http-keepalive.html suggests that you "do not abandon connection"</p> <h3>Parameters</h3> err - the input stream <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=consumeStream&unscoped_q=consumeStream">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/filesystem/HttpUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/filesystem/HttpUtil.html#consumeStream">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/filesystem/HttpUtil.java">[view source]</a> <br> <br> <hr> <a name="copyConnectProperties"></a> <h2>copyConnectProperties</h2> copyConnectProperties( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html'>java.net.HttpURLConnection</a> urlc, <a href='https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html'>java.net.HttpURLConnection</a> newConnection ) → void <p>copy over connection properties like Cookie and Accept-Encoding.</p> <h3>Parameters</h3> urlc - a HttpURLConnection <br> newConnection - a HttpURLConnection <h3>Returns:</h3> void (returns nothing) <br><br> <a href="https://github.com/autoplot/dev/search?q=copyConnectProperties&unscoped_q=copyConnectProperties">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/filesystem/HttpUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/filesystem/HttpUtil.html#copyConnectProperties">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/filesystem/HttpUtil.java">[view source]</a> <br> <br> <hr> <a name="getMetadata"></a> <h2>getMetadata</h2> getMetadata( <a href='https://docs.oracle.com/javase/8/docs/api/java/net/URL.html'>java.net.URL</a> url, <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> props ) → <a href='https://docs.oracle.com/javase/8/docs/api/java/util/Map.html'>java.util.Map</a> <p>return the metadata about a URL. This will support http, https, and ftp, and will check for redirects. This will allow caching of head requests.</p> <h3>Parameters</h3> url - ftp,https, or http URL <br> props - if non-null, may be a map containing cookie. <h3>Returns:</h3> the metadata <h3>See Also:</h3> <a href='null'>WebProtocol#META_EXIST</a> <br> <a href='null'>WebProtocol#HTTP_RESPONSE_CODE</a> <br> <br><br> <a href="https://github.com/autoplot/dev/search?q=getMetadata&unscoped_q=getMetadata">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/util/filesystem/HttpUtil.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/util/filesystem/HttpUtil.html#getMetadata">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCoreUtil/src/org/das2/util/filesystem/HttpUtil.java">[view source]</a> <br> <br>