Class RestHelper

  • Direct Known Subclasses:
    RestApi, ShareApi

    public abstract class RestHelper
    extends javax.ws.rs.core.Application
    Some helping methods for dealing with rest responses
    Author:
    martinP
    • Constructor Detail

      • RestHelper

        public RestHelper()
    • Method Detail

      • buildResponse

        protected javax.ws.rs.core.Response.ResponseBuilder buildResponse​(int status,
                                                                          UserManager user)
        Generates ResponseBuilder an sets cookies, if possible
        Parameters:
        status - the desired status
        user - the user
        Returns:
        the ResponseBuilder
      • buildErrorResponse

        protected javax.ws.rs.core.Response buildErrorResponse​(int status,
                                                               UserManager user,
                                                               String... errors)
        Generates an error response
        Parameters:
        status - the desired status
        user - the user
        errors - the errors occurred
        Returns:
        the error response
      • buildTextErrorResponse

        protected javax.ws.rs.core.Response buildTextErrorResponse​(int status,
                                                                   UserManager user,
                                                                   String... errors)
        Generates an error response
        Parameters:
        status - the desired status
        user - the user
        errors - the errors occurred
        Returns:
        the error response