Class JsonMemoryHttpService

    • Method Detail

      • doGet

        public ObjectNode doGet​(Memory memory,
                                java.lang.String name,
                                java.lang.String type,
                                JsonRequest request)
                         throws JsonException
        Description copied from class: JsonNamedBeanHttpService
        Respond to an HTTP GET request for the requested name.

        If name is null, return a list of all objects for the given type, if appropriate.

        This method should throw a 500 Internal Server Error if type is not recognized.

        Specified by:
        doGet in class JsonNamedBeanHttpService<Memory>
        Parameters:
        memory - the requested object
        name - the name of the requested object
        type - the type of the requested object
        request - the JSON request
        Returns:
        a JSON description of the requested object
        Throws:
        JsonException - if the named object does not exist or other error occurs
      • doSchema

        public JsonNode doSchema​(java.lang.String type,
                                 boolean server,
                                 JsonRequest request)
                          throws JsonException
        Description copied from class: JsonHttpService
        Get the JSON Schema for the data property of the requested type of JSON object. It is a invalid for implementations to not return a valid schema that clients can use to validate a request to or response from the JSON services.

        Note that a schema must be contained in a standard object as:

        {"type":"schema", "data":{"schema":<em>schema</em>, "server":boolean}}

        If using JsonHttpService.doSchema(String, boolean, String, String, int), an implementation can be as simple as: return doSchema(type, server, "path/to/client/schema.json", "path/to/server/schema.json", id);

        Specified by:
        doSchema in class JsonHttpService
        Parameters:
        type - the type for which a schema is requested
        server - true if the schema is for a message from the server; false if the schema is for a message from the client
        request - the JSON request
        Returns:
        a JSON Schema valid for the type
        Throws:
        JsonException - if an error occurs preparing schema; if type is is not a type handled by this service, this must be thrown with an error code of 500 and the localized message ERROR_UNKNOWN_TYPE