_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q159400
JMXResource.emitOperations
train
private JSONArray emitOperations(ObjectName objName) throws Exception { MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); MBeanInfo mBeanInfo = mBeanServer.getMBeanInfo(objName); JSONArray ar = new JSONArray(); MBeanOperationInfo[] operations = mBeanInfo.getOperation...
java
{ "resource": "" }
q159401
Util.link
train
public static void link(File source, File target) throws IOException { if( UtilJNI.ON_WINDOWS == 1 ) { if( UtilJNI.CreateHardLinkW(target.getCanonicalPath(), source.getCanonicalPath(), 0) == 0) { throw new IOException("link failed"); } } else { if( Uti...
java
{ "resource": "" }
q159402
BluetoothController.stopBluetooth
train
private void stopBluetooth() { Log.d(TAG, "stopBluetooth"); if (mIsCountDownOn) { mIsCountDownOn = false; mCountDown.cancel(); } // Need to stop Sco audio connection here when the app // change orientation or close with headset still turns on. mC...
java
{ "resource": "" }
q159403
AIService.getService
train
public static AIService getService(final Context context, final AIConfiguration config) { if (config.getRecognitionEngine() == AIConfiguration.RecognitionEngine.Google) { return new GoogleRecognitionServiceImpl(context, config); } if (config.getRecognitionEngine() == AIConfiguration....
java
{ "resource": "" }
q159404
GoogleRecognitionServiceImpl.updateStopRunnable
train
private void updateStopRunnable(final int action) { if (stopRunnable != null) { if (action == 0) { handler.removeCallbacks(stopRunnable); } else if (action == 1) { handler.removeCallbacks(stopRunnable); handler.postDelayed(stopRunnable, STO...
java
{ "resource": "" }
q159405
DragItemRecyclerView.findChildView
train
public View findChildView(float x, float y) { final int count = getChildCount(); if (y <= 0 && count > 0) { return getChildAt(0); } for (int i = count - 1; i >= 0; i--) { final View child = getChildAt(i); MarginLayoutParams params = (MarginLayoutParam...
java
{ "resource": "" }
q159406
BoardView.setCustomDragItem
train
public void setCustomDragItem(DragItem dragItem) { DragItem newDragItem = dragItem != null ? dragItem : new DragItem(getContext()); newDragItem.setSnapToTouch(mDragItem.isSnapToTouch()); mDragItem = newDragItem; mRootLayout.removeViewAt(1); mRootLayout.addView(mDragItem.getDragIt...
java
{ "resource": "" }
q159407
StandaloneAhcWSResponse.getHeaders
train
@Override public Map<String, List<String>> getHeaders() { final Map<String, List<String>> headerMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); final HttpHeaders headers = ahcResponse.getHeaders(); for (String name : headers.names()) { final List<String> values = headers.getA...
java
{ "resource": "" }
q159408
StandaloneAhcWSResponse.getCookies
train
@Override public List<WSCookie> getCookies() { return ahcResponse.getCookies().stream().map(this::asCookie).collect(toList()); }
java
{ "resource": "" }
q159409
StandaloneAhcWSResponse.getCookie
train
@Override public Optional<WSCookie> getCookie(String name) { for (Cookie ahcCookie : ahcResponse.getCookies()) { // safe -- cookie.getName() will never return null if (ahcCookie.name().equals(name)) { return Optional.of(asCookie(ahcCookie)); } } ...
java
{ "resource": "" }
q159410
OAuth.retrieveRequestToken
train
public RequestToken retrieveRequestToken(String callbackURL) { OAuthConsumer consumer = new DefaultOAuthConsumer(info.key.key, info.key.secret); try { provider.retrieveRequestToken(consumer, callbackURL); return new RequestToken(consumer.getToken(), consumer.getTokenSecret()); ...
java
{ "resource": "" }
q159411
OAuth.retrieveAccessToken
train
public RequestToken retrieveAccessToken(RequestToken token, String verifier) { OAuthConsumer consumer = new DefaultOAuthConsumer(info.key.key, info.key.secret); consumer.setTokenWithSecret(token.token, token.secret); try { provider.retrieveAccessToken(consumer, verifier); ...
java
{ "resource": "" }
q159412
OAuth.redirectUrl
train
public String redirectUrl(String token) { return play.shaded.oauth.oauth.signpost.OAuth.addQueryParameters( provider.getAuthorizationWebsiteUrl(), play.shaded.oauth.oauth.signpost.OAuth.OAUTH_TOKEN, token ); }
java
{ "resource": "" }
q159413
WebSocketClientConnectorConfig.getSubProtocolsAsCSV
train
public String getSubProtocolsAsCSV() { if (subProtocols == null) { return null; } String subProtocolsAsCSV = ""; for (String subProtocol : subProtocols) { subProtocolsAsCSV = subProtocolsAsCSV.concat(subProtocol + ","); } subProtocolsAsCSV = subPr...
java
{ "resource": "" }
q159414
WebSocketClientConnectorConfig.setSubProtocols
train
public void setSubProtocols(String[] subProtocols) { if (subProtocols == null || subProtocols.length == 0) { this.subProtocols = null; return; } this.subProtocols = Arrays.asList(subProtocols); }
java
{ "resource": "" }
q159415
PathChecker.check
train
@Override public void check(Certificate cert, Collection<String> unresolvedCritExts) throws CertPathValidatorException { RevocationStatus status; try { status = verifier.checkRevocationStatus((X509Certificate) cert, nextIssuer()); if (LOG.isInfoEnabled()) { ...
java
{ "resource": "" }
q159416
HttpConnectorUtil.getSenderConfiguration
train
public static SenderConfiguration getSenderConfiguration(TransportsConfiguration transportsConfiguration, String scheme) { Map<String, SenderConfiguration> senderConfigurations = transportsConfiguration.getSenderConfigurations().stream...
java
{ "resource": "" }
q159417
HttpConnectorUtil.getTransportProperties
train
public static Map<String, Object> getTransportProperties(TransportsConfiguration transportsConfiguration) { Map<String, Object> transportProperties = new HashMap<>(); Set<TransportProperty> transportPropertiesSet = transportsConfiguration.getTransportProperties(); if (transportPropertiesSet != n...
java
{ "resource": "" }
q159418
HttpConnectorUtil.getServerBootstrapConfiguration
train
public static ServerBootstrapConfiguration getServerBootstrapConfiguration(Set<TransportProperty> transportPropertiesSet) { Map<String, Object> transportProperties = new HashMap<>(); if (transportPropertiesSet != null && !transportPropertiesSet.isEmpty()) { transportProperties =...
java
{ "resource": "" }
q159419
WebSocketServerHandshakeHandler.containsUpgradeHeaders
train
private boolean containsUpgradeHeaders(HttpRequest httpRequest) { HttpHeaders headers = httpRequest.headers(); return headers.containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE, true) && headers .containsValue(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET, true); ...
java
{ "resource": "" }
q159420
WebSocketServerHandshakeHandler.handleWebSocketHandshake
train
private void handleWebSocketHandshake(FullHttpRequest fullHttpRequest, ChannelHandlerContext ctx) throws WebSocketConnectorException { String extensionsHeader = fullHttpRequest.headers().getAsString(HttpHeaderNames.SEC_WEBSOCKET_EXTENSIONS); DefaultWebSocketHandshaker webSocketHandshaker = ...
java
{ "resource": "" }
q159421
ConnectionManager.borrowTargetChannel
train
public TargetChannel borrowTargetChannel(HttpRoute httpRoute, SourceHandler sourceHandler, Http2SourceHandler http2SourceHandler, SenderConfiguration senderConfig, BootstrapConfiguration bootstrapConfig, ...
java
{ "resource": "" }
q159422
CertificatePathValidator.validatePath
train
public void validatePath() throws CertificateVerificationException { Security.addProvider(new BouncyCastleProvider()); CollectionCertStoreParameters params = new CollectionCertStoreParameters(fullCertChain); try { CertStore store = CertStore.getInstance("Collection", params, Co...
java
{ "resource": "" }
q159423
HttpCarbonMessage.addHttpContent
train
public synchronized void addHttpContent(HttpContent httpContent) { contentObservable.notifyAddListener(httpContent); if (messageFuture != null) { if (ioException != null) { blockingEntityCollector.addHttpContent(new DefaultLastHttpContent()); messageFuture.not...
java
{ "resource": "" }
q159424
HttpCarbonMessage.getHttpContent
train
public HttpContent getHttpContent() { HttpContent httpContent = this.blockingEntityCollector.getHttpContent(); this.contentObservable.notifyGetListener(httpContent); return httpContent; }
java
{ "resource": "" }
q159425
HttpCarbonMessage.setHeader
train
public void setHeader(String key, Object value) { this.httpMessage.headers().set(key, value); }
java
{ "resource": "" }
q159426
HttpCarbonMessage.pushResponse
train
public HttpResponseFuture pushResponse(HttpCarbonMessage httpCarbonMessage, Http2PushPromise pushPromise) throws ServerConnectorException { httpOutboundRespFuture.notifyHttpListener(httpCarbonMessage, pushPromise); return httpOutboundRespStatusFuture; }
java
{ "resource": "" }
q159427
HttpCarbonMessage.cloneCarbonMessageWithOutData
train
public HttpCarbonMessage cloneCarbonMessageWithOutData() { HttpCarbonMessage newCarbonMessage = getNewHttpCarbonMessage(); Map<String, Object> propertiesMap = this.getProperties(); propertiesMap.forEach(newCarbonMessage::setProperty); return newCarbonMessage; }
java
{ "resource": "" }
q159428
Http2ClientChannel.putInFlightMessage
train
public void putInFlightMessage(int streamId, OutboundMsgHolder inFlightMessage) { if (LOG.isDebugEnabled()) { LOG.debug("In flight message added to channel: {} with stream id: {} ", this, streamId); } inFlightMessages.put(streamId, inFlightMessage); }
java
{ "resource": "" }
q159429
Http2ClientChannel.getInFlightMessage
train
public OutboundMsgHolder getInFlightMessage(int streamId) { if (LOG.isDebugEnabled()) { LOG.debug("Getting in flight message for stream id: {} from channel: {}", streamId, this); } return inFlightMessages.get(streamId); }
java
{ "resource": "" }
q159430
Http2ClientChannel.removeInFlightMessage
train
public void removeInFlightMessage(int streamId) { if (LOG.isDebugEnabled()) { LOG.debug("In flight message for stream id: {} removed from channel: {}", streamId, this); } inFlightMessages.remove(streamId); }
java
{ "resource": "" }
q159431
Http2ClientChannel.destroy
train
void destroy() { this.connection.removeListener(streamCloseListener); inFlightMessages.clear(); promisedMessages.clear(); http2ConnectionManager.removeClientChannel(httpRoute, this); }
java
{ "resource": "" }
q159432
SendingEntityBody.triggerPipeliningLogic
train
private void triggerPipeliningLogic(HttpCarbonMessage outboundResponseMsg) { String httpVersion = (String) inboundRequestMsg.getProperty(Constants.HTTP_VERSION); if (outboundResponseMsg.isPipeliningEnabled() && Constants.HTTP_1_1_VERSION.equalsIgnoreCase (httpVersion)) { Queu...
java
{ "resource": "" }
q159433
WebSocketClient.handshake
train
public ClientHandshakeFuture handshake() { final DefaultClientHandshakeFuture handshakeFuture = new DefaultClientHandshakeFuture(); try { URI uri = new URI(url); String scheme = uri.getScheme(); if (!Constants.WS_SCHEME.equalsIgnoreCase(scheme) && !Constants.WSS_SCHE...
java
{ "resource": "" }
q159434
CRLCache.getNextCacheValue
train
public synchronized ManageableCacheValue getNextCacheValue() { //changes to the map are reflected on the keySet. And its iterator is weakly consistent. so will never //throw concurrent modification exception. if (iterator.hasNext()) { return hashMap.get(iterator.next().getKey());...
java
{ "resource": "" }
q159435
OCSPVerifier.generateOCSPRequest
train
public static OCSPReq generateOCSPRequest(X509Certificate issuerCert, BigInteger serialNumber) throws CertificateVerificationException { //Programatically adding Bouncy Castle as the security provider. So no need to manually set. Once the programme // is over security provider will also...
java
{ "resource": "" }
q159436
SSLHandlerFactory.createSSLContextFromKeystores
train
public SSLContext createSSLContextFromKeystores(boolean isServer) { String protocol = sslConfig.getSSLProtocol(); try { KeyManager[] keyManagers = null; if (sslConfig.getKeyStore() != null) { KeyStore ks = getKeyStore(sslConfig.getKeyStore(), sslConfig.getKeyStore...
java
{ "resource": "" }
q159437
SSLHandlerFactory.buildServerSSLEngine
train
public SSLEngine buildServerSSLEngine(SSLContext sslContext) { SSLEngine engine = sslContext.createSSLEngine(); engine.setUseClientMode(false); if (needClientAuth) { engine.setNeedClientAuth(true); } else if (wantClientAuth) { engine.setWantClientAuth(true); ...
java
{ "resource": "" }
q159438
SSLHandlerFactory.getServerReferenceCountedOpenSslContext
train
public ReferenceCountedOpenSslContext getServerReferenceCountedOpenSslContext(boolean enableOcsp) throws SSLException { if (sslConfig.getKeyStore() != null) { sslContextBuilder = serverContextBuilderWithKs(SslProvider.OPENSSL); } else { sslContextBuilder = serverConte...
java
{ "resource": "" }
q159439
SSLHandlerFactory.buildClientReferenceCountedOpenSslContext
train
public ReferenceCountedOpenSslContext buildClientReferenceCountedOpenSslContext() throws SSLException { if (sslConfig.getTrustStore() != null) { sslContextBuilder = clientContextBuilderWithKs(SslProvider.OPENSSL); } else { sslContextBuilder = clientContextBuilderWithCerts(SslProv...
java
{ "resource": "" }
q159440
SSLHandlerFactory.buildClientSSLEngine
train
public SSLEngine buildClientSSLEngine(String host, int port) { SSLEngine engine = sslContext.createSSLEngine(host, port); engine.setUseClientMode(true); return addCommonConfigs(engine); }
java
{ "resource": "" }
q159441
SSLHandlerFactory.addCommonConfigs
train
public SSLEngine addCommonConfigs(SSLEngine engine) { if (sslConfig.getCipherSuites() != null && sslConfig.getCipherSuites().length > 0) { engine.setEnabledCipherSuites(sslConfig.getCipherSuites()); } if (sslConfig.getEnableProtocols() != null && sslConfig.getEnableProtocols().length...
java
{ "resource": "" }
q159442
SSLHandlerFactory.createHttpTLSContextForServer
train
public SslContext createHttpTLSContextForServer() throws SSLException { SslProvider provider = SslProvider.JDK; SslContext certsSslContext = serverContextBuilderWithCerts(provider).build(); int sessionTimeout = sslConfig.getSessionTimeOut(); if (sessionTimeout > 0) { certsSsl...
java
{ "resource": "" }
q159443
SSLHandlerFactory.createHttpTLSContextForClient
train
public SslContext createHttpTLSContextForClient() throws SSLException { SslProvider provider = SslProvider.JDK; SslContext certsSslContext = clientContextBuilderWithCerts(provider).build(); int sessionTimeout = sslConfig.getSessionTimeOut(); if (sessionTimeout > 0) { certsSsl...
java
{ "resource": "" }
q159444
SourceHandler.setRequestProperties
train
private void setRequestProperties() { inboundRequestMsg.setPipeliningEnabled(pipeliningEnabled); //Value of listener config String connectionHeaderValue = inboundRequestMsg.getHeader(HttpHeaderNames.CONNECTION.toString()); String httpVersion = (String) inboundRequestMsg.getProperty(Constants.HTT...
java
{ "resource": "" }
q159445
SourceHandler.setPipeliningProperties
train
private void setPipeliningProperties() { if (ctx.channel().attr(Constants.MAX_RESPONSES_ALLOWED_TO_BE_QUEUED).get() == null) { ctx.channel().attr(Constants.MAX_RESPONSES_ALLOWED_TO_BE_QUEUED).set(pipeliningLimit); } if (ctx.channel().attr(Constants.RESPONSE_QUEUE).get() == null) { ...
java
{ "resource": "" }
q159446
SourceHandler.setSequenceNumber
train
private void setSequenceNumber() { if (LOG.isDebugEnabled()) { LOG.debug("Sequence id of the request is set to : {}", sequenceId); } inboundRequestMsg.setSequenceId(sequenceId); sequenceId++; }
java
{ "resource": "" }
q159447
Util.shouldEnforceChunkingforHttpOneZero
train
public static boolean shouldEnforceChunkingforHttpOneZero(ChunkConfig chunkConfig, String httpVersion) { return chunkConfig == ChunkConfig.ALWAYS && Float.valueOf(httpVersion) >= Constants.HTTP_1_0; }
java
{ "resource": "" }
q159448
Util.configureHttpPipelineForSSL
train
public static SSLEngine configureHttpPipelineForSSL(SocketChannel socketChannel, String host, int port, SSLConfig sslConfig) throws SSLException { LOG.debug("adding ssl handler"); SSLEngine sslEngine = null; SslHandler sslHandler; ChannelPipeline pipeline = socketChannel.pipe...
java
{ "resource": "" }
q159449
Util.instantiateAndConfigSSL
train
private static SSLEngine instantiateAndConfigSSL(SSLConfig sslConfig, String host, int port, boolean hostNameVerificationEnabled, SSLHandlerFactory sslHandlerFactory) { // set the pipeline factory, which creates the pipeline for each newly created channels SSLEngine sslEngine = null; ...
java
{ "resource": "" }
q159450
Util.getSystemVariableValue
train
private static String getSystemVariableValue(String variableName, String defaultValue) { String value; if (System.getProperty(variableName) != null) { value = System.getProperty(variableName); } else if (System.getenv(variableName) != null) { value = System.getenv(variabl...
java
{ "resource": "" }
q159451
Util.resetChannelAttributes
train
public static void resetChannelAttributes(ChannelHandlerContext ctx) { ctx.channel().attr(Constants.RESPONSE_FUTURE_OF_ORIGINAL_CHANNEL).set(null); ctx.channel().attr(Constants.ORIGINAL_REQUEST).set(null); ctx.channel().attr(Constants.REDIRECT_COUNT).set(null); ctx.channel().attr(Constan...
java
{ "resource": "" }
q159452
Util.sendAndCloseNoEntityBodyResp
train
public static void sendAndCloseNoEntityBodyResp(ChannelHandlerContext ctx, HttpResponseStatus status, HttpVersion httpVersion, String serverName) { HttpResponse outboundResponse = new DefaultHttpResponse(httpVersion, status); outboundResponse.headers().set(HttpHeaderNames.CONTENT_LENGTH, 0);...
java
{ "resource": "" }
q159453
Util.checkForResponseWriteStatus
train
public static void checkForResponseWriteStatus(HttpCarbonMessage inboundRequestMsg, HttpResponseFuture outboundRespStatusFuture, ChannelFuture channelFuture) { channelFuture.addListener(writeOperationPromise -> { Throwable throwable = writeOperationPromise....
java
{ "resource": "" }
q159454
Util.addResponseWriteFailureListener
train
public static void addResponseWriteFailureListener(HttpResponseFuture outboundRespStatusFuture, ChannelFuture channelFuture) { channelFuture.addListener(writeOperationPromise -> { Throwable throwable = writeOperationPromise.cause(); ...
java
{ "resource": "" }
q159455
Util.createHTTPCarbonMessage
train
public static HttpCarbonMessage createHTTPCarbonMessage(HttpMessage httpMessage, ChannelHandlerContext ctx) { Listener contentListener = new DefaultListener(ctx); return new HttpCarbonMessage(httpMessage, contentListener); }
java
{ "resource": "" }
q159456
Util.safelyRemoveHandlers
train
public static void safelyRemoveHandlers(ChannelPipeline pipeline, String... handlerNames) { for (String name : handlerNames) { if (pipeline.get(name) != null) { pipeline.remove(name); } else { LOG.debug("Trying to remove not engaged {} handler from the pip...
java
{ "resource": "" }
q159457
Util.createInboundReqCarbonMsg
train
public static HttpCarbonMessage createInboundReqCarbonMsg(HttpRequest httpRequestHeaders, ChannelHandlerContext ctx, SourceHandler sourceHandler) { HttpCarbonMessage inboundRequestMsg = new HttpCarbonRequest(httpRequestHeaders, new DefaultListener(ctx)); inboundRequestMsg.se...
java
{ "resource": "" }
q159458
Util.createInboundRespCarbonMsg
train
public static HttpCarbonMessage createInboundRespCarbonMsg(ChannelHandlerContext ctx, HttpResponse httpResponseHeaders, HttpCarbonMessage outboundRequestMsg) { HttpCarbonMessage inboundR...
java
{ "resource": "" }
q159459
Util.isKeepAlive
train
public static boolean isKeepAlive(KeepAliveConfig keepAliveConfig, HttpCarbonMessage outboundRequestMsg) throws ConfigurationException { switch (keepAliveConfig) { case AUTO: return Float.valueOf((String) outboundRequestMsg.getProperty(Constants.HTTP_VERSION)) > Constants.HTTP_1_...
java
{ "resource": "" }
q159460
Util.is100ContinueRequest
train
public static boolean is100ContinueRequest(HttpCarbonMessage inboundRequestMsg) { return HEADER_VAL_100_CONTINUE.equalsIgnoreCase( inboundRequestMsg.getHeader(HttpHeaderNames.EXPECT.toString())); }
java
{ "resource": "" }
q159461
Util.isKeepAliveConnection
train
public static boolean isKeepAliveConnection(KeepAliveConfig keepAliveConfig, String requestConnectionHeader, String httpVersion) { if (keepAliveConfig == null || keepAliveConfig == KeepAliveConfig.AUTO) { if (Float.valueOf(httpVersion) <= Constants.HTT...
java
{ "resource": "" }
q159462
Util.setBackPressureListener
train
public static void setBackPressureListener(boolean passthrough, BackPressureHandler backpressureHandler, ChannelHandlerContext inContext) { if (backpressureHandler != null) { if (inContext != null && passthrough) { backpressureHandler.ge...
java
{ "resource": "" }
q159463
Util.checkUnWritabilityAndNotify
train
public static void checkUnWritabilityAndNotify(ChannelHandlerContext context, BackPressureHandler backpressureHandler) { if (backpressureHandler != null) { Channel channel = context.channel(); if (!channel.isWritable() && channel.isActiv...
java
{ "resource": "" }
q159464
HttpClientChannelInitializer.configureProxyServer
train
private void configureProxyServer(ChannelPipeline clientPipeline) { if (proxyServerConfiguration != null && sslConfig != null) { if (proxyServerConfiguration.getProxyUsername() != null && proxyServerConfiguration.getProxyPassword() != null) { clientPipeline.addLas...
java
{ "resource": "" }
q159465
HttpClientChannelInitializer.configureHttp2UpgradePipeline
train
private void configureHttp2UpgradePipeline(ChannelPipeline pipeline, HttpClientCodec sourceCodec, TargetHandler targetHandler) { pipeline.addLast(sourceCodec); addCommonHandlers(pipeline); Http2ClientUpgradeCodec upgradeCodec = new Http2ClientUpgrad...
java
{ "resource": "" }
q159466
HttpClientChannelInitializer.configureHttp2Pipeline
train
private void configureHttp2Pipeline(ChannelPipeline pipeline) { pipeline.addLast(Constants.CONNECTION_HANDLER, http2ConnectionHandler); pipeline.addLast(Constants.HTTP2_TARGET_HANDLER, http2TargetHandler); pipeline.addLast(Constants.DECOMPRESSOR_HANDLER, new HttpContentDecompressor()); }
java
{ "resource": "" }
q159467
HttpClientChannelInitializer.configureHttpPipeline
train
public void configureHttpPipeline(ChannelPipeline pipeline, TargetHandler targetHandler) { pipeline.addLast(Constants.HTTP_CLIENT_CODEC, new HttpClientCodec()); addCommonHandlers(pipeline); pipeline.addLast(Constants.BACK_PRESSURE_HANDLER, new BackPressureHandler()); pipeline.addLast(Con...
java
{ "resource": "" }
q159468
HttpClientChannelInitializer.addCommonHandlers
train
private void addCommonHandlers(ChannelPipeline pipeline) { pipeline.addLast(Constants.DECOMPRESSOR_HANDLER, new HttpContentDecompressor()); if (httpTraceLogEnabled) { pipeline.addLast(Constants.HTTP_TRACE_LOG_HANDLER, new HttpTraceLoggingHandler(Constants.TRACE_LOG_UPSTRE...
java
{ "resource": "" }
q159469
OutboundMsgHolder.addPushResponse
train
public void addPushResponse(int streamId, HttpCarbonResponse pushResponse) { pushResponsesMap.put(streamId, pushResponse); responseFuture.notifyPushResponse(streamId, pushResponse); }
java
{ "resource": "" }
q159470
OCSPCache.init
train
public void init(int size, int delay) { if (cacheManager == null) { synchronized (OCSPCache.class) { if (cacheManager == null) { cacheManager = new CacheManager(cache, size, delay); CacheController mbean = new CacheController(cache, cacheM...
java
{ "resource": "" }
q159471
DefaultHttpWsConnectorFactory.shutdownNow
train
public void shutdownNow() { allChannels.close(); workerGroup.shutdownGracefully(); bossGroup.shutdownGracefully(); clientGroup.shutdownGracefully(); if (pipeliningGroup != null) { pipeliningGroup.shutdownGracefully(); } }
java
{ "resource": "" }
q159472
CRLVerifier.downloadCRLFromWeb
train
protected X509CRL downloadCRLFromWeb(String crlURL) throws IOException, CertificateVerificationException { URL url = new URL(crlURL); try (InputStream crlStream = url.openStream()) { CertificateFactory cf = CertificateFactory.getInstance(Constants.X_509); return (X509CRL) cf....
java
{ "resource": "" }
q159473
CRLVerifier.getCrlDistributionPoints
train
private List<String> getCrlDistributionPoints(X509Certificate cert) throws CertificateVerificationException { //Gets the DER-encoded OCTET string for the extension value for CRLDistributionPoints. byte[] crlDPExtensionValue = cert.getExtensionValue(Extension.cRLDistributionPoints.getId()); ...
java
{ "resource": "" }
q159474
OCSPResponseBuilder.getKeyStore
train
public static KeyStore getKeyStore(File keyStoreFile, String keyStorePassword, String tlsStoreType) throws IOException { KeyStore keyStore = null; if (keyStoreFile != null && keyStorePassword != null) { try (InputStream inputStream = new FileInputStream(keyStoreFile)) { ...
java
{ "resource": "" }
q159475
OCSPResponseBuilder.getAIALocations
train
public static List<String> getAIALocations(X509Certificate userCertificate) throws CertificateVerificationException { List<String> locations; //List the AIA locations from the certificate. Those are the URL's of CA s. try { locations = OCSPVerifier.getAIALocations(userCer...
java
{ "resource": "" }
q159476
OCSPResponseBuilder.getOCSPResponse
train
public static OCSPResp getOCSPResponse(List<String> locations, OCSPReq request, X509Certificate userCertificate, OCSPCache ocspCache) throws CertificateVerificationException { SingleResp[] responses; BasicOCSPResp basicResponse; CertificateStatus certificateStatus; for (Strin...
java
{ "resource": "" }
q159477
RevocationVerificationManager.verifyRevocationStatus
train
public boolean verifyRevocationStatus(javax.security.cert.X509Certificate[] peerCertificates) throws CertificateVerificationException { X509Certificate[] convertedCertificates = convert(peerCertificates); long start = System.currentTimeMillis(); // If not set by the user, def...
java
{ "resource": "" }
q159478
RevocationVerificationManager.convert
train
private X509Certificate[] convert(javax.security.cert.X509Certificate[] certs) throws CertificateVerificationException { X509Certificate[] certChain = new X509Certificate[certs.length]; Throwable exceptionThrown; for (int i = 0; i < certs.length; i++) { try { ...
java
{ "resource": "" }
q159479
Http2PushPromise.addHeader
train
public void addHeader(String name, String value) { httpRequest.headers().add(name, value); }
java
{ "resource": "" }
q159480
Http2PushPromise.getHeaders
train
public String[] getHeaders(String name) { List<String> headerList = httpRequest.headers().getAll(name); return headerList.toArray(new String[0]); }
java
{ "resource": "" }
q159481
Http2PushPromise.setHeader
train
public void setHeader(String name, String value) { httpRequest.headers().set(name, value); }
java
{ "resource": "" }
q159482
CacheManager.start
train
private boolean start() { if (scheduledFuture == null || scheduledFuture.isCancelled()) { scheduledFuture = scheduler.scheduleWithFixedDelay(cacheManagingTask, delay, delay, TimeUnit.MINUTES); if (LOG.isDebugEnabled()) { LOG.debug("{} Cache Manager Started.", cache.ge...
java
{ "resource": "" }
q159483
CacheManager.stop
train
public boolean stop() { if (scheduledFuture != null && !scheduledFuture.isCancelled()) { scheduledFuture.cancel(DO_NOT_INTERRUPT_IF_RUNNING); if (LOG.isDebugEnabled()) { LOG.debug("{} Cache Manager stopped.", cache.getClass().getSimpleName()); } ...
java
{ "resource": "" }
q159484
ForwardedHeaderUpdater.setForwardedHeader
train
public void setForwardedHeader() { StringBuilder headerValue = new StringBuilder(); if (forwardedHeader == null) { Object remoteAddressProperty = httpOutboundRequest.getProperty(Constants.REMOTE_ADDRESS); if (remoteAddressProperty != null) { String remoteAddress =...
java
{ "resource": "" }
q159485
Http2TargetHandler.resetStream
train
void resetStream(ChannelHandlerContext ctx, int streamId, Http2Error http2Error) { encoder.writeRstStream(ctx, streamId, http2Error.code(), ctx.newPromise()); http2ClientChannel.getDataEventListeners() .forEach(dataEventListener -> dataEventListener.onStreamReset(streamId)); ctx....
java
{ "resource": "" }
q159486
Http2StateUtil.notifyRequestListener
train
public static void notifyRequestListener(Http2SourceHandler http2SourceHandler, HttpCarbonMessage httpRequestMsg, int streamId) { if (http2SourceHandler.getServerConnectorFuture() != null) { try { ServerConnectorFuture outboundRespFuture =...
java
{ "resource": "" }
q159487
Http2StateUtil.writeHttp2Headers
train
public static void writeHttp2Headers(ChannelHandlerContext ctx, Http2ConnectionEncoder encoder, HttpResponseFuture outboundRespStatusFuture, int streamId, Http2Headers http2Headers, boolean endStream) throws Http2Exception { Chann...
java
{ "resource": "" }
q159488
Http2StateUtil.writeHttp2Promise
train
public static void writeHttp2Promise(Http2PushPromise pushPromise, ChannelHandlerContext ctx, Http2Connection conn, Http2ConnectionEncoder encoder, HttpCarbonMessage inboundRequestMsg, HttpResponseFuture outboundRespStatusFuture, ...
java
{ "resource": "" }
q159489
Http2StateUtil.validatePromisedStreamState
train
public static void validatePromisedStreamState(int originalStreamId, int streamId, Http2Connection conn, HttpCarbonMessage inboundRequestMsg) throws Http2Exception { if (streamId == originalStreamId) { // Not a promised stream, no need to validate r...
java
{ "resource": "" }
q159490
Http2StateUtil.writeHttp2Headers
train
public static void writeHttp2Headers(ChannelHandlerContext ctx, OutboundMsgHolder outboundMsgHolder, Http2ClientChannel http2ClientChannel, Http2ConnectionEncoder encoder, int streamId, HttpHeaders headers, Http2Headers http2Headers, ...
java
{ "resource": "" }
q159491
Http2StateUtil.initiateStream
train
public static int initiateStream(ChannelHandlerContext ctx, Http2Connection connection, Http2ClientChannel http2ClientChannel, OutboundMsgHolder outboundMsgHolder) throws Http2Exception { int streamId = getNextStreamId(connection); ...
java
{ "resource": "" }
q159492
Http2StateUtil.createStream
train
private static synchronized void createStream(Http2Connection conn, int streamId) throws Http2Exception { conn.local().createStream(streamId, false); if (LOG.isDebugEnabled()) { LOG.debug("Stream created streamId: {}", streamId); } }
java
{ "resource": "" }
q159493
Http2StateUtil.onPushPromiseRead
train
public static void onPushPromiseRead(Http2PushPromise http2PushPromise, Http2ClientChannel http2ClientChannel, OutboundMsgHolder outboundMsgHolder) { int streamId = http2PushPromise.getStreamId(); int promisedStreamId = http2PushPromise.getPromisedStreamId(); ...
java
{ "resource": "" }
q159494
Http2ConnectionManager.getOrCreateEventLoopPool
train
private EventLoopPool getOrCreateEventLoopPool(EventLoop eventLoop) { final EventLoopPool pool = eventLoopPools.get(eventLoop); if (pool != null) { return pool; } return eventLoopPools.computeIfAbsent(eventLoop, e -> new EventLoopPool()); }
java
{ "resource": "" }
q159495
Http2ConnectionManager.getOrCreatePerRoutePool
train
private EventLoopPool.PerRouteConnectionPool getOrCreatePerRoutePool(EventLoopPool eventLoopPool, String key) { final EventLoopPool.PerRouteConnectionPool perRouteConnectionPool = eventLoopPool.fetchPerRoutePool(key); if (perRouteConnectionPool != null) { return perRouteConnectionPool; ...
java
{ "resource": "" }
q159496
NettyTcNativeLoader.overrideExceptionValue
train
private static void overrideExceptionValue() { Field exceptionField = null; Field modifiersField = null; int originalModifiers = 0; boolean setModifiers = false; try { exceptionField = OpenSsl.class.getDeclaredField("UNAVAILABILITY_CAUSE"); exceptionField...
java
{ "resource": "" }
q159497
Socks4ClientBootstrap.getPipelineFactory
train
@Override public ChannelPipelineFactory getPipelineFactory() { return new ChannelPipelineFactory() { @Override public ChannelPipeline getPipeline() throws Exception { final ChannelPipeline cp = Channels.pipeline(); ...
java
{ "resource": "" }
q159498
Socks4ClientBootstrap.connect
train
@Override public ChannelFuture connect(final SocketAddress remoteAddress) { if (!(remoteAddress instanceof InetSocketAddress)) { throw new IllegalArgumentException("expecting InetSocketAddress"); } final SettableChannelFuture settableChannelFuture = new SettableChannelFuture(...
java
{ "resource": "" }
q159499
Socks4ClientBootstrap.socksConnect
train
private static ChannelFuture socksConnect(Channel channel, InetSocketAddress remoteAddress) { channel.write(createHandshake(remoteAddress)); return ((Socks4HandshakeHandler) channel.getPipeline().get("handshake")).getChannelFuture(); }
java
{ "resource": "" }