congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
HttpVersion.equals
Code IndexAdd Tabnine to your IDE (free)

How to use
equals
method
in
org.jboss.netty.handler.codec.http.HttpVersion

Best Java code snippets using org.jboss.netty.handler.codec.http.HttpVersion.equals (Showing top 11 results out of 315)

origin: org.elasticsearch.plugin/transport-netty3-client

private boolean isHttp10() {
  return nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_0);
}
origin: com.google.code.maven-play-plugin.org.playframework/play

public static boolean isKeepAlive(HttpMessage message) {
  return HttpHeaders.isKeepAlive(message) && message.getProtocolVersion().equals(HttpVersion.HTTP_1_1);
}
origin: gncloud/fastcatsearch

@Override
public void close() {
  boolean http10 = request.getProtocolVersion().equals(HttpVersion.HTTP_1_0);
  boolean close = HttpHeaders.Values.CLOSE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION))
      || (http10 && !HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION)));
  logger.debug("netty http close = {}", close);
  
  if (close) {
    channel.close();
  }
}
origin: cgbystrom/sockjs-netty

  @Override
  protected HttpResponse createResponse(String contentType) {
    HttpResponse response = super.createResponse(contentType);
    if (request.getProtocolVersion().equals(HttpVersion.HTTP_1_1)) {
      response.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
    }
    return response;
  }
}
origin: landy8530/netty-file-parent

private void writeResponse(Channel channel) {
  ChannelBuffer buf = ChannelBuffers.copiedBuffer(
      this.responseContent.toString(), CharsetUtil.UTF_8);
  this.responseContent.setLength(0);
  boolean close = ("close".equalsIgnoreCase(this.request
      .getHeader("Connection")))
      || ((this.request.getProtocolVersion()
          .equals(HttpVersion.HTTP_1_0)) && (!"keep-alive"
          .equalsIgnoreCase(this.request.getHeader("Connection"))));
  HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1,
      HttpResponseStatus.OK);
  response.setContent(buf);
  response.setHeader("Content-Type", "text/plain; charset=UTF-8");
  if (!close) {
    response.setHeader("Content-Length",
        String.valueOf(buf.readableBytes()));
  }
  ChannelFuture future = channel.write(response);
  if (close)
    future.addListener(ChannelFutureListener.CLOSE);
}
origin: gncloud/fastcatsearch

@Override
public void sendError(HttpResponseStatus status, Throwable throwable) {
  // Decide whether to close the connection or not.
  boolean http10 = request.getProtocolVersion().equals(HttpVersion.HTTP_1_0);
  boolean close = HttpHeaders.Values.CLOSE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION))
      || (http10 && !HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION)));
  // Build the response object.
  HttpResponse resp = null;
  if (http10) {
    resp = new DefaultHttpResponse(HttpVersion.HTTP_1_0, status);
    if (!close) {
      resp.addHeader(HttpHeaders.Names.CONNECTION, "Keep-Alive");
    }
  } else {
    resp = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status);
  }
  String cause = getErrorHtml(status, throwable);
  byte[] errorMessage = cause.getBytes(Charset.forName("UTF-8"));
  ChannelBuffer buf = ChannelBuffers.wrappedBuffer(errorMessage);
  resp.setContent(buf);
  resp.setHeader(HttpHeaders.Names.CONTENT_TYPE, "text/html");
  resp.setHeader(HttpHeaders.Names.CONTENT_ENCODING, "UTF-8");
  resp.setHeader(HttpHeaders.Names.CONTENT_LENGTH, buf.readableBytes());
  // Write the response.
  ChannelFuture future = channel.write(resp);
  // Close the connection after the write operation is done if necessary.
  if (close) {
    future.addListener(ChannelFutureListener.CLOSE);
  }
}
origin: org.graylog2/jersey-netty

if (protocolVersion.equals(HttpVersion.HTTP_1_1) && HttpHeaders.getContentLength(httpResponse, -3L) != -3L) {
  httpResponse.setChunked(true);
  HttpHeaders.setTransferEncodingChunked(httpResponse);
origin: com.google.code.maven-play-plugin.org.playframework/play

long fileLength = raf.length();
boolean isKeepAlive = HttpHeaders.isKeepAlive(nettyRequest) && nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_1);
origin: gncloud/fastcatsearch

@Override
public void sendHeader(ActionResponse response) {
  // Decide whether to close the connection or not.
  boolean http10 = request.getProtocolVersion().equals(HttpVersion.HTTP_1_0);
  boolean close = HttpHeaders.Values.CLOSE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION))
      || (http10 && !HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION)));
  // Build the response object.
  HttpResponseStatus status = HttpResponseStatus.OK;
  HttpResponse resp = null;
  if (http10) {
    resp = new DefaultHttpResponse(HttpVersion.HTTP_1_0, status);
    if (!close) {
      resp.addHeader(HttpHeaders.Names.CONNECTION, "Keep-Alive");
    }
  } else {
    resp = new DefaultHttpResponse(HttpVersion.HTTP_1_1, status);
  }
  if (response.responseCookie() != null) {
    resp.addHeader(HttpHeaders.Names.COOKIE, response.responseCookie());
  }
  if (response.responseSetCookie() != null) {
    resp.addHeader(HttpHeaders.Names.SET_COOKIE, response.responseSetCookie());
  }
  resp.setHeader(HttpHeaders.Names.CONTENT_TYPE, response.contentType());
}
origin: gncloud/fastcatsearch

boolean http10 = request.getProtocolVersion().equals(HttpVersion.HTTP_1_0);
boolean close = HttpHeaders.Values.CLOSE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION))
    || (http10 && !HttpHeaders.Values.KEEP_ALIVE.equalsIgnoreCase(request.getHeader(HttpHeaders.Names.CONNECTION)));
origin: jprante/elasticsearch-transport-websocket

@Override
public void sendResponse(RestResponse response) {
  boolean http10 = nettyRequest.getProtocolVersion().equals(HttpVersion.HTTP_1_0);
  boolean close =
      HttpHeaders.Values.CLOSE.equalsIgnoreCase(nettyRequest.headers().get(HttpHeaders.Names.CONNECTION)) ||
org.jboss.netty.handler.codec.httpHttpVersionequals

Popular methods of HttpVersion

  • getText
    Returns the full protocol version text such as "HTTP/1.0".
  • getMajorVersion
    Returns the name of the protocol such as 1 in "HTTP/1.0".
  • getMinorVersion
    Returns the name of the protocol such as 0 in "HTTP/1.0".
  • getProtocolName
    Returns the name of the protocol such as "HTTP" in "HTTP/1.0".
  • toString
    Returns the full protocol version text such as "HTTP/1.0".
  • isKeepAliveDefault
    Returns true if and only if the connection is kept alive unless the "Connection" header is set to "c
  • valueOf
    Returns an existing or new HttpVersion instance which matches to the specified protocol version stri
  • <init>
    Creates a new HTTP version with the specified version string. You will not need to create a new inst
  • compareTo

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • runOnUiThread (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JLabel (javax.swing)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now