Search in sources :

Example 16 with OCallable

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;
        }
    };
}
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)16 ONeedRetryException (com.orientechnologies.common.concur.ONeedRetryException)7 OException (com.orientechnologies.common.exception.OException)7 OIOException (com.orientechnologies.common.io.OIOException)6 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)6 HazelcastException (com.hazelcast.core.HazelcastException)5 HazelcastInstanceNotActiveException (com.hazelcast.core.HazelcastInstanceNotActiveException)5 OOfflineNodeException (com.orientechnologies.common.concur.OOfflineNodeException)5 ODistributedRedirectException (com.orientechnologies.orient.enterprise.channel.binary.ODistributedRedirectException)5 Callable (java.util.concurrent.Callable)5 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)5 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)4 ORecordId (com.orientechnologies.orient.core.id.ORecordId)4 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)3 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)2 OServerCommandGetStaticContent (com.orientechnologies.orient.server.network.protocol.http.command.get.OServerCommandGetStaticContent)2 IOException (java.io.IOException)2 URL (java.net.URL)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 OPair (com.orientechnologies.common.util.OPair)1