Class SlingSafeMethodsServlet
- All Implemented Interfaces:
Serializable
,Servlet
,ServletConfig
- Direct Known Subclasses:
AbstractImageServlet
,CampaignsDataSourceServlet
,CanEditTemplateRenderCondition
,Children
,FeedRendererServlet
,ParagraphList
,ParagraphServlet
,ProxyServlet
,QueryDatasource
,RootMappingServlet
,SegmentsDataSourceServlet
,SlingAllMethodsServlet
If any of the default HTTP methods is to be implemented just overwrite the
respective doXXX method. If additional methods should be supported implement
appropriate doXXX methods and overwrite the
mayService(SlingHttpServletRequest, SlingHttpServletResponse)
method
to dispatch to the doXXX methods as appropriate and overwrite the
getAllowedRequestMethods(Map)
to add the new method names.
Please note, that this base class is intended for applications where data is
only read. As such, this servlet by itself does not support the POST,
PUT and DELETE methods. Extensions of this class should
either overwrite any of the doXXX methods of this class or add support for
other read-only methods only. Applications wishing to support data
modification should rather use or extend the SlingAllMethodsServlet
which also contains support for the POST, PUT and
DELETE methods. This latter class should also be overwritten to
add support for HTTP methods modifying data.
Implementors note: The methods in this class are all declared to throw the exceptions according to the intentions of the Servlet API rather than throwing their Sling RuntimeException counter parts. This is done to ease the integration with traditional servlets.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NotNull String
Returns the simple class name of this servlet class.void
service
(@NotNull ServletRequest req, @NotNull ServletResponse res) Forwards the request to theservice(SlingHttpServletRequest, SlingHttpServletResponse)
method if the request is a HTTP request.Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, init, log, log
-
Constructor Details
-
SlingSafeMethodsServlet
public SlingSafeMethodsServlet()
-
-
Method Details
-
service
public void service(@NotNull @NotNull ServletRequest req, @NotNull @NotNull ServletResponse res) throws ServletException, IOException Forwards the request to theservice(SlingHttpServletRequest, SlingHttpServletResponse)
method if the request is a HTTP request.Implementations of this class will not generally overwrite this method.
- Specified by:
service
in interfaceServlet
- Specified by:
service
in classGenericServlet
- Parameters:
req
- The Servlet requestres
- The Servlet response- Throws:
ServletException
- If the request is not a HTTP request or forwarded from theservice(SlingHttpServletRequest, SlingHttpServletResponse)
called.IOException
- Forwarded from theservice(SlingHttpServletRequest, SlingHttpServletResponse)
called.
-
getServletInfo
Returns the simple class name of this servlet class. Extensions of this class may overwrite to return more specific information.- Specified by:
getServletInfo
in interfaceServlet
- Overrides:
getServletInfo
in classGenericServlet
- Returns:
- String information about this servlet, by default an empty string
-