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:
  Serializable, Iterable

    @DefaultKey(value="json")
     @ValidScope(value="request")
    public class JsonTool
    extends 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:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.velocity.tools.generic.ImportSupport

`ImportSupport.SafeClosingHttpURLConnectionReader`

### Field Summary

### Fields inherited from class org.apache.velocity.tools.generic.JsonTool

`importSupport`

### Fields inherited from class org.apache.velocity.tools.generic.ImportSupport

`RESOURCE_KEY, URL_KEY, VALID_SCHEME_CHARS`

### Fields 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
Constructor and Description
`JsonTool()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected void` `configure(ValueParser parser)` Configuration.
`protected void` `initializeImportSupport(ValueParser config)` Importsupport initialization
`protected static boolean` `isJsonContentType(String contentType)` Check if a given content type is of JSON type
`protected static boolean` `isJsonMimeType(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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Constructor Detail

#### JsonTool

    public JsonTool()

### Method Detail

#### initializeImportSupport

    protected void initializeImportSupport(ValueParser config)

Importsupport initialization

Overrides:
  `initializeImportSupport` in class `JsonTool`
Parameters:
  `config` - configuration values

#### isJsonMimeType

    protected static boolean isJsonMimeType(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(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(ValueParser parser)

Configuration. Parses request body if appropriate.

Overrides:
  `configure` in class `JsonTool`
Parameters:
  `parser` - configuration values