Class ServletPluginExtension
java.lang.Object
ro.sync.ecss.extensions.api.webapp.plugin.ServletPluginExtension
- All Implemented Interfaces:
PluginExtension
- Direct Known Subclasses:
ServletPluginConfigExtension
@API(type=EXTENDABLE,
src=PUBLIC)
public abstract class ServletPluginExtension
extends Object
implements PluginExtension
This abstract class should be extended in order to create a servlet.
To register the servlet you just have to declare an extension of type "WebappServlet"
in the plugin's plugin.xml file. For example:
<extension type="WebappServlet" class="com.domain.example.ServletPluginExtensionImpl"/>
Web Author installs servlet extensions automatically, each one receiving requests from specific URLs
based on the path returned by the getPath()
method.
For example, if the Web Author is available at https://example.com/oxygen-xml-web-author/
and
the getPath()
method returns custom-path
, the servlet handles requests for the
URLs starting with: https://example.com/oxygen-xml-web-author/plugins-dispatcher/custom-path/
.
- Since:
- 26
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
doDelete
(HttpServletRequest req, HttpServletResponse resp) Servlet's doDelete method.void
doGet
(HttpServletRequest req, HttpServletResponse resp) Servlet's doGet method.void
doPost
(HttpServletRequest req, HttpServletResponse resp) Servlet's doPost method.void
doPut
(HttpServletRequest req, HttpServletResponse resp) Servlet's doPut method.abstract String
getPath()
Should be implemented to return the relative path handled by this plugin.void
init()
Servlet's init() method.void
init
(ServletConfig config) Init function that stores the config.boolean
void
service
(HttpServletRequest req, HttpServletResponse resp) Servlet's service method.
-
Field Details
-
config
The servlet configuration.
-
-
Constructor Details
-
ServletPluginExtension
public ServletPluginExtension()
-
-
Method Details
-
getPath
Should be implemented to return the relative path handled by this plugin. The path should be unique among other webapp servlet plugins paths and should contain only lower case letters or the '-' sign. Example: "plugin-path"- Returns:
- the path at which the servlet will be accessed.
-
init
Init function that stores the config. Consider overriding theinit()
method instead. If you decide to override this one, call the super implementation.- Parameters:
config
- The configuration.- Throws:
ServletException
-
init
Servlet's init() method.- Throws:
ServletException
-
service
public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Servlet's service method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
IOException
-
doGet
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Servlet's doGet method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
IOException
-
doPost
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Servlet's doPost method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
IOException
-
doPut
public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Servlet's doPut method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
IOException
-
doDelete
public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Servlet's doDelete method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
IOException
-
getServletConfig
- Returns:
- Returns the servlet configuration.
-
requiresAuthorization
public boolean requiresAuthorization()- Returns:
- True if this extension requires user to be authenticated as administrator.
-