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

How to use
HttpClientHandler
in
com.mpush.netty.http

Best Java code snippets using com.mpush.netty.http.HttpClientHandler (Showing top 2 results out of 315)

origin: mpusher/mpush

  @Override
  public void initChannel(SocketChannel ch) throws Exception {
    ch.pipeline().addLast("decoder", new HttpResponseDecoder());
    ch.pipeline().addLast("aggregator", new HttpObjectAggregator(maxContentLength));
    ch.pipeline().addLast("encoder", new HttpRequestEncoder());
    ch.pipeline().addLast("handler", new HttpClientHandler(NettyHttpClient.this));
  }
});
origin: mpusher/mpush

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  RequestContext context = ctx.channel().attr(client.requestKey).getAndSet(null);
  try {
    if (context != null && context.tryDone()) {
      LOGGER.debug("receive server response, request={}, response={}", context, msg);
      HttpResponse response = (HttpResponse) msg;
      if (isRedirect(response)) {
        if (context.onRedirect(response)) {
          String location = getRedirectLocation(context.request, response);
          if (location != null && location.length() > 0) {
            context.cancelled.set(false);
            context.request.setUri(location);
            client.request(context);
            return;
          }
        }
      }
      context.onResponse(response);
    } else {
      LOGGER.warn("receive server response but timeout, request={}, response={}", context, msg);
    }
  } finally {
    client.pool.tryRelease(ctx.channel());
    ReferenceCountUtil.release(msg);
  }
}
com.mpush.netty.httpHttpClientHandler

Most used methods

  • <init>
  • getRedirectLocation
  • isRedirect

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Top 12 Jupyter Notebook extensions
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