Package net.yacy.cora.protocol

Examples of net.yacy.cora.protocol.ResponseHeader.containsKey()


    String directory = "";
    if (proxyurl.getPath().lastIndexOf('/') > 0)
      directory = proxyurl.getPath().substring(0, proxyurl.getPath().lastIndexOf('/'));

    if (outgoingHeader.containsKey("Location")) {
      // rewrite location header
      String location = outgoingHeader.get("Location");
      if (location.startsWith("http")) {
        location = "/proxy.html?url=" + location;
      } else {
View Full Code Here


    final String mimeType = outgoingHeader.getContentType();
    if (mimeType.startsWith("text/html") || mimeType.startsWith("text")) {
      final StringWriter buffer = new StringWriter();

      if (outgoingHeader.containsKey(HeaderFramework.TRANSFER_ENCODING)) {
        FileUtils.copy(new ChunkedInputStream(in), buffer, UTF8.charset);
      } else {
        FileUtils.copy(in, buffer, UTF8.charset);
      }
View Full Code Here

      }
      m.appendTail(result);

      final byte[] sbb = UTF8.getBytes(result.toString());

      if (outgoingHeader.containsKey(HeaderFramework.TRANSFER_ENCODING)) {
        HTTPDemon.sendRespondHeader(conProp, out, httpVersion, httpStatus, outgoingHeader);

        ChunkedOutputStream cos = new ChunkedOutputStream(out);

        cos.write(sbb);
View Full Code Here

        HTTPDemon.sendRespondHeader(conProp, out, httpVersion, httpStatus, outgoingHeader);

        out.write(sbb);
      }
    } else {
      if (!outgoingHeader.containsKey(HeaderFramework.CONTENT_LENGTH))
        outgoingHeader.put(HeaderFramework.CONTENT_LENGTH, (String) prop.get(HeaderFramework.CONNECTION_PROP_PROXY_RESPOND_SIZE));
        HTTPDemon.sendRespondHeader(conProp, out, httpVersion, httpStatus, outgoingHeader);
      FileUtils.copy(in, out);
    }
    return;
View Full Code Here

                    robotsTxt = null;
                    log.info("Robots.txt from URL '" + robotsURL + "' has wrong mimetype '" + header.mime() + "'.");
                } else {

                    // getting some metadata
                  eTag = header.containsKey(HeaderFramework.ETAG)?(header.get(HeaderFramework.ETAG)).trim():null;
                    lastMod = header.lastModified();
                   
                    // if the robots.txt file was not changed we break here
                    if ((eTag != null) && (oldEtag != null) && (eTag.equals(oldEtag))) {
                        if (log.isDebugEnabled()) log.debug("Robots.txt from URL '" + robotsURL + "' was not modified. Abort downloading of new version.");
View Full Code Here

          final ResponseHeader header = new ResponseHeader(client.getHttpResponse().getAllHeaders());
          final int code = client.getHttpResponse().getStatusLine().getStatusCode();

          if (code > 299 && code < 310) {
            // redirection (content may be empty)
                if (header.containsKey(HeaderFramework.LOCATION)) {
                    // getting redirection URL
                  String redirectionUrlString = header.get(HeaderFramework.LOCATION);
                    redirectionUrlString = redirectionUrlString.trim();

                    if (redirectionUrlString.length() == 0) {
View Full Code Here

                        responseBody
                );

                return response;
            } else if (code > 299 && code < 310) {
                if (header.containsKey(HeaderFramework.LOCATION)) {
                    // getting redirection URL
                  String redirectionUrlString = header.get(HeaderFramework.LOCATION);
                    redirectionUrlString = redirectionUrlString.trim();

                    if (redirectionUrlString.length() == 0) {
View Full Code Here

    String directory = "";
    if (proxyurl.getPath().lastIndexOf('/') > 0)
      directory = proxyurl.getPath().substring(0, proxyurl.getPath().lastIndexOf('/'));

    if (outgoingHeader.containsKey("Location")) {
      // rewrite location header
      String location = outgoingHeader.get("Location");
      if (location.startsWith("http")) {
        location = "/proxy.html?url=" + location;
      } else {
View Full Code Here

    final String mimeType = outgoingHeader.getContentType();
    if (mimeType.startsWith("text/html") || mimeType.startsWith("text")) {
      final StringWriter buffer = new StringWriter();

      if (outgoingHeader.containsKey(HeaderFramework.TRANSFER_ENCODING)) {
        FileUtils.copy(new ChunkedInputStream(in), buffer, UTF8.charset);
      } else {
        FileUtils.copy(in, buffer, UTF8.charset);
      }
View Full Code Here

      }
      m.appendTail(result);

      final byte[] sbb = UTF8.getBytes(result.toString());

      if (outgoingHeader.containsKey(HeaderFramework.TRANSFER_ENCODING)) {
        HTTPDemon.sendRespondHeader(conProp, out, httpVersion, httpStatus, outgoingHeader);

        final ChunkedOutputStream cos = new ChunkedOutputStream(out);

        cos.write(sbb);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.