List of usage examples for javax.script ScriptEngineFactory getMimeTypes
public List<String> getMimeTypes();
From source file:MimeTypesDemo.java
public static void main(String[] args) { ScriptEngineManager manager = new ScriptEngineManager(); List<ScriptEngineFactory> factories = manager.getEngineFactories(); for (ScriptEngineFactory factory : factories) { List<String> mimeTypes = factory.getMimeTypes(); for (int i = 0; i < mimeTypes.size(); i++) { System.out.printf("Supported MIME type " + i + " " + (String) mimeTypes.get(i) + "\n"); }//from ww w.ja v a 2s . c o m } }
From source file:Main.java
public static void main(String args[]) { ScriptEngineManager manager = new ScriptEngineManager(); List<ScriptEngineFactory> factories = manager.getEngineFactories(); for (ScriptEngineFactory factory : factories) { System.out.println(factory.getEngineName()); System.out.println(factory.getEngineVersion()); System.out.println(factory.getLanguageName()); System.out.println(factory.getLanguageVersion()); System.out.println(factory.getExtensions()); System.out.println(factory.getMimeTypes()); System.out.println(factory.getNames()); }//w w w . j av a 2 s. com }
From source file:Main.java
public static void main(String[] args) { ScriptEngineManager manager = new ScriptEngineManager(); // Get the list of all available engines List<ScriptEngineFactory> list = manager.getEngineFactories(); // Print the details of each engine for (ScriptEngineFactory f : list) { System.out.println("Engine Name:" + f.getEngineName()); System.out.println("Engine Version:" + f.getEngineVersion()); System.out.println("Language Name:" + f.getLanguageName()); System.out.println("Language Version:" + f.getLanguageVersion()); System.out.println("Engine Short Names:" + f.getNames()); System.out.println("Mime Types:" + f.getMimeTypes()); System.out.println("==="); }/*w ww. j a v a 2 s . c o m*/ }
From source file:EnumerateScriptEngines.java
public static void main(String[] args) { ScriptEngineManager manager = new ScriptEngineManager(); List<ScriptEngineFactory> factories = manager.getEngineFactories(); for (ScriptEngineFactory factory : factories) { System.out.println("Engine name (full): " + factory.getEngineName()); System.out.println("Engine version: " + factory.getEngineVersion()); System.out.println("Supported extensions:"); List<String> extensions = factory.getExtensions(); for (String extension : extensions) System.out.println(" " + extension); System.out.println("Language name: " + factory.getLanguageName()); System.out.println("Language version: " + factory.getLanguageVersion()); System.out.println("Supported MIME types:"); List<String> mimetypes = factory.getMimeTypes(); for (String mimetype : mimetypes) System.out.println(" " + mimetype); System.out.println("Supported short names:"); List<String> shortnames = factory.getNames(); for (String shortname : shortnames) System.out.println(" " + shortname); System.out.println();//from w w w . ja v a 2 s . com } }
From source file:com.xafero.vee.cmd.MainApp.java
private static void printLanguages() { ScriptEngineManager mgr = new ScriptEngineManager(); for (ScriptEngineFactory factory : mgr.getEngineFactories()) System.out.println(MoreObjects.toStringHelper("").add("name", factory.getEngineName()) .add("version", factory.getEngineVersion()) .add("extensions", "[ " + Strings.join(" | ", factory.getExtensions()) + " ]") .add("mimeTypes", "[ " + Strings.join(" | ", factory.getMimeTypes()) + " ]") .add("aliases", "[ " + Strings.join(" | ", factory.getNames()) + " ]") .add("language", factory.getLanguageName() + " " + factory.getLanguageVersion()) .omitNullValues().toString().replace(", ", String.format(", %n "))); }
From source file:ca.hedlund.jiss.preprocessor.LangPreprocessor.java
@Override public boolean preprocessCommand(JissModel jissModel, String orig, StringBuffer cmd) { final String c = cmd.toString(); if (c.equals("::langs")) { cmd.setLength(0);// w w w . j av a 2 s. c o m printLangs(jissModel, cmd); } else if (c.equals("::lang")) { cmd.setLength(0); printCurrentLang(jissModel, cmd); } else if (c.startsWith("::lang")) { cmd.setLength(0); final String parts[] = c.split("\\p{Space}"); if (parts.length == 2) { final String lang = parts[1]; final ScriptEngineManager manager = new ScriptEngineManager(JissModel.class.getClassLoader()); ScriptEngine newEngine = null; for (ScriptEngineFactory factory : manager.getEngineFactories()) { if (factory.getLanguageName().equals(lang) || factory.getExtensions().contains(lang) || factory.getMimeTypes().contains(lang)) { newEngine = factory.getScriptEngine(); break; } } if (newEngine != null) { jissModel.setScriptEngine(newEngine); printCurrentLang(jissModel, cmd); } } } return false; }
From source file:com.galeoconsulting.leonardinius.api.impl.ScriptServiceImpl.java
@Override public void defaultRegistration(ScriptEngineFactory engineFactory) { for (String extension : engineFactory.getExtensions()) { registerEngineExtension(extension, engineFactory); }/* ww w. j a v a 2s.com*/ for (String mime : engineFactory.getMimeTypes()) { registerEngineMime(mime, engineFactory); } registerEngineLanguage(engineFactory.getLanguageName(), engineFactory); registerEngineLanguage((String) engineFactory.getParameter(ScriptEngine.NAME), engineFactory); // do not rely on the other methods registeredEngines.put(engineFactory, DUMMY); }