@Override
    public GremlinScriptEngine getEngineByMimeType(final String mimeType) {
        if (null == mimeType) throw new NullPointerException();
        //look for registered types first
        Object obj;
        if (null != (obj = mimeTypeAssociations.get(mimeType))) {
            final GremlinScriptEngineFactory spi = (GremlinScriptEngineFactory) obj;
            try {
                return createGremlinScriptEngine(spi);
            } catch (Exception exp) {
                logger.error(String.format("Could not create GremlinScriptEngine for %s", mimeType), exp);
            }
        }

        for (GremlinScriptEngineFactory spi : engineSpis) {
            List<String> types = null;
            try {
                types = spi.getMimeTypes();
            } catch (Exception exp) {
                logger.error("Could not get GremlinScriptEngine mimetypes", exp);
            }
            if (types == null) continue;
            for (String type : types) {
                if (mimeType.equals(type)) {
                    try {
                        return createGremlinScriptEngine(spi);
                    } catch (Exception exp) {
                        logger.error(String.format("Could not create GremlinScriptEngine for %s", mimeType), exp);
                    }
                }
            }
        }
        return null;
    }
Look up and create a {@link GremlinScriptEngine} for a given mime type.  The algorithm used by
{@link #getEngineByName(String)} is used except that the search starts by looking for a
{@link GremlinScriptEngineFactory} registered to handle the given mime type using
{@link #registerEngineMimeType(String, GremlinScriptEngineFactory)}.

@param mimeType The given mime type
@return The engine to handle scripts with this mime type.  Returns {@code null} if not found.
@throws NullPointerException if mime-type is {@code null}.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java