AttributeComponent(String attributeName, Function<Object, String> stringifer, boolean addQuote, @Nullable Function<HttpHeaders, Boolean> condition) { super(condition, addQuote); key = AttributeKey.valueOf(requireNonNull(attributeName, "attributeName")); this.stringifer = requireNonNull(stringifer, "stringifer"); }
public Flag(String name) { attributeKey = AttributeKey.newInstance(name); }
private static int index(AttributeKey<?> key) { return key.id() & MASK; }
private void cacheNode(Node node, SocketChannel channel) { String name = "node-" + node.getId(); boolean exists = AttributeKey.exists(name); AttributeKey attributeKey; if (exists) { attributeKey = AttributeKey.valueOf(name); } else { attributeKey = AttributeKey.newInstance(name); } Attribute<Node> attribute = channel.attr(attributeKey); attribute.set(node); }
@Override protected AttributeKey<Object> newConstant(int id, String name) { return new AttributeKey<Object>(id, name); } };
boolean containsAttribute(AttributeKey<?> key) { requireNonNull(key, "key"); return attrs.stream().anyMatch(e -> e.key.equals(key)); }
@Override protected AttributeKey<Object> newConstant(int id, String name) { return new AttributeKey<Object>(id, name); } };
boolean containsAttribute(AttributeKey<?> key) { requireNonNull(key, "key"); return attrs.stream().anyMatch(e -> e.key.equals(key)); }
/** * Returns true if this is an HTTPS request. * * @return true if https, false if http */ public boolean isHttps() { Attribute<Boolean> isHttpsAttr = ctx.attr(AttributeKey.<Boolean>valueOf(IS_HTTPS_ATTRIBUTE_NAME)); Boolean isHttps = isHttpsAttr.get(); if (isHttps == null) { return false; } else { return isHttps; } }
public Flag(String name) { attributeKey = AttributeKey.newInstance(name); }
private static int index(AttributeKey<?> key) { return key.id() & MASK; }
@Override protected AttributeKey<Object> newConstant(int id, String name) { return new AttributeKey<Object>(id, name); } };
boolean containsAttribute(AttributeKey<?> key) { requireNonNull(key, "key"); return attrs.stream().anyMatch(e -> e.key.equals(key)); }
public static final AttributeKey<Connection> CONNECTION_ATTRIBUTE_KEY = AttributeKey.valueOf("rx-netty-conn-attr");
final AttributeKey<Integer> id = AttributeKey.newInstance("ID"); Bootstrap bootstrap = new Bootstrap(); bootstrap.group(new NioEventLoopGroup())
private static int index(AttributeKey<?> key) { return key.id() & MASK; }
@Override protected AttributeKey<Object> newConstant(int id, String name) { return new AttributeKey<Object>(id, name); } };
/** * Returns the host and port of this HTTPS request, including any modifications by other filters. * * @return host and port of this HTTPS request * @throws IllegalStateException if this is not an HTTPS request */ private String getHttpsRequestHostAndPort() throws IllegalStateException { if (!isHttps()) { throw new IllegalStateException("Request is not HTTPS. Cannot get host and port on non-HTTPS request using this method."); } Attribute<String> hostnameAttr = ctx.attr(AttributeKey.<String>valueOf(HOST_ATTRIBUTE_NAME)); return hostnameAttr.get(); }
public Flag(String name) { attributeKey = AttributeKey.newInstance(name); }
private static int index(AttributeKey<?> key) { return key.id() & MASK; }