Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Rhino JavaScript Java Library Source Code
Rhino JavaScript Java Library is an open-source implementation of JavaScript
written entirely in Java.
Rhino JavaScript Java Library Source Code files are provided in binary package (rhino-1.7.14.zip).
You can also browse the source code below:
✍: FYIcenter.com
⏎ org/mozilla/javascript/engine/RhinoScriptEngineFactory.java
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.javascript.engine;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory;
import org.mozilla.javascript.Context;
/**
* <p>
* This is an implementation of the standard Java "ScriptEngine" for Rhino. If the Rhino engine
* (typically in the form of the "rhino-engine" JAR) is in the classpath, then this script
* engine will be activated.
* </p>
* <p>
* See the list of constants in this class for the list of language names, file extensions, and
* MIME types that this engine supports. This list is essentially the same as the list supported
* in the Nashorn script engine that was included in Java 8.
* </p>
* <p>
* Since this engine and Nashorn support the same language and file extensions, then unless
* you are sure you are running in an environment that has Nashorn, the best way to get this
* engine is to call ScriptEngine.getEngineByName("rhino") to ask for Rhino directly.
* </p>
*/
public class RhinoScriptEngineFactory
implements ScriptEngineFactory {
public static final String NAME = "rhino";
private static final String LANGUAGE = "javascript";
private static final List<String> NAMES =
Arrays.asList("rhino", "Rhino", "javascript", "JavaScript");
private static final List<String> EXTENSIONS =
Collections.singletonList("js");
private static final List<String> MIME_TYPES =
Arrays.asList("application/javascript", "application/ecmascript",
"text/javascript", "text/ecmascript");
private static final String LANGUAGE_VERSION =
String.valueOf(RhinoScriptEngine.DEFAULT_LANGUAGE_VERSION);
@Override
public String getEngineName() {
return NAME;
}
@Override
public String getEngineVersion() {
try (Context cx = Context.enter()) {
String v = cx.getImplementationVersion();
return (v == null ? "unknown" : v);
}
}
@Override
public List<String> getExtensions() {
return EXTENSIONS;
}
@Override
public List<String> getMimeTypes() {
return MIME_TYPES;
}
@Override
public List<String> getNames() {
return NAMES;
}
@Override
public String getLanguageName() {
return LANGUAGE;
}
@Override
public String getLanguageVersion() {
return LANGUAGE_VERSION;
}
@Override
public Object getParameter(String key) {
switch (key) {
case ScriptEngine.ENGINE:
return getEngineName();
case ScriptEngine.ENGINE_VERSION:
return getEngineVersion();
case ScriptEngine.LANGUAGE:
return getLanguageName();
case ScriptEngine.LANGUAGE_VERSION:
return getLanguageVersion();
case ScriptEngine.NAME:
return NAME;
case "THREADING":
// Engines are explicitly not thread-safe
return null;
default:
return null;
}
}
@Override
public String getMethodCallSyntax(String obj, String m, String... args) {
StringBuilder sb = new StringBuilder();
sb.append(obj).append('.').append(m).append('(');
for (int i = 0; i < args.length; i++) {
if (i > 0) {
sb.append(',');
}
sb.append(args[i]);
}
sb.append(");");
return sb.toString();
}
@Override
public String getOutputStatement(String toDisplay) {
return "print('" + toDisplay + "');";
}
@Override
public String getProgram(String... statements) {
StringBuilder sb = new StringBuilder();
for (String stmt : statements) {
sb.append(stmt).append(";\n");
}
return sb.toString();
}
@Override
public ScriptEngine getScriptEngine() {
return new RhinoScriptEngine(this);
}
}
⏎ org/mozilla/javascript/engine/RhinoScriptEngineFactory.java
Or download all of them as a single archive file:
File name: rhino-1.7.14-sources.jar File size: 1029165 bytes Release date: 2022-01-06 Download
⇒ Example code to Test rhino-runtime-1.7.14.jar
⇐ Download Rhino JavaScript Binary Package
2022-05-03, ≈102🔥, 1💬
Popular Posts:
JDK 11 java.desktop.jmod is the JMOD file for JDK 11 Desktop module. JDK 11 Desktop module compiled ...
What Is poi-scratchpad-3.5.jar? poi-scratchpad-3.5.jar is one of the JAR files for Apache POI 3.5, w...
What Is jms.jar? I heard it's related to JMS (Java Message Service) 1.1? The if you have an jms.jar ...
JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module. JDK 11 Naming module compiled cla...
commons-io-1.4.jar is the JAR file for Commons IO 1.4, which is a library of utilities to assist wit...