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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.setMenuTextAppearance | public void setMenuTextAppearance(int appearanceResource) {
mLeftText.setTextAppearance(getContext(), appearanceResource);
mMidText.setTextAppearance(getContext(), appearanceResource);
mRightText.setTextAppearance(getContext(), appearanceResource);
} | java | public void setMenuTextAppearance(int appearanceResource) {
mLeftText.setTextAppearance(getContext(), appearanceResource);
mMidText.setTextAppearance(getContext(), appearanceResource);
mRightText.setTextAppearance(getContext(), appearanceResource);
} | [
"public",
"void",
"setMenuTextAppearance",
"(",
"int",
"appearanceResource",
")",
"{",
"mLeftText",
".",
"setTextAppearance",
"(",
"getContext",
"(",
")",
",",
"appearanceResource",
")",
";",
"mMidText",
".",
"setTextAppearance",
"(",
"getContext",
"(",
")",
",",
... | Set text appearance for button text views
@param appearanceResource | [
"Set",
"text",
"appearance",
"for",
"button",
"text",
"views"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L174-L178 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.setMenuButtonImage | public void setMenuButtonImage(MenuButton button, Drawable drawable) {
switch (button) {
case MID:
mMidBtn.setImageDrawable(drawable);
break;
case LEFT:
mLeftBtn.setImageDrawable(drawable);
break;
case RIGHT:
... | java | public void setMenuButtonImage(MenuButton button, Drawable drawable) {
switch (button) {
case MID:
mMidBtn.setImageDrawable(drawable);
break;
case LEFT:
mLeftBtn.setImageDrawable(drawable);
break;
case RIGHT:
... | [
"public",
"void",
"setMenuButtonImage",
"(",
"MenuButton",
"button",
",",
"Drawable",
"drawable",
")",
"{",
"switch",
"(",
"button",
")",
"{",
"case",
"MID",
":",
"mMidBtn",
".",
"setImageDrawable",
"(",
"drawable",
")",
";",
"break",
";",
"case",
"LEFT",
... | Set image drawable for a menu button
@param button
@param drawable | [
"Set",
"image",
"drawable",
"for",
"a",
"menu",
"button"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L196-L208 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.setMenuButtonText | public void setMenuButtonText(MenuButton button, String text) {
switch (button) {
case MID:
mMidText.setText(text);
break;
case LEFT:
mLeftText.setText(text);
break;
case RIGHT:
mRightText.setText... | java | public void setMenuButtonText(MenuButton button, String text) {
switch (button) {
case MID:
mMidText.setText(text);
break;
case LEFT:
mLeftText.setText(text);
break;
case RIGHT:
mRightText.setText... | [
"public",
"void",
"setMenuButtonText",
"(",
"MenuButton",
"button",
",",
"String",
"text",
")",
"{",
"switch",
"(",
"button",
")",
"{",
"case",
"MID",
":",
"mMidText",
".",
"setText",
"(",
"text",
")",
";",
"break",
";",
"case",
"LEFT",
":",
"mLeftText",... | Set text displayed under a menu button
@param button
@param text | [
"Set",
"text",
"displayed",
"under",
"a",
"menu",
"button"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L226-L238 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.inflate | private void inflate() {
((LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.ebm__menu, this, true);
mOverlay = findViewById(R.id.ebm__menu_overlay);
mMidContainer = findViewById(R.id.ebm__menu_middle_container);
mLeftContainer = findViewB... | java | private void inflate() {
((LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.ebm__menu, this, true);
mOverlay = findViewById(R.id.ebm__menu_overlay);
mMidContainer = findViewById(R.id.ebm__menu_middle_container);
mLeftContainer = findViewB... | [
"private",
"void",
"inflate",
"(",
")",
"{",
"(",
"(",
"LayoutInflater",
")",
"getContext",
"(",
")",
".",
"getSystemService",
"(",
"Context",
".",
"LAYOUT_INFLATER_SERVICE",
")",
")",
".",
"inflate",
"(",
"R",
".",
"layout",
".",
"ebm__menu",
",",
"this",... | Inflates the view | [
"Inflates",
"the",
"view"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L307-L337 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.parseAttributes | private void parseAttributes(AttributeSet attrs) {
if (attrs != null) {
TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.ExpandableMenuOverlay, 0, 0);
try {
// button metrics
mainButtonSize = a.getFloat(R.styleable.Expandabl... | java | private void parseAttributes(AttributeSet attrs) {
if (attrs != null) {
TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.ExpandableMenuOverlay, 0, 0);
try {
// button metrics
mainButtonSize = a.getFloat(R.styleable.Expandabl... | [
"private",
"void",
"parseAttributes",
"(",
"AttributeSet",
"attrs",
")",
"{",
"if",
"(",
"attrs",
"!=",
"null",
")",
"{",
"TypedArray",
"a",
"=",
"getContext",
"(",
")",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttributes",
"(",
"attrs",
",",
"R",
".... | Parses custom XML attributes
@param attrs | [
"Parses",
"custom",
"XML",
"attributes"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L344-L370 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.setViewLayoutParams | private void setViewLayoutParams() {
// Some extra margin to center other buttons in the center of the main button
final int EXTRA_MARGIN = (int) (sWidth * (mainButtonSize - otherButtonSize) / 2);
Log.d(TAG, "otherButton: " + otherButtonSize);
Log.d(TAG, "mainButton: " + mainButtonSize... | java | private void setViewLayoutParams() {
// Some extra margin to center other buttons in the center of the main button
final int EXTRA_MARGIN = (int) (sWidth * (mainButtonSize - otherButtonSize) / 2);
Log.d(TAG, "otherButton: " + otherButtonSize);
Log.d(TAG, "mainButton: " + mainButtonSize... | [
"private",
"void",
"setViewLayoutParams",
"(",
")",
"{",
"// Some extra margin to center other buttons in the center of the main button",
"final",
"int",
"EXTRA_MARGIN",
"=",
"(",
"int",
")",
"(",
"sWidth",
"*",
"(",
"mainButtonSize",
"-",
"otherButtonSize",
")",
"/",
"... | Initialized the layout of menu buttons. Sets button sizes and distances between them
by a % of screen width or height accordingly.
Some extra padding between buttons is added by default to avoid intersections. | [
"Initialized",
"the",
"layout",
"of",
"menu",
"buttons",
".",
"Sets",
"button",
"sizes",
"and",
"distances",
"between",
"them",
"by",
"a",
"%",
"of",
"screen",
"width",
"or",
"height",
"accordingly",
".",
"Some",
"extra",
"padding",
"between",
"buttons",
"is... | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L377-L408 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.calculateAnimationProportions | private void calculateAnimationProportions() {
TRANSLATION_Y = sHeight * buttonDistanceY;
TRANSLATION_X = sWidth * buttonDistanceX;
anticipation = new AnticipateInterpolator(INTERPOLATOR_WEIGHT);
overshoot = new OvershootInterpolator(INTERPOLATOR_WEIGHT);
} | java | private void calculateAnimationProportions() {
TRANSLATION_Y = sHeight * buttonDistanceY;
TRANSLATION_X = sWidth * buttonDistanceX;
anticipation = new AnticipateInterpolator(INTERPOLATOR_WEIGHT);
overshoot = new OvershootInterpolator(INTERPOLATOR_WEIGHT);
} | [
"private",
"void",
"calculateAnimationProportions",
"(",
")",
"{",
"TRANSLATION_Y",
"=",
"sHeight",
"*",
"buttonDistanceY",
";",
"TRANSLATION_X",
"=",
"sWidth",
"*",
"buttonDistanceX",
";",
"anticipation",
"=",
"new",
"AnticipateInterpolator",
"(",
"INTERPOLATOR_WEIGHT"... | Initialized animation properties | [
"Initialized",
"animation",
"properties"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L446-L452 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.animateExpand | private void animateExpand() {
mCloseBtn.setVisibility(View.VISIBLE);
mMidContainer.setVisibility(View.VISIBLE);
mRightContainer.setVisibility(View.VISIBLE);
mLeftContainer.setVisibility(View.VISIBLE);
setButtonsVisibleForPreHC();
ANIMATION_COUNTER = 0;
ViewPro... | java | private void animateExpand() {
mCloseBtn.setVisibility(View.VISIBLE);
mMidContainer.setVisibility(View.VISIBLE);
mRightContainer.setVisibility(View.VISIBLE);
mLeftContainer.setVisibility(View.VISIBLE);
setButtonsVisibleForPreHC();
ANIMATION_COUNTER = 0;
ViewPro... | [
"private",
"void",
"animateExpand",
"(",
")",
"{",
"mCloseBtn",
".",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"mMidContainer",
".",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"mRightContainer",
".",
"setVisibility",
"(",
"View",
"... | Start expand animation | [
"Start",
"expand",
"animation"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L457-L470 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.animateCollapse | private void animateCollapse() {
mCloseBtn.setVisibility(View.VISIBLE);
ANIMATION_COUNTER = 0;
ViewPropertyAnimator.animate(mMidContainer).setDuration(ANIMATION_DURATION).translationYBy(TRANSLATION_Y).setInterpolator(anticipation).setListener(ON_EXPAND_COLLAPSE_LISTENER);
ViewPropertyA... | java | private void animateCollapse() {
mCloseBtn.setVisibility(View.VISIBLE);
ANIMATION_COUNTER = 0;
ViewPropertyAnimator.animate(mMidContainer).setDuration(ANIMATION_DURATION).translationYBy(TRANSLATION_Y).setInterpolator(anticipation).setListener(ON_EXPAND_COLLAPSE_LISTENER);
ViewPropertyA... | [
"private",
"void",
"animateCollapse",
"(",
")",
"{",
"mCloseBtn",
".",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"ANIMATION_COUNTER",
"=",
"0",
";",
"ViewPropertyAnimator",
".",
"animate",
"(",
"mMidContainer",
")",
".",
"setDuration",
"(",
"ANIM... | Start collapse animation | [
"Start",
"collapse",
"animation"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L475-L484 | train |
lemonlabs/ExpandableButtonMenu | library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java | ExpandableButtonMenu.setButtonsVisibleForPreHC | private void setButtonsVisibleForPreHC() {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
ViewHelper.setAlpha(mMidContainer, 1.0f);
ViewHelper.setAlpha(mLeftContainer, 1.0f);
ViewHelper.setAlpha(mRightContainer, 1.0f);
}
} | java | private void setButtonsVisibleForPreHC() {
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
ViewHelper.setAlpha(mMidContainer, 1.0f);
ViewHelper.setAlpha(mLeftContainer, 1.0f);
ViewHelper.setAlpha(mRightContainer, 1.0f);
}
} | [
"private",
"void",
"setButtonsVisibleForPreHC",
"(",
")",
"{",
"if",
"(",
"android",
".",
"os",
".",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"{",
"ViewHelper",
".",
"setAlpha",
"(",
"mMidContainer",... | Hide views for pre-Honeycomb devices | [
"Hide",
"views",
"for",
"pre",
"-",
"Honeycomb",
"devices"
] | 2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d | https://github.com/lemonlabs/ExpandableButtonMenu/blob/2284593fc76b9bf7cc6b4aec311f24ee2bbbaa9d/library/src/main/java/lt/lemonlabs/android/expandablebuttonmenu/ExpandableButtonMenu.java#L545-L551 | train |
kaazing/gateway | service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java | HttpProxyServiceHandler.validateNoLoopDetected | private boolean validateNoLoopDetected(DefaultHttpSession acceptSession) {
List<String> viaHeaders = acceptSession.getReadHeaders(HEADER_VIA);
if (viaHeaders != null && viaHeaders.stream().anyMatch(h -> h.equals(viaHeader))) {
LOGGER.warn("Connection to " + getConnectURIs().iterator().ne... | java | private boolean validateNoLoopDetected(DefaultHttpSession acceptSession) {
List<String> viaHeaders = acceptSession.getReadHeaders(HEADER_VIA);
if (viaHeaders != null && viaHeaders.stream().anyMatch(h -> h.equals(viaHeader))) {
LOGGER.warn("Connection to " + getConnectURIs().iterator().ne... | [
"private",
"boolean",
"validateNoLoopDetected",
"(",
"DefaultHttpSession",
"acceptSession",
")",
"{",
"List",
"<",
"String",
">",
"viaHeaders",
"=",
"acceptSession",
".",
"getReadHeaders",
"(",
"HEADER_VIA",
")",
";",
"if",
"(",
"viaHeaders",
"!=",
"null",
"&&",
... | Helper method performing loop detection
@param acceptSession - session parameter
@return - whether a loop was detected or not | [
"Helper",
"method",
"performing",
"loop",
"detection"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java#L252-L262 | train |
kaazing/gateway | service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java | HttpProxyServiceHandler.setupForwardedHeaders | private void setupForwardedHeaders(HttpAcceptSession acceptSession, HttpConnectSession connectSession) {
if (FORWARDED_EXCLUDE.equalsIgnoreCase(useForwarded)) {
excludeForwardedHeaders(connectSession);
return;
}
if (FORWARDED_INJECT.equalsIgnoreCase(useForwarded)) {
... | java | private void setupForwardedHeaders(HttpAcceptSession acceptSession, HttpConnectSession connectSession) {
if (FORWARDED_EXCLUDE.equalsIgnoreCase(useForwarded)) {
excludeForwardedHeaders(connectSession);
return;
}
if (FORWARDED_INJECT.equalsIgnoreCase(useForwarded)) {
... | [
"private",
"void",
"setupForwardedHeaders",
"(",
"HttpAcceptSession",
"acceptSession",
",",
"HttpConnectSession",
"connectSession",
")",
"{",
"if",
"(",
"FORWARDED_EXCLUDE",
".",
"equalsIgnoreCase",
"(",
"useForwarded",
")",
")",
"{",
"excludeForwardedHeaders",
"(",
"co... | Compose the Forwarded header and the X-Forwarded headers and add them to the connect session write headers.
@param acceptSession
@param connectSession
@param forwardedProperty the value of the 'use-forwarded' property used for http.proxy type in gateway-config:
inject (add the corresponding data to the Forwarded/X-For... | [
"Compose",
"the",
"Forwarded",
"header",
"and",
"the",
"X",
"-",
"Forwarded",
"headers",
"and",
"add",
"them",
"to",
"the",
"connect",
"session",
"write",
"headers",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java#L500-L529 | train |
kaazing/gateway | service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java | HttpProxyServiceHandler.excludeForwardedHeaders | private static void excludeForwardedHeaders(HttpConnectSession connectSession) {
connectSession.clearWriteHeaders(HEADER_FORWARDED);
connectSession.clearWriteHeaders(HEADER_X_FORWARDED_FOR);
connectSession.clearWriteHeaders(HEADER_X_FORWARDED_SERVER);
connectSession.clearWriteHeaders(HEA... | java | private static void excludeForwardedHeaders(HttpConnectSession connectSession) {
connectSession.clearWriteHeaders(HEADER_FORWARDED);
connectSession.clearWriteHeaders(HEADER_X_FORWARDED_FOR);
connectSession.clearWriteHeaders(HEADER_X_FORWARDED_SERVER);
connectSession.clearWriteHeaders(HEA... | [
"private",
"static",
"void",
"excludeForwardedHeaders",
"(",
"HttpConnectSession",
"connectSession",
")",
"{",
"connectSession",
".",
"clearWriteHeaders",
"(",
"HEADER_FORWARDED",
")",
";",
"connectSession",
".",
"clearWriteHeaders",
"(",
"HEADER_X_FORWARDED_FOR",
")",
";... | Remove the Forwarded headers from the connect session if the 'use-forwarded' property for the http.proxy type is
set to 'exclude'.
@param connectSession | [
"Remove",
"the",
"Forwarded",
"headers",
"from",
"the",
"connect",
"session",
"if",
"the",
"use",
"-",
"forwarded",
"property",
"for",
"the",
"http",
".",
"proxy",
"type",
"is",
"set",
"to",
"exclude",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java#L537-L543 | train |
kaazing/gateway | service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java | HttpProxyServiceHandler.getResourceIpAddress | private static String getResourceIpAddress(HttpAcceptSession acceptSession, String parameterName) {
String resourceIpAddress = null;
ResourceAddress resourceAddress = null;
switch (parameterName) {
case FORWARDED_FOR:
resourceAddress = acceptSession.getRemoteAddress();
... | java | private static String getResourceIpAddress(HttpAcceptSession acceptSession, String parameterName) {
String resourceIpAddress = null;
ResourceAddress resourceAddress = null;
switch (parameterName) {
case FORWARDED_FOR:
resourceAddress = acceptSession.getRemoteAddress();
... | [
"private",
"static",
"String",
"getResourceIpAddress",
"(",
"HttpAcceptSession",
"acceptSession",
",",
"String",
"parameterName",
")",
"{",
"String",
"resourceIpAddress",
"=",
"null",
";",
"ResourceAddress",
"resourceAddress",
"=",
"null",
";",
"switch",
"(",
"paramet... | Get the IP address of the resource based on the parameter name
@param acceptSession
@param parameterName can be either 'for' (the IP address of the client/server making the request to this
service), or 'by' (the IP address of this proxy)
@return the IP address based on the parameter name received | [
"Get",
"the",
"IP",
"address",
"of",
"the",
"resource",
"based",
"on",
"the",
"parameter",
"name"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.proxy/src/main/java/org/kaazing/gateway/service/http/proxy/HttpProxyServiceHandler.java#L553-L571 | train |
kaazing/gateway | mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioServerDatagramChannelFactory.java | NioServerDatagramChannelFactory.newChildChannel | public NioChildDatagramChannel newChildChannel(Channel parent, final ChannelPipeline pipeline) {
return new NioChildDatagramChannel(parent, this, pipeline, childSink, workerPool.nextWorker(), family);
} | java | public NioChildDatagramChannel newChildChannel(Channel parent, final ChannelPipeline pipeline) {
return new NioChildDatagramChannel(parent, this, pipeline, childSink, workerPool.nextWorker(), family);
} | [
"public",
"NioChildDatagramChannel",
"newChildChannel",
"(",
"Channel",
"parent",
",",
"final",
"ChannelPipeline",
"pipeline",
")",
"{",
"return",
"new",
"NioChildDatagramChannel",
"(",
"parent",
",",
"this",
",",
"pipeline",
",",
"childSink",
",",
"workerPool",
"."... | mina.netty change - adding this to create child datagram channels | [
"mina",
".",
"netty",
"change",
"-",
"adding",
"this",
"to",
"create",
"child",
"datagram",
"channels"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/NioServerDatagramChannelFactory.java#L91-L93 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/filter/codec/ProtocolDecoderException.java | ProtocolDecoderException.getMessage | @Override
public String getMessage() {
String message = super.getMessage();
if (message == null) {
message = "";
}
if (hexdump != null) {
return message + (message.length() > 0 ? " " : "") + "(Hexdump: "
+ hexdump + ')';
}
... | java | @Override
public String getMessage() {
String message = super.getMessage();
if (message == null) {
message = "";
}
if (hexdump != null) {
return message + (message.length() > 0 ? " " : "") + "(Hexdump: "
+ hexdump + ')';
}
... | [
"@",
"Override",
"public",
"String",
"getMessage",
"(",
")",
"{",
"String",
"message",
"=",
"super",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"message",
"==",
"null",
")",
"{",
"message",
"=",
"\"\"",
";",
"}",
"if",
"(",
"hexdump",
"!=",
"null",... | Returns the message and the hexdump of the unknown part. | [
"Returns",
"the",
"message",
"and",
"the",
"hexdump",
"of",
"the",
"unknown",
"part",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/codec/ProtocolDecoderException.java#L64-L78 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/session/SessionManagementBeanImpl.java | SessionManagementBeanImpl.setUserPrincipals | @Override
public void setUserPrincipals(Map<String, String> userPrincipals) {
this.userPrincipals = userPrincipals;
this.serviceManagementBean.addUserPrincipals(session, userPrincipals);
} | java | @Override
public void setUserPrincipals(Map<String, String> userPrincipals) {
this.userPrincipals = userPrincipals;
this.serviceManagementBean.addUserPrincipals(session, userPrincipals);
} | [
"@",
"Override",
"public",
"void",
"setUserPrincipals",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"userPrincipals",
")",
"{",
"this",
".",
"userPrincipals",
"=",
"userPrincipals",
";",
"this",
".",
"serviceManagementBean",
".",
"addUserPrincipals",
"(",
"se... | The following is intended to run ON the IO thread | [
"The",
"following",
"is",
"intended",
"to",
"run",
"ON",
"the",
"IO",
"thread"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/session/SessionManagementBeanImpl.java#L92-L96 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/session/SessionManagementBeanImpl.java | SessionManagementBeanImpl.getUserPrincipals | @Override
public String getUserPrincipals() {
if (userPrincipals == null) {
return null;
}
JSONObject jsonObj = new JSONObject(userPrincipals);
return jsonObj.toString();
} | java | @Override
public String getUserPrincipals() {
if (userPrincipals == null) {
return null;
}
JSONObject jsonObj = new JSONObject(userPrincipals);
return jsonObj.toString();
} | [
"@",
"Override",
"public",
"String",
"getUserPrincipals",
"(",
")",
"{",
"if",
"(",
"userPrincipals",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"JSONObject",
"jsonObj",
"=",
"new",
"JSONObject",
"(",
"userPrincipals",
")",
";",
"return",
"jsonObj",... | In contrast to getPrincipals, this is for sending a JSON value back. | [
"In",
"contrast",
"to",
"getPrincipals",
"this",
"is",
"for",
"sending",
"a",
"JSON",
"value",
"back",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/session/SessionManagementBeanImpl.java#L146-L155 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.getLMResponse | public static byte[] getLMResponse(String password, byte[] challenge)
throws Exception {
byte[] lmHash = lmHash(password);
return lmResponse(lmHash, challenge);
} | java | public static byte[] getLMResponse(String password, byte[] challenge)
throws Exception {
byte[] lmHash = lmHash(password);
return lmResponse(lmHash, challenge);
} | [
"public",
"static",
"byte",
"[",
"]",
"getLMResponse",
"(",
"String",
"password",
",",
"byte",
"[",
"]",
"challenge",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"lmHash",
"=",
"lmHash",
"(",
"password",
")",
";",
"return",
"lmResponse",
"(",
"lmH... | Calculates the LM Response for the given challenge, using the specified
password.
@param password The user's password.
@param challenge The Type 2 challenge from the server.
@return The LM Response. | [
"Calculates",
"the",
"LM",
"Response",
"for",
"the",
"given",
"challenge",
"using",
"the",
"specified",
"password",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L61-L65 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.getNTLMResponse | public static byte[] getNTLMResponse(String password, byte[] challenge)
throws Exception {
byte[] ntlmHash = ntlmHash(password);
return lmResponse(ntlmHash, challenge);
} | java | public static byte[] getNTLMResponse(String password, byte[] challenge)
throws Exception {
byte[] ntlmHash = ntlmHash(password);
return lmResponse(ntlmHash, challenge);
} | [
"public",
"static",
"byte",
"[",
"]",
"getNTLMResponse",
"(",
"String",
"password",
",",
"byte",
"[",
"]",
"challenge",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"ntlmHash",
"=",
"ntlmHash",
"(",
"password",
")",
";",
"return",
"lmResponse",
"(",
... | Calculates the NTLM Response for the given challenge, using the
specified password.
@param password The user's password.
@param challenge The Type 2 challenge from the server.
@return The NTLM Response. | [
"Calculates",
"the",
"NTLM",
"Response",
"for",
"the",
"given",
"challenge",
"using",
"the",
"specified",
"password",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L76-L80 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.getLMv2Response | public static byte[] getLMv2Response(String target, String user,
String password, byte[] challenge, byte[] clientNonce)
throws Exception {
byte[] ntlmv2Hash = ntlmv2Hash(target, user, password);
return lmv2Response(ntlmv2Hash, clientNonce, challenge);
} | java | public static byte[] getLMv2Response(String target, String user,
String password, byte[] challenge, byte[] clientNonce)
throws Exception {
byte[] ntlmv2Hash = ntlmv2Hash(target, user, password);
return lmv2Response(ntlmv2Hash, clientNonce, challenge);
} | [
"public",
"static",
"byte",
"[",
"]",
"getLMv2Response",
"(",
"String",
"target",
",",
"String",
"user",
",",
"String",
"password",
",",
"byte",
"[",
"]",
"challenge",
",",
"byte",
"[",
"]",
"clientNonce",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]... | Calculates the LMv2 Response for the given challenge, using the
specified authentication target, username, password, and client
challenge.
@param target The authentication target (i.e., domain).
@param user The username.
@param password The user's password.
@param challenge The Type 2 challenge from the server.
@param... | [
"Calculates",
"the",
"LMv2",
"Response",
"for",
"the",
"given",
"challenge",
"using",
"the",
"specified",
"authentication",
"target",
"username",
"password",
"and",
"client",
"challenge",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L142-L147 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.getNTLM2SessionResponse | public static byte[] getNTLM2SessionResponse(String password,
byte[] challenge, byte[] clientNonce) throws Exception {
byte[] ntlmHash = ntlmHash(password);
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(challenge);
md5.update(clientNonce);
byte[] se... | java | public static byte[] getNTLM2SessionResponse(String password,
byte[] challenge, byte[] clientNonce) throws Exception {
byte[] ntlmHash = ntlmHash(password);
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(challenge);
md5.update(clientNonce);
byte[] se... | [
"public",
"static",
"byte",
"[",
"]",
"getNTLM2SessionResponse",
"(",
"String",
"password",
",",
"byte",
"[",
"]",
"challenge",
",",
"byte",
"[",
"]",
"clientNonce",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"ntlmHash",
"=",
"ntlmHash",
"(",
"pass... | Calculates the NTLM2 Session Response for the given challenge, using the
specified password and client nonce.
@param password The user's password.
@param challenge The Type 2 challenge from the server.
@param clientNonce The random 8-byte client nonce.
@return The NTLM2 Session Response. This is placed in the NTLM
r... | [
"Calculates",
"the",
"NTLM2",
"Session",
"Response",
"for",
"the",
"given",
"challenge",
"using",
"the",
"specified",
"password",
"and",
"client",
"nonce",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L161-L170 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.createBlob | private static byte[] createBlob(byte[] targetInformation,
byte[] clientNonce, long time) {
byte[] blobSignature = new byte[] { (byte) 0x01, (byte) 0x01,
(byte) 0x00, (byte) 0x00 };
byte[] reserved = new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0... | java | private static byte[] createBlob(byte[] targetInformation,
byte[] clientNonce, long time) {
byte[] blobSignature = new byte[] { (byte) 0x01, (byte) 0x01,
(byte) 0x00, (byte) 0x00 };
byte[] reserved = new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00,
(byte) 0... | [
"private",
"static",
"byte",
"[",
"]",
"createBlob",
"(",
"byte",
"[",
"]",
"targetInformation",
",",
"byte",
"[",
"]",
"clientNonce",
",",
"long",
"time",
")",
"{",
"byte",
"[",
"]",
"blobSignature",
"=",
"new",
"byte",
"[",
"]",
"{",
"(",
"byte",
"... | Creates the NTLMv2 blob from the given target information block and
client nonce.
@param targetInformation The target information block from the Type 2
message.
@param clientNonce The random 8-byte client nonce.
@param time the time stamp.
@return The blob, used in the calculation of the NTLMv2 Response. | [
"Creates",
"the",
"NTLMv2",
"blob",
"from",
"the",
"given",
"target",
"information",
"block",
"and",
"client",
"nonce",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L295-L332 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.hmacMD5 | public static byte[] hmacMD5(byte[] data, byte[] key) throws Exception {
byte[] ipad = new byte[64];
byte[] opad = new byte[64];
// Stores key in pads and XOR it with ipad and opad values
for (int i = 0; i < 64; i++) {
if (i < key.length) {
ipad[i] = (byte) (... | java | public static byte[] hmacMD5(byte[] data, byte[] key) throws Exception {
byte[] ipad = new byte[64];
byte[] opad = new byte[64];
// Stores key in pads and XOR it with ipad and opad values
for (int i = 0; i < 64; i++) {
if (i < key.length) {
ipad[i] = (byte) (... | [
"public",
"static",
"byte",
"[",
"]",
"hmacMD5",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"[",
"]",
"key",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"ipad",
"=",
"new",
"byte",
"[",
"64",
"]",
";",
"byte",
"[",
"]",
"opad",
"=",
"ne... | Calculates the HMAC-MD5 hash of the given data using the specified
hashing key.
@param data The data for which the hash will be calculated.
@param key The hashing key.
@return The HMAC-MD5 hash of the given data. | [
"Calculates",
"the",
"HMAC",
"-",
"MD5",
"hash",
"of",
"the",
"given",
"data",
"using",
"the",
"specified",
"hashing",
"key",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L343-L367 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java | NTLMResponses.oddParity | private static void oddParity(byte[] bytes) {
for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
boolean needsParity = (((b >>> 7) ^ (b >>> 6) ^ (b >>> 5)
^ (b >>> 4) ^ (b >>> 3) ^ (b >>> 2) ^ (b >>> 1)) & 0x01) == 0;
if (needsParity) {
... | java | private static void oddParity(byte[] bytes) {
for (int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
boolean needsParity = (((b >>> 7) ^ (b >>> 6) ^ (b >>> 5)
^ (b >>> 4) ^ (b >>> 3) ^ (b >>> 2) ^ (b >>> 1)) & 0x01) == 0;
if (needsParity) {
... | [
"private",
"static",
"void",
"oddParity",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"bytes",
".",
"length",
";",
"i",
"++",
")",
"{",
"byte",
"b",
"=",
"bytes",
"[",
"i",
"]",
";",
"boolean",
"... | Applies odd parity to the given byte array.
@param bytes The data whose parity bits are to be adjusted for
odd parity. | [
"Applies",
"odd",
"parity",
"to",
"the",
"given",
"byte",
"array",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/ntlm/NTLMResponses.java#L401-L412 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/jmx/ServiceMXBeanImpl.java | ServiceMXBeanImpl.getLoggedInSessions | @Override
public Map<String, Map<String, String>> getLoggedInSessions() {
// First, get the map of session ID to user principals for that session.
Map<Long, Map<String, String>> sessionPrincipalMap = serviceManagementBean.getLoggedInSessions();
Map<String, Map<String, String>> result = new ... | java | @Override
public Map<String, Map<String, String>> getLoggedInSessions() {
// First, get the map of session ID to user principals for that session.
Map<Long, Map<String, String>> sessionPrincipalMap = serviceManagementBean.getLoggedInSessions();
Map<String, Map<String, String>> result = new ... | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"getLoggedInSessions",
"(",
")",
"{",
"// First, get the map of session ID to user principals for that session.",
"Map",
"<",
"Long",
",",
"Map",
"<",
"String",
",... | Return a map of session mbean names to the user principals for those sessions. The serviceManagementBean stores them as
session ID to user principals, and we have to convert the session ID to mbean name here. Gross, but it's the only way to
not have JMX-specific stuff in the ServiceManagementBean. | [
"Return",
"a",
"map",
"of",
"session",
"mbean",
"names",
"to",
"the",
"user",
"principals",
"for",
"those",
"sessions",
".",
"The",
"serviceManagementBean",
"stores",
"them",
"as",
"session",
"ID",
"to",
"user",
"principals",
"and",
"we",
"have",
"to",
"conv... | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/jmx/ServiceMXBeanImpl.java#L140-L155 | train |
kaazing/gateway | transport/ws/src/main/java/org/kaazing/gateway/transport/ws/WsScheduledCommand.java | WsScheduledCommand.cancel | public void cancel(ScheduledFuture<?> scheduledFuture) {
clear();
if (scheduledFuture != null && !scheduledFuture.isDone()) {
scheduledFuture.cancel(false);
}
} | java | public void cancel(ScheduledFuture<?> scheduledFuture) {
clear();
if (scheduledFuture != null && !scheduledFuture.isDone()) {
scheduledFuture.cancel(false);
}
} | [
"public",
"void",
"cancel",
"(",
"ScheduledFuture",
"<",
"?",
">",
"scheduledFuture",
")",
"{",
"clear",
"(",
")",
";",
"if",
"(",
"scheduledFuture",
"!=",
"null",
"&&",
"!",
"scheduledFuture",
".",
"isDone",
"(",
")",
")",
"{",
"scheduledFuture",
".",
"... | Cancel the scheduled command.
@param scheduledFuture the scheduled future used to schedule the command. | [
"Cancel",
"the",
"scheduled",
"command",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/WsScheduledCommand.java#L56-L61 | train |
kaazing/gateway | transport/ws/src/main/java/org/kaazing/gateway/transport/ws/WsScheduledCommand.java | WsScheduledCommand.schedule | public ScheduledFuture<?> schedule(ScheduledExecutorService scheduler,
long delay, final TimeUnit unit) {
return scheduler.schedule(
this,
delay, unit);
} | java | public ScheduledFuture<?> schedule(ScheduledExecutorService scheduler,
long delay, final TimeUnit unit) {
return scheduler.schedule(
this,
delay, unit);
} | [
"public",
"ScheduledFuture",
"<",
"?",
">",
"schedule",
"(",
"ScheduledExecutorService",
"scheduler",
",",
"long",
"delay",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"return",
"scheduler",
".",
"schedule",
"(",
"this",
",",
"delay",
",",
"unit",
")",
";",
... | Schedule this command using the scheduler, delay and time units provided.
@param scheduler the scheduler for scheduling this command
@param delay the delay
@param unit the time units for the delay
@return a scheduled future representing the scheduled command. | [
"Schedule",
"this",
"command",
"using",
"the",
"scheduler",
"delay",
"and",
"time",
"units",
"provided",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/WsScheduledCommand.java#L81-L86 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/handler/stream/StreamIoHandler.java | StreamIoHandler.sessionOpened | @Override
public void sessionOpened(IoSession session) {
// Set timeouts
session.getConfig().setWriteTimeout(writeTimeout);
session.getConfig().setIdleTime(IdleStatus.READER_IDLE, readTimeout);
// Create streams
InputStream in = new IoSessionInputStream();
OutputStre... | java | @Override
public void sessionOpened(IoSession session) {
// Set timeouts
session.getConfig().setWriteTimeout(writeTimeout);
session.getConfig().setIdleTime(IdleStatus.READER_IDLE, readTimeout);
// Create streams
InputStream in = new IoSessionInputStream();
OutputStre... | [
"@",
"Override",
"public",
"void",
"sessionOpened",
"(",
"IoSession",
"session",
")",
"{",
"// Set timeouts",
"session",
".",
"getConfig",
"(",
")",
".",
"setWriteTimeout",
"(",
"writeTimeout",
")",
";",
"session",
".",
"getConfig",
"(",
")",
".",
"setIdleTime... | Initializes streams and timeout settings. | [
"Initializes",
"streams",
"and",
"timeout",
"settings",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/stream/StreamIoHandler.java#L99-L111 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/handler/stream/StreamIoHandler.java | StreamIoHandler.messageReceived | @Override
public void messageReceived(IoSession session, Object buf) {
final IoSessionInputStream in = (IoSessionInputStream) session
.getAttribute(KEY_IN);
in.write((IoBuffer) buf);
} | java | @Override
public void messageReceived(IoSession session, Object buf) {
final IoSessionInputStream in = (IoSessionInputStream) session
.getAttribute(KEY_IN);
in.write((IoBuffer) buf);
} | [
"@",
"Override",
"public",
"void",
"messageReceived",
"(",
"IoSession",
"session",
",",
"Object",
"buf",
")",
"{",
"final",
"IoSessionInputStream",
"in",
"=",
"(",
"IoSessionInputStream",
")",
"session",
".",
"getAttribute",
"(",
"KEY_IN",
")",
";",
"in",
".",... | Forwards read data to input stream. | [
"Forwards",
"read",
"data",
"to",
"input",
"stream",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/stream/StreamIoHandler.java#L130-L135 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/handler/stream/StreamIoHandler.java | StreamIoHandler.exceptionCaught | @Override
public void exceptionCaught(IoSession session, Throwable cause) {
final IoSessionInputStream in = (IoSessionInputStream) session
.getAttribute(KEY_IN);
IOException e = null;
if (cause instanceof StreamIoException) {
e = (IOException) cause.getCause();
... | java | @Override
public void exceptionCaught(IoSession session, Throwable cause) {
final IoSessionInputStream in = (IoSessionInputStream) session
.getAttribute(KEY_IN);
IOException e = null;
if (cause instanceof StreamIoException) {
e = (IOException) cause.getCause();
... | [
"@",
"Override",
"public",
"void",
"exceptionCaught",
"(",
"IoSession",
"session",
",",
"Throwable",
"cause",
")",
"{",
"final",
"IoSessionInputStream",
"in",
"=",
"(",
"IoSessionInputStream",
")",
"session",
".",
"getAttribute",
"(",
"KEY_IN",
")",
";",
"IOExce... | Forwards caught exceptions to input stream. | [
"Forwards",
"caught",
"exceptions",
"to",
"input",
"stream",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/stream/StreamIoHandler.java#L140-L158 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/handler/stream/StreamIoHandler.java | StreamIoHandler.sessionIdle | @Override
public void sessionIdle(IoSession session, IdleStatus status) {
if (status == IdleStatus.READER_IDLE) {
throw new StreamIoException(new SocketTimeoutException(
"Read timeout"));
}
} | java | @Override
public void sessionIdle(IoSession session, IdleStatus status) {
if (status == IdleStatus.READER_IDLE) {
throw new StreamIoException(new SocketTimeoutException(
"Read timeout"));
}
} | [
"@",
"Override",
"public",
"void",
"sessionIdle",
"(",
"IoSession",
"session",
",",
"IdleStatus",
"status",
")",
"{",
"if",
"(",
"status",
"==",
"IdleStatus",
".",
"READER_IDLE",
")",
"{",
"throw",
"new",
"StreamIoException",
"(",
"new",
"SocketTimeoutException"... | Handles read timeout. | [
"Handles",
"read",
"timeout",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/handler/stream/StreamIoHandler.java#L163-L169 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks4LogicHandler.java | Socks4LogicHandler.messageReceived | public void messageReceived(final NextFilter nextFilter,
final IoBuffer buf) {
try {
if (buf.remaining() >= SocksProxyConstants.SOCKS_4_RESPONSE_SIZE) {
handleResponse(buf);
}
} catch (Exception ex) {
closeSession("Proxy handshake failed: "... | java | public void messageReceived(final NextFilter nextFilter,
final IoBuffer buf) {
try {
if (buf.remaining() >= SocksProxyConstants.SOCKS_4_RESPONSE_SIZE) {
handleResponse(buf);
}
} catch (Exception ex) {
closeSession("Proxy handshake failed: "... | [
"public",
"void",
"messageReceived",
"(",
"final",
"NextFilter",
"nextFilter",
",",
"final",
"IoBuffer",
"buf",
")",
"{",
"try",
"{",
"if",
"(",
"buf",
".",
"remaining",
"(",
")",
">=",
"SocksProxyConstants",
".",
"SOCKS_4_RESPONSE_SIZE",
")",
"{",
"handleResp... | Handle incoming data during the handshake process. Should consume only the
handshake data from the buffer, leaving any extra data in place.
@param nextFilter the next filter
@param buf the server response data buffer | [
"Handle",
"incoming",
"data",
"during",
"the",
"handshake",
"process",
".",
"Should",
"consume",
"only",
"the",
"handshake",
"data",
"from",
"the",
"buffer",
"leaving",
"any",
"extra",
"data",
"in",
"place",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/Socks4LogicHandler.java#L110-L119 | train |
kaazing/gateway | server/src/main/java/org/kaazing/gateway/server/util/version/DuplicateJarFinder.java | DuplicateJarFinder.findDuplicateJars | public void findDuplicateJars() throws IOException, DuplicateJarsException {
Map<String, List<String>> artifactsToVersion = new HashMap<>();
Enumeration<URL> manifestURLs = classPathParser.getManifestURLs();
while (manifestURLs.hasMoreElements()) {
parseManifestFileFromClassPathEntry... | java | public void findDuplicateJars() throws IOException, DuplicateJarsException {
Map<String, List<String>> artifactsToVersion = new HashMap<>();
Enumeration<URL> manifestURLs = classPathParser.getManifestURLs();
while (manifestURLs.hasMoreElements()) {
parseManifestFileFromClassPathEntry... | [
"public",
"void",
"findDuplicateJars",
"(",
")",
"throws",
"IOException",
",",
"DuplicateJarsException",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"artifactsToVersion",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"Enumeration",
"<",
"U... | Parses the class path system attribute and the manifest files
and if there are duplicate jar a DuplicateJarsException is thrown.
@throws IOException
@throws DuplicateJarsException | [
"Parses",
"the",
"class",
"path",
"system",
"attribute",
"and",
"the",
"manifest",
"files",
"and",
"if",
"there",
"are",
"duplicate",
"jar",
"a",
"DuplicateJarsException",
"is",
"thrown",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/util/version/DuplicateJarFinder.java#L54-L61 | train |
kaazing/gateway | mina.netty/src/main/java/org/kaazing/mina/netty/bootstrap/ConnectionlessBootstrap.java | ConnectionlessBootstrap.bindAsync | public ChannelFuture bindAsync(final SocketAddress localAddress) {
if (localAddress == null) {
throw new NullPointerException("localAddress");
}
ChannelPipeline pipeline;
try {
pipeline = getPipelineFactory().getPipeline();
} catch (Exception e) {
... | java | public ChannelFuture bindAsync(final SocketAddress localAddress) {
if (localAddress == null) {
throw new NullPointerException("localAddress");
}
ChannelPipeline pipeline;
try {
pipeline = getPipelineFactory().getPipeline();
} catch (Exception e) {
... | [
"public",
"ChannelFuture",
"bindAsync",
"(",
"final",
"SocketAddress",
"localAddress",
")",
"{",
"if",
"(",
"localAddress",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"localAddress\"",
")",
";",
"}",
"ChannelPipeline",
"pipeline",
";",
... | Creates a new channel which is bound to the specified local address.
@return a new {@link ChannelFuture} which will be notified once the Channel is
bound and accepts incoming connections
@throws ChannelException
if failed to create a new channel and
bind it to the local address | [
"Creates",
"a",
"new",
"channel",
"which",
"is",
"bound",
"to",
"the",
"specified",
"local",
"address",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/netty/bootstrap/ConnectionlessBootstrap.java#L81-L110 | train |
kaazing/gateway | server/src/main/java/org/kaazing/gateway/server/impl/GatewayImpl.java | GatewayImpl.setProperties | @Override
public void setProperties(Properties properties) {
if (this.env == null) {
this.env = properties;
} else {
this.env.putAll(properties);
}
if (baseGateway != null) {
baseGateway.setProperties(properties);
}
} | java | @Override
public void setProperties(Properties properties) {
if (this.env == null) {
this.env = properties;
} else {
this.env.putAll(properties);
}
if (baseGateway != null) {
baseGateway.setProperties(properties);
}
} | [
"@",
"Override",
"public",
"void",
"setProperties",
"(",
"Properties",
"properties",
")",
"{",
"if",
"(",
"this",
".",
"env",
"==",
"null",
")",
"{",
"this",
".",
"env",
"=",
"properties",
";",
"}",
"else",
"{",
"this",
".",
"env",
".",
"putAll",
"("... | Configure a new Gateway instance with the given environment properties. | [
"Configure",
"a",
"new",
"Gateway",
"instance",
"with",
"the",
"given",
"environment",
"properties",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/impl/GatewayImpl.java#L100-L111 | train |
kaazing/gateway | server/src/main/java/org/kaazing/gateway/server/util/version/ManifestReader.java | ManifestReader.getManifestAttributesFromURL | public Attributes getManifestAttributesFromURL(URL url) throws IOException {
Manifest manifest = new Manifest(url.openStream());
return manifest.getMainAttributes();
} | java | public Attributes getManifestAttributesFromURL(URL url) throws IOException {
Manifest manifest = new Manifest(url.openStream());
return manifest.getMainAttributes();
} | [
"public",
"Attributes",
"getManifestAttributesFromURL",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"Manifest",
"manifest",
"=",
"new",
"Manifest",
"(",
"url",
".",
"openStream",
"(",
")",
")",
";",
"return",
"manifest",
".",
"getMainAttributes",
"(",
... | Retrieves the jar file manifest attributes for a given class path entry
@param url - the class path entry
@return the manifest file attributes
@throws IOException | [
"Retrieves",
"the",
"jar",
"file",
"manifest",
"attributes",
"for",
"a",
"given",
"class",
"path",
"entry"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/util/version/ManifestReader.java#L44-L47 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java | AbstractPollingIoConnector.processConnections | private int processConnections(Iterator<H> handlers) {
int nHandles = 0;
// Loop on each connection request
while (handlers.hasNext()) {
H handle = handlers.next();
handlers.remove();
ConnectionRequest connectionRequest = getConnectionRequest(handle)... | java | private int processConnections(Iterator<H> handlers) {
int nHandles = 0;
// Loop on each connection request
while (handlers.hasNext()) {
H handle = handlers.next();
handlers.remove();
ConnectionRequest connectionRequest = getConnectionRequest(handle)... | [
"private",
"int",
"processConnections",
"(",
"Iterator",
"<",
"H",
">",
"handlers",
")",
"{",
"int",
"nHandles",
"=",
"0",
";",
"// Loop on each connection request",
"while",
"(",
"handlers",
".",
"hasNext",
"(",
")",
")",
"{",
"H",
"handle",
"=",
"handlers"... | Process the incoming connections, creating a new session for each
valid connection. | [
"Process",
"the",
"incoming",
"connections",
"creating",
"a",
"new",
"session",
"for",
"each",
"valid",
"connection",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/polling/AbstractPollingIoConnector.java#L414-L448 | train |
kaazing/gateway | transport/wseb/src/main/java/org/kaazing/gateway/transport/wseb/WsebSession.java | WsebSession.checkLongPollingOrder | private boolean checkLongPollingOrder(HttpAcceptSession session) {
if (firstWriter && !validateSequenceNo && longpoll(session)) {
String message = "Out of order long-polling request, must not be first";
setCloseException(new IOException(message));
HttpStatus status = HttpStat... | java | private boolean checkLongPollingOrder(HttpAcceptSession session) {
if (firstWriter && !validateSequenceNo && longpoll(session)) {
String message = "Out of order long-polling request, must not be first";
setCloseException(new IOException(message));
HttpStatus status = HttpStat... | [
"private",
"boolean",
"checkLongPollingOrder",
"(",
"HttpAcceptSession",
"session",
")",
"{",
"if",
"(",
"firstWriter",
"&&",
"!",
"validateSequenceNo",
"&&",
"longpoll",
"(",
"session",
")",
")",
"{",
"String",
"message",
"=",
"\"Out of order long-polling request, mu... | If the first write request is long-polling, then it is out of order | [
"If",
"the",
"first",
"write",
"request",
"is",
"long",
"-",
"polling",
"then",
"it",
"is",
"out",
"of",
"order"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/wseb/src/main/java/org/kaazing/gateway/transport/wseb/WsebSession.java#L763-L774 | train |
kaazing/gateway | service/proxy/src/main/java/org/kaazing/gateway/service/proxy/ConnectionPool.java | ConnectionPool.addConnectFuture | private void addConnectFuture(ConnectFuture future) {
Object key = connectFutures.add(future);
future.getSession().setAttributeIfAbsent(CONNECT_FUTURE_KEY, key);
} | java | private void addConnectFuture(ConnectFuture future) {
Object key = connectFutures.add(future);
future.getSession().setAttributeIfAbsent(CONNECT_FUTURE_KEY, key);
} | [
"private",
"void",
"addConnectFuture",
"(",
"ConnectFuture",
"future",
")",
"{",
"Object",
"key",
"=",
"connectFutures",
".",
"add",
"(",
"future",
")",
";",
"future",
".",
"getSession",
"(",
")",
".",
"setAttributeIfAbsent",
"(",
"CONNECT_FUTURE_KEY",
",",
"k... | the associated ConnectFuture from the map of preconnect futures. | [
"the",
"associated",
"ConnectFuture",
"from",
"the",
"map",
"of",
"preconnect",
"futures",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/proxy/src/main/java/org/kaazing/gateway/service/proxy/ConnectionPool.java#L136-L139 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java | SocksProxyRequest.getPort | public byte[] getPort() {
byte[] port = new byte[2];
int p = (getEndpointAddress() == null ? this.port
: getEndpointAddress().getPort());
port[1] = (byte) p;
port[0] = (byte) (p >> 8);
return port;
} | java | public byte[] getPort() {
byte[] port = new byte[2];
int p = (getEndpointAddress() == null ? this.port
: getEndpointAddress().getPort());
port[1] = (byte) p;
port[0] = (byte) (p >> 8);
return port;
} | [
"public",
"byte",
"[",
"]",
"getPort",
"(",
")",
"{",
"byte",
"[",
"]",
"port",
"=",
"new",
"byte",
"[",
"2",
"]",
";",
"int",
"p",
"=",
"(",
"getEndpointAddress",
"(",
")",
"==",
"null",
"?",
"this",
".",
"port",
":",
"getEndpointAddress",
"(",
... | Return the server port as a byte array.
@return the server port | [
"Return",
"the",
"server",
"port",
"as",
"a",
"byte",
"array",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java#L118-L125 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java | SocksProxyRequest.getHost | public synchronized final String getHost() {
if (host == null) {
InetSocketAddress adr = getEndpointAddress();
if ( adr != null && !adr.isUnresolved()) {
host = getEndpointAddress().getHostName();
}
}
return host;
} | java | public synchronized final String getHost() {
if (host == null) {
InetSocketAddress adr = getEndpointAddress();
if ( adr != null && !adr.isUnresolved()) {
host = getEndpointAddress().getHostName();
}
}
return host;
} | [
"public",
"synchronized",
"final",
"String",
"getHost",
"(",
")",
"{",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"InetSocketAddress",
"adr",
"=",
"getEndpointAddress",
"(",
")",
";",
"if",
"(",
"adr",
"!=",
"null",
"&&",
"!",
"adr",
".",
"isUnresolved",... | Return the server host name.
@return the server host name | [
"Return",
"the",
"server",
"host",
"name",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/socks/SocksProxyRequest.java#L159-L169 | train |
kaazing/gateway | transport/ws/src/main/java/org/kaazing/gateway/transport/ws/extension/WebSocketExtensionFactory.java | WebSocketExtensionFactory.offerWebSocketExtensions | public List<WebSocketExtension> offerWebSocketExtensions(WsResourceAddress address,
ExtensionHelper extensionHelper) {
List<WebSocketExtension> list = new ArrayList<>();
for(WebSocketExtensionFactorySpi factory : factoriesRO.values()) {
... | java | public List<WebSocketExtension> offerWebSocketExtensions(WsResourceAddress address,
ExtensionHelper extensionHelper) {
List<WebSocketExtension> list = new ArrayList<>();
for(WebSocketExtensionFactorySpi factory : factoriesRO.values()) {
... | [
"public",
"List",
"<",
"WebSocketExtension",
">",
"offerWebSocketExtensions",
"(",
"WsResourceAddress",
"address",
",",
"ExtensionHelper",
"extensionHelper",
")",
"{",
"List",
"<",
"WebSocketExtension",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"f... | Returns a list of extensions that want to be part of websocket request
@param address WsResourceAddress to which a websocket connection is being attempted
@param extensionHelper extension helper
@return list of extensions that want to be part of the request | [
"Returns",
"a",
"list",
"of",
"extensions",
"that",
"want",
"to",
"be",
"part",
"of",
"websocket",
"request"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ws/src/main/java/org/kaazing/gateway/transport/ws/extension/WebSocketExtensionFactory.java#L113-L124 | train |
kaazing/gateway | server/src/main/java/org/kaazing/gateway/server/context/resolve/GatewayContextResolver.java | GatewayContextResolver.resolveServiceDefaults | private DefaultServiceDefaultsContext resolveServiceDefaults(ServiceDefaultsType serviceDefaults, RealmsContext realmsContext) {
if (serviceDefaults == null) {
return null;
}
DefaultAcceptOptionsContext acceptOptions = null;
ServiceAcceptOptionsType serviceAcceptOptions = ... | java | private DefaultServiceDefaultsContext resolveServiceDefaults(ServiceDefaultsType serviceDefaults, RealmsContext realmsContext) {
if (serviceDefaults == null) {
return null;
}
DefaultAcceptOptionsContext acceptOptions = null;
ServiceAcceptOptionsType serviceAcceptOptions = ... | [
"private",
"DefaultServiceDefaultsContext",
"resolveServiceDefaults",
"(",
"ServiceDefaultsType",
"serviceDefaults",
",",
"RealmsContext",
"realmsContext",
")",
"{",
"if",
"(",
"serviceDefaults",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"DefaultAcceptOptionsCon... | own object to management. | [
"own",
"object",
"to",
"management",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/context/resolve/GatewayContextResolver.java#L416-L446 | train |
kaazing/gateway | server/src/main/java/org/kaazing/gateway/server/context/resolve/GatewayContextResolver.java | GatewayContextResolver.supportsConnects | private boolean supportsConnects(String serviceType) {
return !serviceType.equals("jms") &&
!serviceType.equals("echo") &&
!serviceType.equals("management.jmx") &&
!serviceType.equals("$management.jmx$") &&
!serviceType.equals("management.snmp") &&... | java | private boolean supportsConnects(String serviceType) {
return !serviceType.equals("jms") &&
!serviceType.equals("echo") &&
!serviceType.equals("management.jmx") &&
!serviceType.equals("$management.jmx$") &&
!serviceType.equals("management.snmp") &&... | [
"private",
"boolean",
"supportsConnects",
"(",
"String",
"serviceType",
")",
"{",
"return",
"!",
"serviceType",
".",
"equals",
"(",
"\"jms\"",
")",
"&&",
"!",
"serviceType",
".",
"equals",
"(",
"\"echo\"",
")",
"&&",
"!",
"serviceType",
".",
"equals",
"(",
... | Gross method to tell us if a given service type supports using 'connect's. XXX This needs to be fixed later!
@param serviceType
@return | [
"Gross",
"method",
"to",
"tell",
"us",
"if",
"a",
"given",
"service",
"type",
"supports",
"using",
"connect",
"s",
".",
"XXX",
"This",
"needs",
"to",
"be",
"fixed",
"later!"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/server/src/main/java/org/kaazing/gateway/server/context/resolve/GatewayContextResolver.java#L1221-L1229 | train |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpMergeRequestFilter.java | HttpMergeRequestFilter.removeFilter | protected final void removeFilter(IoFilterChain filterChain, IoFilter filter) {
if (filterChain.contains(filter)) {
filterChain.remove(filter);
}
} | java | protected final void removeFilter(IoFilterChain filterChain, IoFilter filter) {
if (filterChain.contains(filter)) {
filterChain.remove(filter);
}
} | [
"protected",
"final",
"void",
"removeFilter",
"(",
"IoFilterChain",
"filterChain",
",",
"IoFilter",
"filter",
")",
"{",
"if",
"(",
"filterChain",
".",
"contains",
"(",
"filter",
")",
")",
"{",
"filterChain",
".",
"remove",
"(",
"filter",
")",
";",
"}",
"}"... | A utility method to remove a filter from a filter chain, without
complaining if it is not in the chain.
@param filterChain the filter chain
@param filter the filter to remove | [
"A",
"utility",
"method",
"to",
"remove",
"a",
"filter",
"from",
"a",
"filter",
"chain",
"without",
"complaining",
"if",
"it",
"is",
"not",
"in",
"the",
"chain",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpMergeRequestFilter.java#L397-L401 | train |
kaazing/gateway | transport/ssl/src/main/java/org/kaazing/gateway/transport/ssl/bridge/filter/SslFilter.java | SslFilter.sessionClosed | @Override
public void sessionClosed(NextFilter nextFilter, IoSession session)
throws SSLException {
SslHandler handler = getSslSessionHandler(session);
try {
synchronized (handler) {
// release resources
handler.destroy();
}
... | java | @Override
public void sessionClosed(NextFilter nextFilter, IoSession session)
throws SSLException {
SslHandler handler = getSslSessionHandler(session);
try {
synchronized (handler) {
// release resources
handler.destroy();
}
... | [
"@",
"Override",
"public",
"void",
"sessionClosed",
"(",
"NextFilter",
"nextFilter",
",",
"IoSession",
"session",
")",
"throws",
"SSLException",
"{",
"SslHandler",
"handler",
"=",
"getSslSessionHandler",
"(",
"session",
")",
";",
"try",
"{",
"synchronized",
"(",
... | IoFilter impl. | [
"IoFilter",
"impl",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/ssl/src/main/java/org/kaazing/gateway/transport/ssl/bridge/filter/SslFilter.java#L389-L404 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java | DefaultIoFuture.await0 | private boolean await0(long timeoutMillis, boolean interruptable) throws InterruptedException {
long endTime = System.currentTimeMillis() + timeoutMillis;
if (endTime < 0) {
endTime = Long.MAX_VALUE;
}
synchronized (lock) {
if (ready) {
r... | java | private boolean await0(long timeoutMillis, boolean interruptable) throws InterruptedException {
long endTime = System.currentTimeMillis() + timeoutMillis;
if (endTime < 0) {
endTime = Long.MAX_VALUE;
}
synchronized (lock) {
if (ready) {
r... | [
"private",
"boolean",
"await0",
"(",
"long",
"timeoutMillis",
",",
"boolean",
"interruptable",
")",
"throws",
"InterruptedException",
"{",
"long",
"endTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"timeoutMillis",
";",
"if",
"(",
"endTime",
"<",... | Wait for the Future to be ready. If the requested delay is 0 or
negative, this method immediately returns the value of the
'ready' flag.
Every 5 second, the wait will be suspended to be able to check if
there is a deadlock or not.
@param timeoutMillis The delay we will wait for the Future to be ready
@param interrupta... | [
"Wait",
"for",
"the",
"Future",
"to",
"be",
"ready",
".",
"If",
"the",
"requested",
"delay",
"is",
"0",
"or",
"negative",
"this",
"method",
"immediately",
"returns",
"the",
"value",
"of",
"the",
"ready",
"flag",
".",
"Every",
"5",
"second",
"the",
"wait"... | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java#L165-L207 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java | DefaultIoFuture.setValue | public void setValue(Object newValue) {
synchronized (lock) {
// Allow only once.
if (ready) {
return;
}
result = newValue;
ready = true;
if (waiters > 0) {
lock.notifyAll();
}
}
... | java | public void setValue(Object newValue) {
synchronized (lock) {
// Allow only once.
if (ready) {
return;
}
result = newValue;
ready = true;
if (waiters > 0) {
lock.notifyAll();
}
}
... | [
"public",
"void",
"setValue",
"(",
"Object",
"newValue",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"// Allow only once.",
"if",
"(",
"ready",
")",
"{",
"return",
";",
"}",
"result",
"=",
"newValue",
";",
"ready",
"=",
"true",
";",
"if",
"(",
"wa... | Sets the result of the asynchronous operation, and mark it as finished. | [
"Sets",
"the",
"result",
"of",
"the",
"asynchronous",
"operation",
"and",
"mark",
"it",
"as",
"finished",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/core/future/DefaultIoFuture.java#L272-L287 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java | SslHandler.destroy | public void destroy() {
if (sslEngine == null) {
return;
}
// Close inbound and flush all remaining data if available.
try {
sslEngine.closeInbound();
} catch (SSLException e) {
LOGGER.debug(
"Unexpected exception from SSLE... | java | public void destroy() {
if (sslEngine == null) {
return;
}
// Close inbound and flush all remaining data if available.
try {
sslEngine.closeInbound();
} catch (SSLException e) {
LOGGER.debug(
"Unexpected exception from SSLE... | [
"public",
"void",
"destroy",
"(",
")",
"{",
"if",
"(",
"sslEngine",
"==",
"null",
")",
"{",
"return",
";",
"}",
"// Close inbound and flush all remaining data if available.",
"try",
"{",
"sslEngine",
".",
"closeInbound",
"(",
")",
";",
"}",
"catch",
"(",
"SSLE... | Release allocated buffers. | [
"Release",
"allocated",
"buffers",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java#L157-L190 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java | SslHandler.closeOutbound | public boolean closeOutbound() throws SSLException {
if (sslEngine == null || sslEngine.isOutboundDone()) {
return false;
}
sslEngine.closeOutbound();
createOutNetBuffer(0);
SSLEngineResult result;
for (;;) {
result = sslEngine.wrap(emptyBuffer.b... | java | public boolean closeOutbound() throws SSLException {
if (sslEngine == null || sslEngine.isOutboundDone()) {
return false;
}
sslEngine.closeOutbound();
createOutNetBuffer(0);
SSLEngineResult result;
for (;;) {
result = sslEngine.wrap(emptyBuffer.b... | [
"public",
"boolean",
"closeOutbound",
"(",
")",
"throws",
"SSLException",
"{",
"if",
"(",
"sslEngine",
"==",
"null",
"||",
"sslEngine",
".",
"isOutboundDone",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"sslEngine",
".",
"closeOutbound",
"(",
")",
";"... | Start SSL shutdown process.
@return <tt>true</tt> if shutdown process is started.
<tt>false</tt> if shutdown process is already finished.
@throws SSLException on errors | [
"Start",
"SSL",
"shutdown",
"process",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/ssl/SslHandler.java#L382-L406 | train |
kaazing/gateway | resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResolutionUtils.java | ResolutionUtils.getAllByName | public static Collection<InetAddress> getAllByName(String host, boolean allowIPv6) {
Enumeration<NetworkInterface> networkInterfaces = cloneInterfaces(ResolutionUtils.networkInterfaces);
List<String> resolvedAddresses = resolveDeviceAddress(host, networkInterfaces, allowIPv6);
List<InetAddress> res... | java | public static Collection<InetAddress> getAllByName(String host, boolean allowIPv6) {
Enumeration<NetworkInterface> networkInterfaces = cloneInterfaces(ResolutionUtils.networkInterfaces);
List<String> resolvedAddresses = resolveDeviceAddress(host, networkInterfaces, allowIPv6);
List<InetAddress> res... | [
"public",
"static",
"Collection",
"<",
"InetAddress",
">",
"getAllByName",
"(",
"String",
"host",
",",
"boolean",
"allowIPv6",
")",
"{",
"Enumeration",
"<",
"NetworkInterface",
">",
"networkInterfaces",
"=",
"cloneInterfaces",
"(",
"ResolutionUtils",
".",
"networkIn... | Method resolving host to InetAddresses
@param host
@return | [
"Method",
"resolving",
"host",
"to",
"InetAddresses"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResolutionUtils.java#L67-L80 | train |
kaazing/gateway | resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResolutionUtils.java | ResolutionUtils.parseBindAddress | public static InetSocketAddress parseBindAddress(String bindAddress) {
Exception cause = null;
try {
if (!bindAddress.contains(":")) {
// port only
return new InetSocketAddress(Integer.parseInt(bindAddress));
}
// Test for network inter... | java | public static InetSocketAddress parseBindAddress(String bindAddress) {
Exception cause = null;
try {
if (!bindAddress.contains(":")) {
// port only
return new InetSocketAddress(Integer.parseInt(bindAddress));
}
// Test for network inter... | [
"public",
"static",
"InetSocketAddress",
"parseBindAddress",
"(",
"String",
"bindAddress",
")",
"{",
"Exception",
"cause",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"!",
"bindAddress",
".",
"contains",
"(",
"\":\"",
")",
")",
"{",
"// port only",
"return",
"n... | Method creating an InetAddress from String.
@param bindAddress syntax host:port
host optional, can be specified as IPv4, IPv6, NetworkInterface
port mandatory
@return | [
"Method",
"creating",
"an",
"InetAddress",
"from",
"String",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResolutionUtils.java#L89-L116 | train |
kaazing/gateway | resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResolutionUtils.java | ResolutionUtils.resolveDeviceAddress | private static List<String> resolveDeviceAddress(String deviceName,
Enumeration<NetworkInterface> networkInterfaces, boolean allowIPv6) {
List<String> resolvedAddresses = new ArrayList<>();
if (deviceName.startsWith("[@") && deviceName.endsWith("]")) {
deviceName = deviceName.subs... | java | private static List<String> resolveDeviceAddress(String deviceName,
Enumeration<NetworkInterface> networkInterfaces, boolean allowIPv6) {
List<String> resolvedAddresses = new ArrayList<>();
if (deviceName.startsWith("[@") && deviceName.endsWith("]")) {
deviceName = deviceName.subs... | [
"private",
"static",
"List",
"<",
"String",
">",
"resolveDeviceAddress",
"(",
"String",
"deviceName",
",",
"Enumeration",
"<",
"NetworkInterface",
">",
"networkInterfaces",
",",
"boolean",
"allowIPv6",
")",
"{",
"List",
"<",
"String",
">",
"resolvedAddresses",
"="... | Method performing device address resolution
@param deviceName
@param networkInterfaces
@param allowIPv6
@return | [
"Method",
"performing",
"device",
"address",
"resolution"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/ResolutionUtils.java#L125-L160 | train |
kaazing/gateway | transport/wseb/src/main/java/org/kaazing/gateway/transport/wseb/filter/WsebFrameEscapeZeroAndNewLineEncoder.java | WsebFrameEscapeZeroAndNewLineEncoder.calculatePrefixBytes | protected ByteBuffer calculatePrefixBytes(int payloadLength, byte opCode) {
int totalOffset = 2 + WsUtils.calculateEncodedLengthSize(payloadLength);
ByteBuffer binary = ByteBuffer.allocate(totalOffset);
binary.put(opCode);
WsUtils.encodeLength(binary, payloadLength);
//the on... | java | protected ByteBuffer calculatePrefixBytes(int payloadLength, byte opCode) {
int totalOffset = 2 + WsUtils.calculateEncodedLengthSize(payloadLength);
ByteBuffer binary = ByteBuffer.allocate(totalOffset);
binary.put(opCode);
WsUtils.encodeLength(binary, payloadLength);
//the on... | [
"protected",
"ByteBuffer",
"calculatePrefixBytes",
"(",
"int",
"payloadLength",
",",
"byte",
"opCode",
")",
"{",
"int",
"totalOffset",
"=",
"2",
"+",
"WsUtils",
".",
"calculateEncodedLengthSize",
"(",
"payloadLength",
")",
";",
"ByteBuffer",
"binary",
"=",
"ByteBu... | quick calculate WsebFrame prefix bytes | [
"quick",
"calculate",
"WsebFrame",
"prefix",
"bytes"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/wseb/src/main/java/org/kaazing/gateway/transport/wseb/filter/WsebFrameEscapeZeroAndNewLineEncoder.java#L166-L198 | train |
kaazing/gateway | transport/wseb/src/main/java/org/kaazing/gateway/transport/wseb/filter/WsebFrameEscapeZeroAndNewLineEncoder.java | WsebFrameEscapeZeroAndNewLineEncoder.doEscapeZeroAndNewline | private byte[] doEscapeZeroAndNewline(byte[] decodedArray,int decodedArrayOffset, int decodedArrayPosition,int decodedArrayLimit, byte[] encodedArray, int[] encodedArrayInsertionCount, ByteBuffer prefix) {
int prefixLength = prefix.remaining();
for (; decodedArrayPosition < decodedArrayLimit; decodedArr... | java | private byte[] doEscapeZeroAndNewline(byte[] decodedArray,int decodedArrayOffset, int decodedArrayPosition,int decodedArrayLimit, byte[] encodedArray, int[] encodedArrayInsertionCount, ByteBuffer prefix) {
int prefixLength = prefix.remaining();
for (; decodedArrayPosition < decodedArrayLimit; decodedArr... | [
"private",
"byte",
"[",
"]",
"doEscapeZeroAndNewline",
"(",
"byte",
"[",
"]",
"decodedArray",
",",
"int",
"decodedArrayOffset",
",",
"int",
"decodedArrayPosition",
",",
"int",
"decodedArrayLimit",
",",
"byte",
"[",
"]",
"encodedArray",
",",
"int",
"[",
"]",
"e... | insert escape characters into encodedArray, return number of inserted bytes | [
"insert",
"escape",
"characters",
"into",
"encodedArray",
"return",
"number",
"of",
"inserted",
"bytes"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/wseb/src/main/java/org/kaazing/gateway/transport/wseb/filter/WsebFrameEscapeZeroAndNewLineEncoder.java#L201-L265 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java | SessionAttributeInitializingFilter.setAttributes | public void setAttributes(Map<String, ?> attributes) {
if (attributes == null) {
attributes = new HashMap<>();
}
this.attributes.clear();
this.attributes.putAll(attributes);
} | java | public void setAttributes(Map<String, ?> attributes) {
if (attributes == null) {
attributes = new HashMap<>();
}
this.attributes.clear();
this.attributes.putAll(attributes);
} | [
"public",
"void",
"setAttributes",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"attributes",
")",
"{",
"if",
"(",
"attributes",
"==",
"null",
")",
"{",
"attributes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"this",
".",
"attributes",
".",
"clea... | Sets the attribute map. The specified attributes are copied into the
underlying map, so modifying the specified attributes parameter after
the call won't change the internal state. | [
"Sets",
"the",
"attribute",
"map",
".",
"The",
"specified",
"attributes",
"are",
"copied",
"into",
"the",
"underlying",
"map",
"so",
"modifying",
"the",
"specified",
"attributes",
"parameter",
"after",
"the",
"call",
"won",
"t",
"change",
"the",
"internal",
"s... | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java#L125-L132 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java | SessionAttributeInitializingFilter.sessionCreated | @Override
public void sessionCreated(NextFilter nextFilter, IoSession session)
throws Exception {
for (Map.Entry<String, Object> e : attributes.entrySet()) {
session.setAttribute(e.getKey(), e.getValue());
}
nextFilter.sessionCreated(session);
} | java | @Override
public void sessionCreated(NextFilter nextFilter, IoSession session)
throws Exception {
for (Map.Entry<String, Object> e : attributes.entrySet()) {
session.setAttribute(e.getKey(), e.getValue());
}
nextFilter.sessionCreated(session);
} | [
"@",
"Override",
"public",
"void",
"sessionCreated",
"(",
"NextFilter",
"nextFilter",
",",
"IoSession",
"session",
")",
"throws",
"Exception",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"e",
":",
"attributes",
".",
"entrySet",
... | Puts all pre-configured attributes into the actual session attribute
map and forward the event to the next filter. | [
"Puts",
"all",
"pre",
"-",
"configured",
"attributes",
"into",
"the",
"actual",
"session",
"attribute",
"map",
"and",
"forward",
"the",
"event",
"to",
"the",
"next",
"filter",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/util/SessionAttributeInitializingFilter.java#L138-L146 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java | ProfilerTimerFilter.getTotalTime | public long getTotalTime(IoEventType type) {
switch (type) {
case MESSAGE_RECEIVED :
if (profileMessageReceived) {
return messageReceivedTimerWorker.getTotal();
}
break;
case MESSAGE_SEN... | java | public long getTotalTime(IoEventType type) {
switch (type) {
case MESSAGE_RECEIVED :
if (profileMessageReceived) {
return messageReceivedTimerWorker.getTotal();
}
break;
case MESSAGE_SEN... | [
"public",
"long",
"getTotalTime",
"(",
"IoEventType",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"MESSAGE_RECEIVED",
":",
"if",
"(",
"profileMessageReceived",
")",
"{",
"return",
"messageReceivedTimerWorker",
".",
"getTotal",
"(",
")",
";",
"}"... | The total time this method has been executing
@param type
The {@link IoEventType} that the user wants to get the total time this method has
been executing
@return
The total time for the method represented by the {@link IoEventType} | [
"The",
"total",
"time",
"this",
"method",
"has",
"been",
"executing"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java#L602-L649 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java | AbstractProxyLogicHandler.writeData | protected WriteFuture writeData(final NextFilter nextFilter,
final IoBuffer data) {
// write net data
ProxyHandshakeIoBuffer writeBuffer = new ProxyHandshakeIoBuffer(data);
LOGGER.debug(" session write: {}", writeBuffer);
WriteFuture writeFuture = new DefaultWriteFuture(g... | java | protected WriteFuture writeData(final NextFilter nextFilter,
final IoBuffer data) {
// write net data
ProxyHandshakeIoBuffer writeBuffer = new ProxyHandshakeIoBuffer(data);
LOGGER.debug(" session write: {}", writeBuffer);
WriteFuture writeFuture = new DefaultWriteFuture(g... | [
"protected",
"WriteFuture",
"writeData",
"(",
"final",
"NextFilter",
"nextFilter",
",",
"final",
"IoBuffer",
"data",
")",
"{",
"// write net data",
"ProxyHandshakeIoBuffer",
"writeBuffer",
"=",
"new",
"ProxyHandshakeIoBuffer",
"(",
"data",
")",
";",
"LOGGER",
".",
"... | Writes data to the proxy server.
@param nextFilter the next filter
@param data Data buffer to be written. | [
"Writes",
"data",
"to",
"the",
"proxy",
"server",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java#L99-L111 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java | AbstractProxyLogicHandler.setHandshakeComplete | protected final void setHandshakeComplete() {
synchronized (this) {
handshakeComplete = true;
}
ProxyIoSession proxyIoSession = getProxyIoSession();
proxyIoSession.getConnector()
.fireConnected(proxyIoSession.getSession())
.awaitUninterruptibl... | java | protected final void setHandshakeComplete() {
synchronized (this) {
handshakeComplete = true;
}
ProxyIoSession proxyIoSession = getProxyIoSession();
proxyIoSession.getConnector()
.fireConnected(proxyIoSession.getSession())
.awaitUninterruptibl... | [
"protected",
"final",
"void",
"setHandshakeComplete",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"handshakeComplete",
"=",
"true",
";",
"}",
"ProxyIoSession",
"proxyIoSession",
"=",
"getProxyIoSession",
"(",
")",
";",
"proxyIoSession",
".",
"getConnecto... | Signals that the handshake has finished. | [
"Signals",
"that",
"the",
"handshake",
"has",
"finished",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java#L126-L145 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java | AbstractProxyLogicHandler.flushPendingWriteRequests | protected synchronized void flushPendingWriteRequests() throws Exception {
LOGGER.debug(" flushPendingWriteRequests()");
if (writeRequestQueue == null) {
return;
}
Event scheduledWrite;
while ((scheduledWrite = writeRequestQueue.poll()) != null) {
LOGGER... | java | protected synchronized void flushPendingWriteRequests() throws Exception {
LOGGER.debug(" flushPendingWriteRequests()");
if (writeRequestQueue == null) {
return;
}
Event scheduledWrite;
while ((scheduledWrite = writeRequestQueue.poll()) != null) {
LOGGER... | [
"protected",
"synchronized",
"void",
"flushPendingWriteRequests",
"(",
")",
"throws",
"Exception",
"{",
"LOGGER",
".",
"debug",
"(",
"\" flushPendingWriteRequests()\"",
")",
";",
"if",
"(",
"writeRequestQueue",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Event",
... | Send any write requests which were queued whilst waiting for handshaking to complete. | [
"Send",
"any",
"write",
"requests",
"which",
"were",
"queued",
"whilst",
"waiting",
"for",
"handshaking",
"to",
"complete",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java#L150-L168 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java | AbstractProxyLogicHandler.enqueueWriteRequest | public synchronized void enqueueWriteRequest(final NextFilter nextFilter,
final WriteRequest writeRequest) {
if (writeRequestQueue == null) {
writeRequestQueue = new LinkedList<>();
}
writeRequestQueue.offer(new Event(nextFilter, writeRequest));
} | java | public synchronized void enqueueWriteRequest(final NextFilter nextFilter,
final WriteRequest writeRequest) {
if (writeRequestQueue == null) {
writeRequestQueue = new LinkedList<>();
}
writeRequestQueue.offer(new Event(nextFilter, writeRequest));
} | [
"public",
"synchronized",
"void",
"enqueueWriteRequest",
"(",
"final",
"NextFilter",
"nextFilter",
",",
"final",
"WriteRequest",
"writeRequest",
")",
"{",
"if",
"(",
"writeRequestQueue",
"==",
"null",
")",
"{",
"writeRequestQueue",
"=",
"new",
"LinkedList",
"<>",
... | Enqueue a message to be written once handshaking is complete. | [
"Enqueue",
"a",
"message",
"to",
"be",
"written",
"once",
"handshaking",
"is",
"complete",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/AbstractProxyLogicHandler.java#L173-L180 | train |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpSubjectSecurityFilter.java | HttpSubjectSecurityFilter.doMessageReceived | @Override
public void doMessageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception {
// GL.debug("http", getClass().getSimpleName() + " request received.");
if (! httpRequestMessageReceived(nextFilter, session, message)) return;
HttpRequestMessage httpReques... | java | @Override
public void doMessageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception {
// GL.debug("http", getClass().getSimpleName() + " request received.");
if (! httpRequestMessageReceived(nextFilter, session, message)) return;
HttpRequestMessage httpReques... | [
"@",
"Override",
"public",
"void",
"doMessageReceived",
"(",
"NextFilter",
"nextFilter",
",",
"IoSession",
"session",
",",
"Object",
"message",
")",
"throws",
"Exception",
"{",
"// GL.debug(\"http\", getClass().getSimpleName() + \" request received.\");",
"if",
"(",
"!",
... | Security code for subject-security LEGACY | [
"Security",
"code",
"for",
"subject",
"-",
"security",
"LEGACY"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpSubjectSecurityFilter.java#L96-L134 | train |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpSubjectSecurityFilter.java | HttpSubjectSecurityFilter.securityMessageReceived | void securityMessageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception {
final boolean loggerIsEnabled = logger != null && logger.isTraceEnabled();
if (! httpRequestMessageReceived(nextFilter, session, message)) return;
HttpRequestMessage httpRequest = (HttpReq... | java | void securityMessageReceived(NextFilter nextFilter, IoSession session, Object message) throws Exception {
final boolean loggerIsEnabled = logger != null && logger.isTraceEnabled();
if (! httpRequestMessageReceived(nextFilter, session, message)) return;
HttpRequestMessage httpRequest = (HttpReq... | [
"void",
"securityMessageReceived",
"(",
"NextFilter",
"nextFilter",
",",
"IoSession",
"session",
",",
"Object",
"message",
")",
"throws",
"Exception",
"{",
"final",
"boolean",
"loggerIsEnabled",
"=",
"logger",
"!=",
"null",
"&&",
"logger",
".",
"isTraceEnabled",
"... | Security code for subject-security going forward | [
"Security",
"code",
"for",
"subject",
"-",
"security",
"going",
"forward"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpSubjectSecurityFilter.java#L313-L385 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractHttpLogicHandler.java | AbstractHttpLogicHandler.writeRequest0 | private void writeRequest0(final NextFilter nextFilter,
final HttpProxyRequest request) {
try {
String data = request.toHttpString();
IoBuffer buf = IoBuffer.wrap(data.getBytes(getProxyIoSession()
.getCharsetName()));
LOGGER.debug(" write:\n... | java | private void writeRequest0(final NextFilter nextFilter,
final HttpProxyRequest request) {
try {
String data = request.toHttpString();
IoBuffer buf = IoBuffer.wrap(data.getBytes(getProxyIoSession()
.getCharsetName()));
LOGGER.debug(" write:\n... | [
"private",
"void",
"writeRequest0",
"(",
"final",
"NextFilter",
"nextFilter",
",",
"final",
"HttpProxyRequest",
"request",
")",
"{",
"try",
"{",
"String",
"data",
"=",
"request",
".",
"toHttpString",
"(",
")",
";",
"IoBuffer",
"buf",
"=",
"IoBuffer",
".",
"w... | Encodes a HTTP request and sends it to the proxy server.
@param nextFilter the next filter
@param request the http request | [
"Encodes",
"a",
"HTTP",
"request",
"and",
"sends",
"it",
"to",
"the",
"proxy",
"server",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractHttpLogicHandler.java#L326-L341 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractHttpLogicHandler.java | AbstractHttpLogicHandler.reconnect | private void reconnect(final NextFilter nextFilter,
final HttpProxyRequest request) {
LOGGER.debug("Reconnecting to proxy ...");
final ProxyIoSession proxyIoSession = getProxyIoSession();
// Fires reconnection
proxyIoSession.getConnector().connect(
new IoSes... | java | private void reconnect(final NextFilter nextFilter,
final HttpProxyRequest request) {
LOGGER.debug("Reconnecting to proxy ...");
final ProxyIoSession proxyIoSession = getProxyIoSession();
// Fires reconnection
proxyIoSession.getConnector().connect(
new IoSes... | [
"private",
"void",
"reconnect",
"(",
"final",
"NextFilter",
"nextFilter",
",",
"final",
"HttpProxyRequest",
"request",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Reconnecting to proxy ...\"",
")",
";",
"final",
"ProxyIoSession",
"proxyIoSession",
"=",
"getProxyIoSessio... | Method to reconnect to the proxy when it decides not to maintain the connection
during handshake.
@param nextFilter the next filter
@param request the http request | [
"Method",
"to",
"reconnect",
"to",
"the",
"proxy",
"when",
"it",
"decides",
"not",
"to",
"maintain",
"the",
"connection",
"during",
"handshake",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractHttpLogicHandler.java#L350-L379 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractHttpLogicHandler.java | AbstractHttpLogicHandler.decodeResponse | protected HttpProxyResponse decodeResponse(final String response)
throws Exception {
LOGGER.debug(" parseResponse()");
// Break response into lines
String[] responseLines = response.split(HttpProxyConstants.CRLF);
// Status-Line = HTTP-Version SP Status-Code SP Reason-Phra... | java | protected HttpProxyResponse decodeResponse(final String response)
throws Exception {
LOGGER.debug(" parseResponse()");
// Break response into lines
String[] responseLines = response.split(HttpProxyConstants.CRLF);
// Status-Line = HTTP-Version SP Status-Code SP Reason-Phra... | [
"protected",
"HttpProxyResponse",
"decodeResponse",
"(",
"final",
"String",
"response",
")",
"throws",
"Exception",
"{",
"LOGGER",
".",
"debug",
"(",
"\" parseResponse()\"",
")",
";",
"// Break response into lines",
"String",
"[",
"]",
"responseLines",
"=",
"response... | Parse a HTTP response from the proxy server.
@param response The response string. | [
"Parse",
"a",
"HTTP",
"response",
"from",
"the",
"proxy",
"server",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractHttpLogicHandler.java#L386-L417 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/Utils.java | Utils.assertIOThread | public static void assertIOThread(Thread t, boolean flag) {
if (flag) {
assert t.equals(Thread.currentThread()) : "Management NOT on IO thread when expected"; // XXX testing
} else {
assert !(t.equals(Thread.currentThread())) : "Management on IO thread when not expected"; // XX... | java | public static void assertIOThread(Thread t, boolean flag) {
if (flag) {
assert t.equals(Thread.currentThread()) : "Management NOT on IO thread when expected"; // XXX testing
} else {
assert !(t.equals(Thread.currentThread())) : "Management on IO thread when not expected"; // XX... | [
"public",
"static",
"void",
"assertIOThread",
"(",
"Thread",
"t",
",",
"boolean",
"flag",
")",
"{",
"if",
"(",
"flag",
")",
"{",
"assert",
"t",
".",
"equals",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
":",
"\"Management NOT on IO thread when expect... | means we expect that we are NOT. | [
"means",
"we",
"expect",
"that",
"we",
"are",
"NOT",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/Utils.java#L101-L107 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/Utils.java | Utils.sumFutures | public static long sumFutures(List<Future<Object>> futures) {
long total = 0;
for (Future<Object> f : futures) {
try {
total += (Long) f.get();
} catch (Exception ignore) {
System.out.println("### sumFutures got exception!");
}
... | java | public static long sumFutures(List<Future<Object>> futures) {
long total = 0;
for (Future<Object> f : futures) {
try {
total += (Long) f.get();
} catch (Exception ignore) {
System.out.println("### sumFutures got exception!");
}
... | [
"public",
"static",
"long",
"sumFutures",
"(",
"List",
"<",
"Future",
"<",
"Object",
">",
">",
"futures",
")",
"{",
"long",
"total",
"=",
"0",
";",
"for",
"(",
"Future",
"<",
"Object",
">",
"f",
":",
"futures",
")",
"{",
"try",
"{",
"total",
"+=",
... | This must NOT run on any IO worker thread | [
"This",
"must",
"NOT",
"run",
"on",
"any",
"IO",
"worker",
"thread"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/Utils.java#L117-L129 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/Utils.java | Utils.makeJSONArrayString | public static String makeJSONArrayString(Object[] values) {
// Since they won't change during a run, compute the JSON value for the
// summary data fields (an array where all field names are wrapped in quotes
StringBuilder buf = new StringBuilder();
int numVals = values.length;
... | java | public static String makeJSONArrayString(Object[] values) {
// Since they won't change during a run, compute the JSON value for the
// summary data fields (an array where all field names are wrapped in quotes
StringBuilder buf = new StringBuilder();
int numVals = values.length;
... | [
"public",
"static",
"String",
"makeJSONArrayString",
"(",
"Object",
"[",
"]",
"values",
")",
"{",
"// Since they won't change during a run, compute the JSON value for the",
"// summary data fields (an array where all field names are wrapped in quotes",
"StringBuilder",
"buf",
"=",
"n... | Given an array of strings, return a string that equals the output of creating a JSONArray and then stringifying it.
@param values
@return | [
"Given",
"an",
"array",
"of",
"strings",
"return",
"a",
"string",
"that",
"equals",
"the",
"output",
"of",
"creating",
"a",
"JSONArray",
"and",
"then",
"stringifying",
"it",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/Utils.java#L147-L165 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeWriter.java | CompositeByteArrayRelativeWriter.flushTo | public void flushTo( int index )
{
ByteArray removed = cba.removeTo( index );
flusher.flush( removed );
} | java | public void flushTo( int index )
{
ByteArray removed = cba.removeTo( index );
flusher.flush( removed );
} | [
"public",
"void",
"flushTo",
"(",
"int",
"index",
")",
"{",
"ByteArray",
"removed",
"=",
"cba",
".",
"removeTo",
"(",
"index",
")",
";",
"flusher",
".",
"flush",
"(",
"removed",
")",
";",
"}"
] | Flush to the given index. | [
"Flush",
"to",
"the",
"given",
"index",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeWriter.java#L165-L169 | train |
kaazing/gateway | mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java | AbstractNioWorker.messageReceived | public void messageReceived(AbstractNioChannel<?> channel, ChannelEvent event) {
boolean written = readQueue.offer(event);
if (!written) {
noDroppedMessages++;
if (noDroppedMessages%10000 == 0) {
if (LOGGER.isInfoEnabled()) {
String msg = "UDP ... | java | public void messageReceived(AbstractNioChannel<?> channel, ChannelEvent event) {
boolean written = readQueue.offer(event);
if (!written) {
noDroppedMessages++;
if (noDroppedMessages%10000 == 0) {
if (LOGGER.isInfoEnabled()) {
String msg = "UDP ... | [
"public",
"void",
"messageReceived",
"(",
"AbstractNioChannel",
"<",
"?",
">",
"channel",
",",
"ChannelEvent",
"event",
")",
"{",
"boolean",
"written",
"=",
"readQueue",
".",
"offer",
"(",
"event",
")",
";",
"if",
"(",
"!",
"written",
")",
"{",
"noDroppedM... | This method is called from the boss thread | [
"This",
"method",
"is",
"called",
"from",
"the",
"boss",
"thread"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/jboss/netty/channel/socket/nio/AbstractNioWorker.java#L649-L668 | train |
kaazing/gateway | service/update.check/src/main/java/org/kaazing/gateway/service/update/check/GatewayVersion.java | GatewayVersion.parseGatewayVersion | public static GatewayVersion parseGatewayVersion(String version) throws Exception {
if ("develop-SNAPSHOT".equals(version)) {
return new GatewayVersion(0, 0, 0);
} else {
String regex = "(?<major>[0-9]+)\\.(?<minor>[0-9]+)\\.(?<patch>[0-9]+)-?(?<rc>[RC0-9{3}]*)";
Patt... | java | public static GatewayVersion parseGatewayVersion(String version) throws Exception {
if ("develop-SNAPSHOT".equals(version)) {
return new GatewayVersion(0, 0, 0);
} else {
String regex = "(?<major>[0-9]+)\\.(?<minor>[0-9]+)\\.(?<patch>[0-9]+)-?(?<rc>[RC0-9{3}]*)";
Patt... | [
"public",
"static",
"GatewayVersion",
"parseGatewayVersion",
"(",
"String",
"version",
")",
"throws",
"Exception",
"{",
"if",
"(",
"\"develop-SNAPSHOT\"",
".",
"equals",
"(",
"version",
")",
")",
"{",
"return",
"new",
"GatewayVersion",
"(",
"0",
",",
"0",
",",... | Parses a GatewayVersion from a String
@param version
@return
@throws Exception | [
"Parses",
"a",
"GatewayVersion",
"from",
"a",
"String"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/update.check/src/main/java/org/kaazing/gateway/service/update/check/GatewayVersion.java#L92-L109 | train |
kaazing/gateway | service/proxy/src/main/java/org/kaazing/gateway/service/proxy/ServiceConnectManager.java | ServiceConnectManager.start | public void start() {
IoFutureListener<ConnectFuture> tmpConnectListener;
if (interval > 0) {
tmpConnectListener = new IoFutureListener<ConnectFuture>() {
@Override
public void operationComplete(ConnectFuture future) {
heartbeatFilter.setSe... | java | public void start() {
IoFutureListener<ConnectFuture> tmpConnectListener;
if (interval > 0) {
tmpConnectListener = new IoFutureListener<ConnectFuture>() {
@Override
public void operationComplete(ConnectFuture future) {
heartbeatFilter.setSe... | [
"public",
"void",
"start",
"(",
")",
"{",
"IoFutureListener",
"<",
"ConnectFuture",
">",
"tmpConnectListener",
";",
"if",
"(",
"interval",
">",
"0",
")",
"{",
"tmpConnectListener",
"=",
"new",
"IoFutureListener",
"<",
"ConnectFuture",
">",
"(",
")",
"{",
"@"... | Start the connection manager so that any pre-connections are established. | [
"Start",
"the",
"connection",
"manager",
"so",
"that",
"any",
"pre",
"-",
"connections",
"are",
"established",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/proxy/src/main/java/org/kaazing/gateway/service/proxy/ServiceConnectManager.java#L141-L181 | train |
kaazing/gateway | service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/ConflictResolverUtils.java | ConflictResolverUtils.resolveConflicts | public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) {
for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) {
Directive generalDirective = entry.getKey();
String generalValue = entry.getValue();
... | java | public static void resolveConflicts(PatternCacheControl specificPattern, PatternCacheControl generalPattern) {
for (Entry<Directive, String> entry : generalPattern.getDirectives().entrySet()) {
Directive generalDirective = entry.getKey();
String generalValue = entry.getValue();
... | [
"public",
"static",
"void",
"resolveConflicts",
"(",
"PatternCacheControl",
"specificPattern",
",",
"PatternCacheControl",
"generalPattern",
")",
"{",
"for",
"(",
"Entry",
"<",
"Directive",
",",
"String",
">",
"entry",
":",
"generalPattern",
".",
"getDirectives",
"(... | Resolves directive conflicts between two PatternCacheControl objects
@param specificPattern - the pattern which can be included in the second one
@param generalPattern - the pattern which includes the first one | [
"Resolves",
"directive",
"conflicts",
"between",
"two",
"PatternCacheControl",
"objects"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/ConflictResolverUtils.java#L52-L62 | train |
kaazing/gateway | service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/ConflictResolverUtils.java | ConflictResolverUtils.resolveValueConflicts | private static void resolveValueConflicts(Directive directive, String generalValue, PatternCacheControl specificPattern) {
long generalPatternValue = Long.parseLong(generalValue);
if (specificPattern.hasDirective(directive)) {
long specificPatternValue = Long.parseLong(specificPattern.getDir... | java | private static void resolveValueConflicts(Directive directive, String generalValue, PatternCacheControl specificPattern) {
long generalPatternValue = Long.parseLong(generalValue);
if (specificPattern.hasDirective(directive)) {
long specificPatternValue = Long.parseLong(specificPattern.getDir... | [
"private",
"static",
"void",
"resolveValueConflicts",
"(",
"Directive",
"directive",
",",
"String",
"generalValue",
",",
"PatternCacheControl",
"specificPattern",
")",
"{",
"long",
"generalPatternValue",
"=",
"Long",
".",
"parseLong",
"(",
"generalValue",
")",
";",
... | Resolves the conflicts for a given directive between the general pattern and the specific PatternCacheControl
@param directive
@param generalValue
@param specificPattern | [
"Resolves",
"the",
"conflicts",
"for",
"a",
"given",
"directive",
"between",
"the",
"general",
"pattern",
"and",
"the",
"specific",
"PatternCacheControl"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/http.directory/src/main/java/org/kaazing/gateway/service/http/directory/cachecontrol/ConflictResolverUtils.java#L70-L80 | train |
kaazing/gateway | mina.core/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java | AbstractPropertyAccessor.getProperty | @Override
public final Object getProperty(Map context, Object target, Object oname)
throws OgnlException {
return super.getProperty(context, target, oname);
} | java | @Override
public final Object getProperty(Map context, Object target, Object oname)
throws OgnlException {
return super.getProperty(context, target, oname);
} | [
"@",
"Override",
"public",
"final",
"Object",
"getProperty",
"(",
"Map",
"context",
",",
"Object",
"target",
",",
"Object",
"oname",
")",
"throws",
"OgnlException",
"{",
"return",
"super",
".",
"getProperty",
"(",
"context",
",",
"target",
",",
"oname",
")",... | to override them. | [
"to",
"override",
"them",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/integration-ognl/src/main/java/org/apache/mina/integration/ognl/AbstractPropertyAccessor.java#L110-L114 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java | StringUtilities.skipLws | private static int skipLws(byte[] buf, int start) {
int i;
for (i = start; i < buf.length; i++) {
if (!isLws(buf[i])) {
return i;
}
}
return i;
} | java | private static int skipLws(byte[] buf, int start) {
int i;
for (i = start; i < buf.length; i++) {
if (!isLws(buf[i])) {
return i;
}
}
return i;
} | [
"private",
"static",
"int",
"skipLws",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"start",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"start",
";",
"i",
"<",
"buf",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"isLws",
"(",
... | Skip all linear white spaces
@param buf the buf which is being scanned for lws
@param start the offset to start at
@return the next position in buf which isn't a lws character | [
"Skip",
"all",
"linear",
"white",
"spaces"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java#L270-L280 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java | StringUtilities.addValueToHeader | public static void addValueToHeader(Map<String, List<String>> headers,
String key, String value, boolean singleValued) {
List<String> values = headers.get(key);
if (values == null) {
values = new ArrayList<>(1);
headers.put(key, values);
}
if (single... | java | public static void addValueToHeader(Map<String, List<String>> headers,
String key, String value, boolean singleValued) {
List<String> values = headers.get(key);
if (values == null) {
values = new ArrayList<>(1);
headers.put(key, values);
}
if (single... | [
"public",
"static",
"void",
"addValueToHeader",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
",",
"String",
"key",
",",
"String",
"value",
",",
"boolean",
"singleValued",
")",
"{",
"List",
"<",
"String",
">",
"values",
"=",... | Adds an header to the provided map of headers.
@param headers the http headers map
@param key the name of the new header to add
@param value the value of the added header
@param singleValued if true and the map already contains one value
then it is replaced by the new value. Otherwise it simply adds a new
value to thi... | [
"Adds",
"an",
"header",
"to",
"the",
"provided",
"map",
"of",
"headers",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/utils/StringUtilities.java#L333-L347 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractAuthLogicHandler.java | AbstractAuthLogicHandler.addKeepAliveHeaders | public static void addKeepAliveHeaders(Map<String, List<String>> headers) {
StringUtilities.addValueToHeader(headers, "Keep-Alive",
HttpProxyConstants.DEFAULT_KEEP_ALIVE_TIME, true);
StringUtilities.addValueToHeader(headers, "Proxy-Connection",
"keep-Alive", true);
} | java | public static void addKeepAliveHeaders(Map<String, List<String>> headers) {
StringUtilities.addValueToHeader(headers, "Keep-Alive",
HttpProxyConstants.DEFAULT_KEEP_ALIVE_TIME, true);
StringUtilities.addValueToHeader(headers, "Proxy-Connection",
"keep-Alive", true);
} | [
"public",
"static",
"void",
"addKeepAliveHeaders",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"headers",
")",
"{",
"StringUtilities",
".",
"addValueToHeader",
"(",
"headers",
",",
"\"Keep-Alive\"",
",",
"HttpProxyConstants",
".",
"DEFAULT_K... | Try to force proxy connection to be kept alive.
@param headers the request headers | [
"Try",
"to",
"force",
"proxy",
"connection",
"to",
"be",
"kept",
"alive",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/AbstractAuthLogicHandler.java#L110-L115 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java | AwsUtils.getAccountId | public static String getAccountId() throws IOException {
// Get the MAC address of the machine.
String macUrl = getMetadataUrl() + "/network/interfaces/macs/";
String mac = invokeUrl(macUrl).trim();
// Use the MAC address to obtain the owner-id or the
// AWS AccountId.
S... | java | public static String getAccountId() throws IOException {
// Get the MAC address of the machine.
String macUrl = getMetadataUrl() + "/network/interfaces/macs/";
String mac = invokeUrl(macUrl).trim();
// Use the MAC address to obtain the owner-id or the
// AWS AccountId.
S... | [
"public",
"static",
"String",
"getAccountId",
"(",
")",
"throws",
"IOException",
"{",
"// Get the MAC address of the machine.",
"String",
"macUrl",
"=",
"getMetadataUrl",
"(",
")",
"+",
"\"/network/interfaces/macs/\"",
";",
"String",
"mac",
"=",
"invokeUrl",
"(",
"mac... | Returns the AccountId of the user who is running the instance.
@return String representing the AccountId or the owner-id
@throws java.io.IOException if failed to retrieve the AccountId using the
Cloud infrastructure | [
"Returns",
"the",
"AccountId",
"of",
"the",
"user",
"who",
"is",
"running",
"the",
"instance",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java#L68-L80 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java | AwsUtils.getRegion | public static String getRegion() throws IOException {
String url = getMetadataUrl() + "/placement/availability-zone";
String zone = invokeUrl(url);
zone = zone.trim();
// In case of AWS, the zone includes an extra character
// at the end such as "us-east-1a", "us-east-1b", "eu-w... | java | public static String getRegion() throws IOException {
String url = getMetadataUrl() + "/placement/availability-zone";
String zone = invokeUrl(url);
zone = zone.trim();
// In case of AWS, the zone includes an extra character
// at the end such as "us-east-1a", "us-east-1b", "eu-w... | [
"public",
"static",
"String",
"getRegion",
"(",
")",
"throws",
"IOException",
"{",
"String",
"url",
"=",
"getMetadataUrl",
"(",
")",
"+",
"\"/placement/availability-zone\"",
";",
"String",
"zone",
"=",
"invokeUrl",
"(",
"url",
")",
";",
"zone",
"=",
"zone",
... | Returns the region in which the instance is running.
@return String representing the region where the instance is
running
@throws java.io.IOException if failed to retrieve the region information
using the Cloud infrastructure | [
"Returns",
"the",
"region",
"in",
"which",
"the",
"instance",
"is",
"running",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java#L100-L112 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java | AwsUtils.getSecurityGroupName | public static String getSecurityGroupName() throws IOException {
// For AWS, we are returning the first security group from the list
// that is obtained by querying the meta-data.
String url = getMetadataUrl() + "/security-groups";
String groups = invokeUrl(url);
if ((groups ==... | java | public static String getSecurityGroupName() throws IOException {
// For AWS, we are returning the first security group from the list
// that is obtained by querying the meta-data.
String url = getMetadataUrl() + "/security-groups";
String groups = invokeUrl(url);
if ((groups ==... | [
"public",
"static",
"String",
"getSecurityGroupName",
"(",
")",
"throws",
"IOException",
"{",
"// For AWS, we are returning the first security group from the list",
"// that is obtained by querying the meta-data.",
"String",
"url",
"=",
"getMetadataUrl",
"(",
")",
"+",
"\"/securi... | Returns the name of the security group from the list that is
obtained from the resource vendor. An instance may belong to multiple
security groups. And, the list of security groups obtained from the
vendor may not be ordered. If the vendor supports the notion of
a default security group, then that should be returned. O... | [
"Returns",
"the",
"name",
"of",
"the",
"security",
"group",
"from",
"the",
"list",
"that",
"is",
"obtained",
"from",
"the",
"resource",
"vendor",
".",
"An",
"instance",
"may",
"belong",
"to",
"multiple",
"security",
"groups",
".",
"And",
"the",
"list",
"of... | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java#L125-L139 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java | AwsUtils.getVersion2SignedRequest | public static String getVersion2SignedRequest(String requestMethod,
String protocol,
String endpoint,
String requestUR... | java | public static String getVersion2SignedRequest(String requestMethod,
String protocol,
String endpoint,
String requestUR... | [
"public",
"static",
"String",
"getVersion2SignedRequest",
"(",
"String",
"requestMethod",
",",
"String",
"protocol",
",",
"String",
"endpoint",
",",
"String",
"requestURI",
",",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"String",
"awsAccessKeyId",
... | This method returns a complete signed request using HmaSHA256 algorithm
using the "SignatureVersion 2" scheme. Currently, this method creates
"SignatureVersion 2" based signed requests ONLY for the HTTP "GET"
method. It's the callers the responsibility such as "Action" and such
based on the REST API that they are tryin... | [
"This",
"method",
"returns",
"a",
"complete",
"signed",
"request",
"using",
"HmaSHA256",
"algorithm",
"using",
"the",
"SignatureVersion",
"2",
"scheme",
".",
"Currently",
"this",
"method",
"creates",
"SignatureVersion",
"2",
"based",
"signed",
"requests",
"ONLY",
... | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java#L253-L289 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java | AwsUtils.invokeUrl | public static String invokeUrl(String url) throws IOException {
if (url == null) {
throw new IllegalArgumentException("Null parameter passed in");
}
URL urlObj;
InputStream inStream = null;
String response = null;
HttpURLConnect... | java | public static String invokeUrl(String url) throws IOException {
if (url == null) {
throw new IllegalArgumentException("Null parameter passed in");
}
URL urlObj;
InputStream inStream = null;
String response = null;
HttpURLConnect... | [
"public",
"static",
"String",
"invokeUrl",
"(",
"String",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null parameter passed in\"",
")",
";",
"}",
"URL",
"urlObj",
";",
... | This is a generic method to invoke the REST API. The URL that is passed
in should result in a signed request with the "Signature" query parameter
included. It's the caller's responsibility to deal with the return value
which may be a simple string or a XML response.
@param url represents a signed request wit... | [
"This",
"is",
"a",
"generic",
"method",
"to",
"invoke",
"the",
"REST",
"API",
".",
"The",
"URL",
"that",
"is",
"passed",
"in",
"should",
"result",
"in",
"a",
"signed",
"request",
"with",
"the",
"Signature",
"query",
"parameter",
"included",
".",
"It",
"s... | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java#L302-L373 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java | AwsUtils.rfc3986Conformance | private static String rfc3986Conformance(String s) {
assert s != null;
String out;
if (s == null) {
return null;
}
try {
out = URLEncoder.encode(s, UTF8_CHARSET).replace("+", "%20")
.replace("*", "%2A").replace("%7E", "~");
}... | java | private static String rfc3986Conformance(String s) {
assert s != null;
String out;
if (s == null) {
return null;
}
try {
out = URLEncoder.encode(s, UTF8_CHARSET).replace("+", "%20")
.replace("*", "%2A").replace("%7E", "~");
}... | [
"private",
"static",
"String",
"rfc3986Conformance",
"(",
"String",
"s",
")",
"{",
"assert",
"s",
"!=",
"null",
";",
"String",
"out",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"out",
"=",
"URLEncoder",
".",
... | Based on RFC 3986 and AWS doc, further encode certain characters. | [
"Based",
"on",
"RFC",
"3986",
"and",
"AWS",
"doc",
"further",
"encode",
"certain",
"characters",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/aws/AwsUtils.java#L560-L576 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MMFMonitoringDataManager.java | MMFMonitoringDataManager.createMonitoringFile | private void createMonitoringFile() {
String monitoringDirName = getMonitoringDirName();
monitoringDir = new File(monitoringDirName);
File monitoringFile = new File(monitoringDir, gatewayId);
IoUtil.deleteIfExists(monitoringFile);
monitorFileWriter.initialize(monitoringFile);
... | java | private void createMonitoringFile() {
String monitoringDirName = getMonitoringDirName();
monitoringDir = new File(monitoringDirName);
File monitoringFile = new File(monitoringDir, gatewayId);
IoUtil.deleteIfExists(monitoringFile);
monitorFileWriter.initialize(monitoringFile);
... | [
"private",
"void",
"createMonitoringFile",
"(",
")",
"{",
"String",
"monitoringDirName",
"=",
"getMonitoringDirName",
"(",
")",
";",
"monitoringDir",
"=",
"new",
"File",
"(",
"monitoringDirName",
")",
";",
"File",
"monitoringFile",
"=",
"new",
"File",
"(",
"moni... | Method creating the monitoring MMF | [
"Method",
"creating",
"the",
"monitoring",
"MMF"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MMFMonitoringDataManager.java#L79-L86 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MMFMonitoringDataManager.java | MMFMonitoringDataManager.getMonitoringDirName | private String getMonitoringDirName() {
String monitoringDirName = IoUtil.tmpDirName() + MONITOR_DIR_NAME;
if (LINUX.equalsIgnoreCase(System.getProperty(OS_NAME_SYSTEM_PROPERTY))) {
final File devShmDir = new File(LINUX_DEV_SHM_DIRECTORY);
if (devShmDir.exists()) {
... | java | private String getMonitoringDirName() {
String monitoringDirName = IoUtil.tmpDirName() + MONITOR_DIR_NAME;
if (LINUX.equalsIgnoreCase(System.getProperty(OS_NAME_SYSTEM_PROPERTY))) {
final File devShmDir = new File(LINUX_DEV_SHM_DIRECTORY);
if (devShmDir.exists()) {
... | [
"private",
"String",
"getMonitoringDirName",
"(",
")",
"{",
"String",
"monitoringDirName",
"=",
"IoUtil",
".",
"tmpDirName",
"(",
")",
"+",
"MONITOR_DIR_NAME",
";",
"if",
"(",
"LINUX",
".",
"equalsIgnoreCase",
"(",
"System",
".",
"getProperty",
"(",
"OS_NAME_SYS... | This method is used to compute the monitoring directory name which will be used by Agrona in order
to create a file in which to write the data in shared memory.
The monitoring directory will be dependent of the operating system.
For Linux we will use the OS implementation of the shared memory. So the directory will b... | [
"This",
"method",
"is",
"used",
"to",
"compute",
"the",
"monitoring",
"directory",
"name",
"which",
"will",
"be",
"used",
"by",
"Agrona",
"in",
"order",
"to",
"create",
"a",
"file",
"in",
"which",
"to",
"write",
"the",
"data",
"in",
"shared",
"memory",
"... | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MMFMonitoringDataManager.java#L100-L112 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/der/DerId.java | DerId.decode | public static DerId decode(ByteBuffer buf) {
if (buf == null || buf.remaining() == 0) {
throw new IllegalArgumentException("Null or empty buffer");
}
DerId id = new DerId();
byte first = buf.get(); // first octet
// Bits 8 and 7 represent the tag class
id.t... | java | public static DerId decode(ByteBuffer buf) {
if (buf == null || buf.remaining() == 0) {
throw new IllegalArgumentException("Null or empty buffer");
}
DerId id = new DerId();
byte first = buf.get(); // first octet
// Bits 8 and 7 represent the tag class
id.t... | [
"public",
"static",
"DerId",
"decode",
"(",
"ByteBuffer",
"buf",
")",
"{",
"if",
"(",
"buf",
"==",
"null",
"||",
"buf",
".",
"remaining",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null or empty buffer\"",
")",
";",
... | Decodes identifier octets from a DER-encoded message.
@param buf
the buffer containing the DER-encoded message
@return the DER identifier | [
"Decodes",
"identifier",
"octets",
"from",
"a",
"DER",
"-",
"encoded",
"message",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/der/DerId.java#L86-L121 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/der/DerId.java | DerId.matches | public boolean matches(TagClass tagClass, EncodingType encodingType, int tagNumber) {
return this.tagClass == tagClass && this.encodingType == encodingType && this.tagNumber == tagNumber;
} | java | public boolean matches(TagClass tagClass, EncodingType encodingType, int tagNumber) {
return this.tagClass == tagClass && this.encodingType == encodingType && this.tagNumber == tagNumber;
} | [
"public",
"boolean",
"matches",
"(",
"TagClass",
"tagClass",
",",
"EncodingType",
"encodingType",
",",
"int",
"tagNumber",
")",
"{",
"return",
"this",
".",
"tagClass",
"==",
"tagClass",
"&&",
"this",
".",
"encodingType",
"==",
"encodingType",
"&&",
"this",
"."... | Tests whether this DER identifier matches the specified tag class, encoding type and tag number.
@param tagClass
the tag class to match against
@param encodingType
the encoding type to match against
@param tagNumber
the tag number to match against
@return whether there's a match | [
"Tests",
"whether",
"this",
"DER",
"identifier",
"matches",
"the",
"specified",
"tag",
"class",
"encoding",
"type",
"and",
"tag",
"number",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/der/DerId.java#L134-L136 | train |
kaazing/gateway | mina.netty/src/main/java/org/kaazing/mina/core/session/AbstractIoSessionEx.java | AbstractIoSessionEx.setSubject | protected void setSubject(Subject subject) {
Subject currentSubject = this.subject;
if (!(currentSubject == null && subject == null)) {
this.subject = subject;
if (currentThread() == ioThread) {
notifySubjectChanged(subject);
}
else {
... | java | protected void setSubject(Subject subject) {
Subject currentSubject = this.subject;
if (!(currentSubject == null && subject == null)) {
this.subject = subject;
if (currentThread() == ioThread) {
notifySubjectChanged(subject);
}
else {
... | [
"protected",
"void",
"setSubject",
"(",
"Subject",
"subject",
")",
"{",
"Subject",
"currentSubject",
"=",
"this",
".",
"subject",
";",
"if",
"(",
"!",
"(",
"currentSubject",
"==",
"null",
"&&",
"subject",
"==",
"null",
")",
")",
"{",
"this",
".",
"subjec... | Memorizes the Subject representing the current logged on user and fires any
currently registered SubjectChangeListeners | [
"Memorizes",
"the",
"Subject",
"representing",
"the",
"current",
"logged",
"on",
"user",
"and",
"fires",
"any",
"currently",
"registered",
"SubjectChangeListeners"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/core/session/AbstractIoSessionEx.java#L242-L259 | train |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/monitoring/entity/manager/impl/ServiceCounterManagerImpl.java | ServiceCounterManagerImpl.initializeSessionCounters | private void initializeSessionCounters() {
if (monitoringEntityFactory == null) {
return;
}
numberOfSessionsCounter = monitoringEntityFactory.makeLongMonitoringCounter(CURRENT_NUMBER_OF_SESSIONS);
numberOfNativeSessionsCounter = monitoringEntityFactory.makeLongMonitoringCount... | java | private void initializeSessionCounters() {
if (monitoringEntityFactory == null) {
return;
}
numberOfSessionsCounter = monitoringEntityFactory.makeLongMonitoringCounter(CURRENT_NUMBER_OF_SESSIONS);
numberOfNativeSessionsCounter = monitoringEntityFactory.makeLongMonitoringCount... | [
"private",
"void",
"initializeSessionCounters",
"(",
")",
"{",
"if",
"(",
"monitoringEntityFactory",
"==",
"null",
")",
"{",
"return",
";",
"}",
"numberOfSessionsCounter",
"=",
"monitoringEntityFactory",
".",
"makeLongMonitoringCounter",
"(",
"CURRENT_NUMBER_OF_SESSIONS",... | Method initializing the service session counters
@return | [
"Method",
"initializing",
"the",
"service",
"session",
"counters"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/entity/manager/impl/ServiceCounterManagerImpl.java#L134-L146 | train |
kaazing/gateway | mina.netty/src/main/java/org/kaazing/mina/core/future/DefaultIoFutureEx.java | DefaultIoFutureEx.reset | @Override
public void reset(IoSession session) {
synchronized (lock) {
if (!ready && this.session != null) {
throw new IllegalStateException("Cannot reset a future that has not yet completed");
}
this.session = session;
this.firstListener = nu... | java | @Override
public void reset(IoSession session) {
synchronized (lock) {
if (!ready && this.session != null) {
throw new IllegalStateException("Cannot reset a future that has not yet completed");
}
this.session = session;
this.firstListener = nu... | [
"@",
"Override",
"public",
"void",
"reset",
"(",
"IoSession",
"session",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"!",
"ready",
"&&",
"this",
".",
"session",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cann... | Call this method to reuse a future after it has been completed | [
"Call",
"this",
"method",
"to",
"reuse",
"a",
"future",
"after",
"it",
"has",
"been",
"completed"
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/core/future/DefaultIoFutureEx.java#L75-L89 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/der/DerUtils.java | DerUtils.decodeLength | public static int decodeLength(ByteBuffer buf) {
if (buf == null || buf.remaining() == 0) {
throw new IllegalArgumentException("Null or empty buffer");
}
int len = 0;
byte first = buf.get();
if (first >> 7 == 0) {
// Bit 8 is zero: Short form
... | java | public static int decodeLength(ByteBuffer buf) {
if (buf == null || buf.remaining() == 0) {
throw new IllegalArgumentException("Null or empty buffer");
}
int len = 0;
byte first = buf.get();
if (first >> 7 == 0) {
// Bit 8 is zero: Short form
... | [
"public",
"static",
"int",
"decodeLength",
"(",
"ByteBuffer",
"buf",
")",
"{",
"if",
"(",
"buf",
"==",
"null",
"||",
"buf",
".",
"remaining",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null or empty buffer\"",
")",
"... | Decode octets and extract the length information from a DER-encoded message.
@param buf
the DER-encoded data buffer with position immediately after the DER-identifier octets
@return the length of the DER-encoded contents | [
"Decode",
"octets",
"and",
"extract",
"the",
"length",
"information",
"from",
"a",
"DER",
"-",
"encoded",
"message",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/der/DerUtils.java#L34-L60 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/der/DerUtils.java | DerUtils.decodeIdAndLength | public static DerId decodeIdAndLength(ByteBuffer buf) {
DerId id = DerId.decode(buf);
DerUtils.decodeLength(buf);
return id;
} | java | public static DerId decodeIdAndLength(ByteBuffer buf) {
DerId id = DerId.decode(buf);
DerUtils.decodeLength(buf);
return id;
} | [
"public",
"static",
"DerId",
"decodeIdAndLength",
"(",
"ByteBuffer",
"buf",
")",
"{",
"DerId",
"id",
"=",
"DerId",
".",
"decode",
"(",
"buf",
")",
";",
"DerUtils",
".",
"decodeLength",
"(",
"buf",
")",
";",
"return",
"id",
";",
"}"
] | Decodes ID and length octets from a DER-encoded message.
@param buf
the buffer with the DER-encoded message
@return the ID | [
"Decodes",
"ID",
"and",
"length",
"octets",
"from",
"a",
"DER",
"-",
"encoded",
"message",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/der/DerUtils.java#L69-L73 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/der/DerUtils.java | DerUtils.encodeIdAndLength | public static int encodeIdAndLength(DerId.TagClass tagClass, DerId.EncodingType encodingType, int tagNumber,
int contentLength, ByteBuffer buf) {
int origPos = buf.position();
int pos = buf.position();
// Write out length octets
if (contentLength < 0) {
throw new... | java | public static int encodeIdAndLength(DerId.TagClass tagClass, DerId.EncodingType encodingType, int tagNumber,
int contentLength, ByteBuffer buf) {
int origPos = buf.position();
int pos = buf.position();
// Write out length octets
if (contentLength < 0) {
throw new... | [
"public",
"static",
"int",
"encodeIdAndLength",
"(",
"DerId",
".",
"TagClass",
"tagClass",
",",
"DerId",
".",
"EncodingType",
"encodingType",
",",
"int",
"tagNumber",
",",
"int",
"contentLength",
",",
"ByteBuffer",
"buf",
")",
"{",
"int",
"origPos",
"=",
"buf"... | DER-encode content into a provided buffer.
@param tagClass
the tag class
@param encodingType
the tag encoding type
@param tagNumber
the tag number
@param contentLength
the length of the content (presumed to be in the buffer)
@param buf
the buffer with sufficient space before the current position to add the length and ... | [
"DER",
"-",
"encode",
"content",
"into",
"a",
"provided",
"buffer",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/der/DerUtils.java#L90-L170 | train |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/der/DerUtils.java | DerUtils.sizeOf | public static int sizeOf(int tagNumber, int contentLength) {
if (tagNumber < 0 || contentLength < 0) {
throw new IllegalArgumentException("Invalid tagNumber/contentLength: " + tagNumber + ", " + contentLength);
}
int len = 0;
// ID octets
if (tagNumber <= 30) {
... | java | public static int sizeOf(int tagNumber, int contentLength) {
if (tagNumber < 0 || contentLength < 0) {
throw new IllegalArgumentException("Invalid tagNumber/contentLength: " + tagNumber + ", " + contentLength);
}
int len = 0;
// ID octets
if (tagNumber <= 30) {
... | [
"public",
"static",
"int",
"sizeOf",
"(",
"int",
"tagNumber",
",",
"int",
"contentLength",
")",
"{",
"if",
"(",
"tagNumber",
"<",
"0",
"||",
"contentLength",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid tagNumber/contentLength:... | Computes the DER-encoded size of content with a specified tag number.
@param tagNumber
the DER tag number in the identifier
@param contentLength
the length of the content in bytes
@return | [
"Computes",
"the",
"DER",
"-",
"encoded",
"size",
"of",
"content",
"with",
"a",
"specified",
"tag",
"number",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/der/DerUtils.java#L181-L206 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java | NamePreservingRunnable.run | public void run() {
Thread currentThread = Thread.currentThread();
String oldName = currentThread.getName();
if (newName != null) {
setName(currentThread, newName);
}
try {
runnable.run();
} finally {
setName(currentThread, oldName);
... | java | public void run() {
Thread currentThread = Thread.currentThread();
String oldName = currentThread.getName();
if (newName != null) {
setName(currentThread, newName);
}
try {
runnable.run();
} finally {
setName(currentThread, oldName);
... | [
"public",
"void",
"run",
"(",
")",
"{",
"Thread",
"currentThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"String",
"oldName",
"=",
"currentThread",
".",
"getName",
"(",
")",
";",
"if",
"(",
"newName",
"!=",
"null",
")",
"{",
"setName",
"(... | Run the runnable after having renamed the current thread's name
to the new name. When the runnable has completed, set back the
current thread name back to its origin. | [
"Run",
"the",
"runnable",
"after",
"having",
"renamed",
"the",
"current",
"thread",
"s",
"name",
"to",
"the",
"new",
"name",
".",
"When",
"the",
"runnable",
"has",
"completed",
"set",
"back",
"the",
"current",
"thread",
"name",
"back",
"to",
"its",
"origin... | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/util/NamePreservingRunnable.java#L52-L65 | train |
kaazing/gateway | mina.core/core/src/main/java/org/apache/mina/proxy/ProxyConnector.java | ProxyConnector.setProxyIoSession | public void setProxyIoSession(ProxyIoSession proxyIoSession) {
if (proxyIoSession == null) {
throw new NullPointerException("proxySession object cannot be null");
}
if (proxyIoSession.getProxyAddress() == null) {
throw new NullPointerException(
"proxy... | java | public void setProxyIoSession(ProxyIoSession proxyIoSession) {
if (proxyIoSession == null) {
throw new NullPointerException("proxySession object cannot be null");
}
if (proxyIoSession.getProxyAddress() == null) {
throw new NullPointerException(
"proxy... | [
"public",
"void",
"setProxyIoSession",
"(",
"ProxyIoSession",
"proxyIoSession",
")",
"{",
"if",
"(",
"proxyIoSession",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"proxySession object cannot be null\"",
")",
";",
"}",
"if",
"(",
"proxyIoSe... | Sets the proxy session object of this connector.
@param proxyIoSession the configuration of this connector. | [
"Sets",
"the",
"proxy",
"session",
"object",
"of",
"this",
"connector",
"."
] | 06017b19273109b3b992e528e702586446168d57 | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/ProxyConnector.java#L127-L140 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.