repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
kaazing/gateway
resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResourceAddressFactory.java
ResourceAddressFactory.newResourceAddress
public ResourceAddress newResourceAddress(String location, String nextProtocol) { if (nextProtocol != null) { ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(NEXT_PROTOCOL, nextProtocol); return newResourceAddress(location, options); ...
java
public ResourceAddress newResourceAddress(String location, String nextProtocol) { if (nextProtocol != null) { ResourceOptions options = ResourceOptions.FACTORY.newResourceOptions(); options.setOption(NEXT_PROTOCOL, nextProtocol); return newResourceAddress(location, options); ...
[ "public", "ResourceAddress", "newResourceAddress", "(", "String", "location", ",", "String", "nextProtocol", ")", "{", "if", "(", "nextProtocol", "!=", "null", ")", "{", "ResourceOptions", "options", "=", "ResourceOptions", ".", "FACTORY", ".", "newResourceOptions",...
convenience method only, consider removing from API
[ "convenience", "method", "only", "consider", "removing", "from", "API" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResourceAddressFactory.java#L117-L126
train
kaazing/gateway
transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpLoginSecurityFilter.java
HttpLoginSecurityFilter.loginMissingToken
private boolean loginMissingToken(NextFilter nextFilter, IoSession session, HttpRequestMessage httpRequest, AuthenticationToken authToken, TypedCallbackHandlerMap addit...
java
private boolean loginMissingToken(NextFilter nextFilter, IoSession session, HttpRequestMessage httpRequest, AuthenticationToken authToken, TypedCallbackHandlerMap addit...
[ "private", "boolean", "loginMissingToken", "(", "NextFilter", "nextFilter", ",", "IoSession", "session", ",", "HttpRequestMessage", "httpRequest", ",", "AuthenticationToken", "authToken", ",", "TypedCallbackHandlerMap", "additionalCallbacks", ",", "HttpRealmInfo", "[", "]",...
Handle the initial "login" attempt where the client has presumably not sent any specific authentication token yet. @return always returns false.
[ "Handle", "the", "initial", "login", "attempt", "where", "the", "client", "has", "presumably", "not", "sent", "any", "specific", "authentication", "token", "yet", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpLoginSecurityFilter.java#L159-L234
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/logging/MdcInjectionFilter.java
MdcInjectionFilter.setProperty
public static void setProperty(IoSession session, String key, String value) { if (key == null) { throw new NullPointerException("key should not be null"); } if (value == null) { removeProperty(session, key); } Map<String, String> context = getContext(sessi...
java
public static void setProperty(IoSession session, String key, String value) { if (key == null) { throw new NullPointerException("key should not be null"); } if (value == null) { removeProperty(session, key); } Map<String, String> context = getContext(sessi...
[ "public", "static", "void", "setProperty", "(", "IoSession", "session", ",", "String", "key", ",", "String", "value", ")", "{", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"key should not be null\"", ")", ";", "}"...
Add a property to the context for the given session This property will be added to the MDC for all subsequent events @param session The session for which you want to set a property @param key The name of the property (should not be null) @param value The value of the property
[ "Add", "a", "property", "to", "the", "context", "for", "the", "given", "session", "This", "property", "will", "be", "added", "to", "the", "MDC", "for", "all", "subsequent", "events" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/logging/MdcInjectionFilter.java#L229-L239
train
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/util/ExceptionMonitor.java
ExceptionMonitor.exceptionCaught
public void exceptionCaught(Throwable cause, IoSession s) { if (s == null) { org.apache.mina.util.ExceptionMonitor.getInstance().exceptionCaught(cause); } else { exceptionCaught0(cause, s); } }
java
public void exceptionCaught(Throwable cause, IoSession s) { if (s == null) { org.apache.mina.util.ExceptionMonitor.getInstance().exceptionCaught(cause); } else { exceptionCaught0(cause, s); } }
[ "public", "void", "exceptionCaught", "(", "Throwable", "cause", ",", "IoSession", "s", ")", "{", "if", "(", "s", "==", "null", ")", "{", "org", ".", "apache", ".", "mina", ".", "util", ".", "ExceptionMonitor", ".", "getInstance", "(", ")", ".", "except...
Invoked when there are any uncaught exceptions.
[ "Invoked", "when", "there", "are", "any", "uncaught", "exceptions", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/util/ExceptionMonitor.java#L60-L66
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java
ByteArrayList.removeFirst
public Node removeFirst() { Node node = header.getNextNode(); firstByte += node.ba.last(); return removeNode( node ); }
java
public Node removeFirst() { Node node = header.getNextNode(); firstByte += node.ba.last(); return removeNode( node ); }
[ "public", "Node", "removeFirst", "(", ")", "{", "Node", "node", "=", "header", ".", "getNextNode", "(", ")", ";", "firstByte", "+=", "node", ".", "ba", ".", "last", "(", ")", ";", "return", "removeNode", "(", "node", ")", ";", "}" ]
Removes the first node from this list @return The node that was removed
[ "Removes", "the", "first", "node", "from", "this", "list" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java#L147-L152
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java
ByteArrayList.removeLast
public Node removeLast() { Node node = header.getPreviousNode(); lastByte -= node.ba.last(); return removeNode( node ); }
java
public Node removeLast() { Node node = header.getPreviousNode(); lastByte -= node.ba.last(); return removeNode( node ); }
[ "public", "Node", "removeLast", "(", ")", "{", "Node", "node", "=", "header", ".", "getPreviousNode", "(", ")", ";", "lastByte", "-=", "node", ".", "ba", ".", "last", "(", ")", ";", "return", "removeNode", "(", "node", ")", ";", "}" ]
Removes the last node in this list @return The node that was taken off of the list
[ "Removes", "the", "last", "node", "in", "this", "list" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java#L160-L165
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java
ByteArrayList.addNode
protected void addNode( Node nodeToInsert, Node insertBeforeNode ) { // Insert node. nodeToInsert.next = insertBeforeNode; nodeToInsert.previous = insertBeforeNode.previous; insertBeforeNode.previous.next = nodeToInsert; insertBeforeNode.previous = nodeToInsert; }
java
protected void addNode( Node nodeToInsert, Node insertBeforeNode ) { // Insert node. nodeToInsert.next = insertBeforeNode; nodeToInsert.previous = insertBeforeNode.previous; insertBeforeNode.previous.next = nodeToInsert; insertBeforeNode.previous = nodeToInsert; }
[ "protected", "void", "addNode", "(", "Node", "nodeToInsert", ",", "Node", "insertBeforeNode", ")", "{", "// Insert node.", "nodeToInsert", ".", "next", "=", "insertBeforeNode", ";", "nodeToInsert", ".", "previous", "=", "insertBeforeNode", ".", "previous", ";", "i...
Inserts a new node into the list. @param nodeToInsert new node to insert @param insertBeforeNode node to insert before @throws NullPointerException if either node is null
[ "Inserts", "a", "new", "node", "into", "the", "list", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java#L177-L184
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java
ByteArrayList.removeNode
protected Node removeNode( Node node ) { // Remove node. node.previous.next = node.next; node.next.previous = node.previous; node.removed = true; return node; }
java
protected Node removeNode( Node node ) { // Remove node. node.previous.next = node.next; node.next.previous = node.previous; node.removed = true; return node; }
[ "protected", "Node", "removeNode", "(", "Node", "node", ")", "{", "// Remove node.", "node", ".", "previous", ".", "next", "=", "node", ".", "next", ";", "node", ".", "next", ".", "previous", "=", "node", ".", "previous", ";", "node", ".", "removed", "...
Removes the specified node from the list. @param node the node to remove @throws NullPointerException if <code>node</code> is null
[ "Removes", "the", "specified", "node", "from", "the", "list", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayList.java#L193-L200
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/executor/DefaultIoEventSizeEstimator.java
DefaultIoEventSizeEstimator.estimateSize
public int estimateSize(Object message) { if (message == null) { return 8; } int answer = 8 + estimateSize(message.getClass(), null); if (message instanceof IoBuffer) { answer += ((IoBuffer) message).remaining(); } else if (message instanceof WriteReques...
java
public int estimateSize(Object message) { if (message == null) { return 8; } int answer = 8 + estimateSize(message.getClass(), null); if (message instanceof IoBuffer) { answer += ((IoBuffer) message).remaining(); } else if (message instanceof WriteReques...
[ "public", "int", "estimateSize", "(", "Object", "message", ")", "{", "if", "(", "message", "==", "null", ")", "{", "return", "8", ";", "}", "int", "answer", "=", "8", "+", "estimateSize", "(", "message", ".", "getClass", "(", ")", ",", "null", ")", ...
Estimate the size of an Objecr in number of bytes @param message The object to estimate @return The estimated size of the object
[ "Estimate", "the", "size", "of", "an", "Objecr", "in", "number", "of", "bytes" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/executor/DefaultIoEventSizeEstimator.java#L74-L94
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java
ByteUtilities.networkByteOrderToInt
public static int networkByteOrderToInt(byte[] buf, int start, int count) { if (count > 4) { throw new IllegalArgumentException( "Cannot handle more than 4 bytes"); } int result = 0; for (int i = 0; i < count; i++) { result <<= 8; ...
java
public static int networkByteOrderToInt(byte[] buf, int start, int count) { if (count > 4) { throw new IllegalArgumentException( "Cannot handle more than 4 bytes"); } int result = 0; for (int i = 0; i < count; i++) { result <<= 8; ...
[ "public", "static", "int", "networkByteOrderToInt", "(", "byte", "[", "]", "buf", ",", "int", "start", ",", "int", "count", ")", "{", "if", "(", "count", ">", "4", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot handle more than 4 bytes\""...
Returns the integer represented by up to 4 bytes in network byte order. @param buf the buffer to read the bytes from @param start @param count @return
[ "Returns", "the", "integer", "represented", "by", "up", "to", "4", "bytes", "in", "network", "byte", "order", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java#L36-L50
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java
ByteUtilities.intToNetworkByteOrder
public static byte[] intToNetworkByteOrder(int num, int count) { byte[] buf = new byte[count]; intToNetworkByteOrder(num, buf, 0, count); return buf; }
java
public static byte[] intToNetworkByteOrder(int num, int count) { byte[] buf = new byte[count]; intToNetworkByteOrder(num, buf, 0, count); return buf; }
[ "public", "static", "byte", "[", "]", "intToNetworkByteOrder", "(", "int", "num", ",", "int", "count", ")", "{", "byte", "[", "]", "buf", "=", "new", "byte", "[", "count", "]", ";", "intToNetworkByteOrder", "(", "num", ",", "buf", ",", "0", ",", "cou...
Encodes an integer into up to 4 bytes in network byte order. @param num the int to convert to a byte array @param count the number of reserved bytes for the write operation @return the resulting byte array
[ "Encodes", "an", "integer", "into", "up", "to", "4", "bytes", "in", "network", "byte", "order", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java#L59-L64
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java
ByteUtilities.asHex
public static String asHex(byte[] bytes, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { String code = Integer.toHexString(bytes[i] & 0xFF); if ((bytes[i] & 0xFF) < 16) { sb.append('0'); } ...
java
public static String asHex(byte[] bytes, String separator) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { String code = Integer.toHexString(bytes[i] & 0xFF); if ((bytes[i] & 0xFF) < 16) { sb.append('0'); } ...
[ "public", "static", "String", "asHex", "(", "byte", "[", "]", "bytes", ",", "String", "separator", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bytes", ".", "length", ...
Returns a hexadecimal representation of the given byte array. @param bytes the array to output to an hex string @param separator the separator to use between each byte in the output string. If null no char is inserted between each byte value. @return the hex representation as a string
[ "Returns", "a", "hexadecimal", "representation", "of", "the", "given", "byte", "array", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java#L246-L262
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java
ByteUtilities.asByteArray
public static byte[] asByteArray(String hex) { byte[] bts = new byte[hex.length() / 2]; for (int i = 0; i < bts.length; i++) { bts[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2), 16); } return bts; }
java
public static byte[] asByteArray(String hex) { byte[] bts = new byte[hex.length() / 2]; for (int i = 0; i < bts.length; i++) { bts[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2), 16); } return bts; }
[ "public", "static", "byte", "[", "]", "asByteArray", "(", "String", "hex", ")", "{", "byte", "[", "]", "bts", "=", "new", "byte", "[", "hex", ".", "length", "(", ")", "/", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "bts",...
Converts a hex string representation to a byte array. @param hex the string holding the hex values @return the resulting byte array
[ "Converts", "a", "hex", "string", "representation", "to", "a", "byte", "array", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/utils/ByteUtilities.java#L270-L278
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
IoServiceStatistics.updateThroughput
public void updateThroughput(long currentTime) { synchronized (throughputCalculationLock) { int interval = (int) (currentTime - lastThroughputCalculationTime); long minInterval = getThroughputCalculationIntervalInMillis(); if (minInterval == 0 || interval < minInterval) { ...
java
public void updateThroughput(long currentTime) { synchronized (throughputCalculationLock) { int interval = (int) (currentTime - lastThroughputCalculationTime); long minInterval = getThroughputCalculationIntervalInMillis(); if (minInterval == 0 || interval < minInterval) { ...
[ "public", "void", "updateThroughput", "(", "long", "currentTime", ")", "{", "synchronized", "(", "throughputCalculationLock", ")", "{", "int", "interval", "=", "(", "int", ")", "(", "currentTime", "-", "lastThroughputCalculationTime", ")", ";", "long", "minInterva...
Updates the throughput counters.
[ "Updates", "the", "throughput", "counters", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java#L264-L306
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
AbstractPollingIoProcessor.nextThreadName
private String nextThreadName() { Class<?> cls = getClass(); int newThreadId; // We synchronize this block to avoid a concurrent access to // the actomicInteger (it can be modified by another thread, while // being seen as null by another thread) synchronized (threadIds...
java
private String nextThreadName() { Class<?> cls = getClass(); int newThreadId; // We synchronize this block to avoid a concurrent access to // the actomicInteger (it can be modified by another thread, while // being seen as null by another thread) synchronized (threadIds...
[ "private", "String", "nextThreadName", "(", ")", "{", "Class", "<", "?", ">", "cls", "=", "getClass", "(", ")", ";", "int", "newThreadId", ";", "// We synchronize this block to avoid a concurrent access to ", "// the actomicInteger (it can be modified by another thread, while...
Compute the thread ID for this class instance. As we may have different classes, we store the last ID number into a Map associating the class name to the last assigned ID. @return a name for the current thread, based on the class name and an incremental value, starting at 1.
[ "Compute", "the", "thread", "ID", "for", "this", "class", "instance", ".", "As", "we", "may", "have", "different", "classes", "we", "store", "the", "last", "ID", "number", "into", "a", "Map", "associating", "the", "class", "name", "to", "the", "last", "a...
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java#L132-L157
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
AbstractPollingIoProcessor.startupProcessor
private void startupProcessor() { Processor processor = processorRef.get(); if (processor == null) { processor = new Processor(); if (processorRef.compareAndSet(null, processor)) { executor.execute(new NamePreservingRunnable(processor, thre...
java
private void startupProcessor() { Processor processor = processorRef.get(); if (processor == null) { processor = new Processor(); if (processorRef.compareAndSet(null, processor)) { executor.execute(new NamePreservingRunnable(processor, thre...
[ "private", "void", "startupProcessor", "(", ")", "{", "Processor", "processor", "=", "processorRef", ".", "get", "(", ")", ";", "if", "(", "processor", "==", "null", ")", "{", "processor", "=", "new", "Processor", "(", ")", ";", "if", "(", "processorRef"...
Starts the inner Processor, asking the executor to pick a thread in its pool. The Runnable will be renamed
[ "Starts", "the", "inner", "Processor", "asking", "the", "executor", "to", "pick", "a", "thread", "in", "its", "pool", ".", "The", "Runnable", "will", "be", "renamed" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java#L409-L422
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
AbstractPollingIoProcessor.handleNewSessions
private int handleNewSessions() { int addedSessions = 0; for (;;) { T session = newSessions.poll(); if (session == null) { // All new sessions have been handled break; } if (addNow(session)) { // A new ses...
java
private int handleNewSessions() { int addedSessions = 0; for (;;) { T session = newSessions.poll(); if (session == null) { // All new sessions have been handled break; } if (addNow(session)) { // A new ses...
[ "private", "int", "handleNewSessions", "(", ")", "{", "int", "addedSessions", "=", "0", ";", "for", "(", ";", ";", ")", "{", "T", "session", "=", "newSessions", ".", "poll", "(", ")", ";", "if", "(", "session", "==", "null", ")", "{", "// All new ses...
Loops over the new sessions blocking queue and returns the number of sessions which are effectively created @return The number of new sessions
[ "Loops", "over", "the", "new", "sessions", "blocking", "queue", "and", "returns", "the", "number", "of", "sessions", "which", "are", "effectively", "created" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java#L430-L448
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
AbstractPollingIoProcessor.process
private void process(T session) { // Process Reads if (isReadable(session) && !session.isReadSuspended()) { read(session); } // Process writes if (isWritable(session) && !session.isWriteSuspended()) { scheduleFlush(session); } }
java
private void process(T session) { // Process Reads if (isReadable(session) && !session.isReadSuspended()) { read(session); } // Process writes if (isWritable(session) && !session.isWriteSuspended()) { scheduleFlush(session); } }
[ "private", "void", "process", "(", "T", "session", ")", "{", "// Process Reads", "if", "(", "isReadable", "(", "session", ")", "&&", "!", "session", ".", "isReadSuspended", "(", ")", ")", "{", "read", "(", "session", ")", ";", "}", "// Process writes", "...
Deal with session ready for the read or write operations, or both.
[ "Deal", "with", "session", "ready", "for", "the", "read", "or", "write", "operations", "or", "both", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java#L602-L612
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java
AbstractPollingIoProcessor.updateTrafficMask
private void updateTrafficMask() { int queueSize = trafficControllingSessions.size(); while (queueSize > 0) { T session = trafficControllingSessions.poll(); if (session == null) { return; } SessionState state = getState(session);...
java
private void updateTrafficMask() { int queueSize = trafficControllingSessions.size(); while (queueSize > 0) { T session = trafficControllingSessions.poll(); if (session == null) { return; } SessionState state = getState(session);...
[ "private", "void", "updateTrafficMask", "(", ")", "{", "int", "queueSize", "=", "trafficControllingSessions", ".", "size", "(", ")", ";", "while", "(", "queueSize", ">", "0", ")", "{", "T", "session", "=", "trafficControllingSessions", ".", "poll", "(", ")",...
Update the trafficControl for all the session which has just been opened.
[ "Update", "the", "trafficControl", "for", "all", "the", "session", "which", "has", "just", "been", "opened", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoProcessor.java#L900-L937
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/AbstractManagementBean.java
AbstractManagementBean.sendSummaryData
public boolean sendSummaryData() { if (clearDirty()) { //System.out.println("#### sendSummaryData for " + Utils.getClassName(this)); // we had something that changed, so send the notification of summaryData String summaryData = getSummaryData(); for (SummaryData...
java
public boolean sendSummaryData() { if (clearDirty()) { //System.out.println("#### sendSummaryData for " + Utils.getClassName(this)); // we had something that changed, so send the notification of summaryData String summaryData = getSummaryData(); for (SummaryData...
[ "public", "boolean", "sendSummaryData", "(", ")", "{", "if", "(", "clearDirty", "(", ")", ")", "{", "//System.out.println(\"#### sendSummaryData for \" + Utils.getClassName(this));", "// we had something that changed, so send the notification of summaryData", "String", "summaryData",...
Send the summary data, returning whether anything actually needed to be sent. @return true iff any summary data needed to be sent
[ "Send", "the", "summary", "data", "returning", "whether", "anything", "actually", "needed", "to", "be", "sent", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/AbstractManagementBean.java#L159-L178
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java
ProxyFilter.messageReceived
@Override public void messageReceived(final NextFilter nextFilter, final IoSession session, final Object message) throws ProxyAuthException { ProxyLogicHandler handler = getProxyHandler(session); synchronized (handler) { IoBuffer buf = (IoBuffer) message; ...
java
@Override public void messageReceived(final NextFilter nextFilter, final IoSession session, final Object message) throws ProxyAuthException { ProxyLogicHandler handler = getProxyHandler(session); synchronized (handler) { IoBuffer buf = (IoBuffer) message; ...
[ "@", "Override", "public", "void", "messageReceived", "(", "final", "NextFilter", "nextFilter", ",", "final", "IoSession", "session", ",", "final", "Object", "message", ")", "throws", "ProxyAuthException", "{", "ProxyLogicHandler", "handler", "=", "getProxyHandler", ...
Receives data from the remote host, passes to the handler if a handshake is in progress, otherwise passes on transparently. @param nextFilter the next filter in filter chain @param session the session object @param message the object holding the received data
[ "Receives", "data", "from", "the", "remote", "host", "passes", "to", "the", "handler", "if", "a", "handshake", "is", "in", "progress", "otherwise", "passes", "on", "transparently", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java#L146-L184
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java
ProxyFilter.filterWrite
@Override public void filterWrite(final NextFilter nextFilter, final IoSession session, final WriteRequest writeRequest) { writeData(nextFilter, session, writeRequest, false); }
java
@Override public void filterWrite(final NextFilter nextFilter, final IoSession session, final WriteRequest writeRequest) { writeData(nextFilter, session, writeRequest, false); }
[ "@", "Override", "public", "void", "filterWrite", "(", "final", "NextFilter", "nextFilter", ",", "final", "IoSession", "session", ",", "final", "WriteRequest", "writeRequest", ")", "{", "writeData", "(", "nextFilter", ",", "session", ",", "writeRequest", ",", "f...
Filters outgoing writes, queueing them up if necessary while a handshake is ongoing. @param nextFilter the next filter in filter chain @param session the session object @param writeRequest the data to write
[ "Filters", "outgoing", "writes", "queueing", "them", "up", "if", "necessary", "while", "a", "handshake", "is", "ongoing", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java#L194-L198
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java
ProxyFilter.writeData
public void writeData(final NextFilter nextFilter, final IoSession session, final WriteRequest writeRequest, final boolean isHandshakeData) { ProxyLogicHandler handler = getProxyHandler(session); synchronized (handler) { if (handler.isHandshakeComplete()) { // Ha...
java
public void writeData(final NextFilter nextFilter, final IoSession session, final WriteRequest writeRequest, final boolean isHandshakeData) { ProxyLogicHandler handler = getProxyHandler(session); synchronized (handler) { if (handler.isHandshakeComplete()) { // Ha...
[ "public", "void", "writeData", "(", "final", "NextFilter", "nextFilter", ",", "final", "IoSession", "session", ",", "final", "WriteRequest", "writeRequest", ",", "final", "boolean", "isHandshakeData", ")", "{", "ProxyLogicHandler", "handler", "=", "getProxyHandler", ...
Actually write data. Queues the data up unless it relates to the handshake or the handshake is done. @param nextFilter the next filter in filter chain @param session the session object @param writeRequest the data to write @param isHandshakeData true if writeRequest is written by the proxy classes.
[ "Actually", "write", "data", ".", "Queues", "the", "data", "up", "unless", "it", "relates", "to", "the", "handshake", "or", "the", "handshake", "is", "done", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java#L209-L234
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java
ProxyFilter.messageSent
@Override public void messageSent(final NextFilter nextFilter, final IoSession session, final WriteRequest writeRequest) throws Exception { if (writeRequest.getMessage() != null && writeRequest.getMessage() instanceof ProxyHandshakeIoBuffer) { // Ignore bu...
java
@Override public void messageSent(final NextFilter nextFilter, final IoSession session, final WriteRequest writeRequest) throws Exception { if (writeRequest.getMessage() != null && writeRequest.getMessage() instanceof ProxyHandshakeIoBuffer) { // Ignore bu...
[ "@", "Override", "public", "void", "messageSent", "(", "final", "NextFilter", "nextFilter", ",", "final", "IoSession", "session", ",", "final", "WriteRequest", "writeRequest", ")", "throws", "Exception", "{", "if", "(", "writeRequest", ".", "getMessage", "(", ")...
Filter handshake related messages from reaching the messageSent callbacks of downstream filters. @param nextFilter the next filter in filter chain @param session the session object @param writeRequest the data written
[ "Filter", "handshake", "related", "messages", "from", "reaching", "the", "messageSent", "callbacks", "of", "downstream", "filters", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/filter/ProxyFilter.java#L244-L255
train
kaazing/gateway
service/amqp/src/main/java/org/kaazing/gateway/service/amqp/amqp091/codec/AmqpMessageDecoder.java
AmqpMessageDecoder.decodeAuthAmqPlain
private static String[] decodeAuthAmqPlain(String response) { Logger logger = LoggerFactory.getLogger(SERVICE_AMQP_PROXY_LOGGER); String[] credentials = null; if ((response != null) && (response.trim().length() > 0)) { ByteBuffer buffer = ByteBuffer.wrap(response.getBytes()...
java
private static String[] decodeAuthAmqPlain(String response) { Logger logger = LoggerFactory.getLogger(SERVICE_AMQP_PROXY_LOGGER); String[] credentials = null; if ((response != null) && (response.trim().length() > 0)) { ByteBuffer buffer = ByteBuffer.wrap(response.getBytes()...
[ "private", "static", "String", "[", "]", "decodeAuthAmqPlain", "(", "String", "response", ")", "{", "Logger", "logger", "=", "LoggerFactory", ".", "getLogger", "(", "SERVICE_AMQP_PROXY_LOGGER", ")", ";", "String", "[", "]", "credentials", "=", "null", ";", "if...
the 1st element is the password.
[ "the", "1st", "element", "is", "the", "password", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/amqp/src/main/java/org/kaazing/gateway/service/amqp/amqp091/codec/AmqpMessageDecoder.java#L309-L338
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java
DefaultIoFilterChain.checkOldName
private EntryImpl checkOldName(String baseName) { EntryImpl e = (EntryImpl) name2entry.get(baseName); if (e == null) { throw new IllegalArgumentException("Filter not found:" + baseName); } return e; }
java
private EntryImpl checkOldName(String baseName) { EntryImpl e = (EntryImpl) name2entry.get(baseName); if (e == null) { throw new IllegalArgumentException("Filter not found:" + baseName); } return e; }
[ "private", "EntryImpl", "checkOldName", "(", "String", "baseName", ")", "{", "EntryImpl", "e", "=", "(", "EntryImpl", ")", "name2entry", ".", "get", "(", "baseName", ")", ";", "if", "(", "e", "==", "null", ")", "{", "throw", "new", "IllegalArgumentExceptio...
Throws an exception when the specified filter name is not registered in this chain. @return An filter entry with the specified name.
[ "Throws", "an", "exception", "when", "the", "specified", "filter", "name", "is", "not", "registered", "in", "this", "chain", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/filterchain/DefaultIoFilterChain.java#L328-L334
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/buffer/BufferedWriteFilter.java
BufferedWriteFilter.internalFlush
private void internalFlush(NextFilter nextFilter, IoSession session, IoBuffer buf) throws Exception { IoBuffer tmp; synchronized (buf) { buf.flip(); tmp = buf.duplicate(); buf.clear(); } logger.debug("Flushing buffer: {}", tmp); nex...
java
private void internalFlush(NextFilter nextFilter, IoSession session, IoBuffer buf) throws Exception { IoBuffer tmp; synchronized (buf) { buf.flip(); tmp = buf.duplicate(); buf.clear(); } logger.debug("Flushing buffer: {}", tmp); nex...
[ "private", "void", "internalFlush", "(", "NextFilter", "nextFilter", ",", "IoSession", "session", ",", "IoBuffer", "buf", ")", "throws", "Exception", "{", "IoBuffer", "tmp", ";", "synchronized", "(", "buf", ")", "{", "buf", ".", "flip", "(", ")", ";", "tmp...
Internal method that actually flushes the buffered data. @param nextFilter the {@link NextFilter} of this filter @param session the session where buffer will be written @param buf the data to write @throws Exception if a write operation fails
[ "Internal", "method", "that", "actually", "flushes", "the", "buffered", "data", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/buffer/BufferedWriteFilter.java#L195-L205
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/buffer/BufferedWriteFilter.java
BufferedWriteFilter.flush
public void flush(IoSession session) { try { internalFlush(session.getFilterChain().getNextFilter(this), session, buffersMap.get(session)); } catch (Throwable e) { session.getFilterChain().fireExceptionCaught(e); } }
java
public void flush(IoSession session) { try { internalFlush(session.getFilterChain().getNextFilter(this), session, buffersMap.get(session)); } catch (Throwable e) { session.getFilterChain().fireExceptionCaught(e); } }
[ "public", "void", "flush", "(", "IoSession", "session", ")", "{", "try", "{", "internalFlush", "(", "session", ".", "getFilterChain", "(", ")", ".", "getNextFilter", "(", "this", ")", ",", "session", ",", "buffersMap", ".", "get", "(", "session", ")", ")...
Flushes the buffered data. @param session the session where buffer will be written
[ "Flushes", "the", "buffered", "data", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/buffer/BufferedWriteFilter.java#L212-L219
train
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java
VicariousThreadLocal.currentThreadRef
static WeakReference<Thread> currentThreadRef() { WeakReference<Thread> ref = weakThread.get(); if (ref == null) { ref = new WeakReference<>(Thread.currentThread()); weakThread.set(ref); } return ref; }
java
static WeakReference<Thread> currentThreadRef() { WeakReference<Thread> ref = weakThread.get(); if (ref == null) { ref = new WeakReference<>(Thread.currentThread()); weakThread.set(ref); } return ref; }
[ "static", "WeakReference", "<", "Thread", ">", "currentThreadRef", "(", ")", "{", "WeakReference", "<", "Thread", ">", "ref", "=", "weakThread", ".", "get", "(", ")", ";", "if", "(", "ref", "==", "null", ")", "{", "ref", "=", "new", "WeakReference", "<...
Returns a unique object representing the current thread. Although we use a weak-reference to the thread, we could use practically anything that does not reference our class-loader.
[ "Returns", "a", "unique", "object", "representing", "the", "current", "thread", ".", "Although", "we", "use", "a", "weak", "-", "reference", "to", "the", "thread", "we", "could", "use", "practically", "anything", "that", "does", "not", "reference", "our", "c...
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java#L67-L74
train
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java
VicariousThreadLocal.createHolder
private Holder createHolder() { poll(); Holder holder = new Holder(queue); WeakReference<Holder> ref = new WeakReference<>(holder); Holder old; do { old = strongRefs; holder.next = old; } while (!strongRefsUpdater.compareAndSet(this, old, holder))...
java
private Holder createHolder() { poll(); Holder holder = new Holder(queue); WeakReference<Holder> ref = new WeakReference<>(holder); Holder old; do { old = strongRefs; holder.next = old; } while (!strongRefsUpdater.compareAndSet(this, old, holder))...
[ "private", "Holder", "createHolder", "(", ")", "{", "poll", "(", ")", ";", "Holder", "holder", "=", "new", "Holder", "(", "queue", ")", ";", "WeakReference", "<", "Holder", ">", "ref", "=", "new", "WeakReference", "<>", "(", "holder", ")", ";", "Holder...
Creates a new holder object, and registers it appropriately. Also polls for thread-exits.
[ "Creates", "a", "new", "holder", "object", "and", "registers", "it", "appropriately", ".", "Also", "polls", "for", "thread", "-", "exits", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java#L176-L189
train
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java
VicariousThreadLocal.isInitialized
public boolean isInitialized() { WeakReference<Holder> ref = local.get(); if (ref != null) { Holder holder = ref.get(); return holder != null && holder.value != UNINITIALISED; } else { return false; } }
java
public boolean isInitialized() { WeakReference<Holder> ref = local.get(); if (ref != null) { Holder holder = ref.get(); return holder != null && holder.value != UNINITIALISED; } else { return false; } }
[ "public", "boolean", "isInitialized", "(", ")", "{", "WeakReference", "<", "Holder", ">", "ref", "=", "local", ".", "get", "(", ")", ";", "if", "(", "ref", "!=", "null", ")", "{", "Holder", "holder", "=", "ref", ".", "get", "(", ")", ";", "return",...
Indicates whether thread-local has been initialised for the current thread.
[ "Indicates", "whether", "thread", "-", "local", "has", "been", "initialised", "for", "the", "current", "thread", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java#L202-L210
train
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java
VicariousThreadLocal.swap
@SuppressWarnings("unchecked") public T swap(T value) { final Holder holder; final T oldValue; WeakReference<Holder> ref = local.get(); if (ref != null) { holder = ref.get(); Object holderValue = holder.value; if (holderValue != UNINITIALISED) { ...
java
@SuppressWarnings("unchecked") public T swap(T value) { final Holder holder; final T oldValue; WeakReference<Holder> ref = local.get(); if (ref != null) { holder = ref.get(); Object holderValue = holder.value; if (holderValue != UNINITIALISED) { ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "swap", "(", "T", "value", ")", "{", "final", "Holder", "holder", ";", "final", "T", "oldValue", ";", "WeakReference", "<", "Holder", ">", "ref", "=", "local", ".", "get", "(", ")", ";"...
Swaps the current threads value with the supplied value. Thread-local will be initialised if not already done so.
[ "Swaps", "the", "current", "threads", "value", "with", "the", "supplied", "value", ".", "Thread", "-", "local", "will", "be", "initialised", "if", "not", "already", "done", "so", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java#L215-L234
train
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java
VicariousThreadLocal.poll
public void poll() { synchronized (queue) { // Remove queued references. // (Is this better inside or out?) if (queue.poll() == null) { // Nothing to do. return; } while (queue.poll() != null) { // Discar...
java
public void poll() { synchronized (queue) { // Remove queued references. // (Is this better inside or out?) if (queue.poll() == null) { // Nothing to do. return; } while (queue.poll() != null) { // Discar...
[ "public", "void", "poll", "(", ")", "{", "synchronized", "(", "queue", ")", "{", "// Remove queued references.", "// (Is this better inside or out?)", "if", "(", "queue", ".", "poll", "(", ")", "==", "null", ")", "{", "// Nothing to do.", "return", ";", "}", "...
Check if any strong references need should be removed due to thread exit.
[ "Check", "if", "any", "strong", "references", "need", "should", "be", "removed", "due", "to", "thread", "exit", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/netty/util/threadlocal/VicariousThreadLocal.java#L274-L313
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java
HttpProxyRequest.getHost
public synchronized final String getHost() { if (host == null) { if (getEndpointAddress() != null && !getEndpointAddress().isUnresolved()) { host = getEndpointAddress().getHostName(); } if (host == null && httpURI != null) { ...
java
public synchronized final String getHost() { if (host == null) { if (getEndpointAddress() != null && !getEndpointAddress().isUnresolved()) { host = getEndpointAddress().getHostName(); } if (host == null && httpURI != null) { ...
[ "public", "synchronized", "final", "String", "getHost", "(", ")", "{", "if", "(", "host", "==", "null", ")", "{", "if", "(", "getEndpointAddress", "(", ")", "!=", "null", "&&", "!", "getEndpointAddress", "(", ")", ".", "isUnresolved", "(", ")", ")", "{...
Returns the host to which we are connecting.
[ "Returns", "the", "host", "to", "which", "we", "are", "connecting", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java#L193-L210
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java
HttpProxyRequest.toHttpString
public String toHttpString() { StringBuilder sb = new StringBuilder(); sb.append(getHttpVerb()).append(' ').append(getHttpURI()).append(' ') .append(getHttpVersion()).append(HttpProxyConstants.CRLF); boolean hostHeaderFound = false; if (getHeaders() != null) { ...
java
public String toHttpString() { StringBuilder sb = new StringBuilder(); sb.append(getHttpVerb()).append(' ').append(getHttpURI()).append(' ') .append(getHttpVersion()).append(HttpProxyConstants.CRLF); boolean hostHeaderFound = false; if (getHeaders() != null) { ...
[ "public", "String", "toHttpString", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "getHttpVerb", "(", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "getHttpURI", "(", ")...
Returns the string representation of the HTTP request .
[ "Returns", "the", "string", "representation", "of", "the", "HTTP", "request", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpProxyRequest.java#L267-L298
train
kaazing/gateway
server/src/main/java/org/kaazing/gateway/server/impl/GatewayCreatorImpl.java
GatewayCreatorImpl.configureGateway
@Override public void configureGateway(Gateway gateway) { Properties properties = new Properties(); properties.putAll(System.getProperties()); String gatewayHome = properties.getProperty(Gateway.GATEWAY_HOME_PROPERTY); if ((gatewayHome == null) || "".equals(gatewayHome)) { ...
java
@Override public void configureGateway(Gateway gateway) { Properties properties = new Properties(); properties.putAll(System.getProperties()); String gatewayHome = properties.getProperty(Gateway.GATEWAY_HOME_PROPERTY); if ((gatewayHome == null) || "".equals(gatewayHome)) { ...
[ "@", "Override", "public", "void", "configureGateway", "(", "Gateway", "gateway", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "properties", ".", "putAll", "(", "System", ".", "getProperties", "(", ")", ")", ";", "String", ...
Bootstrap the Gateway instance with a GATEWAY_HOME if not already set in System properties.
[ "Bootstrap", "the", "Gateway", "instance", "with", "a", "GATEWAY_HOME", "if", "not", "already", "set", "in", "System", "properties", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/impl/GatewayCreatorImpl.java#L38-L77
train
kaazing/gateway
transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameDecoder.java
WsFrameDecoder.validateOpcodeUsingFin
private void validateOpcodeUsingFin(Opcode opcode, boolean fin) throws ProtocolDecoderException { switch (opcode) { case CONTINUATION: if (prevDataFin) { throw new ProtocolDecoderException("Not expecting CONTINUATION frame"); } brea...
java
private void validateOpcodeUsingFin(Opcode opcode, boolean fin) throws ProtocolDecoderException { switch (opcode) { case CONTINUATION: if (prevDataFin) { throw new ProtocolDecoderException("Not expecting CONTINUATION frame"); } brea...
[ "private", "void", "validateOpcodeUsingFin", "(", "Opcode", "opcode", ",", "boolean", "fin", ")", "throws", "ProtocolDecoderException", "{", "switch", "(", "opcode", ")", "{", "case", "CONTINUATION", ":", "if", "(", "prevDataFin", ")", "{", "throw", "new", "Pr...
Validates opcode w.r.t FIN bit
[ "Validates", "opcode", "w", ".", "r", ".", "t", "FIN", "bit" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameDecoder.java#L172-L197
train
kaazing/gateway
transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameDecoder.java
WsFrameDecoder.validateRSV
private void validateRSV(byte opcodeByte) throws ProtocolDecoderException { if ((opcodeByte & 0x70) != 0) { // We don't support negotiated extensions that deal with RSV bits if ((opcodeByte & 0x40) != 0) { throw new ProtocolDecoderException("RSV1 is set"); } ...
java
private void validateRSV(byte opcodeByte) throws ProtocolDecoderException { if ((opcodeByte & 0x70) != 0) { // We don't support negotiated extensions that deal with RSV bits if ((opcodeByte & 0x40) != 0) { throw new ProtocolDecoderException("RSV1 is set"); } ...
[ "private", "void", "validateRSV", "(", "byte", "opcodeByte", ")", "throws", "ProtocolDecoderException", "{", "if", "(", "(", "opcodeByte", "&", "0x70", ")", "!=", "0", ")", "{", "// We don't support negotiated extensions that deal with RSV bits", "if", "(", "(", "op...
Validates RSV bits
[ "Validates", "RSV", "bits" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameDecoder.java#L200-L213
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java
Socks5LogicHandler.doHandshake
public synchronized void doHandshake(final NextFilter nextFilter) { LOGGER.debug(" doHandshake()"); // Send request writeRequest(nextFilter, request, (Integer) getSession().getAttribute( HANDSHAKE_STEP)); }
java
public synchronized void doHandshake(final NextFilter nextFilter) { LOGGER.debug(" doHandshake()"); // Send request writeRequest(nextFilter, request, (Integer) getSession().getAttribute( HANDSHAKE_STEP)); }
[ "public", "synchronized", "void", "doHandshake", "(", "final", "NextFilter", "nextFilter", ")", "{", "LOGGER", ".", "debug", "(", "\" doHandshake()\"", ")", ";", "// Send request", "writeRequest", "(", "nextFilter", ",", "request", ",", "(", "Integer", ")", "get...
Performs the handshake process. @param nextFilter the next filter
[ "Performs", "the", "handshake", "process", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java#L87-L93
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java
Socks5LogicHandler.encodeInitialGreetingPacket
private IoBuffer encodeInitialGreetingPacket(final SocksProxyRequest request) { byte nbMethods = (byte) SocksProxyConstants.SUPPORTED_AUTH_METHODS.length; IoBuffer buf = IoBuffer.allocate(2 + nbMethods); buf.put(request.getProtocolVersion()); buf.put(nbMethods); buf.put(SocksPro...
java
private IoBuffer encodeInitialGreetingPacket(final SocksProxyRequest request) { byte nbMethods = (byte) SocksProxyConstants.SUPPORTED_AUTH_METHODS.length; IoBuffer buf = IoBuffer.allocate(2 + nbMethods); buf.put(request.getProtocolVersion()); buf.put(nbMethods); buf.put(SocksPro...
[ "private", "IoBuffer", "encodeInitialGreetingPacket", "(", "final", "SocksProxyRequest", "request", ")", "{", "byte", "nbMethods", "=", "(", "byte", ")", "SocksProxyConstants", ".", "SUPPORTED_AUTH_METHODS", ".", "length", ";", "IoBuffer", "buf", "=", "IoBuffer", "....
Encodes the initial greeting packet. @param request the socks proxy request data @return the encoded buffer
[ "Encodes", "the", "initial", "greeting", "packet", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java#L101-L110
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java
Socks5LogicHandler.encodeProxyRequestPacket
private IoBuffer encodeProxyRequestPacket(final SocksProxyRequest request) throws UnsupportedEncodingException { int len = 6; InetSocketAddress adr = request.getEndpointAddress(); byte addressType = 0; byte[] host = null; if (adr != null && !adr.isUnresolved(...
java
private IoBuffer encodeProxyRequestPacket(final SocksProxyRequest request) throws UnsupportedEncodingException { int len = 6; InetSocketAddress adr = request.getEndpointAddress(); byte addressType = 0; byte[] host = null; if (adr != null && !adr.isUnresolved(...
[ "private", "IoBuffer", "encodeProxyRequestPacket", "(", "final", "SocksProxyRequest", "request", ")", "throws", "UnsupportedEncodingException", "{", "int", "len", "=", "6", ";", "InetSocketAddress", "adr", "=", "request", ".", "getEndpointAddress", "(", ")", ";", "b...
Encodes the proxy authorization request packet. @param request the socks proxy request data @return the encoded buffer @throws UnsupportedEncodingException if request's hostname charset can't be converted to ASCII.
[ "Encodes", "the", "proxy", "authorization", "request", "packet", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java#L120-L165
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java
Socks5LogicHandler.writeRequest
private void writeRequest(final NextFilter nextFilter, final SocksProxyRequest request, int step) { try { IoBuffer buf = null; if (step == SocksProxyConstants.SOCKS5_GREETING_STEP) { buf = encodeInitialGreetingPacket(request); } else if (step == S...
java
private void writeRequest(final NextFilter nextFilter, final SocksProxyRequest request, int step) { try { IoBuffer buf = null; if (step == SocksProxyConstants.SOCKS5_GREETING_STEP) { buf = encodeInitialGreetingPacket(request); } else if (step == S...
[ "private", "void", "writeRequest", "(", "final", "NextFilter", "nextFilter", ",", "final", "SocksProxyRequest", "request", ",", "int", "step", ")", "{", "try", "{", "IoBuffer", "buf", "=", "null", ";", "if", "(", "step", "==", "SocksProxyConstants", ".", "SO...
Encodes a SOCKS5 request and writes it to the next filter so it can be sent to the proxy server. @param nextFilter the next filter @param request the request to send. @param step the current step in the handshake process
[ "Encodes", "a", "SOCKS5", "request", "and", "writes", "it", "to", "the", "next", "filter", "so", "it", "can", "be", "sent", "to", "the", "proxy", "server", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks5LogicHandler.java#L292-L318
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java
BlacklistFilter.setSubnetBlacklist
public void setSubnetBlacklist(Iterable<Subnet> subnets) { if (subnets == null) { throw new NullPointerException("Subnets must not be null"); } blacklist.clear(); for (Subnet subnet : subnets) { block(subnet); } }
java
public void setSubnetBlacklist(Iterable<Subnet> subnets) { if (subnets == null) { throw new NullPointerException("Subnets must not be null"); } blacklist.clear(); for (Subnet subnet : subnets) { block(subnet); } }
[ "public", "void", "setSubnetBlacklist", "(", "Iterable", "<", "Subnet", ">", "subnets", ")", "{", "if", "(", "subnets", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Subnets must not be null\"", ")", ";", "}", "blacklist", ".", "clear...
Sets the subnets to be blacklisted. NOTE: this call will remove any previously blacklisted subnets. @param subnets an array of subnets to be blacklisted.
[ "Sets", "the", "subnets", "to", "be", "blacklisted", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/firewall/BlacklistFilter.java#L107-L115
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java
IdleStatusChecker.addSession
public void addSession(AbstractIoSession session) { sessions.add(session); CloseFuture closeFuture = session.getCloseFuture(); // isn't service reponsability to remove the session nicely ? closeFuture.addListener(sessionCloseListener); }
java
public void addSession(AbstractIoSession session) { sessions.add(session); CloseFuture closeFuture = session.getCloseFuture(); // isn't service reponsability to remove the session nicely ? closeFuture.addListener(sessionCloseListener); }
[ "public", "void", "addSession", "(", "AbstractIoSession", "session", ")", "{", "sessions", ".", "add", "(", "session", ")", ";", "CloseFuture", "closeFuture", "=", "session", ".", "getCloseFuture", "(", ")", ";", "// isn't service reponsability to remove the session n...
Add the session for being checked for idle. @param session the session to check
[ "Add", "the", "session", "for", "being", "checked", "for", "idle", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/session/IdleStatusChecker.java#L59-L65
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
ProtocolCodecFilter.disposeEncoder
private void disposeEncoder(IoSession session) { ProtocolEncoder encoder = (ProtocolEncoder) session .removeAttribute(ENCODER); if (encoder == null) { return; } try { encoder.dispose(session); } catch (Throwable t) { LOGGER.war...
java
private void disposeEncoder(IoSession session) { ProtocolEncoder encoder = (ProtocolEncoder) session .removeAttribute(ENCODER); if (encoder == null) { return; } try { encoder.dispose(session); } catch (Throwable t) { LOGGER.war...
[ "private", "void", "disposeEncoder", "(", "IoSession", "session", ")", "{", "ProtocolEncoder", "encoder", "=", "(", "ProtocolEncoder", ")", "session", ".", "removeAttribute", "(", "ENCODER", ")", ";", "if", "(", "encoder", "==", "null", ")", "{", "return", "...
Dispose the encoder, removing its instance from the session's attributes, and calling the associated dispose method.
[ "Dispose", "the", "encoder", "removing", "its", "instance", "from", "the", "session", "s", "attributes", "and", "calling", "the", "associated", "dispose", "method", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java#L471-L484
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
ProtocolCodecFilter.disposeDecoder
private void disposeDecoder(IoSession session) { ProtocolDecoder decoder = (ProtocolDecoder) session .removeAttribute(DECODER); if (decoder == null) { return; } try { decoder.dispose(session); } catch (Throwable t) { LOGGER.war...
java
private void disposeDecoder(IoSession session) { ProtocolDecoder decoder = (ProtocolDecoder) session .removeAttribute(DECODER); if (decoder == null) { return; } try { decoder.dispose(session); } catch (Throwable t) { LOGGER.war...
[ "private", "void", "disposeDecoder", "(", "IoSession", "session", ")", "{", "ProtocolDecoder", "decoder", "=", "(", "ProtocolDecoder", ")", "session", ".", "removeAttribute", "(", "DECODER", ")", ";", "if", "(", "decoder", "==", "null", ")", "{", "return", "...
Dispose the decoder, removing its instance from the session's attributes, and calling the associated dispose method.
[ "Dispose", "the", "decoder", "removing", "its", "instance", "from", "the", "session", "s", "attributes", "and", "calling", "the", "associated", "dispose", "method", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java#L501-L514
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
ProtocolCodecFilter.getDecoderOut
private ProtocolDecoderOutput getDecoderOut(IoSession session, NextFilter nextFilter) { ProtocolDecoderOutput out = (ProtocolDecoderOutput) session.getAttribute(DECODER_OUT); if (out == null) { // Create a new instance, and stores it into the session out = ne...
java
private ProtocolDecoderOutput getDecoderOut(IoSession session, NextFilter nextFilter) { ProtocolDecoderOutput out = (ProtocolDecoderOutput) session.getAttribute(DECODER_OUT); if (out == null) { // Create a new instance, and stores it into the session out = ne...
[ "private", "ProtocolDecoderOutput", "getDecoderOut", "(", "IoSession", "session", ",", "NextFilter", "nextFilter", ")", "{", "ProtocolDecoderOutput", "out", "=", "(", "ProtocolDecoderOutput", ")", "session", ".", "getAttribute", "(", "DECODER_OUT", ")", ";", "if", "...
Return a reference to the decoder callback. If it's not already created and stored into the session, we create a new instance.
[ "Return", "a", "reference", "to", "the", "decoder", "callback", ".", "If", "it", "s", "not", "already", "created", "and", "stored", "into", "the", "session", "we", "create", "a", "new", "instance", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java#L520-L531
train
kaazing/gateway
transport/http/src/main/java/org/kaazing/gateway/transport/http/WsHandshakeValidator.java
WsHandshakeValidator.validate
public boolean validate(HttpRequestMessage request, boolean isPostMethodAllowed) { WebSocketWireProtocol wireProtocolVersion = guessWireProtocolVersion(request); if ( wireProtocolVersion == null ) { return false; } final WsHandshakeValidator validator = handshakeValidatorsBy...
java
public boolean validate(HttpRequestMessage request, boolean isPostMethodAllowed) { WebSocketWireProtocol wireProtocolVersion = guessWireProtocolVersion(request); if ( wireProtocolVersion == null ) { return false; } final WsHandshakeValidator validator = handshakeValidatorsBy...
[ "public", "boolean", "validate", "(", "HttpRequestMessage", "request", ",", "boolean", "isPostMethodAllowed", ")", "{", "WebSocketWireProtocol", "wireProtocolVersion", "=", "guessWireProtocolVersion", "(", "request", ")", ";", "if", "(", "wireProtocolVersion", "==", "nu...
Facade method to validate an HttpMessageRequest. @param request the request to validate @return true iff the appropriate handshake for websocket protocol is contained within the provided request.
[ "Facade", "method", "to", "validate", "an", "HttpMessageRequest", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/WsHandshakeValidator.java#L58-L67
train
kaazing/gateway
transport/http/src/main/java/org/kaazing/gateway/transport/http/WsHandshakeValidator.java
WsHandshakeValidator.doValidate
protected boolean doValidate(HttpRequestMessage request, final boolean isPostMethodAllowed) { if ( !isPostMethodAllowed ) { if ( request.getMethod() != HttpMethod.GET) { return false; } } else { if ( request.getMethod() != HttpMethod.GET || request.ge...
java
protected boolean doValidate(HttpRequestMessage request, final boolean isPostMethodAllowed) { if ( !isPostMethodAllowed ) { if ( request.getMethod() != HttpMethod.GET) { return false; } } else { if ( request.getMethod() != HttpMethod.GET || request.ge...
[ "protected", "boolean", "doValidate", "(", "HttpRequestMessage", "request", ",", "final", "boolean", "isPostMethodAllowed", ")", "{", "if", "(", "!", "isPostMethodAllowed", ")", "{", "if", "(", "request", ".", "getMethod", "(", ")", "!=", "HttpMethod", ".", "G...
Does the provided request form a valid web socket handshake request? @param request the candidate web socket handshake request @return true iff the provided request is a web socket handshake request.
[ "Does", "the", "provided", "request", "form", "a", "valid", "web", "socket", "handshake", "request?" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/WsHandshakeValidator.java#L94-L123
train
kaazing/gateway
transport/http/src/main/java/org/kaazing/gateway/transport/http/WsHandshakeValidator.java
WsHandshakeValidator.register
private void register(WebSocketWireProtocol wireProtocolVersion, WsHandshakeValidator validator) { if ( wireProtocolVersion == null ) { throw new NullPointerException("wireProtocolVersion"); } if ( validator == null ) { throw new NullPointerException("validator"); ...
java
private void register(WebSocketWireProtocol wireProtocolVersion, WsHandshakeValidator validator) { if ( wireProtocolVersion == null ) { throw new NullPointerException("wireProtocolVersion"); } if ( validator == null ) { throw new NullPointerException("validator"); ...
[ "private", "void", "register", "(", "WebSocketWireProtocol", "wireProtocolVersion", ",", "WsHandshakeValidator", "validator", ")", "{", "if", "(", "wireProtocolVersion", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"wireProtocolVersion\"", ")",...
Allow subclasses to register themselves as validators for specific versions of the wire protocol. @param wireProtocolVersion the version of the protocol @param validator the validator
[ "Allow", "subclasses", "to", "register", "themselves", "as", "validators", "for", "specific", "versions", "of", "the", "wire", "protocol", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/WsHandshakeValidator.java#L170-L185
train
kaazing/gateway
transport/ssl/src/main/java/org/kaazing/gateway/transport/ssl/bridge/filter/SslHandler.java
SslHandler.fetchAppBuffer
public IoBuffer fetchAppBuffer() { IoBufferEx appBuffer = this.appBuffer.flip(); this.appBuffer = null; return (IoBuffer) appBuffer; }
java
public IoBuffer fetchAppBuffer() { IoBufferEx appBuffer = this.appBuffer.flip(); this.appBuffer = null; return (IoBuffer) appBuffer; }
[ "public", "IoBuffer", "fetchAppBuffer", "(", ")", "{", "IoBufferEx", "appBuffer", "=", "this", ".", "appBuffer", ".", "flip", "(", ")", ";", "this", ".", "appBuffer", "=", "null", ";", "return", "(", "IoBuffer", ")", "appBuffer", ";", "}" ]
Get decrypted application data. @return buffer with data
[ "Get", "decrypted", "application", "data", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ssl/src/main/java/org/kaazing/gateway/transport/ssl/bridge/filter/SslHandler.java#L409-L413
train
kaazing/gateway
resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/URLUtils.java
URLUtils.hasLiteralIPAddress
public static boolean hasLiteralIPAddress(URI resource) { String host = resource.getHost(); if ( host == null || host.isEmpty() ) { return false; } // basic check for a '.'-separated numeric string for now return host.matches("([0-9A-Fa-f]|\\.){4,16}"); }
java
public static boolean hasLiteralIPAddress(URI resource) { String host = resource.getHost(); if ( host == null || host.isEmpty() ) { return false; } // basic check for a '.'-separated numeric string for now return host.matches("([0-9A-Fa-f]|\\.){4,16}"); }
[ "public", "static", "boolean", "hasLiteralIPAddress", "(", "URI", "resource", ")", "{", "String", "host", "=", "resource", ".", "getHost", "(", ")", ";", "if", "(", "host", "==", "null", "||", "host", ".", "isEmpty", "(", ")", ")", "{", "return", "fals...
We can make this tighter but IPAddressUtil is in a sun package sadly
[ "We", "can", "make", "this", "tighter", "but", "IPAddressUtil", "is", "in", "a", "sun", "package", "sadly" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/URLUtils.java#L264-L271
train
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/CacheControlHandler.java
CacheControlHandler.getCacheControlHeader
public String getCacheControlHeader() { checkIfMaxAgeIsResolved(); String maxAge = Directive.MAX_AGE.getName() + "=" + (maxAgeResolvedValue > 0 ? maxAgeResolvedValue : "0"); return staticDirectives.toString() + maxAge; }
java
public String getCacheControlHeader() { checkIfMaxAgeIsResolved(); String maxAge = Directive.MAX_AGE.getName() + "=" + (maxAgeResolvedValue > 0 ? maxAgeResolvedValue : "0"); return staticDirectives.toString() + maxAge; }
[ "public", "String", "getCacheControlHeader", "(", ")", "{", "checkIfMaxAgeIsResolved", "(", ")", ";", "String", "maxAge", "=", "Directive", ".", "MAX_AGE", ".", "getName", "(", ")", "+", "\"=\"", "+", "(", "maxAgeResolvedValue", ">", "0", "?", "maxAgeResolvedV...
Returns the Cache-control header string @return
[ "Returns", "the", "Cache", "-", "control", "header", "string" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/CacheControlHandler.java#L56-L60
train
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/CacheControlHandler.java
CacheControlHandler.buildDirectives
private void buildDirectives(PatternCacheControl patternCacheControl) { for (Map.Entry<Directive, String> entry : patternCacheControl.getDirectives().entrySet()) { Directive key = entry.getKey(); String value = entry.getValue(); switch (key) { case MAX_AGE: ...
java
private void buildDirectives(PatternCacheControl patternCacheControl) { for (Map.Entry<Directive, String> entry : patternCacheControl.getDirectives().entrySet()) { Directive key = entry.getKey(); String value = entry.getValue(); switch (key) { case MAX_AGE: ...
[ "private", "void", "buildDirectives", "(", "PatternCacheControl", "patternCacheControl", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Directive", ",", "String", ">", "entry", ":", "patternCacheControl", ".", "getDirectives", "(", ")", ".", "entrySet", "(", ...
Builds a string of directives by concatenating all the static directives @param patternCacheControl
[ "Builds", "a", "string", "of", "directives", "by", "concatenating", "all", "the", "static", "directives" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/CacheControlHandler.java#L127-L145
train
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/Utils.java
Utils.fill
public static String fill(char c, int size) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < size; i++) { builder.append(c); } return builder.toString(); }
java
public static String fill(char c, int size) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < size; i++) { builder.append(c); } return builder.toString(); }
[ "public", "static", "String", "fill", "(", "char", "c", ",", "int", "size", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "buil...
Creates a new String filled with size of a repeating character @param c Character to repeat @param size Size of resulting String @return String full of repeated characters
[ "Creates", "a", "new", "String", "filled", "with", "size", "of", "a", "repeating", "character" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/Utils.java#L137-L143
train
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/Utils.java
Utils.initCaps
public static String initCaps(String in) { return in.length() < 2 ? in.toUpperCase() : in.substring(0, 1).toUpperCase() + in.substring(1); }
java
public static String initCaps(String in) { return in.length() < 2 ? in.toUpperCase() : in.substring(0, 1).toUpperCase() + in.substring(1); }
[ "public", "static", "String", "initCaps", "(", "String", "in", ")", "{", "return", "in", ".", "length", "(", ")", "<", "2", "?", "in", ".", "toUpperCase", "(", ")", ":", "in", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")...
Converts the first character of the string to uppercase. Does NOT deal with surrogate pairs.
[ "Converts", "the", "first", "character", "of", "the", "string", "to", "uppercase", ".", "Does", "NOT", "deal", "with", "surrogate", "pairs", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/Utils.java#L457-L459
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyIoHandler.java
AbstractProxyIoHandler.sessionOpened
@Override public final void sessionOpened(IoSession session) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session .getAttribute(ProxyIoSession.PROXY_SESSION); if (proxyIoSession.getRequest() instanceof SocksProxyRequest || proxyIoSession.isAuth...
java
@Override public final void sessionOpened(IoSession session) throws Exception { ProxyIoSession proxyIoSession = (ProxyIoSession) session .getAttribute(ProxyIoSession.PROXY_SESSION); if (proxyIoSession.getRequest() instanceof SocksProxyRequest || proxyIoSession.isAuth...
[ "@", "Override", "public", "final", "void", "sessionOpened", "(", "IoSession", "session", ")", "throws", "Exception", "{", "ProxyIoSession", "proxyIoSession", "=", "(", "ProxyIoSession", ")", "session", ".", "getAttribute", "(", "ProxyIoSession", ".", "PROXY_SESSION...
Hooked session opened event. @param session the io session
[ "Hooked", "session", "opened", "event", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyIoHandler.java#L48-L60
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/AbstractBridgeSession.java
AbstractBridgeSession.reset
public void reset(final Throwable cause) { if (cause == null) { throw new NullPointerException("cause must not be null in AbstractBridgeSession.reset"); } if (!isIoAligned() || getIoThread() == Thread.currentThread()) { reset0(cause); } else { ...
java
public void reset(final Throwable cause) { if (cause == null) { throw new NullPointerException("cause must not be null in AbstractBridgeSession.reset"); } if (!isIoAligned() || getIoThread() == Thread.currentThread()) { reset0(cause); } else { ...
[ "public", "void", "reset", "(", "final", "Throwable", "cause", ")", "{", "if", "(", "cause", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"cause must not be null in AbstractBridgeSession.reset\"", ")", ";", "}", "if", "(", "!", "isIoAli...
Behave similarly to connection reset by peer at NIO layer. This method should be called from handlers' exceptionCaught method instead of calling fireExceptionCaught and IoProcessor.remove, because the latter will fail if we're not on its IO thread. @param cause
[ "Behave", "similarly", "to", "connection", "reset", "by", "peer", "at", "NIO", "layer", ".", "This", "method", "should", "be", "called", "from", "handlers", "exceptionCaught", "method", "instead", "of", "calling", "fireExceptionCaught", "and", "IoProcessor", ".", ...
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/AbstractBridgeSession.java#L216-L232
train
kaazing/gateway
samples/security/TokenLoginModule.java
TokenLoginModule.processToken
private void processToken(String tokenData) throws JSONException, LoginException { JSONObject json = new JSONObject(tokenData); // Validate that the token hasn't expired. ZonedDateTime expires = ZonedDateTime.parse(json.getString("tokenExpires")); ZonedDateTime now = ZonedDateTime.now(...
java
private void processToken(String tokenData) throws JSONException, LoginException { JSONObject json = new JSONObject(tokenData); // Validate that the token hasn't expired. ZonedDateTime expires = ZonedDateTime.parse(json.getString("tokenExpires")); ZonedDateTime now = ZonedDateTime.now(...
[ "private", "void", "processToken", "(", "String", "tokenData", ")", "throws", "JSONException", ",", "LoginException", "{", "JSONObject", "json", "=", "new", "JSONObject", "(", "tokenData", ")", ";", "// Validate that the token hasn't expired.", "ZonedDateTime", "expires...
Validate the token and extract the username to add to shared state. An exception is thrown if the token is found to be invalid This method expects the token to be in JSON format: { username: "joe", nonce: "5171483440790326", tokenExpires: "2017-04-20T15:48:49.187Z" }
[ "Validate", "the", "token", "and", "extract", "the", "username", "to", "add", "to", "shared", "state", ".", "An", "exception", "is", "thrown", "if", "the", "token", "is", "found", "to", "be", "invalid" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/samples/security/TokenLoginModule.java#L199-L230
train
kaazing/gateway
transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameUtils.java
WsFrameUtils.xor
public static void xor(ByteBuffer src, ByteBuffer dst, int mask) { int remainder = src.remaining() % 4; int remaining = src.remaining() - remainder; int end = remaining + src.position(); // xor a 32bit word at a time as long as possible while (src.position() < end) { int masked = src.get...
java
public static void xor(ByteBuffer src, ByteBuffer dst, int mask) { int remainder = src.remaining() % 4; int remaining = src.remaining() - remainder; int end = remaining + src.position(); // xor a 32bit word at a time as long as possible while (src.position() < end) { int masked = src.get...
[ "public", "static", "void", "xor", "(", "ByteBuffer", "src", ",", "ByteBuffer", "dst", ",", "int", "mask", ")", "{", "int", "remainder", "=", "src", ".", "remaining", "(", ")", "%", "4", ";", "int", "remaining", "=", "src", ".", "remaining", "(", ")"...
Masks source buffer into destination buffer. @param src the buffer containing readable bytes to be masked @param dst the buffer where masked bytes are written @param mask the mask to apply
[ "Masks", "source", "buffer", "into", "destination", "buffer", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/bridge/filter/WsFrameUtils.java#L32-L68
train
kaazing/gateway
server/src/main/java/org/kaazing/gateway/server/config/parse/GatewayConfigParser.java
GatewayConfigParser.countNewLines
private static int countNewLines(char[] ch, int start, int length) { int newLineCount = 0; // quite reliable, since only Commodore 8-bit machines, TRS-80, Apple II family, Mac OS up to version 9 and OS-9 // use only '\r' for (int i = start; i < length; i++) { newLineCount = n...
java
private static int countNewLines(char[] ch, int start, int length) { int newLineCount = 0; // quite reliable, since only Commodore 8-bit machines, TRS-80, Apple II family, Mac OS up to version 9 and OS-9 // use only '\r' for (int i = start; i < length; i++) { newLineCount = n...
[ "private", "static", "int", "countNewLines", "(", "char", "[", "]", "ch", ",", "int", "start", ",", "int", "length", ")", "{", "int", "newLineCount", "=", "0", ";", "// quite reliable, since only Commodore 8-bit machines, TRS-80, Apple II family, Mac OS up to version 9 an...
Count the number of new lines @param ch @param start @param length
[ "Count", "the", "number", "of", "new", "lines" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/config/parse/GatewayConfigParser.java#L461-L469
train
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/PatternCacheControl.java
PatternCacheControl.parseDirectiveWithValue
private void parseDirectiveWithValue(String directiveName, String directiveValue) { Directive directive; if (directiveName.equals(Directive.MAX_AGE.getName())) { if (directiveValue.startsWith(M_PLUS_STRING)) { directiveValue = directiveValue.replace(M_PLUS_STRING, EMPTY_STRIN...
java
private void parseDirectiveWithValue(String directiveName, String directiveValue) { Directive directive; if (directiveName.equals(Directive.MAX_AGE.getName())) { if (directiveValue.startsWith(M_PLUS_STRING)) { directiveValue = directiveValue.replace(M_PLUS_STRING, EMPTY_STRIN...
[ "private", "void", "parseDirectiveWithValue", "(", "String", "directiveName", ",", "String", "directiveValue", ")", "{", "Directive", "directive", ";", "if", "(", "directiveName", ".", "equals", "(", "Directive", ".", "MAX_AGE", ".", "getName", "(", ")", ")", ...
Adds a directive with the associated value to the directives map, after parsing the value from the configuration file @param directiveName @param directiveValue
[ "Adds", "a", "directive", "with", "the", "associated", "value", "to", "the", "directives", "map", "after", "parsing", "the", "value", "from", "the", "configuration", "file" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/PatternCacheControl.java#L134-L148
train
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/PatternCacheControl.java
PatternCacheControl.checkDirective
private boolean checkDirective(String directive) { if (directives.containsKey(directive)) { throw new IllegalArgumentException("Duplicate cache-control directive in configuration file"); } else if (Directive.get(directive) == null) { throw new IllegalArgumentException("Missing or...
java
private boolean checkDirective(String directive) { if (directives.containsKey(directive)) { throw new IllegalArgumentException("Duplicate cache-control directive in configuration file"); } else if (Directive.get(directive) == null) { throw new IllegalArgumentException("Missing or...
[ "private", "boolean", "checkDirective", "(", "String", "directive", ")", "{", "if", "(", "directives", ".", "containsKey", "(", "directive", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Duplicate cache-control directive in configuration file\"", ")...
Checks for duplicate directive values and correct syntax @param directive @return
[ "Checks", "for", "duplicate", "directive", "values", "and", "correct", "syntax" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/PatternCacheControl.java#L155-L162
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/TransportFactory.java
TransportFactory.injectResources
public Map<String, Object> injectResources(Map<String, Object> resources) { Map<String, Object> allResources = new HashMap<>(resources); for (Entry<String, Transport> entry : transportsByName.entrySet()) { allResources.put(entry.getKey() + ".acceptor", entry.getValue().getAcceptor()); ...
java
public Map<String, Object> injectResources(Map<String, Object> resources) { Map<String, Object> allResources = new HashMap<>(resources); for (Entry<String, Transport> entry : transportsByName.entrySet()) { allResources.put(entry.getKey() + ".acceptor", entry.getValue().getAcceptor()); ...
[ "public", "Map", "<", "String", ",", "Object", ">", "injectResources", "(", "Map", "<", "String", ",", "Object", ">", "resources", ")", "{", "Map", "<", "String", ",", "Object", ">", "allResources", "=", "new", "HashMap", "<>", "(", "resources", ")", "...
Inject the given resources plus all available transport acceptors and connectors into every available acceptor and connector. @param resources Resources that should be injected (in addition to available transport acceptors and connectors) @return A map containing the given input resources plus entries for the acceptor ...
[ "Inject", "the", "given", "resources", "plus", "all", "available", "transport", "acceptors", "and", "connectors", "into", "every", "available", "acceptor", "and", "connector", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/TransportFactory.java#L197-L217
train
kaazing/gateway
service/http.balancer/src/main/java/org/kaazing/gateway/service/http/balancer/HttpBalancerService.java
HttpBalancerService.toWsBalancerURIs
private static Collection<String> toWsBalancerURIs(Collection<String> uris, AcceptOptionsContext acceptOptionsCtx, TransportFactory transportFactory) throws Exception { List<String> httpURIs = new ArrayList<>...
java
private static Collection<String> toWsBalancerURIs(Collection<String> uris, AcceptOptionsContext acceptOptionsCtx, TransportFactory transportFactory) throws Exception { List<String> httpURIs = new ArrayList<>...
[ "private", "static", "Collection", "<", "String", ">", "toWsBalancerURIs", "(", "Collection", "<", "String", ">", "uris", ",", "AcceptOptionsContext", "acceptOptionsCtx", ",", "TransportFactory", "transportFactory", ")", "throws", "Exception", "{", "List", "<", "Str...
Converts a collection of WS URIs to their equivalent WSN balancer URIs. @param uris the URIs to convert @return the converted URIs @throws Exception
[ "Converts", "a", "collection", "of", "WS", "URIs", "to", "their", "equivalent", "WSN", "balancer", "URIs", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.balancer/src/main/java/org/kaazing/gateway/service/http/balancer/HttpBalancerService.java#L175-L202
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventQueue.java
IoSessionEventQueue.flushPendingSessionEvents
public void flushPendingSessionEvents() throws Exception { synchronized (sessionEventsQueue) { IoSessionEvent evt; while ((evt = sessionEventsQueue.poll()) != null) { logger.debug(" Flushing buffered event: {}", evt); evt.deliverEvent(); ...
java
public void flushPendingSessionEvents() throws Exception { synchronized (sessionEventsQueue) { IoSessionEvent evt; while ((evt = sessionEventsQueue.poll()) != null) { logger.debug(" Flushing buffered event: {}", evt); evt.deliverEvent(); ...
[ "public", "void", "flushPendingSessionEvents", "(", ")", "throws", "Exception", "{", "synchronized", "(", "sessionEventsQueue", ")", "{", "IoSessionEvent", "evt", ";", "while", "(", "(", "evt", "=", "sessionEventsQueue", ".", "poll", "(", ")", ")", "!=", "null...
Send any session event which were queued while waiting for handshaking to complete. Please note this is an internal method. DO NOT USE it in your code.
[ "Send", "any", "session", "event", "which", "were", "queued", "while", "waiting", "for", "handshaking", "to", "complete", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventQueue.java#L109-L118
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventQueue.java
IoSessionEventQueue.enqueueSessionEvent
private void enqueueSessionEvent(final IoSessionEvent evt) { synchronized (sessionEventsQueue) { logger.debug("Enqueuing event: {}", evt); sessionEventsQueue.offer(evt); } }
java
private void enqueueSessionEvent(final IoSessionEvent evt) { synchronized (sessionEventsQueue) { logger.debug("Enqueuing event: {}", evt); sessionEventsQueue.offer(evt); } }
[ "private", "void", "enqueueSessionEvent", "(", "final", "IoSessionEvent", "evt", ")", "{", "synchronized", "(", "sessionEventsQueue", ")", "{", "logger", ".", "debug", "(", "\"Enqueuing event: {}\"", ",", "evt", ")", ";", "sessionEventsQueue", ".", "offer", "(", ...
Enqueue an event to be delivered once handshaking is complete. @param evt the session event to enqueue
[ "Enqueue", "an", "event", "to", "be", "delivered", "once", "handshaking", "is", "complete", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/event/IoSessionEventQueue.java#L125-L130
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingConnectionlessIoAcceptor.java
AbstractPollingConnectionlessIoAcceptor.startupAcceptor
private void startupAcceptor() { if (!selectable) { registerQueue.clear(); cancelQueue.clear(); flushingSessions.clear(); } synchronized (lock) { if (acceptor == null) { acceptor = new Acceptor(); executeWorker(acce...
java
private void startupAcceptor() { if (!selectable) { registerQueue.clear(); cancelQueue.clear(); flushingSessions.clear(); } synchronized (lock) { if (acceptor == null) { acceptor = new Acceptor(); executeWorker(acce...
[ "private", "void", "startupAcceptor", "(", ")", "{", "if", "(", "!", "selectable", ")", "{", "registerQueue", ".", "clear", "(", ")", ";", "cancelQueue", ".", "clear", "(", ")", ";", "flushingSessions", ".", "clear", "(", ")", ";", "}", "synchronized", ...
Starts the inner Acceptor thread.
[ "Starts", "the", "inner", "Acceptor", "thread", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingConnectionlessIoAcceptor.java#L315-L328
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyConstants.java
SocksProxyConstants.getReplyCodeAsString
public static String getReplyCodeAsString(byte code) { switch (code) { // v4 & v4a codes case V4_REPLY_REQUEST_GRANTED: return "Request granted"; case V4_REPLY_REQUEST_REJECTED_OR_FAILED: return "Request rejected or failed"; case V4_REPLY_REQUEST_FAILED_NO...
java
public static String getReplyCodeAsString(byte code) { switch (code) { // v4 & v4a codes case V4_REPLY_REQUEST_GRANTED: return "Request granted"; case V4_REPLY_REQUEST_REJECTED_OR_FAILED: return "Request rejected or failed"; case V4_REPLY_REQUEST_FAILED_NO...
[ "public", "static", "String", "getReplyCodeAsString", "(", "byte", "code", ")", "{", "switch", "(", "code", ")", "{", "// v4 & v4a codes", "case", "V4_REPLY_REQUEST_GRANTED", ":", "return", "\"Request granted\"", ";", "case", "V4_REPLY_REQUEST_REJECTED_OR_FAILED", ":", ...
Return the string associated with the specified reply code. @param code the reply code @return the reply string
[ "Return", "the", "string", "associated", "with", "the", "specified", "reply", "code", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyConstants.java#L142-L177
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/util/Transform.java
Transform.getThrowableStrRep
public static String[] getThrowableStrRep(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); throwable.printStackTrace(pw); pw.flush(); LineNumberReader reader = new LineNumberReader(new StringReader(sw.toString())); ArrayLi...
java
public static String[] getThrowableStrRep(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); throwable.printStackTrace(pw); pw.flush(); LineNumberReader reader = new LineNumberReader(new StringReader(sw.toString())); ArrayLi...
[ "public", "static", "String", "[", "]", "getThrowableStrRep", "(", "Throwable", "throwable", ")", "{", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "pw", "=", "new", "PrintWriter", "(", "sw", ")", ";", "throwable", ".", "...
convert a Throwable into an array of Strings @param throwable @return string representation of the throwable
[ "convert", "a", "Throwable", "into", "an", "array", "of", "Strings" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/Transform.java#L122-L141
train
kaazing/gateway
service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryServiceHandler.java
HttpDirectoryServiceHandler.addCacheControl
private void addCacheControl(HttpAcceptSession session, File requestFile, String requestPath) { CacheControlHandler cacheControlHandler = urlCacheControlMap.computeIfAbsent(requestPath, path -> patterns.stream() .filter(patternCacheControl -> PatternMatcherUtils.caseInsensi...
java
private void addCacheControl(HttpAcceptSession session, File requestFile, String requestPath) { CacheControlHandler cacheControlHandler = urlCacheControlMap.computeIfAbsent(requestPath, path -> patterns.stream() .filter(patternCacheControl -> PatternMatcherUtils.caseInsensi...
[ "private", "void", "addCacheControl", "(", "HttpAcceptSession", "session", ",", "File", "requestFile", ",", "String", "requestPath", ")", "{", "CacheControlHandler", "cacheControlHandler", "=", "urlCacheControlMap", ".", "computeIfAbsent", "(", "requestPath", ",", "path...
Matches the file URL with the most specific pattern and caches this information in a map Sets cache-control and expires headers @param session @param requestFile @param requestPath
[ "Matches", "the", "file", "URL", "with", "the", "most", "specific", "pattern", "and", "caches", "this", "information", "in", "a", "map", "Sets", "cache", "-", "control", "and", "expires", "headers" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/HttpDirectoryServiceHandler.java#L311-L323
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/HttpNTLMAuthLogicHandler.java
HttpNTLMAuthLogicHandler.getNTLMHeader
private String getNTLMHeader(final HttpProxyResponse response) { List<String> values = response.getHeaders().get("Proxy-Authenticate"); for (String s : values) { if (s.startsWith("NTLM")) { return s; } } return null; }
java
private String getNTLMHeader(final HttpProxyResponse response) { List<String> values = response.getHeaders().get("Proxy-Authenticate"); for (String s : values) { if (s.startsWith("NTLM")) { return s; } } return null; }
[ "private", "String", "getNTLMHeader", "(", "final", "HttpProxyResponse", "response", ")", "{", "List", "<", "String", ">", "values", "=", "response", ".", "getHeaders", "(", ")", ".", "get", "(", "\"Proxy-Authenticate\"", ")", ";", "for", "(", "String", "s",...
Returns the value of the NTLM Proxy-Authenticate header. @param response the proxy response
[ "Returns", "the", "value", "of", "the", "NTLM", "Proxy", "-", "Authenticate", "header", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/HttpNTLMAuthLogicHandler.java#L134-L144
train
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java
DemuxingIoHandler.exceptionCaught
@Override public void exceptionCaught(IoSession session, Throwable cause) throws Exception { ExceptionHandler<Throwable> handler = findExceptionHandler(cause.getClass()); if (handler != null) { handler.exceptionCaught(session, cause); } else { throw new UnknownMessage...
java
@Override public void exceptionCaught(IoSession session, Throwable cause) throws Exception { ExceptionHandler<Throwable> handler = findExceptionHandler(cause.getClass()); if (handler != null) { handler.exceptionCaught(session, cause); } else { throw new UnknownMessage...
[ "@", "Override", "public", "void", "exceptionCaught", "(", "IoSession", "session", ",", "Throwable", "cause", ")", "throws", "Exception", "{", "ExceptionHandler", "<", "Throwable", ">", "handler", "=", "findExceptionHandler", "(", "cause", ".", "getClass", "(", ...
Invoked when any exception is thrown by user IoHandler implementation or by MINA. If cause is an instance of IOException, MINA will close the connection automatically. <b>Warning !</b> If you are to overload this method, be aware that you _must_ call the messageHandler in your own method, otherwise it won't be called.
[ "Invoked", "when", "any", "exception", "is", "thrown", "by", "user", "IoHandler", "implementation", "or", "by", "MINA", ".", "If", "cause", "is", "an", "instance", "of", "IOException", "MINA", "will", "close", "the", "connection", "automatically", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/demux/DemuxingIoHandler.java#L264-L274
train
kaazing/gateway
mina.core/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialSessionImpl.java
SerialSessionImpl.start
void start() throws IOException, TooManyListenersException { inputStream = port.getInputStream(); outputStream = port.getOutputStream(); ReadWorker w = new ReadWorker(); w.start(); port.addEventListener(this); service.getIdleStatusChecker0().addSession(this); try ...
java
void start() throws IOException, TooManyListenersException { inputStream = port.getInputStream(); outputStream = port.getOutputStream(); ReadWorker w = new ReadWorker(); w.start(); port.addEventListener(this); service.getIdleStatusChecker0().addSession(this); try ...
[ "void", "start", "(", ")", "throws", "IOException", ",", "TooManyListenersException", "{", "inputStream", "=", "port", ".", "getInputStream", "(", ")", ";", "outputStream", "=", "port", ".", "getOutputStream", "(", ")", ";", "ReadWorker", "w", "=", "new", "R...
start handling streams @throws IOException @throws TooManyListenersException
[ "start", "handling", "streams" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/transport-serial/src/main/java/org/apache/mina/transport/serial/SerialSessionImpl.java#L141-L155
train
kaazing/gateway
service/update.check/src/main/java/org/kaazing/gateway/service/update/check/UpdateCheckService.java
UpdateCheckService.checkForUpdate
public void checkForUpdate(UpdateCheckListener updateCheckListener) { listeners.add(updateCheckListener); if (scheduler != null) { scheduler.schedule(new UpdateCheckTask(this, versionServiceUrl, productName), 0, SECONDS); } else { // the scheduler won't be provided if the...
java
public void checkForUpdate(UpdateCheckListener updateCheckListener) { listeners.add(updateCheckListener); if (scheduler != null) { scheduler.schedule(new UpdateCheckTask(this, versionServiceUrl, productName), 0, SECONDS); } else { // the scheduler won't be provided if the...
[ "public", "void", "checkForUpdate", "(", "UpdateCheckListener", "updateCheckListener", ")", "{", "listeners", ".", "add", "(", "updateCheckListener", ")", ";", "if", "(", "scheduler", "!=", "null", ")", "{", "scheduler", ".", "schedule", "(", "new", "UpdateCheck...
Forces a check for an update and registers the listener if it is not already registered @param updateCheckListener
[ "Forces", "a", "check", "for", "an", "update", "and", "registers", "the", "listener", "if", "it", "is", "not", "already", "registered" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/update.check/src/main/java/org/kaazing/gateway/service/update/check/UpdateCheckService.java#L123-L132
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java
MonitorFileWriterImpl.setServicesCount
private void setServicesCount() { servicesCount = MAX_SERVICE_COUNT; metadataLength = NUMBER_OF_INTS_IN_HEADER * BitUtil.SIZE_OF_INT + SIZEOF_STRING + servicesCount * (SIZEOF_STRING + NUMBER_OF_INTS_PER_SERVICE * BitUtil.SIZE_OF_INT); endOfMetadata = BitUtil.align(metadataLength ...
java
private void setServicesCount() { servicesCount = MAX_SERVICE_COUNT; metadataLength = NUMBER_OF_INTS_IN_HEADER * BitUtil.SIZE_OF_INT + SIZEOF_STRING + servicesCount * (SIZEOF_STRING + NUMBER_OF_INTS_PER_SERVICE * BitUtil.SIZE_OF_INT); endOfMetadata = BitUtil.align(metadataLength ...
[ "private", "void", "setServicesCount", "(", ")", "{", "servicesCount", "=", "MAX_SERVICE_COUNT", ";", "metadataLength", "=", "NUMBER_OF_INTS_IN_HEADER", "*", "BitUtil", ".", "SIZE_OF_INT", "+", "SIZEOF_STRING", "+", "servicesCount", "*", "(", "SIZEOF_STRING", "+", "...
Method setting the number of services and metadata length
[ "Method", "setting", "the", "number", "of", "services", "and", "metadata", "length" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L182-L188
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java
MonitorFileWriterImpl.fillMetaData
private void fillMetaData() { metaDataBuffer.putInt(MONITOR_VERSION_OFFSET, MONITOR_VERSION); metaDataBuffer.putInt(GW_DATA_REFERENCE_OFFSET, GW_DATA_OFFSET); metaDataBuffer.putInt(SERVICE_DATA_REFERENCE_OFFSET, serviceDataOffset); metaDataBuffer.putStringUtf8(GW_ID_OFFSET, gatewayId, By...
java
private void fillMetaData() { metaDataBuffer.putInt(MONITOR_VERSION_OFFSET, MONITOR_VERSION); metaDataBuffer.putInt(GW_DATA_REFERENCE_OFFSET, GW_DATA_OFFSET); metaDataBuffer.putInt(SERVICE_DATA_REFERENCE_OFFSET, serviceDataOffset); metaDataBuffer.putStringUtf8(GW_ID_OFFSET, gatewayId, By...
[ "private", "void", "fillMetaData", "(", ")", "{", "metaDataBuffer", ".", "putInt", "(", "MONITOR_VERSION_OFFSET", ",", "MONITOR_VERSION", ")", ";", "metaDataBuffer", ".", "putInt", "(", "GW_DATA_REFERENCE_OFFSET", ",", "GW_DATA_OFFSET", ")", ";", "metaDataBuffer", "...
Fills the meta data in the specified buffer @param monitorMetaDataBuffer - the meta data buffer
[ "Fills", "the", "meta", "data", "in", "the", "specified", "buffer" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L194-L204
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java
MonitorFileWriterImpl.fillServiceMetadata
private void fillServiceMetadata(final String serviceName, final int index) { final int servAreaOffset = noOfServicesOffset + BitUtil.SIZE_OF_INT; metaDataBuffer.putInt(noOfServicesOffset, metaDataBuffer.getInt(noOfServicesOffset) + 1); int serviceNameOffset = getServiceNameOffset(servAreaOffset...
java
private void fillServiceMetadata(final String serviceName, final int index) { final int servAreaOffset = noOfServicesOffset + BitUtil.SIZE_OF_INT; metaDataBuffer.putInt(noOfServicesOffset, metaDataBuffer.getInt(noOfServicesOffset) + 1); int serviceNameOffset = getServiceNameOffset(servAreaOffset...
[ "private", "void", "fillServiceMetadata", "(", "final", "String", "serviceName", ",", "final", "int", "index", ")", "{", "final", "int", "servAreaOffset", "=", "noOfServicesOffset", "+", "BitUtil", ".", "SIZE_OF_INT", ";", "metaDataBuffer", ".", "putInt", "(", "...
Method adding services metadata @param monitorMetaDataBuffer - the metadata buffer
[ "Method", "adding", "services", "metadata" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L210-L220
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java
MonitorFileWriterImpl.getServiceNameOffset
private int getServiceNameOffset(final int servAreaOffset) { // if there are other services which have been written if (prevServiceOffset != 0) { return prevServiceOffset + prevServiceName.length() + BitUtil.SIZE_OF_INT + BitUtil.SIZE_OF_INT; } // else return servArea...
java
private int getServiceNameOffset(final int servAreaOffset) { // if there are other services which have been written if (prevServiceOffset != 0) { return prevServiceOffset + prevServiceName.length() + BitUtil.SIZE_OF_INT + BitUtil.SIZE_OF_INT; } // else return servArea...
[ "private", "int", "getServiceNameOffset", "(", "final", "int", "servAreaOffset", ")", "{", "// if there are other services which have been written", "if", "(", "prevServiceOffset", "!=", "0", ")", "{", "return", "prevServiceOffset", "+", "prevServiceName", ".", "length", ...
Method returning serviceNameOffset @param servAreaOffset @return
[ "Method", "returning", "serviceNameOffset" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L227-L234
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java
MonitorFileWriterImpl.initializeServiceRefMetadata
private void initializeServiceRefMetadata(int serviceLocationOffset, int serviceOffsetIndex) { metaDataBuffer.putInt(serviceLocationOffset, serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT); // service reference section metaDataBuffer.putInt(serviceRefSection + serviceOffsetIndex * ...
java
private void initializeServiceRefMetadata(int serviceLocationOffset, int serviceOffsetIndex) { metaDataBuffer.putInt(serviceLocationOffset, serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT); // service reference section metaDataBuffer.putInt(serviceRefSection + serviceOffsetIndex * ...
[ "private", "void", "initializeServiceRefMetadata", "(", "int", "serviceLocationOffset", ",", "int", "serviceOffsetIndex", ")", "{", "metaDataBuffer", ".", "putInt", "(", "serviceLocationOffset", ",", "serviceRefSection", "+", "serviceOffsetIndex", "*", "BitUtil", ".", "...
Method initializing service ref metadata section data @param serviceLocationOffset @param serviceOffsetIndex
[ "Method", "initializing", "service", "ref", "metadata", "section", "data" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L241-L251
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java
MonitorFileWriterImpl.setGatewayIdDependentOffsets
private void setGatewayIdDependentOffsets(String gatewayId) { gwCountersLblBuffersReferenceOffset = GW_ID_OFFSET + gatewayId.length() + BitUtil.SIZE_OF_INT; gwCountersLblBuffersLengthOffset = gwCountersLblBuffersReferenceOffset + BitUtil.SIZE_OF_INT; gwCountersValueBuffersReferenceOffset = gwCou...
java
private void setGatewayIdDependentOffsets(String gatewayId) { gwCountersLblBuffersReferenceOffset = GW_ID_OFFSET + gatewayId.length() + BitUtil.SIZE_OF_INT; gwCountersLblBuffersLengthOffset = gwCountersLblBuffersReferenceOffset + BitUtil.SIZE_OF_INT; gwCountersValueBuffersReferenceOffset = gwCou...
[ "private", "void", "setGatewayIdDependentOffsets", "(", "String", "gatewayId", ")", "{", "gwCountersLblBuffersReferenceOffset", "=", "GW_ID_OFFSET", "+", "gatewayId", ".", "length", "(", ")", "+", "BitUtil", ".", "SIZE_OF_INT", ";", "gwCountersLblBuffersLengthOffset", "...
Method setting gatewayId dependent offsets @param gatewayId
[ "Method", "setting", "gatewayId", "dependent", "offsets" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L257-L264
train
kaazing/gateway
server.api/src/main/java/org/kaazing/gateway/server/GatewayFactory.java
GatewayFactory.createGateway
public static Gateway createGateway() { Gateway gateway = null; for (GatewayCreator factory : loader) { gateway = factory.createGateway(gateway); factory.configureGateway(gateway); } if (gateway == null) { throw new RuntimeException("Failed to load Ga...
java
public static Gateway createGateway() { Gateway gateway = null; for (GatewayCreator factory : loader) { gateway = factory.createGateway(gateway); factory.configureGateway(gateway); } if (gateway == null) { throw new RuntimeException("Failed to load Ga...
[ "public", "static", "Gateway", "createGateway", "(", ")", "{", "Gateway", "gateway", "=", "null", ";", "for", "(", "GatewayCreator", "factory", ":", "loader", ")", "{", "gateway", "=", "factory", ".", "createGateway", "(", "gateway", ")", ";", "factory", "...
Creates an implementation of an Gateway. @return a Gateway
[ "Creates", "an", "implementation", "of", "an", "Gateway", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server.api/src/main/java/org/kaazing/gateway/server/GatewayFactory.java#L37-L49
train
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/filter/codec/ProtocolCodecFilter.java
ProtocolCodecFilter.messageReceived
@Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { LOGGER.debug("Processing a MESSAGE_RECEIVED for session {}", session.getId()); if (!(message instanceof IoBuffer)) { nextFilter.messageReceived(session, message...
java
@Override public void messageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception { LOGGER.debug("Processing a MESSAGE_RECEIVED for session {}", session.getId()); if (!(message instanceof IoBuffer)) { nextFilter.messageReceived(session, message...
[ "@", "Override", "public", "void", "messageReceived", "(", "NextFilter", "nextFilter", ",", "IoSession", "session", ",", "Object", "message", ")", "throws", "Exception", "{", "LOGGER", ".", "debug", "(", "\"Processing a MESSAGE_RECEIVED for session {}\"", ",", "sessio...
Process the incoming message, calling the session decoder. As the incoming buffer might contains more than one messages, we have to loop until the decoder throws an exception. while ( buffer not empty ) try decode ( buffer ) catch break;
[ "Process", "the", "incoming", "message", "calling", "the", "session", "decoder", ".", "As", "the", "incoming", "buffer", "might", "contains", "more", "than", "one", "messages", "we", "have", "to", "loop", "until", "the", "decoder", "throws", "an", "exception",...
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/filter/codec/ProtocolCodecFilter.java#L214-L286
train
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/filter/codec/ProtocolCodecFilter.java
ProtocolCodecFilter.initCodec
private void initCodec(IoSession session) throws Exception { // Creates the decoder and stores it into the newly created session ProtocolDecoder decoder = factory.getDecoder(session); session.setAttribute(DECODER, decoder); // Creates the encoder and stores it into the newly created ses...
java
private void initCodec(IoSession session) throws Exception { // Creates the decoder and stores it into the newly created session ProtocolDecoder decoder = factory.getDecoder(session); session.setAttribute(DECODER, decoder); // Creates the encoder and stores it into the newly created ses...
[ "private", "void", "initCodec", "(", "IoSession", "session", ")", "throws", "Exception", "{", "// Creates the decoder and stores it into the newly created session", "ProtocolDecoder", "decoder", "=", "factory", ".", "getDecoder", "(", "session", ")", ";", "session", ".", ...
Initialize the encoder and the decoder, storing them in the session attributes.
[ "Initialize", "the", "encoder", "and", "the", "decoder", "storing", "them", "in", "the", "session", "attributes", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/filter/codec/ProtocolCodecFilter.java#L440-L448
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java
LoggingUtils.log
public static void log(IoSession session, Throwable t) { Logger logger = getTransportLogger(session); log(session, logger, t); }
java
public static void log(IoSession session, Throwable t) { Logger logger = getTransportLogger(session); log(session, logger, t); }
[ "public", "static", "void", "log", "(", "IoSession", "session", ",", "Throwable", "t", ")", "{", "Logger", "logger", "=", "getTransportLogger", "(", "session", ")", ";", "log", "(", "session", ",", "logger", ",", "t", ")", ";", "}" ]
Logs an unexpected exception in the same way LoggingFilter would, using the transport logger for the transport of the given session.
[ "Logs", "an", "unexpected", "exception", "in", "the", "same", "way", "LoggingFilter", "would", "using", "the", "transport", "logger", "for", "the", "transport", "of", "the", "given", "session", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L82-L85
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java
LoggingUtils.log
public static void log(IoSession session, Logger logger, Throwable t) { log(session, logger, t.toString(), t); }
java
public static void log(IoSession session, Logger logger, Throwable t) { log(session, logger, t.toString(), t); }
[ "public", "static", "void", "log", "(", "IoSession", "session", ",", "Logger", "logger", ",", "Throwable", "t", ")", "{", "log", "(", "session", ",", "logger", ",", "t", ".", "toString", "(", ")", ",", "t", ")", ";", "}" ]
Logs an unexpected exception in the same way LoggingFilter would.
[ "Logs", "an", "unexpected", "exception", "in", "the", "same", "way", "LoggingFilter", "would", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L90-L92
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java
LoggingUtils.getUserIdentifier
static String getUserIdentifier(IoSession session) { boolean isAcceptor = isAcceptor(session); SocketAddress hostPortAddress = isAcceptor ? session.getRemoteAddress() : session.getLocalAddress(); SocketAddress identityAddress = isAcceptor ? session.getLocalAddress() : session.getRemoteAddress();...
java
static String getUserIdentifier(IoSession session) { boolean isAcceptor = isAcceptor(session); SocketAddress hostPortAddress = isAcceptor ? session.getRemoteAddress() : session.getLocalAddress(); SocketAddress identityAddress = isAcceptor ? session.getLocalAddress() : session.getRemoteAddress();...
[ "static", "String", "getUserIdentifier", "(", "IoSession", "session", ")", "{", "boolean", "isAcceptor", "=", "isAcceptor", "(", "session", ")", ";", "SocketAddress", "hostPortAddress", "=", "isAcceptor", "?", "session", ".", "getRemoteAddress", "(", ")", ":", "...
Get a suitable identification for the user. For now this just consists of the TCP endpoint. the HTTP-layer auth principal, etc. @param session @return
[ "Get", "a", "suitable", "identification", "for", "the", "user", ".", "For", "now", "this", "just", "consists", "of", "the", "TCP", "endpoint", ".", "the", "HTTP", "-", "layer", "auth", "principal", "etc", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L139-L146
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java
LoggingUtils.resolveIdentity
private static String resolveIdentity(SocketAddress address, IoSessionEx session) { if (address instanceof ResourceAddress) { Subject subject = session.getSubject(); if (subject == null) { subject = new Subject(); } return resolveIdentity((Resource...
java
private static String resolveIdentity(SocketAddress address, IoSessionEx session) { if (address instanceof ResourceAddress) { Subject subject = session.getSubject(); if (subject == null) { subject = new Subject(); } return resolveIdentity((Resource...
[ "private", "static", "String", "resolveIdentity", "(", "SocketAddress", "address", ",", "IoSessionEx", "session", ")", "{", "if", "(", "address", "instanceof", "ResourceAddress", ")", "{", "Subject", "subject", "=", "session", ".", "getSubject", "(", ")", ";", ...
Method performing identity resolution - attempts to extract a subject from the current IoSessionEx session @param address @param session @return
[ "Method", "performing", "identity", "resolution", "-", "attempts", "to", "extract", "a", "subject", "from", "the", "current", "IoSessionEx", "session" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L160-L169
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java
LoggingUtils.resolveIdentity
private static String resolveIdentity(ResourceAddress address, Subject subject) { IdentityResolver resolver = address.getOption(IDENTITY_RESOLVER); ResourceAddress transport = address.getTransport(); if (resolver != null) { return resolver.resolve(subject); } if (tran...
java
private static String resolveIdentity(ResourceAddress address, Subject subject) { IdentityResolver resolver = address.getOption(IDENTITY_RESOLVER); ResourceAddress transport = address.getTransport(); if (resolver != null) { return resolver.resolve(subject); } if (tran...
[ "private", "static", "String", "resolveIdentity", "(", "ResourceAddress", "address", ",", "Subject", "subject", ")", "{", "IdentityResolver", "resolver", "=", "address", ".", "getOption", "(", "IDENTITY_RESOLVER", ")", ";", "ResourceAddress", "transport", "=", "addr...
Method attempting to perform identity resolution based on the provided subject parameter and transport It is attempted to perform the resolution from the highest to the lowest layer, recursively. @param address @param subject @return
[ "Method", "attempting", "to", "perform", "identity", "resolution", "based", "on", "the", "provided", "subject", "parameter", "and", "transport", "It", "is", "attempted", "to", "perform", "the", "resolution", "from", "the", "highest", "to", "the", "lowest", "laye...
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L178-L188
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java
LoggingUtils.getHostPort
private static String getHostPort(SocketAddress address) { if (address instanceof ResourceAddress) { ResourceAddress lowest = getLowestTransportLayer((ResourceAddress)address); return format(HOST_PORT_FORMAT, lowest.getResource().getHost(), lowest.getResource().getPort()); } ...
java
private static String getHostPort(SocketAddress address) { if (address instanceof ResourceAddress) { ResourceAddress lowest = getLowestTransportLayer((ResourceAddress)address); return format(HOST_PORT_FORMAT, lowest.getResource().getHost(), lowest.getResource().getPort()); } ...
[ "private", "static", "String", "getHostPort", "(", "SocketAddress", "address", ")", "{", "if", "(", "address", "instanceof", "ResourceAddress", ")", "{", "ResourceAddress", "lowest", "=", "getLowestTransportLayer", "(", "(", "ResourceAddress", ")", "address", ")", ...
Method attempting to retrieve host port identifier @param address @return
[ "Method", "attempting", "to", "retrieve", "host", "port", "identifier" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L195-L207
train
kaazing/gateway
transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java
LoggingUtils.getLowestTransportLayer
static ResourceAddress getLowestTransportLayer(ResourceAddress transport) { if (transport.getTransport() != null) { return getLowestTransportLayer(transport.getTransport()); } return transport; }
java
static ResourceAddress getLowestTransportLayer(ResourceAddress transport) { if (transport.getTransport() != null) { return getLowestTransportLayer(transport.getTransport()); } return transport; }
[ "static", "ResourceAddress", "getLowestTransportLayer", "(", "ResourceAddress", "transport", ")", "{", "if", "(", "transport", ".", "getTransport", "(", ")", "!=", "null", ")", "{", "return", "getLowestTransportLayer", "(", "transport", ".", "getTransport", "(", "...
Method returning lowest transport layer @param transport @return
[ "Method", "returning", "lowest", "transport", "layer" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/spi/src/main/java/org/kaazing/gateway/transport/LoggingUtils.java#L214-L219
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/jmx/JmxManagementService.java
JmxManagementService.handleNotification
@Override public void handleNotification(Notification notification, Object handback) { String notificationType = notification.getType(); if (notificationType.equals(JMXConnectionNotification.OPENED)) { managementContext.incrementManagementSessionCount(); } else if (notificationTy...
java
@Override public void handleNotification(Notification notification, Object handback) { String notificationType = notification.getType(); if (notificationType.equals(JMXConnectionNotification.OPENED)) { managementContext.incrementManagementSessionCount(); } else if (notificationTy...
[ "@", "Override", "public", "void", "handleNotification", "(", "Notification", "notification", ",", "Object", "handback", ")", "{", "String", "notificationType", "=", "notification", ".", "getType", "(", ")", ";", "if", "(", "notificationType", ".", "equals", "("...
NotificationListener support for connection open and closed notifications
[ "NotificationListener", "support", "for", "connection", "open", "and", "closed", "notifications" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/jmx/JmxManagementService.java#L230-L238
train
kaazing/gateway
transport/http/src/main/java/org/kaazing/gateway/transport/http/security/auth/challenge/DispatchHttpChallengeFactory.java
DispatchHttpChallengeFactory.lookup
public HttpChallengeFactory lookup(String authScheme) { HttpChallengeFactory result; if (authScheme == null) return null; result = challengeFactoriesByAuthScheme.get(authScheme); if (result == null) { if (authScheme.startsWith(AUTH_SCHEME_APPLICATION_PREFIX)) { ...
java
public HttpChallengeFactory lookup(String authScheme) { HttpChallengeFactory result; if (authScheme == null) return null; result = challengeFactoriesByAuthScheme.get(authScheme); if (result == null) { if (authScheme.startsWith(AUTH_SCHEME_APPLICATION_PREFIX)) { ...
[ "public", "HttpChallengeFactory", "lookup", "(", "String", "authScheme", ")", "{", "HttpChallengeFactory", "result", ";", "if", "(", "authScheme", "==", "null", ")", "return", "null", ";", "result", "=", "challengeFactoriesByAuthScheme", ".", "get", "(", "authSche...
public until unit test is moved
[ "public", "until", "unit", "test", "is", "moved" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/security/auth/challenge/DispatchHttpChallengeFactory.java#L73-L88
train
kaazing/gateway
service/amqp/src/main/java/org/kaazing/gateway/service/amqp/amqp091/codec/AmqpMessageEncoder.java
AmqpMessageEncoder.putUnsignedLong
private static ByteBuffer putUnsignedLong(ByteBuffer buffer, long v) { buffer.putInt(0); return putUnsignedInt(buffer, (int)v); }
java
private static ByteBuffer putUnsignedLong(ByteBuffer buffer, long v) { buffer.putInt(0); return putUnsignedInt(buffer, (int)v); }
[ "private", "static", "ByteBuffer", "putUnsignedLong", "(", "ByteBuffer", "buffer", ",", "long", "v", ")", "{", "buffer", ".", "putInt", "(", "0", ")", ";", "return", "putUnsignedInt", "(", "buffer", ",", "(", "int", ")", "v", ")", ";", "}" ]
Puts an unsigned long.
[ "Puts", "an", "unsigned", "long", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/amqp/src/main/java/org/kaazing/gateway/service/amqp/amqp091/codec/AmqpMessageEncoder.java#L1005-L1008
train
kaazing/gateway
service/proxy/src/main/java/org/kaazing/gateway/service/proxy/AbstractProxyHandler.java
AbstractProxyHandler.flushQueuedMessages
protected void flushQueuedMessages(IoSession session, AttachedSessionManager attachedSessionManager) { Queue<Object> messageQueue = getMessageQueue(session); if (messageQueue != null) { flushQueuedMessages(messageQueue, session, attachedSessionManager); // Note: leave messageQueu...
java
protected void flushQueuedMessages(IoSession session, AttachedSessionManager attachedSessionManager) { Queue<Object> messageQueue = getMessageQueue(session); if (messageQueue != null) { flushQueuedMessages(messageQueue, session, attachedSessionManager); // Note: leave messageQueu...
[ "protected", "void", "flushQueuedMessages", "(", "IoSession", "session", ",", "AttachedSessionManager", "attachedSessionManager", ")", "{", "Queue", "<", "Object", ">", "messageQueue", "=", "getMessageQueue", "(", "session", ")", ";", "if", "(", "messageQueue", "!="...
called by connect listener in proxy service handler
[ "called", "by", "connect", "listener", "in", "proxy", "service", "handler" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/proxy/src/main/java/org/kaazing/gateway/service/proxy/AbstractProxyHandler.java#L189-L196
train
kaazing/gateway
mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioChildDatagramChannel.java
NioChildDatagramChannel.joinGroup
public ChannelFuture joinGroup( InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source) { if (DetectionUtil.javaVersion() < 7) { throw new UnsupportedOperationException(); } if (multicastAddress == null) { throw new NullPointerExc...
java
public ChannelFuture joinGroup( InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source) { if (DetectionUtil.javaVersion() < 7) { throw new UnsupportedOperationException(); } if (multicastAddress == null) { throw new NullPointerExc...
[ "public", "ChannelFuture", "joinGroup", "(", "InetAddress", "multicastAddress", ",", "NetworkInterface", "networkInterface", ",", "InetAddress", "source", ")", "{", "if", "(", "DetectionUtil", ".", "javaVersion", "(", ")", "<", "7", ")", "{", "throw", "new", "Un...
Joins the specified multicast group at the specified interface using the specified source.
[ "Joins", "the", "specified", "multicast", "group", "at", "the", "specified", "interface", "using", "the", "specified", "source", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioChildDatagramChannel.java#L152-L189
train
kaazing/gateway
mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioChildDatagramChannel.java
NioChildDatagramChannel.leaveGroup
public ChannelFuture leaveGroup(InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source) { if (DetectionUtil.javaVersion() < 7) { throw new UnsupportedOperationException(); } else { if (multicastAddress == null) { ...
java
public ChannelFuture leaveGroup(InetAddress multicastAddress, NetworkInterface networkInterface, InetAddress source) { if (DetectionUtil.javaVersion() < 7) { throw new UnsupportedOperationException(); } else { if (multicastAddress == null) { ...
[ "public", "ChannelFuture", "leaveGroup", "(", "InetAddress", "multicastAddress", ",", "NetworkInterface", "networkInterface", ",", "InetAddress", "source", ")", "{", "if", "(", "DetectionUtil", ".", "javaVersion", "(", ")", "<", "7", ")", "{", "throw", "new", "U...
Leave the specified multicast group at the specified interface using the specified source.
[ "Leave", "the", "specified", "multicast", "group", "at", "the", "specified", "interface", "using", "the", "specified", "source", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioChildDatagramChannel.java#L208-L245
train
kaazing/gateway
mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioChildDatagramChannel.java
NioChildDatagramChannel.block
public ChannelFuture block(InetAddress multicastAddress, InetAddress sourceToBlock) { try { block(multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), sourceToBlock); } catch (SocketException e) { return failedFuture(this, e); } ret...
java
public ChannelFuture block(InetAddress multicastAddress, InetAddress sourceToBlock) { try { block(multicastAddress, NetworkInterface.getByInetAddress(getLocalAddress().getAddress()), sourceToBlock); } catch (SocketException e) { return failedFuture(this, e); } ret...
[ "public", "ChannelFuture", "block", "(", "InetAddress", "multicastAddress", ",", "InetAddress", "sourceToBlock", ")", "{", "try", "{", "block", "(", "multicastAddress", ",", "NetworkInterface", ".", "getByInetAddress", "(", "getLocalAddress", "(", ")", ".", "getAddr...
Block the given sourceToBlock address for the given multicastAddress
[ "Block", "the", "given", "sourceToBlock", "address", "for", "the", "given", "multicastAddress" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioChildDatagramChannel.java#L288-L295
train
kaazing/gateway
management/src/main/java/org/kaazing/gateway/management/config/SecurityConfigurationBeanImpl.java
SecurityConfigurationBeanImpl.getAlternativeNames
private JSONArray getAlternativeNames(Collection<List<?>> alternativeNames) { if (alternativeNames == null || alternativeNames.size() == 0) { return null; } JSONArray altNames = new JSONArray(); for (List<?> altName : alternativeNames) { //int altNameType = (Int...
java
private JSONArray getAlternativeNames(Collection<List<?>> alternativeNames) { if (alternativeNames == null || alternativeNames.size() == 0) { return null; } JSONArray altNames = new JSONArray(); for (List<?> altName : alternativeNames) { //int altNameType = (Int...
[ "private", "JSONArray", "getAlternativeNames", "(", "Collection", "<", "List", "<", "?", ">", ">", "alternativeNames", ")", "{", "if", "(", "alternativeNames", "==", "null", "||", "alternativeNames", ".", "size", "(", ")", "==", "0", ")", "{", "return", "n...
Given an AlternativeNames structure, return a JSONArray with the name strings. @param alternativeNames @return
[ "Given", "an", "AlternativeNames", "structure", "return", "a", "JSONArray", "with", "the", "name", "strings", "." ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/config/SecurityConfigurationBeanImpl.java#L179-L194
train
kaazing/gateway
transport/ws/src/main/java/org/kaazing/gateway/transport/ws/AbstractWsBridgeSession.java
AbstractWsBridgeSession.startupSessionTimeoutCommand
public void startupSessionTimeoutCommand() { if (initSessionTimeoutCommand.compareAndSet(false, true)) { final Long sessionTimeout = getSessionTimeout(); if ( sessionTimeout != null && sessionTimeout > 0) { if ( scheduledEventslogger.isTraceEnabled() ) { ...
java
public void startupSessionTimeoutCommand() { if (initSessionTimeoutCommand.compareAndSet(false, true)) { final Long sessionTimeout = getSessionTimeout(); if ( sessionTimeout != null && sessionTimeout > 0) { if ( scheduledEventslogger.isTraceEnabled() ) { ...
[ "public", "void", "startupSessionTimeoutCommand", "(", ")", "{", "if", "(", "initSessionTimeoutCommand", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "final", "Long", "sessionTimeout", "=", "getSessionTimeout", "(", ")", ";", "if", "(", "ses...
Start up timer for the session timeout of the WebSocket session
[ "Start", "up", "timer", "for", "the", "session", "timeout", "of", "the", "WebSocket", "session" ]
06017b19273109b3b992e528e702586446168d57
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/AbstractWsBridgeSession.java#L143-L153
train