Package jmri.web.servlet.panel
Class AbstractPanelServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
jmri.web.servlet.panel.AbstractPanelServlet
- All Implemented Interfaces:
Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig
- Direct Known Subclasses:
ControlPanelServlet,LayoutPanelServlet,PanelServlet,SwitchboardServlet
Abstract servlet for using panels in browser.
See JMRI Web Server - Panel Servlet Help in help/en/html/web/PanelServlet.shtml for an example description of the interaction between the Web Servlets, the Web Browser and the JMRI application.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Handle a GET request for a panel.protected Editorprotected abstract StringgetJsonPanel(String name) protected JComponentprotected BufferedImagegetPanelImage(String name) protected StringgetPanelText(String name, boolean useXML) protected abstract Stringprotected org.jdom2.ElementgetSignalMastIconsElement(String name, String imageset) Build and return an "icons" element containing icon URLs for all SignalMast states.protected abstract StringgetXmlPanel(String name) voidinit()protected voidlistPanels(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) protected voidparsePortableURIs(org.jdom2.Element element) protected org.jdom2.ElementBuild and return a panel state display element containing icon URLs for all states.Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Field Details
-
mapper
-
-
Constructor Details
-
AbstractPanelServlet
public AbstractPanelServlet()
-
-
Method Details
-
getPanelType
-
init
- Overrides:
initin classjavax.servlet.GenericServlet- Throws:
javax.servlet.ServletException
-
doGet
protected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException Handle a GET request for a panel.The request is processed in this order:
- If the request contains a parameter
name=someValue, redirect to/panel/someValueifsomeValueis an open panel, otherwise redirect to/panel/. - If the request ends in
/, return an HTML page listing all open panels. - Return the panel named in the last element in the path in the
following formats based on the
format=someFormatparameter:- html
- An HTML page rendering the panel.
- png
- A PNG image of the panel.
- json
- A JSON document of the panel (currently incomplete).
- xml
- An XML document of the panel ready to render within a browser.
formatis not specified, it is treated ashtml. All other formats not listed are treated asxml.
- Overrides:
doGetin classjavax.servlet.http.HttpServlet- Throws:
javax.servlet.ServletExceptionIOException
- If the request contains a parameter
-
listPanels
protected void listPanels(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException - Throws:
javax.servlet.ServletExceptionIOException
-
getPanelImage
-
getPanel
-
getPanelText
-
getJsonPanel
-
getXmlPanel
-
getEditor
-
parsePortableURIs
-
getSignalMastIconsElement
Build and return an "icons" element containing icon URLs for all SignalMast states. Element names are cleaned-up aspect names, aspect attribute is actual name of aspect.- Parameters:
name- user/system name of the signalMast using the iconsimageset- imageset name or "default"- Returns:
- an icons element containing icon URLs for SignalMast states
-
positionableElement
Build and return a panel state display element containing icon URLs for all states.- Parameters:
sub- Positional containing additional icons for display (in MultiSensorIcon)- Returns:
- a display element based on element name
-