Class JsonExtension

java.lang.Object
dev.relism.flash.ext.jackson.json.JsonExtension
All Implemented Interfaces:
dev.relism.flash.extension.FlashExtension

public class JsonExtension extends Object implements dev.relism.flash.extension.FlashExtension
JSON for an application: the Json codec, the mapper behind it, and the middleware that serializes whatever a handler returns.

 JsonExtension json = new JsonExtension();
 app.install(json).use(json.auto());
 

The default mapper discovers the modules on the classpath (Java Time among them) and writes dates as ISO strings. Hand it a mapper of your own to decide otherwise.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
    JsonExtension(com.fasterxml.jackson.databind.ObjectMapper mapper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    dev.relism.flash.routing.Middleware
    Serializes what a handler returns, unless it already returned a response, bytes or text.
    void
    configure(dev.relism.flash.extension.FlashRegistrar<?> app, dev.relism.flash.extension.FlashContext ctx)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JsonExtension

      public JsonExtension()
    • JsonExtension

      public JsonExtension(com.fasterxml.jackson.databind.ObjectMapper mapper)
  • Method Details

    • auto

      public dev.relism.flash.routing.Middleware auto()
      Serializes what a handler returns, unless it already returned a response, bytes or text.
    • configure

      public void configure(dev.relism.flash.extension.FlashRegistrar<?> app, dev.relism.flash.extension.FlashContext ctx)
      Specified by:
      configure in interface dev.relism.flash.extension.FlashExtension