Package org.gcube.smartgears.extensions
Class ApiResource
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.gcube.smartgears.extensions.HttpExtension
org.gcube.smartgears.extensions.ApiResource
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable,ApplicationExtension
- Direct Known Subclasses:
ConfigurationResource,FrontPageResource,HealthResource,LifecycleResource,MetricsResource,ProfileResource
A resource-specifc API handled by an
HttpController.- Author:
- Fabio Simeoni
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.gcube.smartgears.extensions.HttpExtension
HttpExtension.Method -
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
ConstructorsConstructorDescriptionApiResource(ApiSignature signature) Creates an instance with a given signature. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaccepts(HttpExtension.Method method, String type) Returnstrueif this resource accepts a given media type for a given method.voiddoDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) voiddoGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) voiddoHead(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) voiddoOptions(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) voiddoPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) voiddoPut(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) voiddoTrace(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) excludes()Returns the set of request paths that should be excluded from request management.static ApiSignatureReturns aApiSignaturethat declares the method and media types handled by anApiResourcefor a given mapping.static ApiMethodSignaturemethod(HttpExtension.Method method) Returns anApiMethodSignaturethat declares the media types handled by anApiResourcefor a given method.booleanproduces(HttpExtension.Method method, String type) Returnstrueif this resource produces a given media type for a given method.Return the signature of this resource.booleansupports(HttpExtension.Method method) Returnstrueif this resource supports a given method.Methods inherited from class org.gcube.smartgears.extensions.HttpExtension
context, init, init, mapping, mapping, name, name, stopMethods inherited from class jakarta.servlet.http.HttpServlet
getLastModified, init, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, logMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.Servlet
destroy, getServletConfig, getServletInfo, init, service
-
Constructor Details
-
ApiResource
Creates an instance with a given signature.- Parameters:
signature- the signature
-
-
Method Details
-
handles
Returns aApiSignaturethat declares the method and media types handled by anApiResourcefor a given mapping.- Parameters:
mapping- the mapping- Returns:
- the signature
-
method
Returns anApiMethodSignaturethat declares the media types handled by anApiResourcefor a given method.- Parameters:
method- the method- Returns:
- the signature
-
excludes
Description copied from interface:ApplicationExtensionReturns the set of request paths that should be excluded from request management.- Specified by:
excludesin interfaceApplicationExtension- Overrides:
excludesin classHttpExtension- Returns:
- the set of request paths that should be excluded from request management
-
supports
Returnstrueif this resource supports a given method.- Parameters:
method- the method- Returns:
trueif this resource supports the given method
-
accepts
Returnstrueif this resource accepts a given media type for a given method.- Parameters:
method- the methodtype- the media type- Returns:
trueif this resource accepts the given media type for the given method
-
produces
Returnstrueif this resource produces a given media type for a given method.- Parameters:
method- the methodtype- the media type- Returns:
trueif this resource produces the given media type for the given method
-
signature
Return the signature of this resource.- Returns:
- the signature
-
doHead
public void doHead(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doHeadin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doGet
public void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doPost
public void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doPut
public void doPut(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doPutin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doDelete
public void doDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doDeletein classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doOptions
public void doOptions(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doOptionsin classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
doTrace
public void doTrace(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException - Overrides:
doTracein classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-