Class BaseREST

java.lang.Object
org.gcube.resourcemanagement.rest.BaseREST
Direct Known Subclasses:
Admin, ContextManager, PlanManager, ResourceManager

public class BaseREST extends Object
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
      Logger instance for this class
    • APPLICATION_JSON_CHARSET_UTF_8

      public static final String APPLICATION_JSON_CHARSET_UTF_8
      Content type for JSON with UTF-8 charset
      See Also:
    • APPLICATION_JSON_API

      public static final String APPLICATION_JSON_API
      Content type for JSON API
      See Also:
    • COUNT_KEY

      public static final String COUNT_KEY
      Key name for count values in JSON responses
      See Also:
    • PURGE_QUERY_PARAMETER

      public static final String PURGE_QUERY_PARAMETER
      Query parameter name for purge operations
      See Also:
    • httpHeaders

      @Context protected jakarta.ws.rs.core.HttpHeaders httpHeaders
      HTTP headers context
    • uriInfo

      @Context protected jakarta.ws.rs.core.UriInfo uriInfo
      URI info context
    • LOCATION_HEADER

      protected static final String LOCATION_HEADER
      Header name for location header
      See Also:
  • Constructor Details

    • BaseREST

      public BaseREST()
  • Method Details

    • addLocation

      protected jakarta.ws.rs.core.Response.ResponseBuilder addLocation(jakarta.ws.rs.core.Response.ResponseBuilder responseBuilder, String id)
      Add a location header to the response builder
      Parameters:
      responseBuilder - the response builder to modify
      id - the resource identifier to append to the location
      Returns:
      the modified response builder
    • createCountJson

      protected String createCountJson(int count)
      Create a JSON string containing a count value
      Parameters:
      count - the count value to include
      Returns:
      JSON string with the count
    • setAccountingMethod

      protected void setAccountingMethod(String method)
      Set the accounting method name for tracking operations
      Parameters:
      method - the method name to set for accounting