Tabnine Logo
SSLSwitchingEvent.getConnection
Code IndexAdd Tabnine to your IDE (free)

How to use
getConnection
method
in
com.ning.http.client.providers.grizzly.events.SSLSwitchingEvent

Best Java code snippets using com.ning.http.client.providers.grizzly.events.SSLSwitchingEvent.getConnection (Showing top 3 results out of 315)

origin: com.ning/async-http-client

@Override
public NextAction handleEvent(final FilterChainContext ctx,
    final FilterChainEvent event) throws IOException {
  
  if (event.type() == SSLSwitchingEvent.class) {
    final SSLSwitchingEvent se = (SSLSwitchingEvent) event;
    final boolean isSecure = se.isSecure();
    CONNECTION_IS_SECURE.set(se.getConnection(), isSecure);
    
    // if enabling security - create SSLEngine here, because default
    // Grizzly SSLFilter will use host/port info from the Connection, rather
    // than request URL. Specifically this doesn't work with CONNECT tunnels.
    if (isSecure &&
        SSLUtils.getSSLEngine(ctx.getConnection()) == null) {
      // if SSLEngine is not yet set for the connection - initialize it
      final SSLEngine sslEngine = getClientSSLEngineConfigurator()
          .createSSLEngine(se.getHost(),
              se.getPort() == -1 ? 443 : se.getPort()
          );
      sslEngine.beginHandshake();
      SSLUtils.setSSLEngine(ctx.getConnection(), sslEngine);
    }
    return ctx.getStopAction();
  }
  return ctx.getInvokeAction();
}
origin: javaee/grizzly-ahc

@Override
public NextAction handleEvent(final FilterChainContext ctx,
    final FilterChainEvent event) throws IOException {
  
  if (event.type() == SSLSwitchingEvent.class) {
    final SSLSwitchingEvent se = (SSLSwitchingEvent) event;
    final boolean isSecure = se.isSecure();
    CONNECTION_IS_SECURE.set(se.getConnection(), isSecure);
    
    // if enabling security - create SSLEngine here, because default
    // Grizzly SSLFilter will use host/port info from the Connection, rather
    // than request URL. Specifically this doesn't work with CONNECT tunnels.
    if (isSecure &&
        SSLUtils.getSSLEngine(ctx.getConnection()) == null) {
      // if SSLEngine is not yet set for the connection - initialize it
      final SSLEngine sslEngine = getClientSSLEngineConfigurator()
          .createSSLEngine(se.getHost(),
              se.getPort() == -1 ? 443 : se.getPort()
          );
      sslEngine.beginHandshake();
      SSLUtils.setSSLEngine(ctx.getConnection(), sslEngine);
    }
    return ctx.getStopAction();
  }
  return ctx.getInvokeAction();
}
origin: org.glassfish.grizzly/grizzly-http-client

@Override
public NextAction handleEvent(final FilterChainContext ctx,
    final FilterChainEvent event) throws IOException {
  
  if (event.type() == SSLSwitchingEvent.class) {
    final SSLSwitchingEvent se = (SSLSwitchingEvent) event;
    final boolean isSecure = se.isSecure();
    CONNECTION_IS_SECURE.set(se.getConnection(), isSecure);
    
    // if enabling security - create SSLEngine here, because default
    // Grizzly SSLFilter will use host/port info from the Connection, rather
    // than request URL. Specifically this doesn't work with CONNECT tunnels.
    if (isSecure &&
        SSLUtils.getSSLEngine(ctx.getConnection()) == null) {
      // if SSLEngine is not yet set for the connection - initialize it
      final SSLEngine sslEngine = getClientSSLEngineConfigurator()
          .createSSLEngine(se.getHost(),
              se.getPort() == -1 ? 443 : se.getPort()
          );
      sslEngine.beginHandshake();
      SSLUtils.setSSLEngine(ctx.getConnection(), sslEngine);
    }
    return ctx.getStopAction();
  }
  return ctx.getInvokeAction();
}
com.ning.http.client.providers.grizzly.eventsSSLSwitchingEventgetConnection

Popular methods of SSLSwitchingEvent

  • <init>
  • getHost
  • getPort
  • isSecure

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • setContentView (Activity)
  • onRequestPermissionsResult (Fragment)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Best IntelliJ plugins
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