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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wisdom-framework/wisdom | framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java | ThymeleafTemplateCollector.configure | @Validate
public synchronized void configure() {
// Thymeleaf specifics
String mode = configuration.getWithDefault("application.template.thymeleaf.mode", "HTML5");
int ttl = configuration.getIntegerWithDefault("application.template.thymeleaf.ttl", 60 * 1000);
if (configuration.isDev... | java | @Validate
public synchronized void configure() {
// Thymeleaf specifics
String mode = configuration.getWithDefault("application.template.thymeleaf.mode", "HTML5");
int ttl = configuration.getIntegerWithDefault("application.template.thymeleaf.ttl", 60 * 1000);
if (configuration.isDev... | [
"@",
"Validate",
"public",
"synchronized",
"void",
"configure",
"(",
")",
"{",
"// Thymeleaf specifics",
"String",
"mode",
"=",
"configuration",
".",
"getWithDefault",
"(",
"\"application.template.thymeleaf.mode\"",
",",
"\"HTML5\"",
")",
";",
"int",
"ttl",
"=",
"co... | Initializes the thymeleaf template engine. | [
"Initializes",
"the",
"thymeleaf",
"template",
"engine",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java#L210-L247 | train |
wisdom-framework/wisdom | framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java | ThymeleafTemplateCollector.bindDialect | @Bind(optional = true, aggregate = true)
public synchronized void bindDialect(IDialect dialect) {
LOGGER.debug("Binding a new dialect using the prefix '{}' and containing {}",
dialect.getPrefix(),
dialect.getProcessors());
if (this.dialects.add(dialect)) {
... | java | @Bind(optional = true, aggregate = true)
public synchronized void bindDialect(IDialect dialect) {
LOGGER.debug("Binding a new dialect using the prefix '{}' and containing {}",
dialect.getPrefix(),
dialect.getProcessors());
if (this.dialects.add(dialect)) {
... | [
"@",
"Bind",
"(",
"optional",
"=",
"true",
",",
"aggregate",
"=",
"true",
")",
"public",
"synchronized",
"void",
"bindDialect",
"(",
"IDialect",
"dialect",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Binding a new dialect using the prefix '{}' and containing {}\"",
",... | A new dialect is now available.
@param dialect the dialect | [
"A",
"new",
"dialect",
"is",
"now",
"available",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java#L253-L266 | train |
wisdom-framework/wisdom | framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java | ThymeleafTemplateCollector.unbindDialect | @Unbind
public synchronized void unbindDialect(IDialect dialect) {
LOGGER.debug("Binding a new dialect {}, processors: {}", dialect.getPrefix(),
dialect.getProcessors());
if (this.dialects.remove(dialect)) {
configure();
for (Template template : getTemplates()... | java | @Unbind
public synchronized void unbindDialect(IDialect dialect) {
LOGGER.debug("Binding a new dialect {}, processors: {}", dialect.getPrefix(),
dialect.getProcessors());
if (this.dialects.remove(dialect)) {
configure();
for (Template template : getTemplates()... | [
"@",
"Unbind",
"public",
"synchronized",
"void",
"unbindDialect",
"(",
"IDialect",
"dialect",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Binding a new dialect {}, processors: {}\"",
",",
"dialect",
".",
"getPrefix",
"(",
")",
",",
"dialect",
".",
"getProcessors",
"... | A dialect has left.
@param dialect the dialect that has left | [
"A",
"dialect",
"has",
"left",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java#L272-L282 | train |
wisdom-framework/wisdom | framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java | ThymeleafTemplateCollector.getTemplateByResourceName | public ThymeLeafTemplateImplementation getTemplateByResourceName(String resourceName) {
Collection<ThymeLeafTemplateImplementation> list = registrations.keySet();
for (ThymeLeafTemplateImplementation template : list) {
if (template.fullName().endsWith(resourceName)
|| tem... | java | public ThymeLeafTemplateImplementation getTemplateByResourceName(String resourceName) {
Collection<ThymeLeafTemplateImplementation> list = registrations.keySet();
for (ThymeLeafTemplateImplementation template : list) {
if (template.fullName().endsWith(resourceName)
|| tem... | [
"public",
"ThymeLeafTemplateImplementation",
"getTemplateByResourceName",
"(",
"String",
"resourceName",
")",
"{",
"Collection",
"<",
"ThymeLeafTemplateImplementation",
">",
"list",
"=",
"registrations",
".",
"keySet",
"(",
")",
";",
"for",
"(",
"ThymeLeafTemplateImplemen... | Finds a template object from the given resource name. The first template matching the given name is returned.
@param resourceName the name
@return the template object. | [
"Finds",
"a",
"template",
"object",
"from",
"the",
"given",
"resource",
"name",
".",
"The",
"first",
"template",
"matching",
"the",
"given",
"name",
"is",
"returned",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java#L316-L328 | train |
wisdom-framework/wisdom | framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java | ThymeleafTemplateCollector.deleteTemplate | public void deleteTemplate(ThymeLeafTemplateImplementation template) {
// 1 - unregister the service
try {
ServiceRegistration reg = registrations.remove(template);
if (reg != null) {
reg.unregister();
}
} catch (Exception e) { //NOSONAR
... | java | public void deleteTemplate(ThymeLeafTemplateImplementation template) {
// 1 - unregister the service
try {
ServiceRegistration reg = registrations.remove(template);
if (reg != null) {
reg.unregister();
}
} catch (Exception e) { //NOSONAR
... | [
"public",
"void",
"deleteTemplate",
"(",
"ThymeLeafTemplateImplementation",
"template",
")",
"{",
"// 1 - unregister the service",
"try",
"{",
"ServiceRegistration",
"reg",
"=",
"registrations",
".",
"remove",
"(",
"template",
")",
";",
"if",
"(",
"reg",
"!=",
"null... | Deletes the given template. The service is unregistered, and the cache is cleared.
@param template the template | [
"Deletes",
"the",
"given",
"template",
".",
"The",
"service",
"is",
"unregistered",
"and",
"the",
"cache",
"is",
"cleared",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/ThymeleafTemplateCollector.java#L343-L363 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java | BundlePackager.bundle | public static void bundle(File basedir, File output, Reporter reporter) throws IOException {
ProjectScanner scanner = new ProjectScanner(basedir);
// Loads the properties inherited from Maven.
Properties instructions = readMavenProperties(basedir);
// Loads the properties from the BND f... | java | public static void bundle(File basedir, File output, Reporter reporter) throws IOException {
ProjectScanner scanner = new ProjectScanner(basedir);
// Loads the properties inherited from Maven.
Properties instructions = readMavenProperties(basedir);
// Loads the properties from the BND f... | [
"public",
"static",
"void",
"bundle",
"(",
"File",
"basedir",
",",
"File",
"output",
",",
"Reporter",
"reporter",
")",
"throws",
"IOException",
"{",
"ProjectScanner",
"scanner",
"=",
"new",
"ProjectScanner",
"(",
"basedir",
")",
";",
"// Loads the properties inher... | Creates the bundle.
@param basedir the project's base directory
@param output the output file
@throws IOException occurs when the bundle cannot be built correctly. | [
"Creates",
"the",
"bundle",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java#L55-L139 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java | BundlePackager.mergeExtraHeaders | private static Properties mergeExtraHeaders(File baseDir, Properties properties) throws IOException {
File extra = new File(baseDir, EXTRA_HEADERS_FILE);
return Instructions.merge(properties, extra);
} | java | private static Properties mergeExtraHeaders(File baseDir, Properties properties) throws IOException {
File extra = new File(baseDir, EXTRA_HEADERS_FILE);
return Instructions.merge(properties, extra);
} | [
"private",
"static",
"Properties",
"mergeExtraHeaders",
"(",
"File",
"baseDir",
",",
"Properties",
"properties",
")",
"throws",
"IOException",
"{",
"File",
"extra",
"=",
"new",
"File",
"(",
"baseDir",
",",
"EXTRA_HEADERS_FILE",
")",
";",
"return",
"Instructions",
... | If a bundle has added extra headers, they are added to the bundle manifest.
@param baseDir the project directory
@param properties the current set of properties in which the read metadata are written
@return the merged set of properties | [
"If",
"a",
"bundle",
"has",
"added",
"extra",
"headers",
"they",
"are",
"added",
"to",
"the",
"bundle",
"manifest",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java#L148-L151 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java | BundlePackager.addExtraHeaderToBundleManifest | public static void addExtraHeaderToBundleManifest(File baseDir, String header, String value) throws IOException {
Properties props = new Properties();
File extra = new File(baseDir, EXTRA_HEADERS_FILE);
extra.getParentFile().mkdirs();
// If the file exist it loads it, if not nothing happ... | java | public static void addExtraHeaderToBundleManifest(File baseDir, String header, String value) throws IOException {
Properties props = new Properties();
File extra = new File(baseDir, EXTRA_HEADERS_FILE);
extra.getParentFile().mkdirs();
// If the file exist it loads it, if not nothing happ... | [
"public",
"static",
"void",
"addExtraHeaderToBundleManifest",
"(",
"File",
"baseDir",
",",
"String",
"header",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"File",
"extra",
"=",
"new... | This method is used by plugin willing to add custom header to the bundle manifest.
@param baseDir the project directory
@param header the header to add
@param value the value to write
@throws IOException if the header cannot be added | [
"This",
"method",
"is",
"used",
"by",
"plugin",
"willing",
"to",
"add",
"custom",
"header",
"to",
"the",
"bundle",
"manifest",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java#L161-L179 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java | BundlePackager.getLocalResources | public static String getLocalResources(File basedir, boolean test, ProjectScanner scanner) {
final String basePath = basedir.getAbsolutePath();
String target = "target/classes";
if (test) {
target = "target/test-classes";
}
Set<String> files = scanner.getLocalResource... | java | public static String getLocalResources(File basedir, boolean test, ProjectScanner scanner) {
final String basePath = basedir.getAbsolutePath();
String target = "target/classes";
if (test) {
target = "target/test-classes";
}
Set<String> files = scanner.getLocalResource... | [
"public",
"static",
"String",
"getLocalResources",
"(",
"File",
"basedir",
",",
"boolean",
"test",
",",
"ProjectScanner",
"scanner",
")",
"{",
"final",
"String",
"basePath",
"=",
"basedir",
".",
"getAbsolutePath",
"(",
")",
";",
"String",
"target",
"=",
"\"tar... | Gets local resources.
@param basedir the project's base directory
@param test whether or not we compute the test resources
@param scanner the project scanner to retrieve information about the sources and resources contained in the
project
@return the resource clause | [
"Gets",
"local",
"resources",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/BundlePackager.java#L244-L278 | train |
wisdom-framework/wisdom | framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/tracker/TemplateDeployer.java | TemplateDeployer.onFileCreate | @Override
public void onFileCreate(File file) {
try {
engine.addTemplate(context.getBundle(0), file.toURI().toURL());
} catch (MalformedURLException e) {
LOGGER.error("Cannot compute the url of file {}", file.getAbsolutePath(), e);
}
} | java | @Override
public void onFileCreate(File file) {
try {
engine.addTemplate(context.getBundle(0), file.toURI().toURL());
} catch (MalformedURLException e) {
LOGGER.error("Cannot compute the url of file {}", file.getAbsolutePath(), e);
}
} | [
"@",
"Override",
"public",
"void",
"onFileCreate",
"(",
"File",
"file",
")",
"{",
"try",
"{",
"engine",
".",
"addTemplate",
"(",
"context",
".",
"getBundle",
"(",
"0",
")",
",",
"file",
".",
"toURI",
"(",
")",
".",
"toURL",
"(",
")",
")",
";",
"}",... | Callback called when an accepted file is created.
@param file the new file | [
"Callback",
"called",
"when",
"an",
"accepted",
"file",
"is",
"created",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/tracker/TemplateDeployer.java#L105-L112 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java | ContextFromVertx.headers | @Override
public List<String> headers(String name) {
return request.headers().get(name);
} | java | @Override
public List<String> headers(String name) {
return request.headers().get(name);
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"headers",
"(",
"String",
"name",
")",
"{",
"return",
"request",
".",
"headers",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"}"
] | Get all the request headers with the given name.
@return the header values | [
"Get",
"all",
"the",
"request",
"headers",
"with",
"the",
"given",
"name",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java#L425-L428 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java | ContextFromVertx.cookieValue | @Override
public String cookieValue(String name) {
return CookieHelper.getCookieValue(name, request().cookies());
} | java | @Override
public String cookieValue(String name) {
return CookieHelper.getCookieValue(name, request().cookies());
} | [
"@",
"Override",
"public",
"String",
"cookieValue",
"(",
"String",
"name",
")",
"{",
"return",
"CookieHelper",
".",
"getCookieValue",
"(",
"name",
",",
"request",
"(",
")",
".",
"cookies",
"(",
")",
")",
";",
"}"
] | Get the cookie value from the request, if defined.
@param name The name of the cookie
@return The cookie value, or null if the cookie was not found | [
"Get",
"the",
"cookie",
"value",
"from",
"the",
"request",
"if",
"defined",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java#L446-L449 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java | ContextFromVertx.reader | @Override
public BufferedReader reader() throws IOException {
byte[] raw = request.getRawBody();
if (raw != null) {
return IOUtils.toBufferedReader(new InputStreamReader(new ByteArrayInputStream(raw)));
}
return null;
} | java | @Override
public BufferedReader reader() throws IOException {
byte[] raw = request.getRawBody();
if (raw != null) {
return IOUtils.toBufferedReader(new InputStreamReader(new ByteArrayInputStream(raw)));
}
return null;
} | [
"@",
"Override",
"public",
"BufferedReader",
"reader",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"raw",
"=",
"request",
".",
"getRawBody",
"(",
")",
";",
"if",
"(",
"raw",
"!=",
"null",
")",
"{",
"return",
"IOUtils",
".",
"toBufferedReade... | Gets the reader to read the request.
@return The reader | [
"Gets",
"the",
"reader",
"to",
"read",
"the",
"request",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java#L520-L527 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java | ContextFromVertx.route | public void route(Route route) {
// Can be called only once, with a non null route.
Preconditions.checkState(this.route == null);
Preconditions.checkNotNull(route);
this.route = route;
} | java | public void route(Route route) {
// Can be called only once, with a non null route.
Preconditions.checkState(this.route == null);
Preconditions.checkNotNull(route);
this.route = route;
} | [
"public",
"void",
"route",
"(",
"Route",
"route",
")",
"{",
"// Can be called only once, with a non null route.",
"Preconditions",
".",
"checkState",
"(",
"this",
".",
"route",
"==",
"null",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"route",
")",
";",
... | Sets the route associated with the current context.
@param route the route | [
"Sets",
"the",
"route",
"associated",
"with",
"the",
"current",
"context",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java#L544-L549 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java | ContextFromVertx.file | @Override
public FileItem file(String name) {
for (FileItem item : request.getFiles()) {
// FileItem that do not have an real file attached, should not be returned
if (item.field().equals(name) && !Strings.isNullOrEmpty(item.name())) {
return item;
}
... | java | @Override
public FileItem file(String name) {
for (FileItem item : request.getFiles()) {
// FileItem that do not have an real file attached, should not be returned
if (item.field().equals(name) && !Strings.isNullOrEmpty(item.name())) {
return item;
}
... | [
"@",
"Override",
"public",
"FileItem",
"file",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"FileItem",
"item",
":",
"request",
".",
"getFiles",
"(",
")",
")",
"{",
"// FileItem that do not have an real file attached, should not be returned",
"if",
"(",
"item",
".... | Gets the uploaded file having a form's field matching the given name.
@param name the name of the field of the form that have uploaded the file
@return the file object, {@literal null} if there are no file with this name | [
"Gets",
"the",
"uploaded",
"file",
"having",
"a",
"form",
"s",
"field",
"matching",
"the",
"given",
"name",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/ContextFromVertx.java#L580-L589 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/bodies/RenderableString.java | RenderableString.render | @Override
public InputStream render(Context context, Result result) throws RenderableException {
byte[] bytes;
// We have a result, charset have to be provided
if (result != null) {
if (result.getCharset() == null) {
// No charset provided, use default encoding (... | java | @Override
public InputStream render(Context context, Result result) throws RenderableException {
byte[] bytes;
// We have a result, charset have to be provided
if (result != null) {
if (result.getCharset() == null) {
// No charset provided, use default encoding (... | [
"@",
"Override",
"public",
"InputStream",
"render",
"(",
"Context",
"context",
",",
"Result",
"result",
")",
"throws",
"RenderableException",
"{",
"byte",
"[",
"]",
"bytes",
";",
"// We have a result, charset have to be provided",
"if",
"(",
"result",
"!=",
"null",
... | Retrieves the content.
@param context the HTTP context
@param result the result having built this renderable object
@return an input stream on the contained String.
@throws RenderableException should not happen | [
"Retrieves",
"the",
"content",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/bodies/RenderableString.java#L127-L144 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java | CSRFServiceImpl.extractTokenFromRequest | @Override
public String extractTokenFromRequest(Context context) {
// First check the tags, this is where tokens are added if it's added to the current request
// In that case, the request scope contains the token
String token = (String) context.request().data().get(TOKEN_KEY);
if (t... | java | @Override
public String extractTokenFromRequest(Context context) {
// First check the tags, this is where tokens are added if it's added to the current request
// In that case, the request scope contains the token
String token = (String) context.request().data().get(TOKEN_KEY);
if (t... | [
"@",
"Override",
"public",
"String",
"extractTokenFromRequest",
"(",
"Context",
"context",
")",
"{",
"// First check the tags, this is where tokens are added if it's added to the current request",
"// In that case, the request scope contains the token",
"String",
"token",
"=",
"(",
"... | Extracts the token from the request. This implementation checks in the request data, then in the CORS cookie
if any, and finally in the session cookie. If the token is signed, it resigns it to avoid the BREACH
vulnerability.
@param context the context
@return the extract token, {@code null} if no token. | [
"Extracts",
"the",
"token",
"from",
"the",
"request",
".",
"This",
"implementation",
"checks",
"in",
"the",
"request",
"data",
"then",
"in",
"the",
"CORS",
"cookie",
"if",
"any",
"and",
"finally",
"in",
"the",
"session",
"cookie",
".",
"If",
"the",
"token"... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java#L87-L111 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java | CSRFServiceImpl.addTokenToResult | @Override
public Result addTokenToResult(Context context, String newToken, Result result) {
if (isCached(context)) {
LOGGER.debug("Not adding token to a cached result");
return result;
}
LOGGER.debug("Adding token to result");
if (getCookieName() != null) {
... | java | @Override
public Result addTokenToResult(Context context, String newToken, Result result) {
if (isCached(context)) {
LOGGER.debug("Not adding token to a cached result");
return result;
}
LOGGER.debug("Adding token to result");
if (getCookieName() != null) {
... | [
"@",
"Override",
"public",
"Result",
"addTokenToResult",
"(",
"Context",
"context",
",",
"String",
"newToken",
",",
"Result",
"result",
")",
"{",
"if",
"(",
"isCached",
"(",
"context",
")",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Not adding token to a cached... | Methods adding the CORS token to the given result. The effect depends on the configuration.
@param context the context
@param newToken the new token
@param result the result that is enhanced
@return the updated result | [
"Methods",
"adding",
"the",
"CORS",
"token",
"to",
"the",
"given",
"result",
".",
"The",
"effect",
"depends",
"on",
"the",
"configuration",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java#L164-L190 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java | CSRFServiceImpl.compareTokens | @Override
public boolean compareTokens(String a, String b) {
if (isSignedToken()) {
return crypto.compareSignedTokens(a, b);
} else {
return crypto.constantTimeEquals(a, b);
}
} | java | @Override
public boolean compareTokens(String a, String b) {
if (isSignedToken()) {
return crypto.compareSignedTokens(a, b);
} else {
return crypto.constantTimeEquals(a, b);
}
} | [
"@",
"Override",
"public",
"boolean",
"compareTokens",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"if",
"(",
"isSignedToken",
"(",
")",
")",
"{",
"return",
"crypto",
".",
"compareSignedTokens",
"(",
"a",
",",
"b",
")",
";",
"}",
"else",
"{",
"... | Compares to token.
@param a the first token
@param b the second token
@return {@code true} if the token are equal, {@code false} otherwise | [
"Compares",
"to",
"token",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java#L218-L225 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java | CSRFServiceImpl.extractTokenFromContent | @Override
public String extractTokenFromContent(Context context) {
// check query String
String token = context.request().parameter(getTokenName());
if (token == null) {
// Check a specified header
token = context.header(CSRF_TOKEN_HEADER);
}
// If s... | java | @Override
public String extractTokenFromContent(Context context) {
// check query String
String token = context.request().parameter(getTokenName());
if (token == null) {
// Check a specified header
token = context.header(CSRF_TOKEN_HEADER);
}
// If s... | [
"@",
"Override",
"public",
"String",
"extractTokenFromContent",
"(",
"Context",
"context",
")",
"{",
"// check query String",
"String",
"token",
"=",
"context",
".",
"request",
"(",
")",
".",
"parameter",
"(",
"getTokenName",
"(",
")",
")",
";",
"if",
"(",
"... | Extracts the token from the content of the request. This implementation checks inside the headers, and inside
form body.
@param context the context
@return the extracted token, {@code null} if not found. | [
"Extracts",
"the",
"token",
"from",
"the",
"content",
"of",
"the",
"request",
".",
"This",
"implementation",
"checks",
"inside",
"the",
"headers",
"and",
"inside",
"form",
"body",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java#L234-L255 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java | CSRFServiceImpl.clearTokenIfInvalid | @Override
public Result clearTokenIfInvalid(Context context, String msg) {
Result error = handler.onError(context, msg);
final String cookieName = getCookieName();
if (cookieName != null) {
Cookie cookie = context.cookie(cookieName);
if (cookie != null) {
... | java | @Override
public Result clearTokenIfInvalid(Context context, String msg) {
Result error = handler.onError(context, msg);
final String cookieName = getCookieName();
if (cookieName != null) {
Cookie cookie = context.cookie(cookieName);
if (cookie != null) {
... | [
"@",
"Override",
"public",
"Result",
"clearTokenIfInvalid",
"(",
"Context",
"context",
",",
"String",
"msg",
")",
"{",
"Result",
"error",
"=",
"handler",
".",
"onError",
"(",
"context",
",",
"msg",
")",
";",
"final",
"String",
"cookieName",
"=",
"getCookieNa... | Clears the token from the request
@param context the context
@param msg the error message
@return the result | [
"Clears",
"the",
"token",
"from",
"the",
"request"
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/CSRFServiceImpl.java#L264-L277 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleStates.java | BundleStates.from | public static String from(int state) {
switch (state) {
case Bundle.ACTIVE:
return ACTIVE;
case Bundle.INSTALLED:
return INSTALLED;
case Bundle.RESOLVED:
return RESOLVED;
case Bundle.STARTING:
return ... | java | public static String from(int state) {
switch (state) {
case Bundle.ACTIVE:
return ACTIVE;
case Bundle.INSTALLED:
return INSTALLED;
case Bundle.RESOLVED:
return RESOLVED;
case Bundle.STARTING:
return ... | [
"public",
"static",
"String",
"from",
"(",
"int",
"state",
")",
"{",
"switch",
"(",
"state",
")",
"{",
"case",
"Bundle",
".",
"ACTIVE",
":",
"return",
"ACTIVE",
";",
"case",
"Bundle",
".",
"INSTALLED",
":",
"return",
"INSTALLED",
";",
"case",
"Bundle",
... | Gets the String form of the given OSGi bundle state.
@param state the state
@return the string form. | [
"Gets",
"the",
"String",
"form",
"of",
"the",
"given",
"OSGi",
"bundle",
"state",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleStates.java#L46-L63 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleStates.java | BundleStates.from | public static int from(String state) {
switch (state.toUpperCase()) {
case ACTIVE:
return Bundle.ACTIVE;
case INSTALLED:
return Bundle.INSTALLED;
case RESOLVED:
return Bundle.RESOLVED;
case STARTING:
... | java | public static int from(String state) {
switch (state.toUpperCase()) {
case ACTIVE:
return Bundle.ACTIVE;
case INSTALLED:
return Bundle.INSTALLED;
case RESOLVED:
return Bundle.RESOLVED;
case STARTING:
... | [
"public",
"static",
"int",
"from",
"(",
"String",
"state",
")",
"{",
"switch",
"(",
"state",
".",
"toUpperCase",
"(",
")",
")",
"{",
"case",
"ACTIVE",
":",
"return",
"Bundle",
".",
"ACTIVE",
";",
"case",
"INSTALLED",
":",
"return",
"Bundle",
".",
"INST... | Gets the OSGi state from the string form.
@param state the state as String
@return the OSGi bundle state | [
"Gets",
"the",
"OSGi",
"state",
"from",
"the",
"string",
"form",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/BundleStates.java#L81-L98 | train |
wisdom-framework/wisdom | framework/thymeleaf-template-engine/src/main/java/ognl/OgnlOps.java | OgnlOps.getNumericType | public static int getNumericType(int t1, int t2, boolean canBeNonNumeric) {
int localt1 = t1;
int localt2 = t2;
if (localt1 == localt2)
return localt1;
if (canBeNonNumeric && (localt1 == NONNUMERIC || localt2 == NONNUMERIC || localt1 == CHAR || localt2 == CHAR))
... | java | public static int getNumericType(int t1, int t2, boolean canBeNonNumeric) {
int localt1 = t1;
int localt2 = t2;
if (localt1 == localt2)
return localt1;
if (canBeNonNumeric && (localt1 == NONNUMERIC || localt2 == NONNUMERIC || localt1 == CHAR || localt2 == CHAR))
... | [
"public",
"static",
"int",
"getNumericType",
"(",
"int",
"t1",
",",
"int",
"t2",
",",
"boolean",
"canBeNonNumeric",
")",
"{",
"int",
"localt1",
"=",
"t1",
";",
"int",
"localt2",
"=",
"t2",
";",
"if",
"(",
"localt1",
"==",
"localt2",
")",
"return",
"loc... | Returns the constant from the NumericTypes interface that best expresses the type
of an operation, which can be either numeric or not, on the two given types.
@param localt1 type of one argument to an operator
@param localt2 type of the other argument
@param canBeNonNumeric whether the operator can be ... | [
"Returns",
"the",
"constant",
"from",
"the",
"NumericTypes",
"interface",
"that",
"best",
"expresses",
"the",
"type",
"of",
"an",
"operation",
"which",
"can",
"be",
"either",
"numeric",
"or",
"not",
"on",
"the",
"two",
"given",
"types",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/ognl/OgnlOps.java#L428-L461 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Socket.java | Socket.publish | public void publish(byte[] message, EventBus bus) {
bus.publish(getBinaryWriteHandlerId(), Buffer.buffer(message));
} | java | public void publish(byte[] message, EventBus bus) {
bus.publish(getBinaryWriteHandlerId(), Buffer.buffer(message));
} | [
"public",
"void",
"publish",
"(",
"byte",
"[",
"]",
"message",
",",
"EventBus",
"bus",
")",
"{",
"bus",
".",
"publish",
"(",
"getBinaryWriteHandlerId",
"(",
")",
",",
"Buffer",
".",
"buffer",
"(",
"message",
")",
")",
";",
"}"
] | Sends a binary frame on the socket.
@param message the message
@param bus the Vert.x event bus. | [
"Sends",
"a",
"binary",
"frame",
"on",
"the",
"socket",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/Socket.java#L95-L97 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/ServiceModel.java | ServiceModel.services | public static List<ServiceModel> services(BundleContext context) {
List<ServiceModel> services = new ArrayList<>();
try {
ServiceReference[] references = context.getAllServiceReferences(null, null);
if (references != null) {
for (ServiceReference ref : references)... | java | public static List<ServiceModel> services(BundleContext context) {
List<ServiceModel> services = new ArrayList<>();
try {
ServiceReference[] references = context.getAllServiceReferences(null, null);
if (references != null) {
for (ServiceReference ref : references)... | [
"public",
"static",
"List",
"<",
"ServiceModel",
">",
"services",
"(",
"BundleContext",
"context",
")",
"{",
"List",
"<",
"ServiceModel",
">",
"services",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"ServiceReference",
"[",
"]",
"references",
... | Creates the list of service models from the list of the currently available services.
@param context the bundle context
@return the list of models | [
"Creates",
"the",
"list",
"of",
"service",
"models",
"from",
"the",
"list",
"of",
"the",
"currently",
"available",
"services",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/osgi/ServiceModel.java#L37-L50 | train |
wisdom-framework/wisdom | framework/i18n-service/src/main/java/org/wisdom/i18n/XMLResourceBundle.java | XMLResourceBundle.getKeys | public Enumeration<String> getKeys() {
Set<String> handleKeys = properties.stringPropertyNames();
return Collections.enumeration(handleKeys);
} | java | public Enumeration<String> getKeys() {
Set<String> handleKeys = properties.stringPropertyNames();
return Collections.enumeration(handleKeys);
} | [
"public",
"Enumeration",
"<",
"String",
">",
"getKeys",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"handleKeys",
"=",
"properties",
".",
"stringPropertyNames",
"(",
")",
";",
"return",
"Collections",
".",
"enumeration",
"(",
"handleKeys",
")",
";",
"}"
] | Gets the keys from the wrapped properties.
@return the set of key.
@see java.util.ResourceBundle#getKeys() | [
"Gets",
"the",
"keys",
"from",
"the",
"wrapped",
"properties",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/i18n-service/src/main/java/org/wisdom/i18n/XMLResourceBundle.java#L63-L66 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/DefaultController.java | DefaultController.logger | public Logger logger() {
if (logger == null) {
logger = LoggerFactory.getLogger(this.getClass().getName());
}
return logger;
} | java | public Logger logger() {
if (logger == null) {
logger = LoggerFactory.getLogger(this.getClass().getName());
}
return logger;
} | [
"public",
"Logger",
"logger",
"(",
")",
"{",
"if",
"(",
"logger",
"==",
"null",
")",
"{",
"logger",
"=",
"LoggerFactory",
".",
"getLogger",
"(",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"return",
"logger",
";",
"}... | Retrieves the logger usable by the controller.
If the logger does not exist yet, get one.
@return the logger. | [
"Retrieves",
"the",
"logger",
"usable",
"by",
"the",
"controller",
".",
"If",
"the",
"logger",
"does",
"not",
"exist",
"yet",
"get",
"one",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/DefaultController.java#L52-L57 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/bodies/RenderableFile.java | RenderableFile.render | @Override
public InputStream render(Context context, Result result) throws RenderableException {
try {
return FileUtils.openInputStream(file);
} catch (IOException e) {
throw new RenderableException("Cannot read file " + file.getAbsolutePath(), e);
}
} | java | @Override
public InputStream render(Context context, Result result) throws RenderableException {
try {
return FileUtils.openInputStream(file);
} catch (IOException e) {
throw new RenderableException("Cannot read file " + file.getAbsolutePath(), e);
}
} | [
"@",
"Override",
"public",
"InputStream",
"render",
"(",
"Context",
"context",
",",
"Result",
"result",
")",
"throws",
"RenderableException",
"{",
"try",
"{",
"return",
"FileUtils",
".",
"openInputStream",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException... | Renders the file. If just returns an empty stream on the served file.
@param context the HTTP context
@param result the result having built this renderable object
@return the input stream. Be aware that the stream may be blocking.
@throws RenderableException if the file cannot be read. | [
"Renders",
"the",
"file",
".",
"If",
"just",
"returns",
"an",
"empty",
"stream",
"on",
"the",
"served",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/bodies/RenderableFile.java#L68-L75 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaCompilerMojo.java | JavaCompilerMojo.accept | @Override
public boolean accept(File file) {
return WatcherUtils.isInDirectory(file, WatcherUtils.getJavaSource(basedir));
} | java | @Override
public boolean accept(File file) {
return WatcherUtils.isInDirectory(file, WatcherUtils.getJavaSource(basedir));
} | [
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"file",
")",
"{",
"return",
"WatcherUtils",
".",
"isInDirectory",
"(",
"file",
",",
"WatcherUtils",
".",
"getJavaSource",
"(",
"basedir",
")",
")",
";",
"}"
] | Checks whether or not an event on the given file should trigger the Java compilation.
@param file the file
@return {@literal true} if the given file is a JAva file and is contained in the Java source directory. | [
"Checks",
"whether",
"or",
"not",
"an",
"event",
"on",
"the",
"given",
"file",
"should",
"trigger",
"the",
"Java",
"compilation",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/JavaCompilerMojo.java#L66-L69 | train |
wisdom-framework/wisdom | extensions/wisdom-markdown-maven-plugin/src/main/java/org/wisdom/markdown/MarkdownMojo.java | MarkdownMojo.execute | public void execute()
throws MojoExecutionException {
if (extensions == null || extensions.isEmpty()) {
extensions = ImmutableList.of("md", "markdown");
}
if (instance == null) {
instance = new PegDownProcessor(Extensions.ALL);
}
try {
... | java | public void execute()
throws MojoExecutionException {
if (extensions == null || extensions.isEmpty()) {
extensions = ImmutableList.of("md", "markdown");
}
if (instance == null) {
instance = new PegDownProcessor(Extensions.ALL);
}
try {
... | [
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"extensions",
"==",
"null",
"||",
"extensions",
".",
"isEmpty",
"(",
")",
")",
"{",
"extensions",
"=",
"ImmutableList",
".",
"of",
"(",
"\"md\"",
",",
"\"markdown\"",
... | Compiles all markdown files located in the internal and external asset directories.
@throws MojoExecutionException if a markdown file cannot be processed | [
"Compiles",
"all",
"markdown",
"files",
"located",
"in",
"the",
"internal",
"and",
"external",
"asset",
"directories",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-markdown-maven-plugin/src/main/java/org/wisdom/markdown/MarkdownMojo.java#L71-L89 | train |
wisdom-framework/wisdom | extensions/wisdom-markdown-maven-plugin/src/main/java/org/wisdom/markdown/MarkdownMojo.java | MarkdownMojo.process | public void process(File input) throws IOException {
File filtered = getFilteredVersion(input);
if (filtered == null) {
// It was not copied.
getLog().warn("Cannot find the filtered version of " + input.getAbsolutePath() + ", " +
"using source file.");
... | java | public void process(File input) throws IOException {
File filtered = getFilteredVersion(input);
if (filtered == null) {
// It was not copied.
getLog().warn("Cannot find the filtered version of " + input.getAbsolutePath() + ", " +
"using source file.");
... | [
"public",
"void",
"process",
"(",
"File",
"input",
")",
"throws",
"IOException",
"{",
"File",
"filtered",
"=",
"getFilteredVersion",
"(",
"input",
")",
";",
"if",
"(",
"filtered",
"==",
"null",
")",
"{",
"// It was not copied.",
"getLog",
"(",
")",
".",
"w... | Processes the given markdown file. When the 'filtered' version of the file exists, it uses it.
@param input the input file
@throws IOException if the file cannot be processed. | [
"Processes",
"the",
"given",
"markdown",
"file",
".",
"When",
"the",
"filtered",
"version",
"of",
"the",
"file",
"exists",
"it",
"uses",
"it",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-markdown-maven-plugin/src/main/java/org/wisdom/markdown/MarkdownMojo.java#L97-L110 | train |
wisdom-framework/wisdom | extensions/wisdom-markdown-maven-plugin/src/main/java/org/wisdom/markdown/MarkdownMojo.java | MarkdownMojo.fileDeleted | @Override
public boolean fileDeleted(File file) {
File output = getOutputFile(file, OUTPUT_EXTENSION);
FileUtils.deleteQuietly(output);
return true;
} | java | @Override
public boolean fileDeleted(File file) {
File output = getOutputFile(file, OUTPUT_EXTENSION);
FileUtils.deleteQuietly(output);
return true;
} | [
"@",
"Override",
"public",
"boolean",
"fileDeleted",
"(",
"File",
"file",
")",
"{",
"File",
"output",
"=",
"getOutputFile",
"(",
"file",
",",
"OUTPUT_EXTENSION",
")",
";",
"FileUtils",
".",
"deleteQuietly",
"(",
"output",
")",
";",
"return",
"true",
";",
"... | An accepted file was deleted - deletes the output file.
@param file the file
@return {@code true} | [
"An",
"accepted",
"file",
"was",
"deleted",
"-",
"deletes",
"the",
"output",
"file",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-markdown-maven-plugin/src/main/java/org/wisdom/markdown/MarkdownMojo.java#L159-L164 | train |
wisdom-framework/wisdom | extensions/wisdom-browser-watch/src/main/java/org/wisdom/browserwatch/BrowserWatchController.java | BrowserWatchController.bundles | @Route(method = HttpMethod.GET, uri = BROWSER_WATCH_BUNDLES)
public Result bundles() {
return ok(render(template));
} | java | @Route(method = HttpMethod.GET, uri = BROWSER_WATCH_BUNDLES)
public Result bundles() {
return ok(render(template));
} | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"GET",
",",
"uri",
"=",
"BROWSER_WATCH_BUNDLES",
")",
"public",
"Result",
"bundles",
"(",
")",
"{",
"return",
"ok",
"(",
"render",
"(",
"template",
")",
")",
";",
"}"
] | Simple test route showing all loaded bundles, and the route of the current one
@return | [
"Simple",
"test",
"route",
"showing",
"all",
"loaded",
"bundles",
"and",
"the",
"route",
"of",
"the",
"current",
"one"
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-browser-watch/src/main/java/org/wisdom/browserwatch/BrowserWatchController.java#L101-L104 | train |
wisdom-framework/wisdom | extensions/wisdom-browser-watch/src/main/java/org/wisdom/browserwatch/BrowserWatchController.java | BrowserWatchController.addedClient | @Opened(BROWSER_WATCH_SOCKET)
public void addedClient(@Parameter("client") String client) {
log.log(LogService.LOG_INFO, String.format("added client %s", client));
} | java | @Opened(BROWSER_WATCH_SOCKET)
public void addedClient(@Parameter("client") String client) {
log.log(LogService.LOG_INFO, String.format("added client %s", client));
} | [
"@",
"Opened",
"(",
"BROWSER_WATCH_SOCKET",
")",
"public",
"void",
"addedClient",
"(",
"@",
"Parameter",
"(",
"\"client\"",
")",
"String",
"client",
")",
"{",
"log",
".",
"log",
"(",
"LogService",
".",
"LOG_INFO",
",",
"String",
".",
"format",
"(",
"\"adde... | When a client is added, we get the service it should be associated with using the route resoluton
mechanism wisdom provides us
@param client
@param url | [
"When",
"a",
"client",
"is",
"added",
"we",
"get",
"the",
"service",
"it",
"should",
"be",
"associated",
"with",
"using",
"the",
"route",
"resoluton",
"mechanism",
"wisdom",
"provides",
"us"
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-browser-watch/src/main/java/org/wisdom/browserwatch/BrowserWatchController.java#L112-L115 | train |
wisdom-framework/wisdom | extensions/wisdom-browser-watch/src/main/java/org/wisdom/browserwatch/BrowserWatchController.java | BrowserWatchController.removedClient | @Closed(BROWSER_WATCH_SOCKET)
public void removedClient(@Parameter("client") String client) {
displayedControllers.inverse().remove(client);
} | java | @Closed(BROWSER_WATCH_SOCKET)
public void removedClient(@Parameter("client") String client) {
displayedControllers.inverse().remove(client);
} | [
"@",
"Closed",
"(",
"BROWSER_WATCH_SOCKET",
")",
"public",
"void",
"removedClient",
"(",
"@",
"Parameter",
"(",
"\"client\"",
")",
"String",
"client",
")",
"{",
"displayedControllers",
".",
"inverse",
"(",
")",
".",
"remove",
"(",
"client",
")",
";",
"}"
] | And when client leaves, stop notifying it
@param client
client to remove | [
"And",
"when",
"client",
"leaves",
"stop",
"notifying",
"it"
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-browser-watch/src/main/java/org/wisdom/browserwatch/BrowserWatchController.java#L134-L137 | train |
wisdom-framework/wisdom | core/wisdom-executors/src/main/java/org/wisdom/executors/Creator.java | Creator.start | @Validate
public void start() {
Configuration conf = configuration.getConfiguration("pools");
createExecutor(ManagedExecutorService.SYSTEM,
conf != null ? conf.getConfiguration("executors." + ManagedExecutorService.SYSTEM) : null);
createScheduler(ManagedScheduledExecutorSer... | java | @Validate
public void start() {
Configuration conf = configuration.getConfiguration("pools");
createExecutor(ManagedExecutorService.SYSTEM,
conf != null ? conf.getConfiguration("executors." + ManagedExecutorService.SYSTEM) : null);
createScheduler(ManagedScheduledExecutorSer... | [
"@",
"Validate",
"public",
"void",
"start",
"(",
")",
"{",
"Configuration",
"conf",
"=",
"configuration",
".",
"getConfiguration",
"(",
"\"pools\"",
")",
";",
"createExecutor",
"(",
"ManagedExecutorService",
".",
"SYSTEM",
",",
"conf",
"!=",
"null",
"?",
"conf... | Creates the system executors and the others specified executors. | [
"Creates",
"the",
"system",
"executors",
"and",
"the",
"others",
"specified",
"executors",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-executors/src/main/java/org/wisdom/executors/Creator.java#L70-L83 | train |
wisdom-framework/wisdom | core/wisdom-executors/src/main/java/org/wisdom/executors/Creator.java | Creator.stop | @Invalidate
public void stop() {
for (Map.Entry<ServiceRegistration, ExecutorService> entry : instances.entrySet()) {
entry.getKey().unregister();
entry.getValue().shutdownNow();
}
instances.clear();
} | java | @Invalidate
public void stop() {
for (Map.Entry<ServiceRegistration, ExecutorService> entry : instances.entrySet()) {
entry.getKey().unregister();
entry.getValue().shutdownNow();
}
instances.clear();
} | [
"@",
"Invalidate",
"public",
"void",
"stop",
"(",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"ServiceRegistration",
",",
"ExecutorService",
">",
"entry",
":",
"instances",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getKey",
"(",
")",
".",... | Shutdown all created executors. | [
"Shutdown",
"all",
"created",
"executors",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-executors/src/main/java/org/wisdom/executors/Creator.java#L169-L176 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/logger/LoggerExtension.java | LoggerExtension.loggers | @Route(method = HttpMethod.GET, uri = "/monitor/logs/loggers")
public Result loggers() {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
List<LoggerModel> loggers = new ArrayList<>();
for (Logger logger : context.getLoggerList()) {
loggers.add(new Logge... | java | @Route(method = HttpMethod.GET, uri = "/monitor/logs/loggers")
public Result loggers() {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
List<LoggerModel> loggers = new ArrayList<>();
for (Logger logger : context.getLoggerList()) {
loggers.add(new Logge... | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"GET",
",",
"uri",
"=",
"\"/monitor/logs/loggers\"",
")",
"public",
"Result",
"loggers",
"(",
")",
"{",
"LoggerContext",
"context",
"=",
"(",
"LoggerContext",
")",
"LoggerFactory",
".",
"getILoggerFactory",
... | Gets a json form of the list of logger.
@return the list of loggers as json. | [
"Gets",
"a",
"json",
"form",
"of",
"the",
"list",
"of",
"logger",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/logger/LoggerExtension.java#L66-L74 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/logger/LoggerExtension.java | LoggerExtension.setLevel | @Route(method = HttpMethod.PUT, uri = "/monitor/logs/{name}")
public Result setLevel(@Parameter("name") String loggerName, @Parameter("level") String level) {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
Logger logger = context.getLogger(loggerName);
if (logger ... | java | @Route(method = HttpMethod.PUT, uri = "/monitor/logs/{name}")
public Result setLevel(@Parameter("name") String loggerName, @Parameter("level") String level) {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
Logger logger = context.getLogger(loggerName);
if (logger ... | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"PUT",
",",
"uri",
"=",
"\"/monitor/logs/{name}\"",
")",
"public",
"Result",
"setLevel",
"(",
"@",
"Parameter",
"(",
"\"name\"",
")",
"String",
"loggerName",
",",
"@",
"Parameter",
"(",
"\"level\"",
")",
... | Changes the log level of the specified logger.
@param loggerName the name of the logger
@param level the new level
@return the updated list of logger (as json), or not found if the given logger cannot be found | [
"Changes",
"the",
"log",
"level",
"of",
"the",
"specified",
"logger",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/logger/LoggerExtension.java#L84-L96 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/LoggedOutputStream.java | LoggedOutputStream.write | @Override
public void write(int b) throws IOException {
byte[] bytes = new byte[1];
bytes[0] = (byte) (b & 0xff);
buffer = buffer + new String(bytes);
if (buffer.endsWith("\n")) {
buffer = buffer.substring(0, buffer.length() - 1);
flush();
}
} | java | @Override
public void write(int b) throws IOException {
byte[] bytes = new byte[1];
bytes[0] = (byte) (b & 0xff);
buffer = buffer + new String(bytes);
if (buffer.endsWith("\n")) {
buffer = buffer.substring(0, buffer.length() - 1);
flush();
}
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"int",
"b",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"1",
"]",
";",
"bytes",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"b",
"&",
"0xff",
")",
";",
... | Writes a byte to the output stream. This method flushes automatically at the end of a line. | [
"Writes",
"a",
"byte",
"to",
"the",
"output",
"stream",
".",
"This",
"method",
"flushes",
"automatically",
"at",
"the",
"end",
"of",
"a",
"line",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/LoggedOutputStream.java#L67-L77 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/LoggedOutputStream.java | LoggedOutputStream.flush | public void flush() {
if (useWarn) {
log.warn(buffer);
} else {
log.info(buffer);
}
if (memory != null) {
memory += buffer + "\n";
}
buffer = "";
} | java | public void flush() {
if (useWarn) {
log.warn(buffer);
} else {
log.info(buffer);
}
if (memory != null) {
memory += buffer + "\n";
}
buffer = "";
} | [
"public",
"void",
"flush",
"(",
")",
"{",
"if",
"(",
"useWarn",
")",
"{",
"log",
".",
"warn",
"(",
"buffer",
")",
";",
"}",
"else",
"{",
"log",
".",
"info",
"(",
"buffer",
")",
";",
"}",
"if",
"(",
"memory",
"!=",
"null",
")",
"{",
"memory",
... | Flushes the output stream. | [
"Flushes",
"the",
"output",
"stream",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/node/LoggedOutputStream.java#L86-L96 | train |
wisdom-framework/wisdom | core/router/src/main/java/org/wisdom/router/RequestRouter.java | RequestRouter.bindController | @Bind(aggregate = true, optional = true)
public synchronized void bindController(Controller controller) {
LOGGER.info("Adding routes from " + controller);
List<Route> newRoutes = new ArrayList<>();
try {
List<Route> annotatedNewRoutes = RouteUtils.collectRouteFromControllerAnno... | java | @Bind(aggregate = true, optional = true)
public synchronized void bindController(Controller controller) {
LOGGER.info("Adding routes from " + controller);
List<Route> newRoutes = new ArrayList<>();
try {
List<Route> annotatedNewRoutes = RouteUtils.collectRouteFromControllerAnno... | [
"@",
"Bind",
"(",
"aggregate",
"=",
"true",
",",
"optional",
"=",
"true",
")",
"public",
"synchronized",
"void",
"bindController",
"(",
"Controller",
"controller",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Adding routes from \"",
"+",
"controller",
")",
";",
... | Binds a new controller.
@param controller the controller | [
"Binds",
"a",
"new",
"controller",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/router/src/main/java/org/wisdom/router/RequestRouter.java#L104-L129 | train |
wisdom-framework/wisdom | core/router/src/main/java/org/wisdom/router/RequestRouter.java | RequestRouter.unbindController | @Unbind(aggregate = true)
public synchronized void unbindController(Controller controller) {
LOGGER.info("Removing routes from " + controller);
Collection<RouteDelegate> copy = new LinkedHashSet<>(routes);
for (RouteDelegate r : copy) {
if (r.getControllerObject().equals(controll... | java | @Unbind(aggregate = true)
public synchronized void unbindController(Controller controller) {
LOGGER.info("Removing routes from " + controller);
Collection<RouteDelegate> copy = new LinkedHashSet<>(routes);
for (RouteDelegate r : copy) {
if (r.getControllerObject().equals(controll... | [
"@",
"Unbind",
"(",
"aggregate",
"=",
"true",
")",
"public",
"synchronized",
"void",
"unbindController",
"(",
"Controller",
"controller",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Removing routes from \"",
"+",
"controller",
")",
";",
"Collection",
"<",
"RouteDel... | Unbinds a controller.
@param controller the controller | [
"Unbinds",
"a",
"controller",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/router/src/main/java/org/wisdom/router/RequestRouter.java#L136-L145 | train |
wisdom-framework/wisdom | core/router/src/main/java/org/wisdom/router/RequestRouter.java | RequestRouter.getReverseRouteFor | @Override
public String getReverseRouteFor(String className, String method, Map<String, Object> params) {
for (Route route : copy()) {
if (route.getControllerClass().getName().equals(className)
&& route.getControllerMethod().getName().equals(method)) {
return ... | java | @Override
public String getReverseRouteFor(String className, String method, Map<String, Object> params) {
for (Route route : copy()) {
if (route.getControllerClass().getName().equals(className)
&& route.getControllerMethod().getName().equals(method)) {
return ... | [
"@",
"Override",
"public",
"String",
"getReverseRouteFor",
"(",
"String",
"className",
",",
"String",
"method",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
")",
"{",
"for",
"(",
"Route",
"route",
":",
"copy",
"(",
")",
")",
"{",
"if",
"(",... | Gets the URL that would invoke the given action method.
@param className the controller class
@param method the controller method
@param params map of parameter name - value
@return the computed URL, {@literal null} if no route matches the given action method | [
"Gets",
"the",
"URL",
"that",
"would",
"invoke",
"the",
"given",
"action",
"method",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/router/src/main/java/org/wisdom/router/RequestRouter.java#L304-L313 | train |
wisdom-framework/wisdom | core/router/src/main/java/org/wisdom/router/RequestRouter.java | RequestRouter.bindFilter | @Bind(aggregate = true, optional = true)
public void bindFilter(Filter filter) {
filters.add(filter);
} | java | @Bind(aggregate = true, optional = true)
public void bindFilter(Filter filter) {
filters.add(filter);
} | [
"@",
"Bind",
"(",
"aggregate",
"=",
"true",
",",
"optional",
"=",
"true",
")",
"public",
"void",
"bindFilter",
"(",
"Filter",
"filter",
")",
"{",
"filters",
".",
"add",
"(",
"filter",
")",
";",
"}"
] | Binds a filter.
@param filter the filter | [
"Binds",
"a",
"filter",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/router/src/main/java/org/wisdom/router/RequestRouter.java#L445-L448 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ClassSourceVisitor.java | ClassSourceVisitor.visit | public Boolean visit(ClassOrInterfaceDeclaration declaration, Object extra) {
if (declaration.getAnnotations() != null
&& containsAnnotation(declaration.getAnnotations(), CONTROL_ANNO_NAME)) {
return true;
}
//Get the list of extended and implemented class
L... | java | public Boolean visit(ClassOrInterfaceDeclaration declaration, Object extra) {
if (declaration.getAnnotations() != null
&& containsAnnotation(declaration.getAnnotations(), CONTROL_ANNO_NAME)) {
return true;
}
//Get the list of extended and implemented class
L... | [
"public",
"Boolean",
"visit",
"(",
"ClassOrInterfaceDeclaration",
"declaration",
",",
"Object",
"extra",
")",
"{",
"if",
"(",
"declaration",
".",
"getAnnotations",
"(",
")",
"!=",
"null",
"&&",
"containsAnnotation",
"(",
"declaration",
".",
"getAnnotations",
"(",
... | Visit the Class declaration and return true if it corresponds to a wisdom controller.
@param declaration The class declaration created by the JavaParser.
@param extra Extra out value argument, not used here.
@return <code>true</code> if the declaration correspond to a wisdom controller, <code>false</code> otherw... | [
"Visit",
"the",
"Class",
"declaration",
"and",
"return",
"true",
"if",
"it",
"corresponds",
"to",
"a",
"wisdom",
"controller",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ClassSourceVisitor.java#L84-L103 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ClassSourceVisitor.java | ClassSourceVisitor.containsAnnotation | private boolean containsAnnotation(List<AnnotationExpr> annos, String annotationName) {
for (AnnotationExpr anno : annos) {
if (anno.getName().getName().equals(annotationName)) {
return true;
}
}
return false;
} | java | private boolean containsAnnotation(List<AnnotationExpr> annos, String annotationName) {
for (AnnotationExpr anno : annos) {
if (anno.getName().getName().equals(annotationName)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"containsAnnotation",
"(",
"List",
"<",
"AnnotationExpr",
">",
"annos",
",",
"String",
"annotationName",
")",
"{",
"for",
"(",
"AnnotationExpr",
"anno",
":",
"annos",
")",
"{",
"if",
"(",
"anno",
".",
"getName",
"(",
")",
".",
"getNam... | Check if the list of annotation contains the annotation of given name.
@param annos, the annotation list
@param annotationName, the annotation name
@return <code>true</code> if the annotation list contains the given annotation. | [
"Check",
"if",
"the",
"list",
"of",
"annotation",
"contains",
"the",
"annotation",
"of",
"given",
"name",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-source-watcher/src/main/java/org/wisdom/source/ast/visitor/ClassSourceVisitor.java#L112-L119 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/HttpUtils.java | HttpUtils.isKeepAlive | public static boolean isKeepAlive(HttpServerRequest request) {
String connection = request.headers().get(HeaderNames.CONNECTION);
if (connection != null && connection.equalsIgnoreCase(CLOSE)) {
return false;
}
if (request.version() == HttpVersion.HTTP_1_1) {
retur... | java | public static boolean isKeepAlive(HttpServerRequest request) {
String connection = request.headers().get(HeaderNames.CONNECTION);
if (connection != null && connection.equalsIgnoreCase(CLOSE)) {
return false;
}
if (request.version() == HttpVersion.HTTP_1_1) {
retur... | [
"public",
"static",
"boolean",
"isKeepAlive",
"(",
"HttpServerRequest",
"request",
")",
"{",
"String",
"connection",
"=",
"request",
".",
"headers",
"(",
")",
".",
"get",
"(",
"HeaderNames",
".",
"CONNECTION",
")",
";",
"if",
"(",
"connection",
"!=",
"null",... | Checks whether the given request should be closed or not once completed.
@param request the request
@return {@code true} if the connection is marked as {@literal keep-alive}, and so must not be closed. {@code
false} otherwise. Notice that if not set in the request, the default value depends on the HTTP version. | [
"Checks",
"whether",
"the",
"given",
"request",
"should",
"be",
"closed",
"or",
"not",
"once",
"completed",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/HttpUtils.java#L53-L63 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/HttpUtils.java | HttpUtils.processResult | public static InputStream processResult(ServiceAccessor accessor, Context context, Renderable renderable,
Result result) throws Exception {
if (renderable.requireSerializer()) {
ContentSerializer serializer = null;
if (result.getContentType() !... | java | public static InputStream processResult(ServiceAccessor accessor, Context context, Renderable renderable,
Result result) throws Exception {
if (renderable.requireSerializer()) {
ContentSerializer serializer = null;
if (result.getContentType() !... | [
"public",
"static",
"InputStream",
"processResult",
"(",
"ServiceAccessor",
"accessor",
",",
"Context",
"context",
",",
"Renderable",
"renderable",
",",
"Result",
"result",
")",
"throws",
"Exception",
"{",
"if",
"(",
"renderable",
".",
"requireSerializer",
"(",
")... | Processes the given result. This method returns either the "rendered renderable",
but also applies required serialization if any.
@param accessor the service accessor
@param context the current HTTP context
@param renderable the renderable object
@param result the computed result
@return the stream of the res... | [
"Processes",
"the",
"given",
"result",
".",
"This",
"method",
"returns",
"either",
"the",
"rendered",
"renderable",
"but",
"also",
"applies",
"required",
"serialization",
"if",
"any",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/HttpUtils.java#L91-L126 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/cookies/SessionCookieImpl.java | SessionCookieImpl.init | @Override
public void init(Context context) {
try {
// get the cookie that contains session information:
Cookie cookie = context.request().cookie(applicationCookiePrefix
+ SESSION_SUFFIX);
// check that the cookie is not empty:
if (cookie ... | java | @Override
public void init(Context context) {
try {
// get the cookie that contains session information:
Cookie cookie = context.request().cookie(applicationCookiePrefix
+ SESSION_SUFFIX);
// check that the cookie is not empty:
if (cookie ... | [
"@",
"Override",
"public",
"void",
"init",
"(",
"Context",
"context",
")",
"{",
"try",
"{",
"// get the cookie that contains session information:",
"Cookie",
"cookie",
"=",
"context",
".",
"request",
"(",
")",
".",
"cookie",
"(",
"applicationCookiePrefix",
"+",
"S... | Has to be called initially.
@param context the current http context. | [
"Has",
"to",
"be",
"called",
"initially",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/cookies/SessionCookieImpl.java#L87-L132 | train |
wisdom-framework/wisdom | extensions/wisdom-npm-runner-maven-plugin/src/main/java/org/wisdom/mojo/npm/NpmRunnerMojo.java | NpmRunnerMojo.execute | public void execute()
throws MojoExecutionException {
if (watchFilter == null) {
removeFromWatching();
}
NPM.npm(this, name, version).execute(
binary != null ? binary : name, arguments);
} | java | public void execute()
throws MojoExecutionException {
if (watchFilter == null) {
removeFromWatching();
}
NPM.npm(this, name, version).execute(
binary != null ? binary : name, arguments);
} | [
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"watchFilter",
"==",
"null",
")",
"{",
"removeFromWatching",
"(",
")",
";",
"}",
"NPM",
".",
"npm",
"(",
"this",
",",
"name",
",",
"version",
")",
".",
"execute",
... | Installs and executes the NPM.
@throws MojoExecutionException if the execution fails. | [
"Installs",
"and",
"executes",
"the",
"NPM",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-npm-runner-maven-plugin/src/main/java/org/wisdom/mojo/npm/NpmRunnerMojo.java#L79-L86 | train |
wisdom-framework/wisdom | extensions/wisdom-npm-runner-maven-plugin/src/main/java/org/wisdom/mojo/npm/NpmRunnerMojo.java | NpmRunnerMojo.accept | @Override
public boolean accept(File file) {
WildcardFileFilter filter = new WildcardFileFilter(watchFilter);
return filter.accept(file);
} | java | @Override
public boolean accept(File file) {
WildcardFileFilter filter = new WildcardFileFilter(watchFilter);
return filter.accept(file);
} | [
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"file",
")",
"{",
"WildcardFileFilter",
"filter",
"=",
"new",
"WildcardFileFilter",
"(",
"watchFilter",
")",
";",
"return",
"filter",
".",
"accept",
"(",
"file",
")",
";",
"}"
] | If the watcher has a filter set, creates a wildcard filter and test the file name against this filter.
@param file is the file.
@return {@code true} if the file is accepted. | [
"If",
"the",
"watcher",
"has",
"a",
"filter",
"set",
"creates",
"a",
"wildcard",
"filter",
"and",
"test",
"the",
"file",
"name",
"against",
"this",
"filter",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-npm-runner-maven-plugin/src/main/java/org/wisdom/mojo/npm/NpmRunnerMojo.java#L94-L98 | train |
wisdom-framework/wisdom | extensions/wisdom-npm-runner-maven-plugin/src/main/java/org/wisdom/mojo/npm/NpmRunnerMojo.java | NpmRunnerMojo.fileCreated | @Override
public boolean fileCreated(File file) throws WatchingException {
try {
execute();
} catch (MojoExecutionException e) {
throw new WatchingException("Cannot execute the NPM '" + name + "'", e);
}
return true;
} | java | @Override
public boolean fileCreated(File file) throws WatchingException {
try {
execute();
} catch (MojoExecutionException e) {
throw new WatchingException("Cannot execute the NPM '" + name + "'", e);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"fileCreated",
"(",
"File",
"file",
")",
"throws",
"WatchingException",
"{",
"try",
"{",
"execute",
"(",
")",
";",
"}",
"catch",
"(",
"MojoExecutionException",
"e",
")",
"{",
"throw",
"new",
"WatchingException",
"(",
"\"... | An accepted file was created - executes the NPM.
@param file is the file.
@return {@code true}
@throws org.wisdom.maven.WatchingException if the execution fails. | [
"An",
"accepted",
"file",
"was",
"created",
"-",
"executes",
"the",
"NPM",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-npm-runner-maven-plugin/src/main/java/org/wisdom/mojo/npm/NpmRunnerMojo.java#L107-L115 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/converters/ReflectionHelper.java | ReflectionHelper.getPrimitiveDefault | public static String getPrimitiveDefault(Class type) {
if (type == Boolean.class) {
return "false";
}
if (type == Character.class) {
return Character.toString((char) 0);
}
return "0";
} | java | public static String getPrimitiveDefault(Class type) {
if (type == Boolean.class) {
return "false";
}
if (type == Character.class) {
return Character.toString((char) 0);
}
return "0";
} | [
"public",
"static",
"String",
"getPrimitiveDefault",
"(",
"Class",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"Boolean",
".",
"class",
")",
"{",
"return",
"\"false\"",
";",
"}",
"if",
"(",
"type",
"==",
"Character",
".",
"class",
")",
"{",
"return",
"C... | Gets the default value as String for the primitive types.
@param type the primitive type
@return the default value as String | [
"Gets",
"the",
"default",
"value",
"as",
"String",
"for",
"the",
"primitive",
"types",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/converters/ReflectionHelper.java#L226-L234 | train |
wisdom-framework/wisdom | framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/dialect/Routes.java | Routes.asset | public String asset(String path) {
Asset asset = assets.assetAt(path);
if (asset == null) {
// If the path starts with "/", try without
if (path.startsWith("/")) {
return asset(path.substring(1));
}
// Not found.
throw new Templ... | java | public String asset(String path) {
Asset asset = assets.assetAt(path);
if (asset == null) {
// If the path starts with "/", try without
if (path.startsWith("/")) {
return asset(path.substring(1));
}
// Not found.
throw new Templ... | [
"public",
"String",
"asset",
"(",
"String",
"path",
")",
"{",
"Asset",
"asset",
"=",
"assets",
".",
"assetAt",
"(",
"path",
")",
";",
"if",
"(",
"asset",
"==",
"null",
")",
"{",
"// If the path starts with \"/\", try without",
"if",
"(",
"path",
".",
"star... | Gets the url of the given asset. Throws an exception if the asset cannot be found.
@param path the asset's path
@return the url | [
"Gets",
"the",
"url",
"of",
"the",
"given",
"asset",
".",
"Throws",
"an",
"exception",
"if",
"the",
"asset",
"cannot",
"be",
"found",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/thymeleaf-template-engine/src/main/java/org/wisdom/template/thymeleaf/dialect/Routes.java#L377-L388 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/file/DiskFileUpload.java | DiskFileUpload.push | @Override
public void push(final Buffer buffer) {
if (async == null) {
upload.pause();
vertx.fileSystem().open(file.getAbsolutePath(), new OpenOptions().setCreate(true),
new Handler<AsyncResult<AsyncFile>>() {
@Override
... | java | @Override
public void push(final Buffer buffer) {
if (async == null) {
upload.pause();
vertx.fileSystem().open(file.getAbsolutePath(), new OpenOptions().setCreate(true),
new Handler<AsyncResult<AsyncFile>>() {
@Override
... | [
"@",
"Override",
"public",
"void",
"push",
"(",
"final",
"Buffer",
"buffer",
")",
"{",
"if",
"(",
"async",
"==",
"null",
")",
"{",
"upload",
".",
"pause",
"(",
")",
";",
"vertx",
".",
"fileSystem",
"(",
")",
".",
"open",
"(",
"file",
".",
"getAbsol... | A new chunk has arrived, save it on disk.
@param buffer the chunk | [
"A",
"new",
"chunk",
"has",
"arrived",
"save",
"it",
"on",
"disk",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/file/DiskFileUpload.java#L103-L126 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/http/MimeTypes.java | MimeTypes.getMimeTypeForFile | public static String getMimeTypeForFile(URL url) {
if (url == null) {
//The input url is null so we can't retrieve a mimetype, therefore we return null.
return null;
}
String external = url.toExternalForm();
if (external.indexOf('.') == -1) {
return BI... | java | public static String getMimeTypeForFile(URL url) {
if (url == null) {
//The input url is null so we can't retrieve a mimetype, therefore we return null.
return null;
}
String external = url.toExternalForm();
if (external.indexOf('.') == -1) {
return BI... | [
"public",
"static",
"String",
"getMimeTypeForFile",
"(",
"URL",
"url",
")",
"{",
"if",
"(",
"url",
"==",
"null",
")",
"{",
"//The input url is null so we can't retrieve a mimetype, therefore we return null.",
"return",
"null",
";",
"}",
"String",
"external",
"=",
"url... | Makes an educated guess of the mime type of the resource pointed by this url.
It tries to extract an 'extension' part and confronts this extension to the list of known extensions.
@param url the url
@return the mime type, BINARY if not found. | [
"Makes",
"an",
"educated",
"guess",
"of",
"the",
"mime",
"type",
"of",
"the",
"resource",
"pointed",
"by",
"this",
"url",
".",
"It",
"tries",
"to",
"extract",
"an",
"extension",
"part",
"and",
"confronts",
"this",
"extension",
"to",
"the",
"list",
"of",
... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/MimeTypes.java#L103-L120 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/VertxSingleton.java | VertxSingleton.start | @Validate
public void start() {
final Configuration configuration = appConfiguration.getConfiguration("vertx");
String log = System.getProperty("org.vertx.logger-delegate-factory-class-name");
if (log == null) {
// No logging backend configured, set one:
System.setP... | java | @Validate
public void start() {
final Configuration configuration = appConfiguration.getConfiguration("vertx");
String log = System.getProperty("org.vertx.logger-delegate-factory-class-name");
if (log == null) {
// No logging backend configured, set one:
System.setP... | [
"@",
"Validate",
"public",
"void",
"start",
"(",
")",
"{",
"final",
"Configuration",
"configuration",
"=",
"appConfiguration",
".",
"getConfiguration",
"(",
"\"vertx\"",
")",
";",
"String",
"log",
"=",
"System",
".",
"getProperty",
"(",
"\"org.vertx.logger-delegat... | Creates and exposed the instance of Vert.X. | [
"Creates",
"and",
"exposed",
"the",
"instance",
"of",
"Vert",
".",
"X",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/VertxSingleton.java#L61-L116 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/VertxSingleton.java | VertxSingleton.stop | @Invalidate
public void stop() throws InterruptedException {
unregisterQuietly(vertxRegistration);
unregisterQuietly(busRegistration);
CountDownLatch latch = new CountDownLatch(1);
vertx.close(v -> latch.countDown());
latch.await();
vertx = null;
} | java | @Invalidate
public void stop() throws InterruptedException {
unregisterQuietly(vertxRegistration);
unregisterQuietly(busRegistration);
CountDownLatch latch = new CountDownLatch(1);
vertx.close(v -> latch.countDown());
latch.await();
vertx = null;
} | [
"@",
"Invalidate",
"public",
"void",
"stop",
"(",
")",
"throws",
"InterruptedException",
"{",
"unregisterQuietly",
"(",
"vertxRegistration",
")",
";",
"unregisterQuietly",
"(",
"busRegistration",
")",
";",
"CountDownLatch",
"latch",
"=",
"new",
"CountDownLatch",
"("... | Unregisters and shuts down the Vert.X singleton. | [
"Unregisters",
"and",
"shuts",
"down",
"the",
"Vert",
".",
"X",
"singleton",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/VertxSingleton.java#L121-L129 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/AssetsSingleton.java | AssetsSingleton.assetAt | @Override
public Asset assetAt(String path) {
// The simplest implementation is to delegate to the provider and see if they return something.
for (AssetProvider provider : providers) {
Asset asset = provider.assetAt(path);
if (asset != null) {
return asset;
... | java | @Override
public Asset assetAt(String path) {
// The simplest implementation is to delegate to the provider and see if they return something.
for (AssetProvider provider : providers) {
Asset asset = provider.assetAt(path);
if (asset != null) {
return asset;
... | [
"@",
"Override",
"public",
"Asset",
"assetAt",
"(",
"String",
"path",
")",
"{",
"// The simplest implementation is to delegate to the provider and see if they return something.",
"for",
"(",
"AssetProvider",
"provider",
":",
"providers",
")",
"{",
"Asset",
"asset",
"=",
"... | Gets the path to retrieve the asset identified by its file name.
@param path the path
@return the path to retrieve the asset or {@literal null} if not found. If there are several matches,
return the first one. | [
"Gets",
"the",
"path",
"to",
"retrieve",
"the",
"asset",
"identified",
"by",
"its",
"file",
"name",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/AssetsSingleton.java#L103-L113 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/AssetsSingleton.java | AssetsSingleton.assets | @Override
public Collection<Asset<?>> assets(boolean useCache) {
if (useCache && !cache.isEmpty()) {
return new ArrayList<>(cache);
}
return assets();
} | java | @Override
public Collection<Asset<?>> assets(boolean useCache) {
if (useCache && !cache.isEmpty()) {
return new ArrayList<>(cache);
}
return assets();
} | [
"@",
"Override",
"public",
"Collection",
"<",
"Asset",
"<",
"?",
">",
">",
"assets",
"(",
"boolean",
"useCache",
")",
"{",
"if",
"(",
"useCache",
"&&",
"!",
"cache",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"cache"... | Retrieve the list of all asset currently available on the platform.
@param useCache whether or not we can returned a cached version of the result. This cache may contain
invalidated data or may not contain all available assets.
@return the list of assets | [
"Retrieve",
"the",
"list",
"of",
"all",
"asset",
"currently",
"available",
"on",
"the",
"platform",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/AssetsSingleton.java#L131-L138 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Instructions.java | Instructions.sanitize | public static Properties sanitize(Properties properties) {
// convert any non-String keys/values to Strings
Properties sanitizedEntries = new Properties();
for (Iterator<?> itr = properties.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Map.Entry) itr.next();
... | java | public static Properties sanitize(Properties properties) {
// convert any non-String keys/values to Strings
Properties sanitizedEntries = new Properties();
for (Iterator<?> itr = properties.entrySet().iterator(); itr.hasNext(); ) {
Map.Entry entry = (Map.Entry) itr.next();
... | [
"public",
"static",
"Properties",
"sanitize",
"(",
"Properties",
"properties",
")",
"{",
"// convert any non-String keys/values to Strings",
"Properties",
"sanitizedEntries",
"=",
"new",
"Properties",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"?",
">",
"itr",
"=",... | Utility method to sanitize the set of instructions.
@param properties the current instructions
@return the new set of instructions | [
"Utility",
"method",
"to",
"sanitize",
"the",
"set",
"of",
"instructions",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Instructions.java#L122-L139 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java | Result.render | public Result render(Object object) {
if (object instanceof Renderable) {
this.content = (Renderable<?>) object;
} else {
this.content = new RenderableObject(object);
}
return this;
} | java | public Result render(Object object) {
if (object instanceof Renderable) {
this.content = (Renderable<?>) object;
} else {
this.content = new RenderableObject(object);
}
return this;
} | [
"public",
"Result",
"render",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Renderable",
")",
"{",
"this",
".",
"content",
"=",
"(",
"Renderable",
"<",
"?",
">",
")",
"object",
";",
"}",
"else",
"{",
"this",
".",
"content",
"... | Sets the content of the current result to the given object.
@param object the object
@return the current result | [
"Sets",
"the",
"content",
"of",
"the",
"current",
"result",
"to",
"the",
"given",
"object",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java#L112-L119 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java | Result.with | public Result with(String headerName, String headerContent) {
headers.put(headerName, headerContent);
return this;
} | java | public Result with(String headerName, String headerContent) {
headers.put(headerName, headerContent);
return this;
} | [
"public",
"Result",
"with",
"(",
"String",
"headerName",
",",
"String",
"headerContent",
")",
"{",
"headers",
".",
"put",
"(",
"headerName",
",",
"headerContent",
")",
";",
"return",
"this",
";",
"}"
] | Sets a header. If this header was already set, the value is overridden.
@param headerName the header name
@param headerContent the header value
@return the current result. | [
"Sets",
"a",
"header",
".",
"If",
"this",
"header",
"was",
"already",
"set",
"the",
"value",
"is",
"overridden",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java#L291-L294 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java | Result.discard | public Result discard(String name) {
Cookie cookie = getCookie(name);
if (cookie != null) {
cookies.remove(cookie);
cookies.add(Cookie.builder(cookie).setMaxAge(0).build());
} else {
cookies.add(Cookie.builder(name, "").setMaxAge(0).build());
}
... | java | public Result discard(String name) {
Cookie cookie = getCookie(name);
if (cookie != null) {
cookies.remove(cookie);
cookies.add(Cookie.builder(cookie).setMaxAge(0).build());
} else {
cookies.add(Cookie.builder(name, "").setMaxAge(0).build());
}
... | [
"public",
"Result",
"discard",
"(",
"String",
"name",
")",
"{",
"Cookie",
"cookie",
"=",
"getCookie",
"(",
"name",
")",
";",
"if",
"(",
"cookie",
"!=",
"null",
")",
"{",
"cookies",
".",
"remove",
"(",
"cookie",
")",
";",
"cookies",
".",
"add",
"(",
... | Discards the given cookie. The cookie max-age is set to 0, so is going to be invalidated.
@param name the name of the cookie
@return the current result | [
"Discards",
"the",
"given",
"cookie",
".",
"The",
"cookie",
"max",
"-",
"age",
"is",
"set",
"to",
"0",
"so",
"is",
"going",
"to",
"be",
"invalidated",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java#L379-L388 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java | Result.redirect | public Result redirect(String url) {
status(Status.SEE_OTHER);
with(HeaderNames.LOCATION, url);
return this;
} | java | public Result redirect(String url) {
status(Status.SEE_OTHER);
with(HeaderNames.LOCATION, url);
return this;
} | [
"public",
"Result",
"redirect",
"(",
"String",
"url",
")",
"{",
"status",
"(",
"Status",
".",
"SEE_OTHER",
")",
";",
"with",
"(",
"HeaderNames",
".",
"LOCATION",
",",
"url",
")",
";",
"return",
"this",
";",
"}"
] | A redirect that uses 303 - SEE OTHER.
@param url The url used as redirect target.
@return A nicely configured result with status code 303 and the url set
as Location header. | [
"A",
"redirect",
"that",
"uses",
"303",
"-",
"SEE",
"OTHER",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java#L432-L436 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java | Result.redirectTemporary | public Result redirectTemporary(String url) {
status(Status.TEMPORARY_REDIRECT);
with(HeaderNames.LOCATION, url);
return this;
} | java | public Result redirectTemporary(String url) {
status(Status.TEMPORARY_REDIRECT);
with(HeaderNames.LOCATION, url);
return this;
} | [
"public",
"Result",
"redirectTemporary",
"(",
"String",
"url",
")",
"{",
"status",
"(",
"Status",
".",
"TEMPORARY_REDIRECT",
")",
";",
"with",
"(",
"HeaderNames",
".",
"LOCATION",
",",
"url",
")",
";",
"return",
"this",
";",
"}"
] | A redirect that uses 307 see other.
@param url The url used as redirect target.
@return A nicely configured result with status code 307 and the url set
as Location header. | [
"A",
"redirect",
"that",
"uses",
"307",
"see",
"other",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java#L445-L449 | train |
wisdom-framework/wisdom | core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java | Result.current | private Context current(boolean fail) {
Context context = Context.CONTEXT.get();
if (context == null && fail) {
throw new IllegalStateException("No context");
}
return context;
} | java | private Context current(boolean fail) {
Context context = Context.CONTEXT.get();
if (context == null && fail) {
throw new IllegalStateException("No context");
}
return context;
} | [
"private",
"Context",
"current",
"(",
"boolean",
"fail",
")",
"{",
"Context",
"context",
"=",
"Context",
".",
"CONTEXT",
".",
"get",
"(",
")",
";",
"if",
"(",
"context",
"==",
"null",
"&&",
"fail",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
... | Convenient method to retrieve the current HTTP context.
@param fail whether or no we should fail (i.e. throw an {@link java.lang.IllegalStateException}) if there are
no HTTP context
@return the HTTP context, {@code null} if none | [
"Convenient",
"method",
"to",
"retrieve",
"the",
"current",
"HTTP",
"context",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java#L536-L542 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/StopMojo.java | StopMojo.execute | @Override
public void execute() throws MojoExecutionException {
new WisdomExecutor().stop(this);
File pid = new File(getWisdomRootDirectory(), "RUNNING_PID");
if (WisdomExecutor.waitForFileDeletion(pid)) {
getLog().info("Wisdom server stopped.");
} else {
thro... | java | @Override
public void execute() throws MojoExecutionException {
new WisdomExecutor().stop(this);
File pid = new File(getWisdomRootDirectory(), "RUNNING_PID");
if (WisdomExecutor.waitForFileDeletion(pid)) {
getLog().info("Wisdom server stopped.");
} else {
thro... | [
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"throws",
"MojoExecutionException",
"{",
"new",
"WisdomExecutor",
"(",
")",
".",
"stop",
"(",
"this",
")",
";",
"File",
"pid",
"=",
"new",
"File",
"(",
"getWisdomRootDirectory",
"(",
")",
",",
"\"RUNN... | Tries to stops the running Wisdom server.
@throws MojoExecutionException if the Wisdom server cannot be stopped | [
"Tries",
"to",
"stops",
"the",
"running",
"Wisdom",
"server",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/StopMojo.java#L45-L55 | train |
wisdom-framework/wisdom | framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java | EhCacheService.start | @Validate
public void start() {
Boolean enabled = configuration.getBooleanWithDefault("ehcache.enabled", true);
if (!enabled) {
return;
}
File config = new File(configuration.getBaseDir(), CUSTOM_CONFIGURATION);
final ClassLoader original = Thread.currentThread()... | java | @Validate
public void start() {
Boolean enabled = configuration.getBooleanWithDefault("ehcache.enabled", true);
if (!enabled) {
return;
}
File config = new File(configuration.getBaseDir(), CUSTOM_CONFIGURATION);
final ClassLoader original = Thread.currentThread()... | [
"@",
"Validate",
"public",
"void",
"start",
"(",
")",
"{",
"Boolean",
"enabled",
"=",
"configuration",
".",
"getBooleanWithDefault",
"(",
"\"ehcache.enabled\"",
",",
"true",
")",
";",
"if",
"(",
"!",
"enabled",
")",
"{",
"return",
";",
"}",
"File",
"config... | Creates the EhCache-based implementation of the Cache Service. | [
"Creates",
"the",
"EhCache",
"-",
"based",
"implementation",
"of",
"the",
"Cache",
"Service",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java#L70-L101 | train |
wisdom-framework/wisdom | framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java | EhCacheService.stop | @Invalidate
public void stop() {
if (registration != null) {
registration.unregister();
registration = null;
}
if (manager != null) {
manager.removeCache(WISDOM_KEY);
}
} | java | @Invalidate
public void stop() {
if (registration != null) {
registration.unregister();
registration = null;
}
if (manager != null) {
manager.removeCache(WISDOM_KEY);
}
} | [
"@",
"Invalidate",
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"registration",
"!=",
"null",
")",
"{",
"registration",
".",
"unregister",
"(",
")",
";",
"registration",
"=",
"null",
";",
"}",
"if",
"(",
"manager",
"!=",
"null",
")",
"{",
"man... | Cleans up everything. | [
"Cleans",
"up",
"everything",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java#L107-L116 | train |
wisdom-framework/wisdom | framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java | EhCacheService.set | @Override
public void set(String key, Object value, int expiration) {
Element element = new Element(key, value);
if (expiration == 0) {
element.setEternal(true);
}
element.setTimeToLive(expiration);
cache.put(element);
} | java | @Override
public void set(String key, Object value, int expiration) {
Element element = new Element(key, value);
if (expiration == 0) {
element.setEternal(true);
}
element.setTimeToLive(expiration);
cache.put(element);
} | [
"@",
"Override",
"public",
"void",
"set",
"(",
"String",
"key",
",",
"Object",
"value",
",",
"int",
"expiration",
")",
"{",
"Element",
"element",
"=",
"new",
"Element",
"(",
"key",
",",
"value",
")",
";",
"if",
"(",
"expiration",
"==",
"0",
")",
"{",... | Adds an entry in the cache.
@param key Item key.
@param value Item value.
@param expiration Expiration time in seconds (0 second means eternity). | [
"Adds",
"an",
"entry",
"in",
"the",
"cache",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java#L125-L133 | train |
wisdom-framework/wisdom | framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java | EhCacheService.get | @Override
public Object get(String key) {
Element element = cache.get(key);
if (element != null) {
return element.getObjectValue();
}
return null;
} | java | @Override
public Object get(String key) {
Element element = cache.get(key);
if (element != null) {
return element.getObjectValue();
}
return null;
} | [
"@",
"Override",
"public",
"Object",
"get",
"(",
"String",
"key",
")",
"{",
"Element",
"element",
"=",
"cache",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"return",
"element",
".",
"getObjectValue",
"(",
")",
";",... | Gets an entry from the cache.
@param key Item key.
@return the stored object, {@literal null} if none of expired. | [
"Gets",
"an",
"entry",
"from",
"the",
"cache",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/ehcache-cache-service/src/main/java/org/wisdom/cache/ehcache/EhCacheService.java#L159-L166 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomWatcherMojo.java | AbstractWisdomWatcherMojo.getResources | public Collection<File> getResources(List<String> extensions) {
List<File> files = new ArrayList<>();
files.addAll(WatcherUtils.getAllFilesFromDirectory(getInternalAssetsDirectory(), extensions));
files.addAll(WatcherUtils.getAllFilesFromDirectory(getExternalAssetsDirectory(), extensions));
... | java | public Collection<File> getResources(List<String> extensions) {
List<File> files = new ArrayList<>();
files.addAll(WatcherUtils.getAllFilesFromDirectory(getInternalAssetsDirectory(), extensions));
files.addAll(WatcherUtils.getAllFilesFromDirectory(getExternalAssetsDirectory(), extensions));
... | [
"public",
"Collection",
"<",
"File",
">",
"getResources",
"(",
"List",
"<",
"String",
">",
"extensions",
")",
"{",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"files",
".",
"addAll",
"(",
"WatcherUtils",
".",
"getAl... | Finds all resources from internal and external assets directories having one of the specified extensions.
@param extensions the extensions
@return the set of file, potentially empty if no files match. | [
"Finds",
"all",
"resources",
"from",
"internal",
"and",
"external",
"assets",
"directories",
"having",
"one",
"of",
"the",
"specified",
"extensions",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomWatcherMojo.java#L73-L78 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomWatcherMojo.java | AbstractWisdomWatcherMojo.getFilteredVersion | public File getFilteredVersion(File input) {
File out = getOutputFile(input);
if (!out.isFile()) {
return null;
}
return out;
} | java | public File getFilteredVersion(File input) {
File out = getOutputFile(input);
if (!out.isFile()) {
return null;
}
return out;
} | [
"public",
"File",
"getFilteredVersion",
"(",
"File",
"input",
")",
"{",
"File",
"out",
"=",
"getOutputFile",
"(",
"input",
")",
";",
"if",
"(",
"!",
"out",
".",
"isFile",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"out",
";",
"}"
] | Searches if the given file has already being copied to its output directory and so may have been 'filtered'.
@param input the input file
@return the 'filtered' file if exists, {@code null} otherwise | [
"Searches",
"if",
"the",
"given",
"file",
"has",
"already",
"being",
"copied",
"to",
"its",
"output",
"directory",
"and",
"so",
"may",
"have",
"been",
"filtered",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/mojos/AbstractWisdomWatcherMojo.java#L86-L92 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/MavenArtifact.java | MavenArtifact.isValid | public static boolean isValid(Artifact artifact) {
return artifact.getGroupId() != null && !FAKE.equals(artifact.getGroupId());
} | java | public static boolean isValid(Artifact artifact) {
return artifact.getGroupId() != null && !FAKE.equals(artifact.getGroupId());
} | [
"public",
"static",
"boolean",
"isValid",
"(",
"Artifact",
"artifact",
")",
"{",
"return",
"artifact",
".",
"getGroupId",
"(",
")",
"!=",
"null",
"&&",
"!",
"FAKE",
".",
"equals",
"(",
"artifact",
".",
"getGroupId",
"(",
")",
")",
";",
"}"
] | Ensures that the given artifact was correctly populated.
@param artifact the artifact
@return {@code true} if the artifact is valid, @{code false} otherwise. | [
"Ensures",
"that",
"the",
"given",
"artifact",
"was",
"correctly",
"populated",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/MavenArtifact.java#L54-L56 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/MavenArtifact.java | MavenArtifact.filter | public static Collection<? extends Artifact> filter(Collection<Artifact> artifacts) {
LinkedHashSet<Artifact> set = new LinkedHashSet<>();
for (Artifact artifact : artifacts) {
if (MavenArtifact.isValid(artifact)) {
set.add(artifact);
}
}
return se... | java | public static Collection<? extends Artifact> filter(Collection<Artifact> artifacts) {
LinkedHashSet<Artifact> set = new LinkedHashSet<>();
for (Artifact artifact : artifacts) {
if (MavenArtifact.isValid(artifact)) {
set.add(artifact);
}
}
return se... | [
"public",
"static",
"Collection",
"<",
"?",
"extends",
"Artifact",
">",
"filter",
"(",
"Collection",
"<",
"Artifact",
">",
"artifacts",
")",
"{",
"LinkedHashSet",
"<",
"Artifact",
">",
"set",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"for",
"(",
... | Removes non valid artifacts from the given list.
@param artifacts the list of artifacts than may contain fake artifacts.
@return the cleaned up list | [
"Removes",
"non",
"valid",
"artifacts",
"from",
"the",
"given",
"list",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/MavenArtifact.java#L64-L72 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/MavenArtifact.java | MavenArtifact.setDependencyFilter | public void setDependencyFilter(ObjectNode filter) {
if (filter == null) {
return;
}
final JsonNode patterns = filter.get("patterns");
if (patterns != null && patterns.isArray()) {
List<String> ids = new ArrayList<>();
for (JsonNode exclusion : pattern... | java | public void setDependencyFilter(ObjectNode filter) {
if (filter == null) {
return;
}
final JsonNode patterns = filter.get("patterns");
if (patterns != null && patterns.isArray()) {
List<String> ids = new ArrayList<>();
for (JsonNode exclusion : pattern... | [
"public",
"void",
"setDependencyFilter",
"(",
"ObjectNode",
"filter",
")",
"{",
"if",
"(",
"filter",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"JsonNode",
"patterns",
"=",
"filter",
".",
"get",
"(",
"\"patterns\"",
")",
";",
"if",
"(",
"patter... | A setter method made especially for Jackson. Artifact's dependency filter is used for the exclusion list. As
the filter cannot be created directly by Jackson, we do the job directly here.
@param filter the Json representation of the filter | [
"A",
"setter",
"method",
"made",
"especially",
"for",
"Jackson",
".",
"Artifact",
"s",
"dependency",
"filter",
"is",
"used",
"for",
"the",
"exclusion",
"list",
".",
"As",
"the",
"filter",
"cannot",
"be",
"created",
"directly",
"by",
"Jackson",
"we",
"do",
... | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/MavenArtifact.java#L80-L92 | train |
wisdom-framework/wisdom | framework/i18n-service/src/main/java/org/wisdom/i18n/I18nExtension.java | I18nExtension.get | public String get(String key, Object... args) {
String value = bundle.getString(key);
if (args.length != 0) {
value = MessageFormat.format(value, args);
}
return value;
} | java | public String get(String key, Object... args) {
String value = bundle.getString(key);
if (args.length != 0) {
value = MessageFormat.format(value, args);
}
return value;
} | [
"public",
"String",
"get",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"String",
"value",
"=",
"bundle",
".",
"getString",
"(",
"key",
")",
";",
"if",
"(",
"args",
".",
"length",
"!=",
"0",
")",
"{",
"value",
"=",
"MessageFormat",
... | Gets the localized message for the given key.
@param key the key
@param args the message parameters, can be empty.
@return the localized message or {@literal null} if the key does not
exist in the bundle. If {@literal args} is not empty, the retrieve message is formatted using the given
arguments. This formatting use... | [
"Gets",
"the",
"localized",
"message",
"for",
"the",
"given",
"key",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/i18n-service/src/main/java/org/wisdom/i18n/I18nExtension.java#L129-L135 | train |
wisdom-framework/wisdom | framework/i18n-service/src/main/java/org/wisdom/i18n/I18nExtension.java | I18nExtension.keys | public Set<String> keys() {
Set<String> list = new LinkedHashSet<>();
Enumeration<String> keys = bundle.getKeys();
while (keys.hasMoreElements()) {
list.add(keys.nextElement());
}
return list;
} | java | public Set<String> keys() {
Set<String> list = new LinkedHashSet<>();
Enumeration<String> keys = bundle.getKeys();
while (keys.hasMoreElements()) {
list.add(keys.nextElement());
}
return list;
} | [
"public",
"Set",
"<",
"String",
">",
"keys",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"list",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"Enumeration",
"<",
"String",
">",
"keys",
"=",
"bundle",
".",
"getKeys",
"(",
")",
";",
"while",
"(",
... | Gets the keys contained in the bundle.
@return the keys. At least one key is returned as empty bundle
was rejected. | [
"Gets",
"the",
"keys",
"contained",
"in",
"the",
"bundle",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/i18n-service/src/main/java/org/wisdom/i18n/I18nExtension.java#L143-L150 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyCopy.java | DependencyCopy.copyBundles | public static void copyBundles(AbstractWisdomMojo mojo, DependencyGraphBuilder graph, boolean transitive,
boolean deployTestDependencies, boolean disableDefaultExclusions, Libraries libraries)
throws IOException {
File applicationDirectory = new File(mojo.getWisdom... | java | public static void copyBundles(AbstractWisdomMojo mojo, DependencyGraphBuilder graph, boolean transitive,
boolean deployTestDependencies, boolean disableDefaultExclusions, Libraries libraries)
throws IOException {
File applicationDirectory = new File(mojo.getWisdom... | [
"public",
"static",
"void",
"copyBundles",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"DependencyGraphBuilder",
"graph",
",",
"boolean",
"transitive",
",",
"boolean",
"deployTestDependencies",
",",
"boolean",
"disableDefaultExclusions",
",",
"Libraries",
"libraries",
")",
... | Copies dependencies, that are bundles, to the application directory.
If the bundle is already in core or runtime, the bundle is not copied.
@param mojo the mojo
@param graph the dependency graph builder
@param transitive whether or not we include the transitive depe... | [
"Copies",
"dependencies",
"that",
"are",
"bundles",
"to",
"the",
"application",
"directory",
".",
"If",
"the",
"bundle",
"is",
"already",
"in",
"core",
"or",
"runtime",
"the",
"bundle",
"is",
"not",
"copied",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyCopy.java#L59-L120 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyCopy.java | DependencyCopy.getArtifactsToConsider | public static Set<Artifact> getArtifactsToConsider(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
boolean transitive, ArtifactFilter filter) {
// No transitive.
Set<Artifact> artifacts;
if (!transitive) {
// Direct depend... | java | public static Set<Artifact> getArtifactsToConsider(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
boolean transitive, ArtifactFilter filter) {
// No transitive.
Set<Artifact> artifacts;
if (!transitive) {
// Direct depend... | [
"public",
"static",
"Set",
"<",
"Artifact",
">",
"getArtifactsToConsider",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"DependencyGraphBuilder",
"graph",
",",
"boolean",
"transitive",
",",
"ArtifactFilter",
"filter",
")",
"{",
"// No transitive.",
"Set",
"<",
"Artifact",
... | Gets the list of artifact to consider during the analysis.
@param mojo the mojo
@param graph the dependency graph builder
@param transitive do we have to include transitive dependencies
@return the set of artifacts | [
"Gets",
"the",
"list",
"of",
"artifact",
"to",
"consider",
"during",
"the",
"analysis",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyCopy.java#L191-L205 | train |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyCopy.java | DependencyCopy.getTransitiveDependencies | private static Set<Artifact> getTransitiveDependencies(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
ArtifactFilter filter) {
Set<Artifact> artifacts;
artifacts = new LinkedHashSet<>();
try {
Set<Artifact> transitive... | java | private static Set<Artifact> getTransitiveDependencies(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
ArtifactFilter filter) {
Set<Artifact> artifacts;
artifacts = new LinkedHashSet<>();
try {
Set<Artifact> transitive... | [
"private",
"static",
"Set",
"<",
"Artifact",
">",
"getTransitiveDependencies",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"DependencyGraphBuilder",
"graph",
",",
"ArtifactFilter",
"filter",
")",
"{",
"Set",
"<",
"Artifact",
">",
"artifacts",
";",
"artifacts",
"=",
"n... | Collects the transitive dependencies of the current projects.
@param mojo the mojo
@param graph the dependency graph builder
@return the set of resolved transitive dependencies. | [
"Collects",
"the",
"transitive",
"dependencies",
"of",
"the",
"current",
"projects",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/DependencyCopy.java#L214-L243 | train |
wisdom-framework/wisdom | extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/AddCSRFTokenInterceptor.java | AddCSRFTokenInterceptor.call | @Override
public Result call(AddCSRFToken configuration, RequestContext context) throws Exception {
if (csrf.eligibleForCSRF(context.context())
&& (csrf.extractTokenFromRequest(context.context()) == null || configuration.newTokenOnEachRequest())) {
// Generate a new token, it wil... | java | @Override
public Result call(AddCSRFToken configuration, RequestContext context) throws Exception {
if (csrf.eligibleForCSRF(context.context())
&& (csrf.extractTokenFromRequest(context.context()) == null || configuration.newTokenOnEachRequest())) {
// Generate a new token, it wil... | [
"@",
"Override",
"public",
"Result",
"call",
"(",
"AddCSRFToken",
"configuration",
",",
"RequestContext",
"context",
")",
"throws",
"Exception",
"{",
"if",
"(",
"csrf",
".",
"eligibleForCSRF",
"(",
"context",
".",
"context",
"(",
")",
")",
"&&",
"(",
"csrf",... | Injects a CSRF token into the result if the request is eligible.
@param configuration the interception configuration
@param context the interception context
@return the result with the token if a token was added
@throws Exception if anything bad happen | [
"Injects",
"a",
"CSRF",
"token",
"into",
"the",
"result",
"if",
"the",
"request",
"is",
"eligible",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-filters/src/main/java/org/wisdom/framework/csrf/AddCSRFTokenInterceptor.java#L50-L61 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java | WebJarController.start | @Validate
public void start() {
if (directory.isDirectory()) {
buildFileIndex();
}
if (tracker != null) {
tracker.open();
}
if (deployer != null) {
deployer.start();
}
} | java | @Validate
public void start() {
if (directory.isDirectory()) {
buildFileIndex();
}
if (tracker != null) {
tracker.open();
}
if (deployer != null) {
deployer.start();
}
} | [
"@",
"Validate",
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"buildFileIndex",
"(",
")",
";",
"}",
"if",
"(",
"tracker",
"!=",
"null",
")",
"{",
"tracker",
".",
"open",
"(",
")",
";",
... | Starts the controllers. | [
"Starts",
"the",
"controllers",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java#L149-L160 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java | WebJarController.stop | @Invalidate
public void stop() {
if (deployer != null) {
deployer.stop();
}
if (tracker != null) {
tracker.close();
}
libraries.clear();
} | java | @Invalidate
public void stop() {
if (deployer != null) {
deployer.stop();
}
if (tracker != null) {
tracker.close();
}
libraries.clear();
} | [
"@",
"Invalidate",
"public",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"deployer",
"!=",
"null",
")",
"{",
"deployer",
".",
"stop",
"(",
")",
";",
"}",
"if",
"(",
"tracker",
"!=",
"null",
")",
"{",
"tracker",
".",
"close",
"(",
")",
";",
"}",
"... | Stops the controllers. | [
"Stops",
"the",
"controllers",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java#L165-L174 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java | WebJarController.modifiedBundle | @Override
public void modifiedBundle(Bundle bundle, BundleEvent bundleEvent, List<BundleWebJarLib> webJarLibs) {
// Remove all WebJars from the given bundle, and then read tem.
synchronized (this) {
removedBundle(bundle, bundleEvent, webJarLibs);
addingBundle(bundle, bundleEv... | java | @Override
public void modifiedBundle(Bundle bundle, BundleEvent bundleEvent, List<BundleWebJarLib> webJarLibs) {
// Remove all WebJars from the given bundle, and then read tem.
synchronized (this) {
removedBundle(bundle, bundleEvent, webJarLibs);
addingBundle(bundle, bundleEv... | [
"@",
"Override",
"public",
"void",
"modifiedBundle",
"(",
"Bundle",
"bundle",
",",
"BundleEvent",
"bundleEvent",
",",
"List",
"<",
"BundleWebJarLib",
">",
"webJarLibs",
")",
"{",
"// Remove all WebJars from the given bundle, and then read tem.",
"synchronized",
"(",
"this... | A bundle is updated.
@param bundle the bundle
@param bundleEvent the event
@param webJarLibs the webjars that were embedded in the previous version of the bundle. | [
"A",
"bundle",
"is",
"updated",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java#L340-L347 | train |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java | WebJarController.removedBundle | @Override
public void removedBundle(Bundle bundle, BundleEvent bundleEvent, List<BundleWebJarLib> webJarLibs) {
removeWebJarLibs(webJarLibs);
} | java | @Override
public void removedBundle(Bundle bundle, BundleEvent bundleEvent, List<BundleWebJarLib> webJarLibs) {
removeWebJarLibs(webJarLibs);
} | [
"@",
"Override",
"public",
"void",
"removedBundle",
"(",
"Bundle",
"bundle",
",",
"BundleEvent",
"bundleEvent",
",",
"List",
"<",
"BundleWebJarLib",
">",
"webJarLibs",
")",
"{",
"removeWebJarLibs",
"(",
"webJarLibs",
")",
";",
"}"
] | A bundle is removed.
@param bundle the bundle
@param bundleEvent the event
@param webJarLibs the webjars that were embedded in the bundle. | [
"A",
"bundle",
"is",
"removed",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java#L356-L359 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java | RamlControllerVisitor.visit | @Override
public void visit(ControllerModel element, Raml raml) {
raml.setTitle(element.getName());
if (element.getDescription() != null && !element.getDescription().isEmpty()) {
DocumentationItem doc = new DocumentationItem();
doc.setContent(element.getDescription());
... | java | @Override
public void visit(ControllerModel element, Raml raml) {
raml.setTitle(element.getName());
if (element.getDescription() != null && !element.getDescription().isEmpty()) {
DocumentationItem doc = new DocumentationItem();
doc.setContent(element.getDescription());
... | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"ControllerModel",
"element",
",",
"Raml",
"raml",
")",
"{",
"raml",
".",
"setTitle",
"(",
"element",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"element",
".",
"getDescription",
"(",
")",
"!=",
"nul... | Visit the Wisdom Controller source model in order to populate the raml model.
@param element The wisdom controller model (we visit it).
@param raml The raml model (we construct it). | [
"Visit",
"the",
"Wisdom",
"Controller",
"source",
"model",
"in",
"order",
"to",
"populate",
"the",
"raml",
"model",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L63-L80 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java | RamlControllerVisitor.addResponsesToAction | private void addResponsesToAction(ControllerRouteModel<Raml> elem, Action action) {
// get all mimeTypes defined in @Route.produces
LOGGER.debug("responsesMimes.size:"+elem.getResponseMimes().size());
List<String> mimes = new ArrayList<>();
mimes.addAll(elem.getResponseMimes());
... | java | private void addResponsesToAction(ControllerRouteModel<Raml> elem, Action action) {
// get all mimeTypes defined in @Route.produces
LOGGER.debug("responsesMimes.size:"+elem.getResponseMimes().size());
List<String> mimes = new ArrayList<>();
mimes.addAll(elem.getResponseMimes());
... | [
"private",
"void",
"addResponsesToAction",
"(",
"ControllerRouteModel",
"<",
"Raml",
">",
"elem",
",",
"Action",
"action",
")",
"{",
"// get all mimeTypes defined in @Route.produces",
"LOGGER",
".",
"debug",
"(",
"\"responsesMimes.size:\"",
"+",
"elem",
".",
"getRespons... | Add the response specification to the given action.
@param elem The ControllerRouteModel that contains the response specification.
@param action The Action on which to add the response specification. | [
"Add",
"the",
"response",
"specification",
"to",
"the",
"given",
"action",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L294-L337 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java | RamlControllerVisitor.addActionFromRouteElem | private void addActionFromRouteElem(ControllerRouteModel<Raml> elem, Resource resource) {
Action action = new Action();
action.setType(ActionType.valueOf(elem.getHttpMethod().name()));
action.setDescription(elem.getDescription());
//handle body
addBodyToAction(elem, action);
... | java | private void addActionFromRouteElem(ControllerRouteModel<Raml> elem, Resource resource) {
Action action = new Action();
action.setType(ActionType.valueOf(elem.getHttpMethod().name()));
action.setDescription(elem.getDescription());
//handle body
addBodyToAction(elem, action);
... | [
"private",
"void",
"addActionFromRouteElem",
"(",
"ControllerRouteModel",
"<",
"Raml",
">",
"elem",
",",
"Resource",
"resource",
")",
"{",
"Action",
"action",
"=",
"new",
"Action",
"(",
")",
";",
"action",
".",
"setType",
"(",
"ActionType",
".",
"valueOf",
"... | Set the resource action from the wisdom route element.
@param elem The wisdom route element that we are visiting
@param resource The raml resource corresponding to the route element | [
"Set",
"the",
"resource",
"action",
"from",
"the",
"wisdom",
"route",
"element",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L345-L435 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java | RamlControllerVisitor.ancestorOrIHasParam | private static Boolean ancestorOrIHasParam(final Resource resource, String uriParamName) {
Resource ancestor = resource;
while (ancestor != null) {
if (ancestor.getUriParameters().containsKey(uriParamName)) {
return true;
}
ancestor = ancestor.getPare... | java | private static Boolean ancestorOrIHasParam(final Resource resource, String uriParamName) {
Resource ancestor = resource;
while (ancestor != null) {
if (ancestor.getUriParameters().containsKey(uriParamName)) {
return true;
}
ancestor = ancestor.getPare... | [
"private",
"static",
"Boolean",
"ancestorOrIHasParam",
"(",
"final",
"Resource",
"resource",
",",
"String",
"uriParamName",
")",
"{",
"Resource",
"ancestor",
"=",
"resource",
";",
"while",
"(",
"ancestor",
"!=",
"null",
")",
"{",
"if",
"(",
"ancestor",
".",
... | Check if the given resource or its ancestor have the uri param of given name.
@param resource The resource on which to check.
@param uriParamName Name of the uri Param we are looking for.
@return <code>true</code> if this or its ancestor resource have the param of given name already define. | [
"Check",
"if",
"the",
"given",
"resource",
"or",
"its",
"ancestor",
"have",
"the",
"uri",
"param",
"of",
"given",
"name",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L444-L455 | train |
wisdom-framework/wisdom | extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java | RamlControllerVisitor.typeConverter | private static ParamType typeConverter(String typeName) {
if (typeName == null || typeName.isEmpty()) {
return null;
}
if ("Number".equals(typeName) || "Long".equalsIgnoreCase(typeName)
|| "Integer".equals(typeName) || "int".equals(typeName)) {
return Par... | java | private static ParamType typeConverter(String typeName) {
if (typeName == null || typeName.isEmpty()) {
return null;
}
if ("Number".equals(typeName) || "Long".equalsIgnoreCase(typeName)
|| "Integer".equals(typeName) || "int".equals(typeName)) {
return Par... | [
"private",
"static",
"ParamType",
"typeConverter",
"(",
"String",
"typeName",
")",
"{",
"if",
"(",
"typeName",
"==",
"null",
"||",
"typeName",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"\"Number\"",
".",
"equals",
"(",
... | Convert a string version of the type name into a ParamType enum or null if nothing correspond.
@param typeName The type name.
@return the {@link ParamType} corresponding to the given type name. | [
"Convert",
"a",
"string",
"version",
"of",
"the",
"type",
"name",
"into",
"a",
"ParamType",
"enum",
"or",
"null",
"if",
"nothing",
"correspond",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-raml/wisdom-raml-maven-plugin/src/main/java/org/wisdom/raml/visitor/RamlControllerVisitor.java#L463-L490 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/converters/ParamConverterEngine.java | ParamConverterEngine.newInstance | @Override
public <T> T newInstance(Context context, Class<T> type) throws IllegalArgumentException {
// Retrieve the factory
for (ParameterFactory factory : factories) {
if (factory.getType().equals(type)) {
// Factory found - instantiate
//noinspection un... | java | @Override
public <T> T newInstance(Context context, Class<T> type) throws IllegalArgumentException {
// Retrieve the factory
for (ParameterFactory factory : factories) {
if (factory.getType().equals(type)) {
// Factory found - instantiate
//noinspection un... | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Context",
"context",
",",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"IllegalArgumentException",
"{",
"// Retrieve the factory",
"for",
"(",
"ParameterFactory",
"factory",
":",
"factories",
... | Creates an instance of T from the given HTTP content. Unlike converters, it does not handler generics or
collections.
@param context the HTTP content
@param type the class to instantiate
@return the created object
@throws IllegalArgumentException if there are no {@link org.wisdom.api.content.ParameterFactory} avail... | [
"Creates",
"an",
"instance",
"of",
"T",
"from",
"the",
"given",
"HTTP",
"content",
".",
"Unlike",
"converters",
"it",
"does",
"not",
"handler",
"generics",
"or",
"collections",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/converters/ParamConverterEngine.java#L138-L150 | train |
wisdom-framework/wisdom | core/content-manager/src/main/java/org/wisdom/content/converters/ParamConverterEngine.java | ParamConverterEngine.getConverter | @SuppressWarnings("unchecked")
private <T> ParameterConverter<T> getConverter(Class<T> type) {
// check for String first
if (type == String.class) {
return (ParameterConverter<T>) StringConverter.INSTANCE;
}
// Search for exposed converters.
for (ParameterConvert... | java | @SuppressWarnings("unchecked")
private <T> ParameterConverter<T> getConverter(Class<T> type) {
// check for String first
if (type == String.class) {
return (ParameterConverter<T>) StringConverter.INSTANCE;
}
// Search for exposed converters.
for (ParameterConvert... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
">",
"ParameterConverter",
"<",
"T",
">",
"getConverter",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"// check for String first",
"if",
"(",
"type",
"==",
"String",
".",
"class",
... | Searches a suitable converter to convert String to the given type.
@param type the target type
@param <T> the class
@return the parameter converter able to creates instances of the target type from String representations.
@throws java.util.NoSuchElementException if no converter can be found | [
"Searches",
"a",
"suitable",
"converter",
"to",
"convert",
"String",
"to",
"the",
"given",
"type",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/converters/ParamConverterEngine.java#L272-L322 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/executors/ExecutorExtension.java | ExecutorExtension.start | @Validate
public void start() {
metrics.register("executors", new MetricSet() {
@Override
public Map<String, Metric> getMetrics() {
return ImmutableMap.<String, Metric>of(
"executors.count", new Gauge<Integer>() {
@O... | java | @Validate
public void start() {
metrics.register("executors", new MetricSet() {
@Override
public Map<String, Metric> getMetrics() {
return ImmutableMap.<String, Metric>of(
"executors.count", new Gauge<Integer>() {
@O... | [
"@",
"Validate",
"public",
"void",
"start",
"(",
")",
"{",
"metrics",
".",
"register",
"(",
"\"executors\"",
",",
"new",
"MetricSet",
"(",
")",
"{",
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Metric",
">",
"getMetrics",
"(",
")",
"{",
"retu... | Starts the extension. It registers the different metrics into the metric registry. | [
"Starts",
"the",
"extension",
".",
"It",
"registers",
"the",
"different",
"metrics",
"into",
"the",
"metric",
"registry",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/executors/ExecutorExtension.java#L63-L107 | train |
wisdom-framework/wisdom | extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/executors/ExecutorExtension.java | ExecutorExtension.data | @Route(method = HttpMethod.GET, uri = "/monitor/executors.json")
public Result data() {
return ok(ImmutableMap.builder()
.put("executors", getExecutorsAsMap(executors))
.put("schedulers", getExecutorsAsMap(schedulers))
.put("hung", getH... | java | @Route(method = HttpMethod.GET, uri = "/monitor/executors.json")
public Result data() {
return ok(ImmutableMap.builder()
.put("executors", getExecutorsAsMap(executors))
.put("schedulers", getExecutorsAsMap(schedulers))
.put("hung", getH... | [
"@",
"Route",
"(",
"method",
"=",
"HttpMethod",
".",
"GET",
",",
"uri",
"=",
"\"/monitor/executors.json\"",
")",
"public",
"Result",
"data",
"(",
")",
"{",
"return",
"ok",
"(",
"ImmutableMap",
".",
"builder",
"(",
")",
".",
"put",
"(",
"\"executors\"",
"... | Retrieves the metrics about the executors. This method is intended to be used to handled an AJAX call.
@return the metrics as JSON. | [
"Retrieves",
"the",
"metrics",
"about",
"the",
"executors",
".",
"This",
"method",
"is",
"intended",
"to",
"be",
"used",
"to",
"handled",
"an",
"AJAX",
"call",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/extensions/wisdom-monitor/src/main/java/org/wisdom/monitor/extensions/executors/ExecutorExtension.java#L202-L211 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/AsyncInputStream.java | AsyncInputStream.handler | @Override
public ReadStream<Buffer> handler(Handler<Buffer> handler) {
if (handler == null) {
throw new IllegalArgumentException("handler");
}
this.dataHandler = handler;
doRead();
return this;
} | java | @Override
public ReadStream<Buffer> handler(Handler<Buffer> handler) {
if (handler == null) {
throw new IllegalArgumentException("handler");
}
this.dataHandler = handler;
doRead();
return this;
} | [
"@",
"Override",
"public",
"ReadStream",
"<",
"Buffer",
">",
"handler",
"(",
"Handler",
"<",
"Buffer",
">",
"handler",
")",
"{",
"if",
"(",
"handler",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"handler\"",
")",
";",
"}",
... | Set a data handler. As data is read, the handler will be called with the data.
@param handler the handler.
@return a reference to this, so the API can be used fluently | [
"Set",
"a",
"data",
"handler",
".",
"As",
"data",
"is",
"read",
"the",
"handler",
"will",
"be",
"called",
"with",
"the",
"data",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/AsyncInputStream.java#L182-L190 | train |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/AsyncInputStream.java | AsyncInputStream.doRead | private void doRead() {
if (context == null) {
context = vertx.getOrCreateContext();
}
if (state == STATUS_ACTIVE) {
final Handler<Buffer> dataHandler = this.dataHandler;
final Handler<Void> closeHandler = this.closeHandler;
executor.submit(
... | java | private void doRead() {
if (context == null) {
context = vertx.getOrCreateContext();
}
if (state == STATUS_ACTIVE) {
final Handler<Buffer> dataHandler = this.dataHandler;
final Handler<Void> closeHandler = this.closeHandler;
executor.submit(
... | [
"private",
"void",
"doRead",
"(",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"context",
"=",
"vertx",
".",
"getOrCreateContext",
"(",
")",
";",
"}",
"if",
"(",
"state",
"==",
"STATUS_ACTIVE",
")",
"{",
"final",
"Handler",
"<",
"Buffer",
... | The method actually reading the stream.
Except the first calls, this method is executed within an Akka thread. | [
"The",
"method",
"actually",
"reading",
"the",
"stream",
".",
"Except",
"the",
"first",
"calls",
"this",
"method",
"is",
"executed",
"within",
"an",
"Akka",
"thread",
"."
] | a35b6431200fec56b178c0ff60837ed73fd7874d | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/AsyncInputStream.java#L197-L243 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.