com.ibm.commerce.foundation.rest.resourcehandler

Interface IResourceHandler

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      javax.ws.rs.core.Response generateResponseFromHttpStatusCodeAndRespData(java.lang.String responseFormat, java.util.Map<java.lang.String,java.lang.Object> responseData, org.apache.wink.common.http.HttpStatus statusCode)
      This method generates REST response for a given response map.
      java.lang.String getFormattingGroupName()
      Returns the formatting group name for resolving the struts action of the formatting JSP.
      java.lang.String getResourceName()
      This method returns the name of the resource used primarily to determine the representation of the resource.
      void postProcess(java.util.Map<java.lang.String,java.lang.Object> responseMap)
      Method to provide post process in out of box JSON/XML entity providers after each DataObject has been converted to a Map and before constructing the REST response.
      void preProcess(java.util.Map<java.lang.String,java.lang.Object> responseMap)
      This method does the pre-processing of the response map before the entity provider is invoked passing the response map.
    • Field Detail

      • COPYRIGHT

        static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
    • Method Detail

      • getResourceName

        java.lang.String getResourceName()
        This method returns the name of the resource used primarily to determine the representation of the resource. This class can be overridden to change the name of the resource and therefore the representation, while keeping all the methods in this class.
        Returns:
        the resource name
      • getFormattingGroupName

        java.lang.String getFormattingGroupName()
        Returns the formatting group name for resolving the struts action of the formatting JSP. By default, it returns NULL. Overwrite this method in your resource handler class to return a formatting group name specific to your resource handler.
        Returns:
        the formatting group name.
      • preProcess

        void preProcess(java.util.Map<java.lang.String,java.lang.Object> responseMap)
        This method does the pre-processing of the response map before the entity provider is invoked passing the response map.

        Overwrite this method in your resource handler class to customize the response map.

        Parameters:
        responseMap - the response map.
      • postProcess

        void postProcess(java.util.Map<java.lang.String,java.lang.Object> responseMap)
        Method to provide post process in out of box JSON/XML entity providers after each DataObject has been converted to a Map and before constructing the REST response. By default, it does nothing. Overwrite this method in your resource handler class to perform any post process, for example, merge maps from multiple DataObjects into a single Map.
        Parameters:
        responseMap - The response Map after each DataObject has been converted to a Map.
      • generateResponseFromHttpStatusCodeAndRespData

        javax.ws.rs.core.Response generateResponseFromHttpStatusCodeAndRespData(java.lang.String responseFormat,
                                                                                java.util.Map<java.lang.String,java.lang.Object> responseData,
                                                                                org.apache.wink.common.http.HttpStatus statusCode)
        This method generates REST response for a given response map.

        Use this method in your resource handler class when you want to pass name value pairs to the entity provider.

        Parameters:
        responseFormat - the response format shortcut. Response format is used to resolve the media type for the REST response.
        responseData - the response map to pass to the entity provider.
        statusCode - the HTTP status code to set in the REST response.
        Returns:
        the REST response.