Package org.commoncrawl.io.shared

Examples of org.commoncrawl.io.shared.NIOHttpHeaders


   
    int resultCode = -1;
   
    if (theConnection != null) {
     
      NIOHttpHeaders headers = theConnection.getResponseHeaders();
      resultCode = NIOHttpConnection.getHttpResponseCode(headers);
     
      if (item != null) {
        item.incrementFailureCount(errorType,resultCode);
      }
View Full Code Here


 
  // @Override
  public void HttpConnectionStateChanged(NIOHttpConnection theConnection,State oldState, State state) {
   
    if (oldState == State.PARSING_HEADERS && state == State.RECEIVING_CONTENT) {
      NIOHttpHeaders headers = theConnection.getResponseHeaders();
      LOG.info("*** S3 INCOMING HEADERS:" + headers.toString());
      LOG.info("Content Length From Header for:" + theConnection.getURL() + " is:" + headers.findValue("Content-Length"));
    }
   
    LOG.info("S3Download Connection:" + theConnection.getURL() +" Old State:" + oldState + " NewState:" + state);
    // get context
    S3DownloadItem item = (S3DownloadItem) theConnection.getContext();

    // if we started receiving content ...
    if (state == State.RECEIVING_CONTENT) {
     
      // this means we successfully parsed http header ...
      // pick up etag and content length for the item ...
      NIOHttpHeaders headers = theConnection.getResponseHeaders();
     
      int resultCode = NIOHttpConnection.getHttpResponseCode(headers);
     
      boolean continueDownloading = false;
      boolean isContinuation = false;
     
      if (item != null) {
        // if success
        if (resultCode >= 200 && resultCode <300) {
         
          continueDownloading = true;
         
          String etagValue = headers.findValue("ETag");
          String contentLengthValue = headers.findValue("Content-Length");
          String rangeValue = headers.findValue("Content-Range");
         
          if(etagValue != null && contentLengthValue != null) {
            try {
              // now check range value .. in case it is set ...
              if (rangeValue != null) {
View Full Code Here

   
    if (failureExcepted) {
      return false;
    }
    else {
      NIOHttpHeaders headers = connection.getResponseHeaders();
     
      if (headers.getValue(0).compareTo(statusLineExpected) != 0) {
        LOG.error("Status Line Comparison Failed. Connection:" + headers.getValue(0) + " Expected:" + statusLineExpected);
        return false;
      }
      if (getHttpResponseCode(headers) != statusCodeExpected) {
        LOG.error("Status Code Different. Found:" + getHttpResponseCode(headers) + " Expected:" + statusCodeExpected);
        return false
View Full Code Here

TOP

Related Classes of org.commoncrawl.io.shared.NIOHttpHeaders

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.