Class JsonTool
java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
org.apache.velocity.tools.generic.ImportSupport
org.apache.velocity.tools.generic.JsonTool
org.apache.velocity.tools.view.JsonTool
- All Implemented Interfaces:
Serializable, Iterable
@DefaultKey("json")
@ValidScope("request")
public class JsonTool
extends org.apache.velocity.tools.generic.JsonTool
View version of
JsonTool. It adds an automatic parsing of the HTTP query
body content, if it is found to be of JSON type.- Since:
- VelocityTools 3.0
- Version:
- $Id:$
- Author:
- Claude Brisson
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.velocity.tools.generic.ImportSupport
org.apache.velocity.tools.generic.ImportSupport.SafeClosingHttpURLConnectionReader -
Field Summary
Fields inherited from class org.apache.velocity.tools.generic.JsonTool
importSupportFields inherited from class org.apache.velocity.tools.generic.ImportSupport
RESOURCE_KEY, URL_KEY, VALID_SCHEME_CHARSFields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigure(org.apache.velocity.tools.generic.ValueParser parser) Configuration.protected voidinitializeImportSupport(org.apache.velocity.tools.generic.ValueParser config) Importsupport initializationprotected static booleanisJsonContentType(String contentType) Check if a given content type is of JSON typeprotected static booleanisJsonMimeType(String mimeType) Check if a given mime type is of JSON typeMethods inherited from class org.apache.velocity.tools.generic.JsonTool
fetch, get, get, initJSON, initJSON, iterator, keys, keySet, parse, read, root, size, toStringMethods inherited from class org.apache.velocity.tools.generic.ImportSupport
acquireLocalURLReader, acquireLocalURLString, acquireReader, acquireRemoteURLReader, acquireRemoteURLString, acquireString, getClasspathResource, getContentTypeAttribute, getFileResource, getProtocol, getResourceReader, getResourceString, isRemoteURL, setSafeModeMethods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfigMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
JsonTool
public JsonTool()
-
-
Method Details
-
initializeImportSupport
protected void initializeImportSupport(org.apache.velocity.tools.generic.ValueParser config) Importsupport initialization- Overrides:
initializeImportSupportin classorg.apache.velocity.tools.generic.JsonTool- Parameters:
config- configuration values
-
isJsonMimeType
Check if a given mime type is of JSON type- Parameters:
mimeType- mime type- Returns:
- whether given mime type is of JSON type
-
isJsonContentType
Check if a given content type is of JSON type- Parameters:
contentType- content type- Returns:
- whether given content type is of JSON type
-
configure
protected void configure(org.apache.velocity.tools.generic.ValueParser parser) Configuration. Parses request body if appropriate.- Overrides:
configurein classorg.apache.velocity.tools.generic.JsonTool- Parameters:
parser- configuration values
-