use of com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent in project orientdb by orientechnologies.
the class OServerPluginManager method registerStaticDirectory.
protected void registerStaticDirectory(final OServerPluginInfo iPluginData) {
Object pluginWWW = iPluginData.getParameter("www");
if (pluginWWW == null)
pluginWWW = iPluginData.getName();
final OServerNetworkListener httpListener = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
if (httpListener == null)
throw new OConfigurationException("HTTP listener not registered while installing Static Content command");
final OServerCommandGetStaticContent command = (OServerCommandGetStaticContent) httpListener.getCommand(OServerCommandGetStaticContent.class);
if (command != null) {
final URL wwwURL = iPluginData.getClassLoader().findResource("www/");
final OCallable<Object, String> callback;
if (wwwURL != null)
callback = createStaticLinkCallback(iPluginData, wwwURL);
else
// LET TO THE COMMAND TO CONTROL IT
callback = new OCallable<Object, String>() {
@Override
public Object call(final String iArgument) {
return iPluginData.getInstance().getContent(iArgument);
}
};
command.registerVirtualFolder(pluginWWW.toString(), callback);
}
}
Aggregations