@Override public Object getAttribute(String key) { return Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute(key).get(connection); }
@Override public Object getAttribute(String key) { return Grizzly.DEFAULT_ATTRIBUTE_BUILDER.createAttribute(key).get(connection); }
static GrizzlyChannel getOrAddChannel(Connection<?> connection, URL url, ChannelHandler handler) { if (connection == null) { return null; } GrizzlyChannel ret = ATTRIBUTE.get(connection); if (ret == null) { ret = new GrizzlyChannel(connection, url, handler); if (connection.isOpen()) { ATTRIBUTE.set(connection, ret); } } return ret; }
static GrizzlyChannel getOrAddChannel(Connection<?> connection, URL url, ChannelHandler handler) { if (connection == null) { return null; } GrizzlyChannel ret = ATTRIBUTE.get(connection); if (ret == null) { ret = new GrizzlyChannel(connection, url, handler); if (connection.isOpen()) { ATTRIBUTE.set(connection, ret); } } return ret; }
private boolean isSecure(final Connection c) { Boolean secStatus = CONNECTION_IS_SECURE.get(c); if (secStatus == null) { secStatus = secureByDefault; } return secStatus; }
static HttpTransactionContext currentTransaction(final AttributeStorage storage) { return REQUEST_STATE_ATTR.get(storage); }
public static boolean isNtlmEstablished(final Connection c) { return Boolean.TRUE.equals(NTLM_HOLDER.IS_NTLM_DONE.get(c)); }
public static boolean getAndSetNtlmAttempted(final Connection c) { final Boolean v = NTLM_HOLDER.IS_NTLM_DONE.get(c); if (v == null) { NTLM_HOLDER.IS_NTLM_DONE.set(c, Boolean.TRUE); return false; } return true; }
@Override public long getTimeoutMillis(Connection connection) { final Long timeout = silentConnectionAttr.get(connection); return timeout != null ? timeout : DelayedExecutor.UNSET_TIMEOUT; }
public static <T> T getValue(final AttributeStorage storage, final Attribute<T> attribute, final T defaultValue) { final T value = attribute.get(storage); if (value != null) { return value; } return defaultValue; }
public static <T> T getValue(final AttributeStorage storage, final Attribute<T> attribute, final T defaultValue) { final T value = attribute.get(storage); if (value != null) { return value; } return defaultValue; }
@Override public long getTimeout(final FilterChainContext ctx) { return IDLE_ATTR.get(ctx.getConnection()).getInitialTimeoutMillis(defaultTimeoutMillis); } }
/** * Get attribute value, stored on the {@link AttributeStorage}. * * @param storage {@link AttributeStorage}. * @return attribute value */ public T get(final AttributeStorage storage) { return get(storage.getAttributes()); }
@Override public void onReregister(final Context context) throws IOException { final FilterChainContext suspendedContext = suspendedContextAttribute.get(context); assert suspendedContext != null; suspendedContext.resume(suspendedContext.getForkAction()); }
final boolean isUsedConnection = Boolean.TRUE.equals(USED_CONNECTION.get(connection)); if (!isUsedConnection) { USED_CONNECTION.set(connection, Boolean.TRUE);
@Override public void onCopy(final FilterChainContext srcContext, final FilterChainContext copiedContext) { final FilterChainContext suspendedContextCopy = suspendedContextAttribute.get(srcContext).copy(); suspendedContextAttribute.set(copiedContext, suspendedContextCopy); copiedContext.addCopyListener(this); }
@Override protected void notifyHandshakeFailed(Connection connection, Throwable t) { final SSLHandshakeContext handshakeContext = handshakeContextAttr.get(connection); if (handshakeContext != null) { connection.removeCloseListener(closeListener); handshakeContext.failed(t); } super.notifyHandshakeFailed(connection, t); }
@Override protected void notifyHandshakeFailed(Connection connection, Throwable t) { final SSLHandshakeContext handshakeContext = handshakeContextAttr.get(connection); if (handshakeContext != null) { connection.removeCloseListener(closeListener); handshakeContext.failed(t); } super.notifyHandshakeFailed(connection, t); }
@Override public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException { // if downstream event - pass it to the puFilter if (isDownstream(ctx)) { final FilterChainContext suspendedParentContext = puFilter.suspendedContextAttribute.get(ctx); assert suspendedParentContext != null; suspendedParentContext.notifyDownstream(event); } return ctx.getInvokeAction(); }
@Override protected void notifyHandshakeComplete(final Connection<?> connection, final SSLEngine sslEngine) { final SSLHandshakeContext handshakeContext = handshakeContextAttr.get(connection); if (handshakeContext != null) { connection.removeCloseListener(closeListener); handshakeContext.completed(sslEngine); handshakeContextAttr.remove(connection); } super.notifyHandshakeComplete(connection, sslEngine); }