Class JsonService


  • @Path("/json/")
    public class JsonService
    extends Object
    The JSON Service provides JSON inspection service which generate an AtlasMap Document object from JSON instance or JSON schema.
    • Constructor Detail

      • JsonService

        public JsonService()
    • Method Detail

      • toJson

        protected byte[] toJson​(Object value)
        Serializes to a JSON.
        Parameters:
        value - value
        Returns:
        serialized
      • fromJson

        protected <T> T fromJson​(InputStream value,
                                 Class<T> clazz)
        Deserializes from a JSON.
        Type Parameters:
        T - type
        Parameters:
        value - value
        clazz - type
        Returns:
        deserialized
      • simpleHelloWorld

        @GET
        @Path("/simple")
        @Produces("text/plain")
        public String simpleHelloWorld​(@QueryParam("from")
                                       String from)
        Simple hello service.
        Parameters:
        from - sender
        Returns:
        pong
      • inspect

        @POST
        @Path("/inspect")
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response inspect​(InputStream requestIn)
        Inspect a JSON schema or instance and return a Document object.
        Parameters:
        requestIn - request
        Returns:
        JsonInspectionResponse
      • validJsonData

        protected boolean validJsonData​(String jsonData)
        Gets if the JSON data is valid.
        Parameters:
        jsonData - json data
        Returns:
        true if valid, or false
      • cleanJsonData

        protected String cleanJsonData​(String jsonData)
        Trims the String.
        Parameters:
        jsonData - String
        Returns:
        trimmed