Class HTTPUtility
- 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 Summary
Constructors Constructor Description HTTPUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static <C> AvailableInAnotherContextExceptiongetElementAvailableInAnotherContextException(Class<C> clz)Gets the element available in another context exception.protected static <C> NotFoundExceptiongetElementNotFoundException(Class<C> clz)Gets the element not found exception.static <C> CgetResponse(Class<C> clz, HttpURLConnection connection)Gets the response.protected static StringBuildergetStringBuilder(InputStream inputStream)Gets the string builder.
-
-
-
Method Detail
-
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 exceptionResourceRegistryException- 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 clzconnection- the connection- Returns:
- the response
- Throws:
Exception- the exception
-
-