java.lang.Object
org.gcube.informationsystem.resourceregistry.api.rest.httputils.HTTPUtility

public class HTTPUtility extends Object
The Class HTTPUtility.
Author:
Luca Frosini (ISTI - CNR)
  • Constructor Details

    • HTTPUtility

      public HTTPUtility()
  • Method Details

    • getElementNotFoundException

      protected static <C> NotFoundException getElementNotFoundException(Class<C> clz) throws NotFoundException, ResourceRegistryException
      Gets the element not found exception.
      Type Parameters:
      C - the generic type
      Parameters:
      clz - the clz
      Returns:
      the element not found exception
      Throws:
      NotFoundException - the not found exception
      ResourceRegistryException - the resource registry exception
    • getElementAvailableInAnotherContextException

      protected static <C> AvailableInAnotherContextException getElementAvailableInAnotherContextException(Class<C> clz)
      Gets the element available in another context exception.
      Type Parameters:
      C - the generic type
      Parameters:
      clz - the clz
      Returns:
      the element available in another context exception
    • getStringBuilder

      protected static StringBuilder getStringBuilder(InputStream inputStream) throws IOException
      Gets the string builder.
      Parameters:
      inputStream - the input stream
      Returns:
      the string builder
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • getResponse

      public static <C> C getResponse(Class<C> clz, HttpURLConnection connection) throws Exception
      Gets the response.
      Type Parameters:
      C - the generic type
      Parameters:
      clz - the clz
      connection - the connection
      Returns:
      the response
      Throws:
      Exception - the exception