congrats Icon
New! Announcing our next generation AI code completions
Read here
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

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • findViewById (Activity)
  • getApplicationContext (Context)
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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