Package com.oorian.html
Class HtmlTemplatePage
java.lang.Object
com.oorian.HttpFile
com.oorian.html.HtmlPage
com.oorian.html.HtmlTemplatePage
An HtmlPage that builds its content by parsing an HTML template file.
This class reads an HTML file from the servlet context, parses it using the Oorian
HtmlParser, and uses the parsed <head> and <body> elements
as the page content. Attributes on the <html> element are applied to the page.
Subclasses can override createHead(Head) and createBody(Body) to
further modify the parsed content after the template has been loaded.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHtmlTemplatePage(String htmlFile) Creates a new template page that will load the specified HTML file. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateBody(Body body) Creates the body section of this page.protected voidcreateHead(Head head) Creates the head section of this page.protected booleanInitializes the page by parsing the HTML template file.voidsetCharset(String charset) Sets the character encoding used when reading the template file.Methods inherited from class com.oorian.html.HtmlPage
addAttribute, addAttributeUpdate, addCommand, addCookie, addCookie, addElement, addElementAddition, addElementSubtraction, addElementUpdate, blockPageUnload, clearWatch, closeWebSocket, closeWindow, createAppUrl, createFile, createFullUrl, createUrl, dispatchEvent, dispatchEvent, dispatchEvent, executeJs, executeJs, getBody, getCommunicationMode, getCookie, getCookie, getCookies, getCurrentPosition, getCurrentPosition, getDisconnectedTime, getElementById, getElementsByTagName, getHash, getHead, getInnerHtml, getIpAddress, getLastActivityTime, getLogicalDocumentHeight, getLogicalDocumentWidth, getPage, getPageId, getPageState, getPhysicalDocumentHeight, getPhysicalDocumentWidth, getPhysicalScreenHeight, getPhysicalScreenWidth, getPhysicalWindowHeight, getPhysicalWindowWidth, getPixelRatio, getPollInterval, getPreviousFullUrl, getReferrer, getReferringPage, getRequestHost, getScreenHeight, getScreenOrientation, getScreenSize, getScreenWidth, getSession, getTempFileDir, getUserAgent, getUtcOffset, getWindowHeight, getWindowOrientation, getWindowSize, getWindowWidth, handleAjaxRequest, handleSseClose, handleSseOpen, handleWebsocketClose, handleWebsocketError, handleWebsocketMessage, handleWebsocketOpen, handleWebSocketRequest, historyPushState, historyReplaceState, initializeFile, isCsrfProtectionEnabled, isDesktop, isDisconnectedTimeout, isHighDpi, isLandscape, isLoaded, isMobile, isPortrait, isResponseWritten, isTablet, isUnloaded, loadImage, loadImages, loadScript, loadScript, makeSameHeight, makeSameHeight, makeSameHeightMax, makeSameHeightMin, makeSameSize, makeSameSizeMax, makeSameSizeMin, makeSameWidth, makeSameWidthMax, makeSameWidthMin, navigateBack, navigateBack, navigateBackAfterDelay, navigateForward, navigateForward, navigateTo, navigateToAfterDelay, navigateToPreviousPage, navigateToReferrer, onCallback, onClientDataEvent, onDocumentResize, onException, onJsReturn, onJsReturn, onLoaded, onRefresh, onRequest, onResponseComplete, onScreenResize, onSessionExpired, onSseClose, onSseOpen, onUnloaded, onUserEvent, onWebsocketClose, onWebsocketError, onWebsocketMessage, onWebsocketOpen, onWindowResize, openInNewWindow, openInNewWindow, openInNewWindow, print, print, print, recreate, refresh, refresh, registerAttributeUpdate, registerElementAddition, registerElementSubtraction, registerElementUpdate, registerListener, registerListener, registerListener, reload, reloadAfterDelay, removeAllElements, removeElement, removeElement, resolveUrl, sendAjaxResponse, sendCommand, sendSseMessage, sendUpdate, sendWebSocketMessage, setBody, setClientInterval, setClientTimeout, setCommunicationMode, setCsrfProtectionEnabled, setDescription, setDir, setDir, setEnableCsrfProtection, setHead, setKeywords, setLang, setOorianScriptPath, setPollInterval, setReloadOnBack, setRobots, setTempFileDir, setTitle, toString, unblockPageUnload, userAgentContains, watchPosition, watchPositionMethods inherited from class com.oorian.HttpFile
addResponseHeader, create, getCacheControl, getDocumentUrl, getFullUrl, getHost, getHttpRequest, getOriginalParameters, getParameter, getParameterAsFloat, getParameterAsInt, getParameterAsLong, getParameterAsShort, getParameters, getParametersAFloat, getParametersAsInt, getParametersAsLong, getParametersAsShort, getParameterValues, getPath, getServletPath, getSessionId, getUrl, getUrlParameters, getWebResponse, hasParameter, hasUrlParams, isWritten, onCreated, onWriteComplete, setCacheControl, setCharacterEncoding, setContentType, setResponseHeader, setUrlParameters, toString, toString, write
-
Constructor Details
-
HtmlTemplatePage
Creates a new template page that will load the specified HTML file.- Parameters:
htmlFile- The path to the HTML template file, relative to the servlet context root.
-
-
Method Details
-
setCharset
Sets the character encoding used when reading the template file.- Parameters:
charset- The character encoding name (default is UTF-8).
-
initializePage
protected boolean initializePage()Initializes the page by parsing the HTML template file.Reads the template file from the servlet context, parses it with the Oorian HtmlParser, and extracts the head and body elements. Attributes from the
<html>element are applied to this page.- Overrides:
initializePagein classHtmlPage- Returns:
trueif initialization was successful.- Throws:
HttpFileException- If the template file cannot be read or parsed.
-
createHead
Description copied from class:HtmlPageCreates the head section of this page.Subclasses must implement this method to add stylesheets, scripts, meta tags, and other head content.
- Specified by:
createHeadin classHtmlPage- Parameters:
head- The Head element to populate.
-
createBody
Description copied from class:HtmlPageCreates the body section of this page.Subclasses must implement this method to build the page layout and content.
- Specified by:
createBodyin classHtmlPage- Parameters:
body- The Body element to populate.
-