Package net.i2p.util

Class EepHead


public class EepHead
extends EepGet
This is a quick hack to get a working EepHead, primarily for the following usage:
 EepHead foo = new EepHead(...);
 if (foo.fetch()) {
     String lastmod = foo.getLastModified();
     if (lastmod != null) {
         parse the string...
         ...
     }
 }
 
Other use cases (command line, listeners, etc...) lightly- or un-tested. Note that this follows redirects! This may not be what you want or expect. Writing from scratch rather than extending EepGet would maybe have been less bloated memory-wise. This way gets us redirect handling, among other benefits.
Since:
0.7.7
Author:
zzz
  • Constructor Details

  • Method Details

    • main

      public static void main​(String[] args)
      EepHead [-p 127.0.0.1:4444] [-n #retries] url This doesn't really do much since it doesn't register a listener. EepGet doesn't have a method to store and return all the headers, so just print out the ones we have methods for. Turn on logging to use it for a decent test.
    • doFetch

      protected void doFetch​(SocketTimeout timeout) throws IOException
      Description copied from class: EepGet
      This reads the response to a single fetch. Call after sendRequest()
      Overrides:
      doFetch in class EepGet
      Parameters:
      timeout - may be null as of 0.9.49
      Throws:
      IOException
    • shouldReadBody

      protected boolean shouldReadBody()
      Should we read the body of the response?
      Overrides:
      shouldReadBody in class EepGet
      Returns:
      false always
      Since:
      0.9.50
    • getRequest

      protected String getRequest() throws IOException
      Overrides:
      getRequest in class EepGet
      Throws:
      IOException
    • getContentLength

      public long getContentLength()
      We don't decrement the variable (unlike in EepGet), so this is valid