Class StatusFilter

  • All Implemented Interfaces:
    Uniform

    public class StatusFilter
    extends Filter
    Filter associating a response entity based on the status. In order to customize the default representation, just subclass this class and override the "getRepresentation" method.
    If any exception occurs during the call handling, a "server internal error" status is automatically associated to the call. Of course, you can personalize the representation of this error. Also, if no status is set (null), then the "success OK" status is assumed. Concurrency note: instances of this class or its subclasses can be invoked by several threads at the same time and therefore must be thread-safe. You should be especially careful when storing state in member variables.
    • Field Detail

      • overwriting

        private volatile boolean overwriting
        Indicates if existing representations should be overwritten.
      • statusService

        private volatile StatusService statusService
        The helped status service.
    • Constructor Detail

      • StatusFilter

        public StatusFilter​(Context context,
                            boolean overwriting,
                            java.lang.String email,
                            Reference homeRef)
        Constructor.
        Parameters:
        context - The context.
        overwriting - Indicates whether an existing representation should be overwritten.
      • StatusFilter

        public StatusFilter​(Context context,
                            StatusService statusService)
        Constructor from a status service.
        Parameters:
        context - The context.
        statusService - The helped status service.
    • Method Detail

      • getStatusService

        public StatusService getStatusService()
        Returns the helped status service.
        Returns:
        The helped status service.
      • isOverwriting

        public boolean isOverwriting()
        Indicates if existing representations should be overwritten.
        Returns:
        True if existing representations should be overwritten.
      • setOverwriting

        public void setOverwriting​(boolean overwriting)
        Indicates if existing representations should be overwritten.
        Parameters:
        overwriting - True if existing representations should be overwritten.
      • setStatusService

        public void setStatusService​(StatusService statusService)
        Sets the helped status service.
        Parameters:
        statusService - The helped status service.