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

How to use
onResponse
method
in
com.mpush.netty.http.RequestContext

Best Java code snippets using com.mpush.netty.http.RequestContext.onResponse (Showing top 1 results out of 315)

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.httpRequestContextonResponse

Popular methods of RequestContext

  • <init>
  • destroy
  • onException
  • onFailure
  • onRedirect
  • parseTimeout
  • tryDone
    由于检测请求超时的任务存在,为了防止多线程下重复处理

Popular in Java

  • Start an intent from android
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Best plugins for Eclipse
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