mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Merge branch 'main' into promote-jexl-injection
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package com.google.common.base;
|
||||
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
public final class MoreObjects {
|
||||
public static <T> T firstNonNull(@Nullable T first, @Nullable T second) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.fasterxml.jackson.databind;
|
||||
|
||||
public class JsonNode {
|
||||
import java.util.*;
|
||||
|
||||
public abstract class JsonNode implements Iterable<JsonNode> {
|
||||
public JsonNode() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.fasterxml.jackson.databind;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class MappingIterator<T> implements Iterator<T>, Closeable {
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,16 @@ public class ObjectMapper {
|
||||
public String writeValueAsString(Object value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ObjectReader readerFor(Class<?> type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T extends JsonNode> T valueToTree(Object fromValue) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T convertValue(Object fromValue, Class<T> toValueType) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.fasterxml.jackson.databind;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class ObjectReader {
|
||||
public ObjectReader forType(Class<?> valueType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(String src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(String src, Class<T> valueType) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(byte[] content) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(byte[] content, Class<T> valueType) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(File src) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(InputStream src) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(InputStream src, Class<T> valueType) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(Reader src) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> T readValue(Reader src, Class<T> valueType) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(String src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(String src, Class<T> valueType) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(byte[] content) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(byte[] content, Class<T> valueType) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(File src) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(InputStream src) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(InputStream src, Class<T> valueType) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(Reader src) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public <T> MappingIterator<T> readValues(Reader src, Class<T> valueType) throws IOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// Autogenerated AST node
|
||||
package org.python.antlr.base;
|
||||
|
||||
public abstract class mod {
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright (c) Corporation for National Research Initiatives
|
||||
package org.python.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utility class for loading compiled Python modules and Java classes defined in Python modules.
|
||||
*/
|
||||
public class BytecodeLoader {
|
||||
|
||||
/**
|
||||
* Turn the Java class file data into a Java class.
|
||||
*
|
||||
* @param name fully-qualified binary name of the class
|
||||
* @param data a class file as a byte array
|
||||
* @param referents super-classes and interfaces that the new class will reference.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Class<?> makeClass(String name, byte[] data, Class<?>... referents) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn the Java class file data into a Java class.
|
||||
*
|
||||
* @param name the name of the class
|
||||
* @param referents super-classes and interfaces that the new class will reference.
|
||||
* @param data a class file as a byte array
|
||||
*/
|
||||
public static Class<?> makeClass(String name, List<Class<?>> referents, byte[] data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn the Java class file data for a compiled Python module into a {@code PyCode} object, by
|
||||
* constructing an instance of the named class and calling the instance's
|
||||
* {@link PyRunnable#getMain()}.
|
||||
*
|
||||
* @param name fully-qualified binary name of the class
|
||||
* @param data a class file as a byte array
|
||||
* @param filename to provide to the constructor of the named class
|
||||
* @return the {@code PyCode} object produced by the named class' {@code getMain}
|
||||
*/
|
||||
public static PyCode makeCode(String name, byte[] data, String filename) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.python.core;
|
||||
|
||||
public enum CompileMode {
|
||||
eval,
|
||||
single,
|
||||
exec;
|
||||
|
||||
public static CompileMode getMode(String mode) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// At some future point this will also be extended - in conjunction with
|
||||
// Py#compileFlags - to add
|
||||
// support for a compiler factory that user code can choose in place of the
|
||||
// normal compiler.
|
||||
// (Perhaps a better name might have been "CompilerOptions".)
|
||||
|
||||
package org.python.core;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class CompilerFlags implements Serializable {
|
||||
public CompilerFlags() {
|
||||
}
|
||||
|
||||
public CompilerFlags(int co_flags) {
|
||||
}
|
||||
}
|
||||
134
java/ql/test/stubs/jython-2.7.2/org/python/core/Py.java
Normal file
134
java/ql/test/stubs/jython-2.7.2/org/python/core/Py.java
Normal file
@@ -0,0 +1,134 @@
|
||||
// Copyright (c) Corporation for National Research Initiatives
|
||||
package org.python.core;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.python.antlr.base.mod;
|
||||
|
||||
public final class Py {
|
||||
/**
|
||||
Convert a given <code>PyObject</code> to an instance of a Java class.
|
||||
Identical to <code>o.__tojava__(c)</code> except that it will
|
||||
raise a <code>TypeError</code> if the conversion fails.
|
||||
@param o the <code>PyObject</code> to convert.
|
||||
@param c the class to convert it to.
|
||||
**/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T tojava(PyObject o, Class<T> c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ??pending: was @deprecated but is actually used by proxie code.
|
||||
// Can get rid of it?
|
||||
public static Object tojava(PyObject o, String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the PyObjectAdapter passed to {@link PySystemState#initialize} to turn o into a PyObject.
|
||||
*
|
||||
* @see ClassicPyObjectAdapter - default PyObjectAdapter type
|
||||
*/
|
||||
public static PyObject java2py(Object o) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the PyObjectAdapter passed to {@link PySystemState#initialize} to turn
|
||||
* <code>objects</code> into an array of PyObjects.
|
||||
*
|
||||
* @see ClassicPyObjectAdapter - default PyObjectAdapter type
|
||||
*/
|
||||
public static PyObject[] javas2pys(Object... objects) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PyObject makeClass(String name, PyObject[] bases, PyCode code,
|
||||
PyObject[] closure_cells) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PyObject makeClass(String name, PyObject base, PyObject dict) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Python class.
|
||||
*
|
||||
* @param name the String name of the class
|
||||
* @param bases an array of PyObject base classes
|
||||
* @param dict the class's namespace, containing the class body
|
||||
* definition
|
||||
* @return a new Python Class PyObject
|
||||
*/
|
||||
public static PyObject makeClass(String name, PyObject[] bases, PyObject dict) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CompilerFlags getCompilerFlags() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CompilerFlags getCompilerFlags(int flags, boolean dont_inherit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static CompilerFlags getCompilerFlags(CompilerFlags flags, boolean dont_inherit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// w/o compiler-flags
|
||||
public static PyCode compile(InputStream istream, String filename, CompileMode kind) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry point for compiling modules.
|
||||
*
|
||||
* @param node Module node, coming from the parsing process
|
||||
* @param name Internal name for the compiled code. Typically generated by
|
||||
* calling {@link #getName()}.
|
||||
* @param filename Source file name
|
||||
* @param linenumbers True to track source line numbers on the generated
|
||||
* code
|
||||
* @param printResults True to call the sys.displayhook on the result of
|
||||
* the code
|
||||
* @param cflags Compiler flags
|
||||
* @return Code object for the compiled module
|
||||
*/
|
||||
public static PyCode compile_flags(mod node, String name, String filename,
|
||||
boolean linenumbers, boolean printResults,
|
||||
CompilerFlags cflags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PyCode compile_flags(mod node, String filename,
|
||||
CompileMode kind, CompilerFlags cflags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles python source code coming from a file or another external stream
|
||||
*/
|
||||
public static PyCode compile_flags(InputStream istream, String filename,
|
||||
CompileMode kind, CompilerFlags cflags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles python source code coming from String (raw bytes) data.
|
||||
*
|
||||
* If the String is properly decoded (from PyUnicode) the PyCF_SOURCE_IS_UTF8 flag
|
||||
* should be specified.
|
||||
*/
|
||||
public static PyCode compile_flags(String data, String filename,
|
||||
CompileMode kind, CompilerFlags cflags) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PyObject compile_command_flags(String string, String filename,
|
||||
CompileMode kind, CompilerFlags cflags, boolean stdprompt) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
43
java/ql/test/stubs/jython-2.7.2/org/python/core/PyCode.java
Normal file
43
java/ql/test/stubs/jython-2.7.2/org/python/core/PyCode.java
Normal file
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) Corporation for National Research Initiatives
|
||||
package org.python.core;
|
||||
|
||||
/**
|
||||
* A super class for all python code implementations.
|
||||
*/
|
||||
public abstract class PyCode extends PyObject
|
||||
{
|
||||
abstract public PyObject call(ThreadState state,
|
||||
PyObject args[], String keywords[],
|
||||
PyObject globals, PyObject[] defaults,
|
||||
PyObject closure);
|
||||
|
||||
abstract public PyObject call(ThreadState state,
|
||||
PyObject self, PyObject args[],
|
||||
String keywords[],
|
||||
PyObject globals, PyObject[] defaults,
|
||||
PyObject closure);
|
||||
|
||||
abstract public PyObject call(ThreadState state,
|
||||
PyObject globals, PyObject[] defaults,
|
||||
PyObject closure);
|
||||
|
||||
abstract public PyObject call(ThreadState state,
|
||||
PyObject arg1, PyObject globals,
|
||||
PyObject[] defaults, PyObject closure);
|
||||
|
||||
abstract public PyObject call(ThreadState state,
|
||||
PyObject arg1, PyObject arg2,
|
||||
PyObject globals, PyObject[] defaults,
|
||||
PyObject closure);
|
||||
|
||||
abstract public PyObject call(ThreadState state,
|
||||
PyObject arg1, PyObject arg2, PyObject arg3,
|
||||
PyObject globals, PyObject[] defaults,
|
||||
PyObject closure);
|
||||
|
||||
abstract public PyObject call(ThreadState state,
|
||||
PyObject arg1, PyObject arg2, PyObject arg3, PyObject arg4,
|
||||
PyObject globals, PyObject[] defaults,
|
||||
PyObject closure);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) Corporation for National Research Initiatives
|
||||
package org.python.core;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* A wrapper for all python exception. Note that the well-known python exceptions are <b>not</b>
|
||||
* subclasses of PyException. Instead the python exception class is stored in the <code>type</code>
|
||||
* field and value or class instance is stored in the <code>value</code> field.
|
||||
*/
|
||||
public class PyException extends RuntimeException
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright (c) Corporation for National Research Initiatives
|
||||
package org.python.core;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* All objects known to the Jython runtime system are represented by an instance of the class
|
||||
* {@code PyObject} or one of its subclasses.
|
||||
*/
|
||||
public class PyObject implements Serializable {
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// Copyright (c) Corporation for National Research Initiatives
|
||||
package org.python.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* The "sys" module.
|
||||
*/
|
||||
// xxx Many have lamented, this should really be a module!
|
||||
// but it will require some refactoring to see this wish come true.
|
||||
public class PySystemState extends PyObject {
|
||||
public PySystemState() {
|
||||
}
|
||||
|
||||
public static void classDictInit(PyObject dict) {
|
||||
}
|
||||
|
||||
public ClassLoader getSyspathJavaLoader() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// xxx fix this accessors
|
||||
public PyObject __findattr_ex__(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void __setattr__(String name, PyObject value) {
|
||||
}
|
||||
|
||||
public void __delattr__(String name) {
|
||||
}
|
||||
|
||||
public PyObject gettrace() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void settrace(PyObject tracefunc) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the current working directory to the specified path.
|
||||
*
|
||||
* path is assumed to be absolute and canonical (via os.path.realpath).
|
||||
*
|
||||
* @param path a path String
|
||||
*/
|
||||
public void setCurrentWorkingDir(String path) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string representing the current working directory.
|
||||
*
|
||||
* @return a path String
|
||||
*/
|
||||
public String getCurrentWorkingDir() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a path. Returns the full path taking the current working directory into account.
|
||||
*
|
||||
* @param path a path String
|
||||
* @return a resolved path String
|
||||
*/
|
||||
public String getPath(String path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a path, returning a {@link File}, taking the current working directory into account.
|
||||
*
|
||||
* @param path a path <code>String</code>
|
||||
* @return a resolved <code>File</code>
|
||||
*/
|
||||
public File getFile(String path) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ClassLoader getClassLoader() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setClassLoader(ClassLoader classLoader) {
|
||||
}
|
||||
|
||||
public static Properties getBaseProperties() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static synchronized void initialize() {
|
||||
}
|
||||
|
||||
public static synchronized void initialize(Properties preProperties,
|
||||
Properties postProperties) {
|
||||
}
|
||||
|
||||
public static synchronized void initialize(Properties preProperties, Properties postProperties,
|
||||
String[] argv) {
|
||||
}
|
||||
|
||||
public static synchronized void initialize(Properties preProperties, Properties postProperties,
|
||||
String[] argv, ClassLoader classLoader) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a classpath directory to the list of places that are searched for java packages.
|
||||
* <p>
|
||||
* <b>Note</b>. Classes found in directory and sub-directory are not made available to jython by
|
||||
* this call. It only makes the java package found in the directory available. This call is
|
||||
* mostly useful if jython is embedded in an application that deals with its own class loaders.
|
||||
* A servlet container is a very good example. Calling
|
||||
* {@code add_classdir("<context>/WEB-INF/classes")} makes the java packages in WEB-INF classes
|
||||
* available to jython import. However the actual class loading is completely handled by the
|
||||
* servlet container's context classloader.
|
||||
*/
|
||||
public static void add_classdir(String directoryPath) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a .jar and .zip directory to the list of places that are searched for java .jar and .zip
|
||||
* files. The .jar and .zip files found will not be cached.
|
||||
* <p>
|
||||
* <b>Note</b>. Classes in .jar and .zip files found in the directory are not made available to
|
||||
* jython by this call. See the note for add_classdir(dir) for more details.
|
||||
*
|
||||
* @param directoryPath The name of a directory.
|
||||
*
|
||||
* @see #add_classdir
|
||||
*/
|
||||
public static void add_extdir(String directoryPath) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a .jar and .zip directory to the list of places that are searched for java .jar and .zip
|
||||
* files.
|
||||
* <p>
|
||||
* <b>Note</b>. Classes in .jar and .zip files found in the directory are not made available to
|
||||
* jython by this call. See the note for add_classdir(dir) for more details.
|
||||
*
|
||||
* @param directoryPath The name of a directory.
|
||||
* @param cache Controls if the packages in the zip and jar file should be cached.
|
||||
*
|
||||
* @see #add_classdir
|
||||
*/
|
||||
public static void add_extdir(String directoryPath, boolean cache) {
|
||||
}
|
||||
|
||||
// Not public by design. We can't rebind the displayhook if
|
||||
// a reflected function is inserted in the class dict.
|
||||
|
||||
/**
|
||||
* Exit a Python program with the given status.
|
||||
*
|
||||
* @param status the value to exit with
|
||||
* @throws PyException {@code SystemExit} always throws this exception. When caught at top level
|
||||
* the program will exit.
|
||||
*/
|
||||
public static void exit(PyObject status) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit a Python program with the status 0.
|
||||
*/
|
||||
public static void exit() {
|
||||
}
|
||||
|
||||
public static void exc_clear() {
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
}
|
||||
|
||||
public void close() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) Corporation for National Research Initiatives
|
||||
package org.python.core;
|
||||
|
||||
// a ThreadState refers to one PySystemState; this weak ref allows for tracking all ThreadState objects
|
||||
// that refer to a given PySystemState
|
||||
|
||||
public class ThreadState {
|
||||
|
||||
public PyException exception;
|
||||
|
||||
public ThreadState(PySystemState systemState) {
|
||||
setSystemState(systemState);
|
||||
}
|
||||
|
||||
public void setSystemState(PySystemState systemState) {
|
||||
}
|
||||
|
||||
public PySystemState getSystemState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean enterRepr(PyObject obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void exitRepr(PyObject obj) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// Copyright (c) Corporation for National Research Initiatives
|
||||
package org.python.util;
|
||||
|
||||
import org.python.core.*;
|
||||
|
||||
/**
|
||||
* This class provides the interface for compiling and running code that supports an interactive
|
||||
* interpreter.
|
||||
*/
|
||||
// Based on CPython-1.5.2's code module
|
||||
public class InteractiveInterpreter extends PythonInterpreter {
|
||||
|
||||
/**
|
||||
* Construct an InteractiveInterpreter with all default characteristics: default state (from
|
||||
* {@link Py#getSystemState()}), and a new empty dictionary of local variables.
|
||||
* */
|
||||
public InteractiveInterpreter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an InteractiveInterpreter with state (from {@link Py#getSystemState()}), and the
|
||||
* specified dictionary of local variables.
|
||||
*
|
||||
* @param locals dictionary to use, or if <code>null</code>, a new empty one will be created
|
||||
*/
|
||||
public InteractiveInterpreter(PyObject locals) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an InteractiveInterpreter with, and system state the specified dictionary of local
|
||||
* variables.
|
||||
*
|
||||
* @param locals dictionary to use, or if <code>null</code>, a new empty one will be created
|
||||
* @param systemState interpreter state, or if <code>null</code> use {@link Py#getSystemState()}
|
||||
*/
|
||||
public InteractiveInterpreter(PyObject locals, PySystemState systemState) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile and run some source in the interpreter, in the mode {@link CompileMode#single} which
|
||||
* is used for incremental compilation at the interactive console, known as {@code <input>}.
|
||||
*
|
||||
* @param source Python code
|
||||
* @return <code>true</code> to indicate a partial statement was entered
|
||||
*/
|
||||
public boolean runsource(String source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile and run some source in the interpreter, in the mode {@link CompileMode#single} which
|
||||
* is used for incremental compilation at the interactive console.
|
||||
*
|
||||
* @param source Python code
|
||||
* @param filename name with which to label this console input (e.g. in error messages).
|
||||
* @return <code>true</code> to indicate a partial statement was entered
|
||||
*/
|
||||
public boolean runsource(String source, String filename) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile and run some source in the interpreter, according to the {@link CompileMode} given.
|
||||
* This method supports incremental compilation and interpretation through the return value,
|
||||
* where {@code true} signifies that more input is expected in order to complete the Python
|
||||
* statement. An interpreter can use this to decide whether to use {@code sys.ps1}
|
||||
* ("{@code >>> }") or {@code sys.ps2} ("{@code ... }") to prompt the next line. The arguments
|
||||
* are the same as the mandatory ones in the Python {@code compile()} command.
|
||||
* <p>
|
||||
* One the following can happen:
|
||||
* <ol>
|
||||
* <li>The input is incorrect; compilation raised an exception (SyntaxError or OverflowError). A
|
||||
* syntax traceback will be printed by calling {@link #showexception(PyException)}. Return is
|
||||
* {@code false}.</li>
|
||||
*
|
||||
* <li>The input is incomplete, and more input is required; compilation returned no code.
|
||||
* Nothing happens. Return is {@code true}.</li>
|
||||
*
|
||||
* <li>The input is complete; compilation returned a code object. The code is executed by
|
||||
* calling {@link #runcode(PyObject)} (which also handles run-time exceptions, except for
|
||||
* SystemExit). Return is {@code false}.</li>
|
||||
* </ol>
|
||||
*
|
||||
* @param source Python code
|
||||
* @param filename name with which to label this console input (e.g. in error messages).
|
||||
* @param kind of compilation required: {@link CompileMode#eval}, {@link CompileMode#exec} or
|
||||
* {@link CompileMode#single}
|
||||
* @return {@code true} to indicate a partial statement was provided
|
||||
*/
|
||||
public boolean runsource(String source, String filename, CompileMode kind) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a code object. When an exception occurs, {@link #showexception(PyException)} is
|
||||
* called to display a stack trace, except in the case of SystemExit, which is re-raised.
|
||||
* <p>
|
||||
* A note about KeyboardInterrupt: this exception may occur elsewhere in this code, and may not
|
||||
* always be caught. The caller should be prepared to deal with it.
|
||||
**/
|
||||
|
||||
// Make this run in another thread somehow????
|
||||
public void runcode(PyObject code) {
|
||||
}
|
||||
|
||||
public void showexception(PyException exc) {
|
||||
}
|
||||
|
||||
public void write(String data) {
|
||||
}
|
||||
|
||||
public void resetbuffer() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
package org.python.util;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.python.core.PyCode;
|
||||
import org.python.core.PyObject;
|
||||
|
||||
/**
|
||||
* The PythonInterpreter class is a standard wrapper for a Jython interpreter for embedding in a
|
||||
* Java application.
|
||||
*/
|
||||
public class PythonInterpreter implements Closeable {
|
||||
|
||||
/**
|
||||
* Initializes the Jython runtime. This should only be called once, before any other Python
|
||||
* objects (including PythonInterpreter) are created.
|
||||
*
|
||||
* @param preProperties A set of properties. Typically System.getProperties() is used.
|
||||
* preProperties override properties from the registry file.
|
||||
* @param postProperties Another set of properties. Values like python.home, python.path and all
|
||||
* other values from the registry files can be added to this property set.
|
||||
* postProperties override system properties and registry properties.
|
||||
* @param argv Command line arguments, assigned to sys.argv.
|
||||
*/
|
||||
public static void
|
||||
initialize(Properties preProperties, Properties postProperties, String[] argv) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new interpreter with an empty local namespace.
|
||||
*/
|
||||
public PythonInterpreter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new interpreter with the ability to maintain a separate local namespace for each
|
||||
* thread (set by invoking setLocals()).
|
||||
*
|
||||
* @param dict a Python mapping object (e.g., a dictionary) for use as the default namespace
|
||||
*/
|
||||
public static PythonInterpreter threadLocalStateInterpreter(PyObject dict) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new interpreter with a specified local namespace.
|
||||
*
|
||||
* @param dict a Python mapping object (e.g., a dictionary) for use as the namespace
|
||||
*/
|
||||
public PythonInterpreter(PyObject dict) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a Python object to use for the standard output stream, <code>sys.stdout</code>. This
|
||||
* stream is used in a byte-oriented way (mostly) that depends on the type of file-like object.
|
||||
* The behaviour as implemented is:
|
||||
* <table border=1>
|
||||
* <caption>Stream behaviour for various object types</caption>
|
||||
* <tr align=center>
|
||||
* <td></td>
|
||||
* <td colspan=3>Python type of object <code>o</code> written</td>
|
||||
* </tr>
|
||||
* <tr align=left>
|
||||
* <th></th>
|
||||
* <th><code>str/bytes</code></th>
|
||||
* <th><code>unicode</code></th>
|
||||
* <th>Any other type</th>
|
||||
* </tr>
|
||||
* <tr align=left>
|
||||
* <th>{@link PyFile}</th>
|
||||
* <td>as bytes directly</td>
|
||||
* <td>respect {@link PyFile#encoding}</td>
|
||||
* <td>call <code>str(o)</code> first</td>
|
||||
* </tr>
|
||||
* <tr align=left>
|
||||
* <th>{@link PyFileWriter}</th>
|
||||
* <td>each byte value as a <code>char</code></td>
|
||||
* <td>write as Java <code>char</code>s</td>
|
||||
* <td>call <code>o.toString()</code> first</td>
|
||||
* </tr>
|
||||
* <tr align=left>
|
||||
* <th>Other {@link PyObject} <code>f</code></th>
|
||||
* <td>invoke <code>f.write(str(o))</code></td>
|
||||
* <td>invoke <code>f.write(o)</code></td>
|
||||
* <td>invoke <code>f.write(str(o))</code></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
*
|
||||
* @param outStream Python file-like object to use as the output stream
|
||||
*/
|
||||
public void setOut(PyObject outStream) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a {@link java.io.Writer} to use for the standard output stream, <code>sys.stdout</code>.
|
||||
* The behaviour as implemented is to output each object <code>o</code> by calling
|
||||
* <code>o.toString()</code> and writing this as UTF-16.
|
||||
*
|
||||
* @param outStream to use as the output stream
|
||||
*/
|
||||
public void setOut(java.io.Writer outStream) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a {@link java.io.OutputStream} to use for the standard output stream.
|
||||
*
|
||||
* @param outStream OutputStream to use as output stream
|
||||
*/
|
||||
public void setOut(java.io.OutputStream outStream) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a Python object to use for the standard output stream, <code>sys.stderr</code>. This
|
||||
* stream is used in a byte-oriented way (mostly) that depends on the type of file-like object,
|
||||
* in the same way as {@link #setOut(PyObject)}.
|
||||
*
|
||||
* @param outStream Python file-like object to use as the error output stream
|
||||
*/
|
||||
public void setErr(PyObject outStream) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a {@link java.io.Writer} to use for the standard output stream, <code>sys.stdout</code>.
|
||||
* The behaviour as implemented is to output each object <code>o</code> by calling
|
||||
* <code>o.toString()</code> and writing this as UTF-16.
|
||||
*
|
||||
* @param outStream to use as the error output stream
|
||||
*/
|
||||
public void setErr(java.io.Writer outStream) {
|
||||
}
|
||||
|
||||
public void setErr(java.io.OutputStream outStream) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates a string as a Python expression and returns the result.
|
||||
*/
|
||||
public PyObject eval(String s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates a Python code object and returns the result.
|
||||
*/
|
||||
public PyObject eval(PyObject code) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a string of Python source in the local namespace.
|
||||
*
|
||||
* In some environments, such as Windows, Unicode characters in the script will be converted
|
||||
* into ascii question marks (?). This can be avoided by first compiling the fragment using
|
||||
* PythonInterpreter.compile(), and using the overridden form of this method which takes a
|
||||
* PyCode object. Code page declarations are not supported.
|
||||
*/
|
||||
public void exec(String s) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a Python code object in the local namespace.
|
||||
*/
|
||||
public void exec(PyObject code) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a file of Python source in the local namespace.
|
||||
*/
|
||||
public void execfile(String filename) {
|
||||
}
|
||||
|
||||
public void execfile(java.io.InputStream s) {
|
||||
}
|
||||
|
||||
public void execfile(java.io.InputStream s, String name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a string of Python source as either an expression (if possible) or a module.
|
||||
*
|
||||
* Designed for use by a JSR 223 implementation: "the Scripting API does not distinguish between
|
||||
* scripts which return values and those which do not, nor do they make the corresponding
|
||||
* distinction between evaluating or executing objects." (SCR.4.2.1)
|
||||
*/
|
||||
public PyCode compile(String script) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public PyCode compile(Reader reader) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public PyCode compile(String script, String filename) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public PyCode compile(Reader reader, String filename) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a variable in the local namespace.
|
||||
*
|
||||
* @param name the name of the variable
|
||||
* @param value the object to set the variable to (as converted to an appropriate Python object)
|
||||
*/
|
||||
public void set(String name, Object value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a variable in the local namespace.
|
||||
*
|
||||
* @param name the name of the variable
|
||||
* @param value the Python object to set the variable to
|
||||
*/
|
||||
public void set(String name, PyObject value) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a variable in the local namespace.
|
||||
*
|
||||
* @param name the name of the variable
|
||||
* @return the value of the variable, or null if that name isn't assigned
|
||||
*/
|
||||
public PyObject get(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of a variable in the local namespace.
|
||||
*
|
||||
* The value will be returned as an instance of the given Java class.
|
||||
* <code>interp.get("foo", Object.class)</code> will return the most appropriate generic Java
|
||||
* object.
|
||||
*
|
||||
* @param name the name of the variable
|
||||
* @param javaclass the class of object to return
|
||||
* @return the value of the variable as the given class, or null if that name isn't assigned
|
||||
*/
|
||||
public <T> T get(String name, Class<T> javaclass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
}
|
||||
|
||||
public void close() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.esotericsoftware.kryo.pool;
|
||||
|
||||
import com.esotericsoftware.kryo.Kryo;
|
||||
|
||||
public interface KryoCallback<T> {
|
||||
T execute (Kryo kryo);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.esotericsoftware.kryo.pool;
|
||||
|
||||
import com.esotericsoftware.kryo.Kryo;
|
||||
|
||||
public interface KryoFactory {
|
||||
Kryo create ();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.esotericsoftware.kryo.pool;
|
||||
|
||||
import com.esotericsoftware.kryo.Kryo;
|
||||
import java.util.Queue;
|
||||
|
||||
public interface KryoPool {
|
||||
|
||||
Kryo borrow ();
|
||||
|
||||
void release (Kryo kryo);
|
||||
|
||||
<T> T run (KryoCallback<T> callback);
|
||||
|
||||
static class Builder {
|
||||
public Builder (KryoFactory factory) {
|
||||
}
|
||||
|
||||
public Builder queue (Queue<Kryo> queue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder softReferences () {
|
||||
return null;
|
||||
}
|
||||
|
||||
public KryoPool build () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
java/ql/test/stubs/scriptengine/javax/script/Bindings.java
Normal file
14
java/ql/test/stubs/scriptengine/javax/script/Bindings.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package javax.script;
|
||||
import java.util.Map;
|
||||
|
||||
public interface Bindings extends Map<String, Object> {
|
||||
public Object put(String name, Object value);
|
||||
|
||||
public void putAll(Map<? extends String, ? extends Object> toMerge);
|
||||
|
||||
public boolean containsKey(Object key);
|
||||
|
||||
public Object get(Object key);
|
||||
|
||||
public Object remove(Object key);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package javax.script;
|
||||
|
||||
import java.io.Reader;
|
||||
|
||||
public interface Compilable {
|
||||
public CompiledScript compile(String script) throws ScriptException;
|
||||
|
||||
public CompiledScript compile(Reader script) throws ScriptException;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package javax.script;
|
||||
|
||||
public abstract class CompiledScript {
|
||||
|
||||
public abstract Object eval(ScriptContext context) throws ScriptException;
|
||||
|
||||
public Object eval(Bindings bindings) throws ScriptException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object eval() throws ScriptException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract ScriptEngine getEngine();
|
||||
|
||||
}
|
||||
@@ -2,5 +2,7 @@ package javax.script;
|
||||
|
||||
public interface ScriptEngine {
|
||||
Object eval(String var1) throws ScriptException;
|
||||
|
||||
public ScriptEngineFactory getFactory();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package javax.script;
|
||||
|
||||
public interface ScriptEngineFactory {
|
||||
public String getEngineName();
|
||||
|
||||
public String getMethodCallSyntax(String obj, String m, String... args);
|
||||
|
||||
public String getProgram(String... statements);
|
||||
|
||||
ScriptEngine getScriptEngine();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package jdk.nashorn.api.scripting;
|
||||
|
||||
public interface ClassFilter {
|
||||
public boolean exposeToScripts(String className);
|
||||
}
|
||||
@@ -1,10 +1,31 @@
|
||||
package jdk.nashorn.api.scripting;
|
||||
|
||||
import javax.script.*;
|
||||
import java.io.Reader;
|
||||
|
||||
public final class NashornScriptEngine extends AbstractScriptEngine {
|
||||
import javax.script.AbstractScriptEngine;
|
||||
import javax.script.Compilable;
|
||||
import javax.script.CompiledScript;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineFactory;
|
||||
import javax.script.ScriptException;
|
||||
|
||||
public final class NashornScriptEngine extends AbstractScriptEngine implements Compilable {
|
||||
public Object eval(String var1) throws ScriptException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptEngineFactory getFactory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompiledScript compile(final Reader reader) throws ScriptException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompiledScript compile(final String str) throws ScriptException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,20 +3,48 @@ package jdk.nashorn.api.scripting;
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineFactory;
|
||||
|
||||
|
||||
public final class NashornScriptEngineFactory implements ScriptEngineFactory {
|
||||
|
||||
public NashornScriptEngineFactory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEngineName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodCallSyntax(final String obj, final String method, final String... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProgram(final String... statements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptEngine getScriptEngine() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ScriptEngine getScriptEngine(final ClassLoader appLoader) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ScriptEngine getScriptEngine(String... args) {
|
||||
public ScriptEngine getScriptEngine(final ClassFilter classFilter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ScriptEngine getScriptEngine(final String... args) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ScriptEngine getScriptEngine(final String[] args, final ClassLoader appLoader) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ScriptEngine getScriptEngine(final String[] args, final ClassLoader appLoader, final ClassFilter classFilter) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.web.savedrequest;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
/**
|
||||
* Encapsulates the functionality required of a cached request for both an authentication
|
||||
* mechanism (typically form-based login) to redirect to the original URL and for a
|
||||
* <tt>RequestCache</tt> to build a wrapped request, reproducing the original request
|
||||
* data.
|
||||
*
|
||||
* @author Luke Taylor
|
||||
* @since 3.0
|
||||
*/
|
||||
public interface SavedRequest extends java.io.Serializable {
|
||||
|
||||
/**
|
||||
* @return the URL for the saved request, allowing a redirect to be performed.
|
||||
*/
|
||||
String getRedirectUrl();
|
||||
|
||||
List<Cookie> getCookies();
|
||||
|
||||
String getMethod();
|
||||
|
||||
List<String> getHeaderValues(String name);
|
||||
|
||||
Collection<String> getHeaderNames();
|
||||
|
||||
List<Locale> getLocales();
|
||||
|
||||
String[] getParameterValues(String name);
|
||||
|
||||
Map<String, String[]> getParameterMap();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.web.savedrequest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
/**
|
||||
* A Bean implementation of SavedRequest
|
||||
*
|
||||
* @author Rob Winch
|
||||
* @since 5.1
|
||||
*/
|
||||
public class SimpleSavedRequest implements SavedRequest {
|
||||
|
||||
public SimpleSavedRequest() {
|
||||
}
|
||||
|
||||
public SimpleSavedRequest(String redirectUrl) {
|
||||
}
|
||||
|
||||
public SimpleSavedRequest(SavedRequest request) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRedirectUrl() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Cookie> getCookies() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethod() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getHeaderValues(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getHeaderNames() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Locale> getLocales() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParameterValues(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String[]> getParameterMap() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setRedirectUrl(String redirectUrl) {
|
||||
}
|
||||
|
||||
public void setCookies(List<Cookie> cookies) {
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
}
|
||||
|
||||
public void setHeaders(Map<String, List<String>> headers) {
|
||||
}
|
||||
|
||||
public void setLocales(List<Locale> locales) {
|
||||
}
|
||||
|
||||
public void setParameters(Map<String, String[]> parameters) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package org.springframework.web.servlet;
|
||||
|
||||
import java.util.Map;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
public class ModelAndView {
|
||||
@Nullable
|
||||
private Object view;
|
||||
@Nullable
|
||||
private HttpStatus status;
|
||||
private boolean cleared = false;
|
||||
|
||||
public ModelAndView() {
|
||||
}
|
||||
|
||||
public ModelAndView(String viewName) {
|
||||
this.view = viewName;
|
||||
}
|
||||
|
||||
public ModelAndView(View view) {
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
public ModelAndView(String viewName, @Nullable Map<String, ?> model) { }
|
||||
|
||||
public ModelAndView(View view, @Nullable Map<String, ?> model) { }
|
||||
|
||||
public ModelAndView(String viewName, HttpStatus status) { }
|
||||
|
||||
public ModelAndView(@Nullable String viewName, @Nullable Map<String, ?> model, @Nullable HttpStatus status) { }
|
||||
|
||||
public ModelAndView(String viewName, String modelName, Object modelObject) { }
|
||||
|
||||
public ModelAndView(View view, String modelName, Object modelObject) { }
|
||||
|
||||
public void setViewName(@Nullable String viewName) {
|
||||
this.view = viewName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getViewName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public void setView(@Nullable View view) { }
|
||||
|
||||
@Nullable
|
||||
public View getView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isReference() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected Map<String, Object> getModelInternal() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<String, Object> getModel() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setStatus(@Nullable HttpStatus status) { }
|
||||
|
||||
@Nullable
|
||||
public HttpStatus getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public ModelAndView addObject(String attributeName, @Nullable Object attributeValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ModelAndView addObject(Object attributeValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ModelAndView addAllObjects(@Nullable Map<String, ?> modelMap) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void clear() { }
|
||||
|
||||
public boolean isEmpty() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean wasCleared() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
|
||||
private String formatView() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.springframework.web.servlet;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
public interface View {
|
||||
String RESPONSE_STATUS_ATTRIBUTE = View.class.getName() + ".responseStatus";
|
||||
String PATH_VARIABLES = View.class.getName() + ".pathVariables";
|
||||
String SELECTED_CONTENT_TYPE = View.class.getName() + ".selectedContentType";
|
||||
|
||||
@Nullable
|
||||
default String getContentType() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void render(@Nullable Map<String, ?> var1, HttpServletRequest var2, HttpServletResponse var3) throws Exception;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package org.springframework.web.servlet.view;
|
||||
|
||||
import java.util.Locale;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
public abstract class AbstractUrlBasedView {
|
||||
@Nullable
|
||||
private String url;
|
||||
|
||||
protected AbstractUrlBasedView() { }
|
||||
|
||||
protected AbstractUrlBasedView(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public void setUrl(@Nullable String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getUrl() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception { }
|
||||
|
||||
protected boolean isUrlRequired() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean checkResource(Locale locale) throws Exception {
|
||||
return true;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
package org.springframework.web.servlet.view;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Array;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
public class RedirectView extends AbstractUrlBasedView {
|
||||
private static final Pattern URI_TEMPLATE_VARIABLE_PATTERN = Pattern.compile("\\{([^/]+?)\\}");
|
||||
private boolean contextRelative = false;
|
||||
private boolean http10Compatible = true;
|
||||
private boolean exposeModelAttributes = true;
|
||||
@Nullable
|
||||
private String encodingScheme;
|
||||
@Nullable
|
||||
private HttpStatus statusCode;
|
||||
private boolean expandUriTemplateVariables = true;
|
||||
private boolean propagateQueryParams = false;
|
||||
@Nullable
|
||||
private String[] hosts;
|
||||
|
||||
public RedirectView() { }
|
||||
|
||||
public RedirectView(String url) { }
|
||||
|
||||
public RedirectView(String url, boolean contextRelative) { }
|
||||
|
||||
public RedirectView(String url, boolean contextRelative, boolean http10Compatible) { }
|
||||
|
||||
public RedirectView(String url, boolean contextRelative, boolean http10Compatible, boolean exposeModelAttributes) { }
|
||||
|
||||
public void setContextRelative(boolean contextRelative) { }
|
||||
|
||||
public void setHttp10Compatible(boolean http10Compatible) { }
|
||||
|
||||
public void setExposeModelAttributes(boolean exposeModelAttributes) { }
|
||||
|
||||
public void setEncodingScheme(String encodingScheme) { }
|
||||
|
||||
public void setStatusCode(HttpStatus statusCode) { }
|
||||
|
||||
public void setExpandUriTemplateVariables(boolean expandUriTemplateVariables) { }
|
||||
|
||||
public void setPropagateQueryParams(boolean propagateQueryParams) { }
|
||||
|
||||
public boolean isPropagateQueryProperties() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setHosts(@Nullable String... hosts) { }
|
||||
|
||||
@Nullable
|
||||
public String[] getHosts() {
|
||||
return this.hosts;
|
||||
}
|
||||
|
||||
public boolean isRedirectView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isContextRequired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws IOException { }
|
||||
|
||||
protected final String createTargetUrl(Map<String, Object> model, HttpServletRequest request) throws UnsupportedEncodingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
private String getContextPath(HttpServletRequest request) {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected StringBuilder replaceUriTemplateVariables(String targetUrl, Map<String, Object> model, Map<String, String> currentUriVariables, String encodingScheme) throws UnsupportedEncodingException {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Map<String, String> getCurrentRequestUriVariables(HttpServletRequest request) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void appendCurrentQueryParams(StringBuilder targetUrl, HttpServletRequest request) { }
|
||||
|
||||
protected void appendQueryProperties(StringBuilder targetUrl, Map<String, Object> model, String encodingScheme) throws UnsupportedEncodingException { }
|
||||
|
||||
protected Map<String, Object> queryProperties(Map<String, Object> model) {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean isEligibleProperty(String key, @Nullable Object value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean isEligibleValue(@Nullable Object value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String urlEncode(String input, String encodingScheme) throws UnsupportedEncodingException {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected String updateTargetUrl(String targetUrl, Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {
|
||||
return "";
|
||||
}
|
||||
|
||||
protected void sendRedirect(HttpServletRequest request, HttpServletResponse response, String targetUrl, boolean http10Compatible) throws IOException { }
|
||||
|
||||
protected boolean isRemoteHost(String targetUrl) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected HttpStatus getHttp11StatusCode(HttpServletRequest request, HttpServletResponse response, String targetUrl) {
|
||||
return this.statusCode;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user