Package org.apache.velocity.tools.view
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:
java.io.Serializable,java.lang.Iterable
@DefaultKey("json") @ValidScope("request") public class JsonTool extends org.apache.velocity.tools.generic.JsonToolView version ofJsonTool. 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JsonTool()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigure(org.apache.velocity.tools.generic.ValueParser parser)Configuration.protected voidinitializeImportSupport(org.apache.velocity.tools.generic.ValueParser config)Importsupport initializationprotected static booleanisJsonContentType(java.lang.String contentType)Check if a given content type is of JSON typeprotected static booleanisJsonMimeType(java.lang.String mimeType)Check if a given mime type is of JSON type-
Methods inherited from class org.apache.velocity.tools.generic.JsonTool
fetch, get, get, initJSON, initJSON, iterator, keys, keySet, parse, read, root, size, toString
-
Methods inherited from class org.apache.velocity.tools.generic.ImportSupport
acquireLocalURLReader, acquireLocalURLString, acquireReader, acquireRemoteURLReader, acquireRemoteURLString, acquireString, getClasspathResource, getContentTypeAttribute, getFileResource, getProtocol, getResourceReader, getResourceString, isRemoteURL, setSafeMode
-
Methods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig
-
-
-
-
Method Detail
-
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
protected static boolean isJsonMimeType(java.lang.String mimeType)
Check if a given mime type is of JSON type- Parameters:
mimeType- mime type- Returns:
- whether given mime type is of JSON type
-
isJsonContentType
protected static boolean isJsonContentType(java.lang.String contentType)
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
-
-