Class AbstractWebConsolePlugin
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.apache.felix.webconsole.AbstractWebConsolePlugin
-
- All Implemented Interfaces:
java.io.Serializable,Servlet,ServletConfig
- Direct Known Subclasses:
SimpleWebConsolePlugin
@Deprecated(since="2021-04-30") public abstract class AbstractWebConsolePlugin extends HttpServlet
Deprecated.The Apache Felix Webconsole is not supported in Cloud environments.The Web Console can be extended by registering an OSGi service for the interfaceServletwith the service propertyfelix.webconsole.labelset to the label (last segment in the URL) of the page. The respective service is called a Web Console Plugin or a plugin for short. To help rendering the response the Apache Felix Web Console bundle provides two options. One of the options is to extend the AbstractWebConsolePlugin overwriting therenderContent(HttpServletRequest, HttpServletResponse)method.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringATTR_FILEUPLOADDeprecated.The name of the request attribute containing the map of FileItems from the POST requeststatic java.lang.StringATTR_FILEUPLOAD_REPODeprecated.The name of the request attribute containing aFile- upload repository path used byDiskFileItemFactory.static java.lang.StringGET_RESOURCE_METHOD_NAMEDeprecated.Web Console Plugin typically consists of servlet and resources such as images, scripts or style sheets.
-
Constructor Summary
Constructors Constructor Description AbstractWebConsolePlugin()Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactivate(BundleContext bundleContext)Deprecated.This method is called from the Felix Web Console to ensure the AbstractWebConsolePlugin is correctly setup.voiddeactivate()Deprecated.This method is called, by the Web Console to de-activate the plugin and release all used resources.static BrandingPlugingetBrandingPlugin()Deprecated.Returns theBrandingPlugincurrently used for web console branding.BundlegetBundle()Deprecated.Returns theBundlepertaining to thebundle contextwith which this plugin has been activated.java.lang.StringgetCategory()Deprecated.This method should return category string which will be used to render the plugin in the navigation menu.abstract java.lang.StringgetLabel()Deprecated.Retrieves the label.static java.lang.StringgetParameter(HttpServletRequest request, java.lang.String name)Deprecated.java.lang.StringgetServletName()Deprecated.Returns the title for this plugin as returned bygetTitle()abstract java.lang.StringgetTitle()Deprecated.Retrieves the title of the plug-in.voidlog(int level, java.lang.String message)Deprecated.Calls theServletContext.log(String)method if the configured log level is less than or equal to the givenlevel.voidlog(int level, java.lang.String message, java.lang.Throwable t)Deprecated.Calls theServletContext.log(String, Throwable)method if the configured log level is less than or equal to the givenlevel.static voidsetBrandingPlugin(BrandingPlugin brandingPlugin)Deprecated.Sets theBrandingPluginto use globally by all extensions of this class for branding.static voidsetLogLevel(int logLevel)Deprecated.Sets the log level to be applied for calls to thelog(int, String)andlog(int, String, Throwable)methods.-
Methods inherited from class javax.servlet.http.HttpServlet
service
-
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, init, init, log, log
-
-
-
-
Field Detail
-
ATTR_FILEUPLOAD
public static final java.lang.String ATTR_FILEUPLOAD
Deprecated.The name of the request attribute containing the map of FileItems from the POST request- See Also:
- Constant Field Values
-
ATTR_FILEUPLOAD_REPO
public static final java.lang.String ATTR_FILEUPLOAD_REPO
Deprecated.The name of the request attribute containing aFile- upload repository path used byDiskFileItemFactory.The Web Console plugin, that utilizes file upload capabilities of the web console SHOULD:
- Obtain the file using
BundleContext.getDataFile(String) - Set the file as request attribute
- Use
WebConsoleUtil.getParameter(HttpServletRequest, String)to obtain the file(s)
- See Also:
- Constant Field Values
- Obtain the file using
-
GET_RESOURCE_METHOD_NAME
public static final java.lang.String GET_RESOURCE_METHOD_NAME
Deprecated.Web Console Plugin typically consists of servlet and resources such as images, scripts or style sheets. To load resources, a Resource Provider is used. The resource provider is an object, that provides a method which name is specified by this constants and it is 'getResource'.- See Also:
getResourceProvider(), Constant Field Values
-
-
Method Detail
-
getServletName
public java.lang.String getServletName()
Deprecated.Returns the title for this plugin as returned bygetTitle()- Specified by:
getServletNamein interfaceServletConfig- Overrides:
getServletNamein classGenericServlet- Returns:
- the name of this servlet instance
- See Also:
GenericServlet.getServletName()
-
getCategory
public java.lang.String getCategory()
Deprecated.This method should return category string which will be used to render the plugin in the navigation menu. Default implementation returns null, which will result in the plugin link rendered as top level menu item. Concrete implementations wishing to be rendered as a sub-menu item under a category should override this method and return a string or definefelix.webconsole.categoryOSGi property. Currently only single level categories are supported. So, this should be a simple String.- Returns:
- category
-
activate
public void activate(BundleContext bundleContext)
Deprecated.This method is called from the Felix Web Console to ensure the AbstractWebConsolePlugin is correctly setup. It is called right after the Web Console receives notification for plugin registration.- Parameters:
bundleContext- the context of the plugin bundle
-
deactivate
public void deactivate()
Deprecated.This method is called, by the Web Console to de-activate the plugin and release all used resources.
-
getLabel
public abstract java.lang.String getLabel()
Deprecated.Retrieves the label. This is the last component in the servlet path. This method MUST be overridden, if theAbstractWebConsolePlugin()constructor is used.- Returns:
- the label.
-
getTitle
public abstract java.lang.String getTitle()
Deprecated.Retrieves the title of the plug-in. It is displayed in the page header and is also included in the title of the HTML document. This method MUST be overridden, if theAbstractWebConsolePlugin()constructor is used.- Returns:
- the plugin title.
-
getBundle
public final Bundle getBundle()
Deprecated.Returns theBundlepertaining to thebundle contextwith which this plugin has been activated. If the plugin has not be activated by calling theactivate(BundleContext)method, this method returnsnull.- Returns:
- the bundle or
nullif the plugin is not activated.
-
log
public void log(int level, java.lang.String message)Deprecated.Calls theServletContext.log(String)method if the configured log level is less than or equal to the givenlevel.Note, that the
levelparamter is only used to decide whether theGenericServlet.log(String)method is called or not. The actual implementation of theGenericServlet.logmethod is outside of the control of this method.If the servlet has not been initialized yet or has already been destroyed the message is printed to stderr.
- Parameters:
level- The log level at which to log the messagemessage- The message to log
-
log
public void log(int level, java.lang.String message, java.lang.Throwable t)Deprecated.Calls theServletContext.log(String, Throwable)method if the configured log level is less than or equal to the givenlevel.Note, that the
levelparamter is only used to decide whether theGenericServlet.log(String, Throwable)method is called or not. The actual implementation of theGenericServlet.logmethod is outside of the control of this method.- Parameters:
level- The log level at which to log the messagemessage- The message to logt- TheThrowableto log with the message
-
getParameter
public static final java.lang.String getParameter(HttpServletRequest request, java.lang.String name)
Deprecated.An utility method, that is used to filter out simple parameter from file parameter when multipart transfer encoding is used. This method processes the request and sets a request attributeATTR_FILEUPLOAD. The attribute value is aMapwhere the key is a String specifying the field name and the value is aFileItem.- Parameters:
request- the HTTP request coming from the username- the name of the parameter- Returns:
- if not multipart transfer encoding is used - the value is the
parameter value or
nullif not set. If multipart is used, and the specified parameter is field - then the value of the parameter is returned.
-
getBrandingPlugin
public static BrandingPlugin getBrandingPlugin()
Deprecated.Returns theBrandingPlugincurrently used for web console branding.- Returns:
- the brandingPlugin
-
setBrandingPlugin
public static final void setBrandingPlugin(BrandingPlugin brandingPlugin)
Deprecated.Sets theBrandingPluginto use globally by all extensions of this class for branding.Note: This method is intended to be used internally by the Web Console to update the branding plugin to use.
- Parameters:
brandingPlugin- the brandingPlugin to set
-
setLogLevel
public static final void setLogLevel(int logLevel)
Deprecated.Sets the log level to be applied for calls to thelog(int, String)andlog(int, String, Throwable)methods.Note: This method is intended to be used internally by the Web Console to update the log level according to the Web Console configuration.
- Parameters:
logLevel- the maximum allowed log level. If message is logged with lower level it will not be forwarded to the logger.
-
-