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 java.lang.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 thegetPath()
method returnscustom-path
, the servlet handles requests for the URLs starting with:https://example.com/oxygen-xml-web-author/plugins-dispatcher/custom-path/
.- Since:
- 26
*********************************
EXPERIMENTAL - Subject to change
********************************
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
-
-
Field Summary
Fields Modifier and Type Field Description protected ServletConfig
config
The servlet configuration.
-
Constructor Summary
Constructors Constructor Description ServletPluginExtension()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
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 java.lang.String
getPath()
Should be implemented to return the relative path handled by this plugin.ServletConfig
getServletConfig()
void
init()
Servlet's init() method.void
init(ServletConfig config)
Init function that stores the config.boolean
requiresAuthorization()
void
service(HttpServletRequest req, HttpServletResponse resp)
Servlet's service method.
-
-
-
Field Detail
-
config
protected ServletConfig config
The servlet configuration.
-
-
Method Detail
-
getPath
public abstract java.lang.String 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
public void init(ServletConfig config) throws ServletException
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
public void init() throws ServletException
Servlet's init() method.- Throws:
ServletException
-
service
public void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
Servlet's service method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
java.io.IOException
-
doGet
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
Servlet's doGet method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
java.io.IOException
-
doPost
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
Servlet's doPost method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
java.io.IOException
-
doPut
public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
Servlet's doPut method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
java.io.IOException
-
doDelete
public void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException
Servlet's doDelete method.- Parameters:
req
- the request.resp
- the response.- Throws:
ServletException
java.io.IOException
-
getServletConfig
public ServletConfig getServletConfig()
- Returns:
- Returns the servlet configuration.
-
requiresAuthorization
public boolean requiresAuthorization()
- Returns:
- True if this extension requires user to be authenticated as administrator.
-
-