Class JacksonModule

java.lang.Object
io.jooby.jackson.Jackson2Module
io.jooby.jackson.JacksonModule
All Implemented Interfaces:
io.jooby.Extension, io.jooby.MessageDecoder, io.jooby.MessageEncoder

@Deprecated(since="4.3.0", forRemoval=true) public class JacksonModule extends Jackson2Module
Deprecated, for removal: This API element is subject to removal in a future version.
Use JacksonModule instead.
JSON module using Jackson: https://jooby.io/modules/jackson2.

Usage:


 {

   install(new JacksonModule());

   get("/", ctx -> {
     MyObject myObject = ...;
     // send json
     return myObject;
   });

   post("/", ctx -> {
     // read json
     MyObject myObject = ctx.body(MyObject.class);
     // send json
     return myObject;
   });
 }
 
For body decoding the client must specify the Content-Type header set to application/json.

You can retrieve the ObjectMapper via require call:


 {

   ObjectMapper mapper = require(ObjectMapper.class);

 }
 
Complete documentation is available at: https://jooby.io/modules/jackson2.
Since:
2.0.0
Author:
edgar
  • Field Summary

    Fields inherited from class io.jooby.jackson.Jackson2Module

    FILTER_ID

    Fields inherited from interface io.jooby.MessageDecoder

    UNSUPPORTED_MEDIA_TYPE

    Fields inherited from interface io.jooby.MessageEncoder

    TO_STRING
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a Jackson module using the default object mapper from create(Module...).
    JacksonModule(com.fasterxml.jackson.databind.ObjectMapper mapper)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates a Jackson module.
    JacksonModule(com.fasterxml.jackson.databind.ObjectMapper mapper, io.jooby.MediaType contentType)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.fasterxml.jackson.databind.ObjectMapper
    create(com.fasterxml.jackson.databind.Module... modules)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Default object mapper.

    Methods inherited from class io.jooby.jackson.Jackson2Module

    decode, encode, install, module

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.jooby.Extension

    lateinit
  • Constructor Details

    • JacksonModule

      public JacksonModule(com.fasterxml.jackson.databind.ObjectMapper mapper, io.jooby.MediaType contentType)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • JacksonModule

      public JacksonModule(com.fasterxml.jackson.databind.ObjectMapper mapper)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a Jackson module.
      Parameters:
      mapper - Object mapper to use.
    • JacksonModule

      public JacksonModule()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Creates a Jackson module using the default object mapper from create(Module...).
  • Method Details

    • create

      public static com.fasterxml.jackson.databind.ObjectMapper create(com.fasterxml.jackson.databind.Module... modules)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Default object mapper. Install Jdk8Module, JavaTimeModule, ParameterNamesModule.
      Parameters:
      modules - Extra/additional modules to install.
      Returns:
      Object mapper instance.