use of com.orientechnologies.common.util.OCallable in project orientdb by orientechnologies.
the class OServerPluginManager method createStaticLinkCallback.
protected OCallable<Object, String> createStaticLinkCallback(final OServerPluginInfo iPluginData, final URL wwwURL) {
return new OCallable<Object, String>() {
@Override
public Object call(final String iArgument) {
String fileName = "www/" + iArgument;
final URL url = iPluginData.getClassLoader().findResource(fileName);
if (url != null) {
final OServerCommandGetStaticContent.OStaticContent content = new OStaticContent();
content.is = new BufferedInputStream(iPluginData.getClassLoader().getResourceAsStream(fileName));
content.contentSize = -1;
content.type = OServerCommandGetStaticContent.getContentType(url.getFile());
return content;
}
return null;
}
};
}
Aggregations