Search in sources :

Example 1 with OStaticContent

use of com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent.OStaticContent 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;
        }
    };
}
Also used : OCallable(com.orientechnologies.common.util.OCallable) OStaticContent(com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent.OStaticContent) OServerCommandGetStaticContent(com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent) BufferedInputStream(java.io.BufferedInputStream) OStaticContent(com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent.OStaticContent) URL(java.net.URL)

Aggregations

OCallable (com.orientechnologies.common.util.OCallable)1 OServerCommandGetStaticContent (com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent)1 OStaticContent (com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent.OStaticContent)1 BufferedInputStream (java.io.BufferedInputStream)1 URL (java.net.URL)1