Class BrowserPage
java.lang.Object
com.webfirmframework.wffweb.server.page.BrowserPage
- All Implemented Interfaces:
Serializable
- Since:
- 2.0.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
To specify (by removeFromContext method) when to removeBrowserPage
instance fromBrowserPageContext
. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addServerMethod
(String methodName, ServerAsyncMethod serverAsyncMethod) final void
addServerMethod
(String methodName, ServerAsyncMethod serverAsyncMethod, Object serverSideData) final void
addWebSocketPushListener
(String sessionId, WebSocketPushListener wsListener) adds the WebSocket listener for the given WebSocket sessionprotected void
afterRender
(AbstractHtml rootTag) Invokes afterrender()
method.protected void
afterToHtml
(AbstractHtml rootTag) Invokes after any of thetoHtmlString
ortoOutputStream
methods invoked.protected void
Invokes just beforerender()
method.protected void
beforeToHtml
(AbstractHtml rootTag) Invokes before any of thetoHtmlString
ortoOutputStream
methods invoked.final boolean
contains
(AbstractHtml tag) To check if the given tag exists in the UI.protected final Executor
gets the executor set bysetExecutor(java.util.concurrent.Executor)
.final String
final PayloadProcessor
Deprecated.this method call may make deadlock somewhere in the application while using multiple threads.final int
Gets the size of internal push queue.final TagRepository
Gets the TagRepository to do different tag operations.static final int
static final int
final int
final int
final String
Generates and gets the SHA hash of internal wff script as base64 encoded string.final String
Generates and gets the SHA hash of internal wff script as base64 encoded string.final String
Generates and gets the SHA hash of internal wff script as base64 encoded string.final WebSocketPushListener
final void
holdPush()
holds push if not already on hold until unholdPush is called Usage :-protected final boolean
By default it is true.protected final boolean
by default it's true.final boolean
final boolean
By default, it is set as true.final boolean
final PayloadProcessor
Creates and returns new instance ofPayloadProcessor
for this browser page.protected void
onInitialClientPing
(AbstractHtml rootTag) It invokes on the first websocket ping, it invokes only once in the whole lifetime of thisBrowserPage
object.final void
performBrowserPageAction
(ByteBuffer actionByteBuffer) performs action provided byBrowserPageAction
.protected void
Invokes when this browser page instance is removed from browser page context.final void
removeFromContext
(boolean enable, BrowserPage.On... ons) By default On.TAB_CLOSE and On.INIT_REMOVE_PREVIOUS are enabled.final void
Deprecated.this method call may make deadlock.final void
removeServerMethod
(String methodName) removes the method fromfinal void
removeWebSocketPushListener
(String sessionId) removes the WebSocket listener added for this WebSocket sessionabstract AbstractHtml
render()
Override and use this method to render html content to the client browser page.protected final void
setAutoremoveWffScript
(boolean autoremoveWffScript) Automatically removes the wff script tag after loading it from the ui.protected final void
setEnableDeferOnWffScript
(boolean enable) It must be called from render method to take effect.protected final void
setExecutor
(Executor executor) Sets the executor to runServerAsyncMethod.asyncMethod(com.webfirmframework.wffweb.wffbm.data.WffBMObject, com.webfirmframework.wffweb.tag.html.attribute.event.ServerAsyncMethod.Event)
,
NB: You may need only one copy of executor object for all browserPage instances in the project.protected final void
setNonceForWffScript
(String value) Sets nonce attribute value for wff script.final void
setPushQueueEnabled
(boolean enabledPushQueue) If the server could not push any server updates it will be put in the queue and when it tries to push in the next time it will first push updates from this queue.final void
setPushQueueOnNewWebSocketListener
(boolean pushQueueOnNewWebSocketListener) By default it's set as true.static final void
setWebSocketDefultHeartbeatInterval
(int milliseconds) Sets the default heartbeat ping interval of webSocket client in milliseconds.static final void
setWebSocketDefultReconnectInterval
(int milliseconds) Sets the default reconnect interval of webSocket client in milliseconds.protected final void
setWebSocketHeartbeatInterval
(int milliseconds) Sets the heartbeat ping interval of webSocket client in milliseconds.final void
setWebSocketPushListener
(WebSocketPushListener wsListener) protected final void
setWebSocketReconnectInterval
(int milliseconds) Sets the reconnect interval of webSocket client in milliseconds.Use this method to produce HTML from very heavy and complicated tag hierarchy.toBigHtmlString
(boolean rebuild) Use this method to produce HTML from very heavy and complicated tag hierarchy.int
toBigOutputStream
(OutputStream os, boolean rebuild, Charset charset) Use this method to produce HTML from very heavy and complicated tag hierarchy.int
toBigOutputStream
(OutputStream os, boolean rebuild, Charset charset, boolean flushOnWrite) Use this method to produce HTML from very heavy and complicated tag hierarchy.int
toBigOutputStream
(OutputStream os, Charset charset) Use this method to produce HTML from very heavy and complicated tag hierarchy.int
toBigOutputStream
(OutputStream os, Charset charset, boolean flushOnWrite) Use this method to produce HTML from very heavy and complicated tag hierarchy.toHtmlString
(boolean rebuild) toHtmlString
(boolean rebuild, String charset) Deprecated.since 3.0.19 as it is unused in the internal implementationtoHtmlString
(String charset) Deprecated.since 3.0.19 as it is unused in the internal implementationint
int
toOutputStream
(OutputStream os, boolean rebuild) int
toOutputStream
(OutputStream os, boolean rebuild, boolean flushOnWrite) int
toOutputStream
(OutputStream os, boolean rebuild, String charset) int
toOutputStream
(OutputStream os, boolean rebuild, Charset charset, boolean flushOnWrite) int
toOutputStream
(OutputStream os, String charset) int
toOutputStream
(OutputStream os, Charset charset, boolean flushOnWrite) final void
unholds push if not already unheld.protected String
Override and use this method to set path to write temporary files to save heap space.final void
websocketMessaged
(byte[] message) Deprecated.alternative method webSocketMessaged is available for the same job.final void
webSocketMessaged
(byte[] message) abstract String
-
Field Details
-
WFF_INSTANCE_ID
- See Also:
-
-
Constructor Details
-
BrowserPage
public BrowserPage()
-
-
Method Details
-
webSocketUrl
-
useExternalDrivePath
Override and use this method to set path to write temporary files to save heap space.- Returns:
- the path to store temporary files to save heap space.
- Since:
- 3.0.18
-
setWebSocketPushListener
- Parameters:
wsListener
-- Since:
- 2.0.0
-
addWebSocketPushListener
adds the WebSocket listener for the given WebSocket session- Parameters:
sessionId
- the unique id of WebSocket sessionwsListener
-- Since:
- 2.1.0
-
removeWebSocketPushListener
removes the WebSocket listener added for this WebSocket session- Parameters:
sessionId
- the unique id of WebSocket session- Since:
- 2.1.0
-
getWsListener
-
websocketMessaged
Deprecated.alternative method webSocketMessaged is available for the same job.This method will be remove later. UsewebSocketMessaged
.- Parameters:
message
- the bytes the received in onmessage- Since:
- 2.0.0
-
onInitialClientPing
It invokes on the first websocket ping, it invokes only once in the whole lifetime of thisBrowserPage
object. All other client events will be received only after invoking this method. It doesn't have any relation to the websocket heartbeat interval or reconnect interval time so changing such configurations will not have any effect on it. Note: It will not invoke whenever the websocket client reconnects to the server but only once in the whole lifetime.
Override this method to build the UI instead ofBrowserPage#afterRender(AbstractHtml)
if you want to build the UI only if the client is able to communication to the server. TheBrowserPage#afterRender(AbstractHtml)
is invoked before this method (and just after theBrowserPage#render()
method) regardless of the client is able to communicate to the server or not.- Parameters:
rootTag
- the root of theBrowserPage
- Since:
- 3.0.18
-
webSocketMessaged
public final void webSocketMessaged(byte[] message) - Parameters:
message
- the bytes the received in onmessage- Since:
- 2.1.0
-
beforeRender
protected void beforeRender()Invokes just beforerender()
method. This is an empty method in BrowserPage. Override and use. This method invokes only once per object in all of its life time.- Since:
- 3.0.1
-
render
Override and use this method to render html content to the client browser page. This method invokes only once per object in all of its life time.- Returns:
- the object of
Html
class which needs to be displayed in the client browser page.
-
afterRender
Invokes afterrender()
method. This is an empty method in BrowserPage. Override and use. This method invokes only once per object in all of its life time.- Parameters:
rootTag
- the rootTag returned byrender()
method.- Since:
- 3.0.1
-
beforeToHtml
Invokes before any of thetoHtmlString
ortoOutputStream
methods invoked. This is an empty method in BrowserPage. Override and use it. This method will invoke every time before any of the following methods is called,toHtmlString
,toOutputStream
etc..- Parameters:
rootTag
- the rootTag returned byrender()
method.- Since:
- 3.0.1
-
afterToHtml
Invokes after any of thetoHtmlString
ortoOutputStream
methods invoked. This is an empty method in BrowserPage. Override and use it. This method will invoke every time after any of the following methods is called,toHtmlString
,toOutputStream
etc..- Parameters:
rootTag
- the rootTag returned byrender()
method.- Since:
- 3.0.1
-
toHtmlString
NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Returns:
String
equalent to the html string of the tag including the child tags.
-
toHtmlString
NB: this method should not be called underrender()
method because this method internally callsrender()
method. rebuilds the html string of the tag including the child tags/values if parameter is true, otherwise returns the html string prebuilt and kept in the cache.- Parameters:
rebuild
- true to rebuild & false to return previously built string.- Returns:
String
equalent to the html string of the tag including the child tags.- Since:
- 2.1.4
-
toHtmlString
Deprecated.since 3.0.19 as it is unused in the internal implementationNB: this method should not be called underrender()
method because this method internally callsrender()
method.- Parameters:
charset
- the charset- Returns:
String
equalent to the html string of the tag including the child tags.
-
toHtmlString
Deprecated.since 3.0.19 as it is unused in the internal implementationNB: this method should not be called underrender()
method because this method internally callsrender()
method. rebuilds the html string of the tag including the child tags/values if parameter is true, otherwise returns the html string prebuilt and kept in the cache.- Parameters:
rebuild
- true to rebuild & false to return previously built string.charset
- the charset to set for the returning value, eg:StandardCharsets.UTF_8.name()
- Returns:
String
equalent to the html string of the tag including the child tags.- Since:
- 2.1.4
-
toOutputStream
NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Parameters:
os
- the object ofOutputStream
to write to.- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 2.1.4 void toOutputStream, 2.1.8 int toOutputStream
-
toOutputStream
NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Parameters:
os
- the object ofOutputStream
to write to.rebuild
- true to rebuild & false to write previously built bytes.- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 2.1.4 void toOutputStream, 2.1.8 int toOutputStream
-
toOutputStream
public int toOutputStream(OutputStream os, boolean rebuild, boolean flushOnWrite) throws IOException NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Parameters:
os
- the object ofOutputStream
to write to.rebuild
- true to rebuild & false to write previously built bytes.flushOnWrite
- true to flush on each write to OutputStream- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 3.0.2
-
toOutputStream
NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Parameters:
os
- the object ofOutputStream
to write to.charset
- the charset- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 2.1.4 void toOutputStream, 2.1.8 int toOutputStream
-
toOutputStream
public int toOutputStream(OutputStream os, Charset charset, boolean flushOnWrite) throws IOException NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Parameters:
os
- the object ofOutputStream
to write to.charset
- the charsetflushOnWrite
- true to flush on each write to OutputStream- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 3.0.2
-
toOutputStream
NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Parameters:
os
- the object ofOutputStream
to write to.rebuild
- true to rebuild & false to write previously built bytes.charset
- the charset- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 2.1.4 void toOutputStream, 2.1.8 int toOutputStream
-
toOutputStream
public int toOutputStream(OutputStream os, boolean rebuild, Charset charset, boolean flushOnWrite) throws IOException NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Parameters:
os
- the object ofOutputStream
to write to.rebuild
- true to rebuild & false to write previously built bytes.charset
- the charsetflushOnWrite
- true to flush on each write to OutputStream- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 3.0.2
-
toBigHtmlString
Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy usetoHtmlString
method which is faster than this method. The advantage oftoBigHtmlString
overtoHtmlString
is it will never throwStackOverflowError
.
NB:- this method has not been undergone all testing process.- Parameters:
rebuild
- true to rebuild the tag hierarchy or false to return from cache if available.- Returns:
- the HTML string similar to toHtmlString method.
- Since:
- 3.0.15
-
toBigHtmlString
Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy usetoHtmlString
method which is faster than this method. The advantage oftoBigHtmlString
overtoHtmlString
is it will never throwStackOverflowError
.
NB:- this method has not been undergone all testing process.- Returns:
- the HTML string similar to toHtmlString method.
- Since:
- 3.0.15
-
toBigOutputStream
public int toBigOutputStream(OutputStream os, boolean rebuild, Charset charset, boolean flushOnWrite) throws IOException Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy usetoOutputStream
method which is faster than this method. The advantage oftoBigOutputStream
overtoOutputStream
is it will never throwStackOverflowError
and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
NB:- this method has not been undergone all testing process.- Parameters:
os
- the object ofOutputStream
to write to.rebuild
- true to rebuild & false to write previously built bytes.charset
- the charsetflushOnWrite
- true to flush on each write to OutputStream- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 3.0.15
-
toBigOutputStream
Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy usetoOutputStream
method which is faster than this method. The advantage oftoBigOutputStream
overtoOutputStream
is it will never throwStackOverflowError
and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
NB:- this method has not been undergone all testing process.- Parameters:
os
- the object ofOutputStream
to write to.rebuild
- true to rebuild & false to write previously built bytes.charset
- the charset- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 3.0.15
-
toBigOutputStream
Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy usetoOutputStream
method which is faster than this method. The advantage oftoBigOutputStream
overtoOutputStream
is it will never throwStackOverflowError
and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
NB:- this method has not been undergone all testing process.- Parameters:
os
- the object ofOutputStream
to write to.charset
- the charset- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 3.0.15
-
toBigOutputStream
public int toBigOutputStream(OutputStream os, Charset charset, boolean flushOnWrite) throws IOException Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy usetoOutputStream
method which is faster than this method. The advantage oftoBigOutputStream
overtoOutputStream
is it will never throwStackOverflowError
and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
NB:- this method has not been undergone all testing process.- Parameters:
os
- the object ofOutputStream
to write to.charset
- the charsetflushOnWrite
- true to flush on each write to OutputStream- Returns:
- the total number of bytes written
- Throws:
IOException
- Since:
- 3.0.15
-
getInstanceId
- Returns:
- a unique id for this instance
- Since:
- 2.0.0
-
isPushQueueEnabled
public final boolean isPushQueueEnabled()By default, it is set as true.- Returns:
- the pushQueueEnabled
- Since:
- 2.0.2
-
setPushQueueEnabled
public final void setPushQueueEnabled(boolean enabledPushQueue) If the server could not push any server updates it will be put in the queue and when it tries to push in the next time it will first push updates from this queue. By default, it is set as true.- Parameters:
enabledPushQueue
- the enabledPushQueue to set- Since:
- 2.0.2
-
addServerMethod
- Parameters:
methodName
-serverAsyncMethod
-- Since:
- 2.1.0
-
addServerMethod
public final void addServerMethod(String methodName, ServerAsyncMethod serverAsyncMethod, Object serverSideData) - Parameters:
methodName
-serverAsyncMethod
-serverSideData
- this object will be available in the event of serverAsyncMethod.asyncMethod- Since:
- 3.0.2
-
removeServerMethod
removes the method from- Parameters:
methodName
-- Since:
- 2.1.0
-
performBrowserPageAction
performs action provided byBrowserPageAction
.- Parameters:
actionByteBuffer
- The ByteBuffer object taken fromBrowserPageAction
.Eg:-BrowserPageAction.RELOAD.getActionByteBuffer();
- Since:
- 2.1.0
-
isPushQueueOnNewWebSocketListener
public final boolean isPushQueueOnNewWebSocketListener()- Returns:
- the pushQueueOnNewWebSocketListener true if it's enabled otherwise false. By default it's set as true.
- Since:
- 2.1.1
-
setPushQueueOnNewWebSocketListener
public final void setPushQueueOnNewWebSocketListener(boolean pushQueueOnNewWebSocketListener) By default it's set as true. If it's enabled then the wffbmBytesQueue will be pushed when new webSocket listener is added/set.- Parameters:
pushQueueOnNewWebSocketListener
- the pushQueueOnNewWebSocketListener to set. Pass true to enable this option and false to disable this option.- Since:
- 2.1.1
-
isHoldPush
public final boolean isHoldPush()- Returns:
- the holdPush true if the push is on hold
- Since:
- 2.1.3
-
holdPush
public final void holdPush()holds push if not already on hold until unholdPush is called Usage :-try { browserPage.holdPush(); for (AbstractHtml tag : tags) { tag.removeAttributes("style"); } // other tag manipulations } finally { browserPage.unholdPush(); }
- Since:
- 2.1.3
-
unholdPush
public final void unholdPush()unholds push if not already unheld. Usage :-try { browserPage.holdPush(); for (AbstractHtml tag : tags) { tag.removeAttributes("style"); } // other tag manipulations } finally { browserPage.unholdPush(); }
- Since:
- 2.1.3
-
getPushQueueSize
public final int getPushQueueSize()Gets the size of internal push queue. This size might not be accurate in multi-threading environment.Use case :- Suppose there is a thread in the server which makes real time ui changes. But if the end user lost connection and the webSocket is not closed connection, in such case the developer can decide whether to make any more ui updates from server when the pushQueueSize exceeds a particular limit.
- Returns:
- the size of internal push queue.
- Since:
- 2.1.4
-
removeFromContext
By default On.TAB_CLOSE and On.INIT_REMOVE_PREVIOUS are enabled.- Parameters:
enable
-ons
- the instance of On to represent on which browser event the browser page needs to be removed.- Since:
- 2.1.4
-
removedFromContext
protected void removedFromContext()Invokes when this browser page instance is removed from browser page context. Override and use this method to stop long running tasks / threads.- Since:
- 2.1.4
-
contains
To check if the given tag exists in the UI.
NB:- This method is valid only ifbrowserPage#toHtmlString
orbrowserPage#toOutputStream
is called at least once in the life time.- Parameters:
tag
- the tag object to be checked.- Returns:
- true if the given tag contains in the BrowserPage i.e. UI. false if the given tag was removed or was not already added in the UI.
- Throws:
NullValueException
- throws this exception if the given tag is null.NotRenderedException
- if theBrowserPage
object is not rendered. i.e. ifbrowserPage#toHtmlString
orbrowserPage#toOutputStream
was NOT called at least once in the life time.- Since:
- 2.1.7
-
setWebSocketHeartbeatInterval
protected final void setWebSocketHeartbeatInterval(int milliseconds) Sets the heartbeat ping interval of webSocket client in milliseconds. Give -1 to disable it. By default it's set with -1. It affects only for the correspondingBrowserPage
instance from which it is called.
NB:- This method has effect only if it is called beforeBrowserPage#render()
method return. This method can be called insideBrowserPage#render()
method to override the default global heartbeat interval set byBrowserPage#setWebSocketDefultHeartbeatInterval(int)
method.- Parameters:
milliseconds
- the heartbeat ping interval of webSocket client in milliseconds. Give -1 to disable it.- Since:
- 2.1.8
-
getWebSocketHeartbeatInterval
public final int getWebSocketHeartbeatInterval()- Returns:
- the interval value set by
BrowserPage#setWebSocketHeartbeatInterval(int)
method. - Since:
- 2.1.8
-
setWebSocketDefultHeartbeatInterval
public static final void setWebSocketDefultHeartbeatInterval(int milliseconds) Sets the default heartbeat ping interval of webSocket client in milliseconds. Give -1 to disable it. It affects globally. By default it's set with -1 till wffweb-2.1.8 and Since wffweb-2.1.9 it's 25000ms i.e. 25 seconds.
NB:- This method has effect only if it is called beforeBrowserPage#render()
invocation.- Parameters:
milliseconds
- the heartbeat ping interval of webSocket client in milliseconds. Give -1 to disable it- Since:
- 2.1.8, 2.1.9 the default value is 25000ms i.e. 25 seconds.
-
getWebSocketDefultHeartbeatInterval
public static final int getWebSocketDefultHeartbeatInterval()- Returns:
- the interval value set by
setWebSocketDefultHeartbeatInterval
method. - Since:
- 2.1.8
-
setWebSocketDefultReconnectInterval
public static final void setWebSocketDefultReconnectInterval(int milliseconds) Sets the default reconnect interval of webSocket client in milliseconds. It affects globally. By default it's set with 2000 ms.
NB:- This method has effect only if it is called beforeBrowserPage#render()
invocation.- Parameters:
milliseconds
- the reconnect interval of webSocket client in milliseconds. It must be greater than 0.- Since:
- 2.1.8
-
getWebSocketDefultReconnectInterval
public static final int getWebSocketDefultReconnectInterval()- Returns:
- the interval value set by
setWebSocketDefultReconnectInterval
method. - Since:
- 2.1.8
-
setWebSocketReconnectInterval
protected final void setWebSocketReconnectInterval(int milliseconds) Sets the reconnect interval of webSocket client in milliseconds. Give -1 to disable it. By default it's set with -1. It affects only for the correspondingBrowserPage
instance from which it is called.
NB:- This method has effect only if it is called beforeBrowserPage#render()
method return. This method can be called insideBrowserPage#render()
method to override the default global WebSocket reconnect interval set byBrowserPage#setWebSocketDefultReconnectInterval(int)
method.- Parameters:
milliseconds
- the reconnect interval of webSocket client in milliseconds. Give -1 to disable it.- Since:
- 2.1.8
-
getWebSocketReconnectInterval
public final int getWebSocketReconnectInterval()- Returns:
- the interval value set by
BrowserPage#setWebSocketReconnectInterval(int)
method. - Since:
- 2.1.8
-
getTagRepository
Gets the TagRepository to do different tag operations. This tag repository is specific to this BrowserPage instance.- Returns:
- the TagRepository object to do different tag operations. Or null if any one of the BrowserPage#toString or BrowserPage#toOutputStream methods is not called.
- Since:
- 2.1.8
-
setNonceForWffScript
Sets nonce attribute value for wff script.- Parameters:
value
- pass value to set nonce value or pass null to remove nonce attribute- Since:
- 3.0.1
-
getWffScriptSHA256InBase64
Generates and gets the SHA hash of internal wff script as base64 encoded string. NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Returns:
- the wff script (text/javascript) content converted to SHA-256 hash encoded in base64 string.
- Since:
- 3.0.1
-
getWffScriptSHA384InBase64
Generates and gets the SHA hash of internal wff script as base64 encoded string. NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Returns:
- the wff script (text/javascript) content converted to SHA-384 hash encoded in base64 string.
- Since:
- 3.0.1
-
getWffScriptSHA512InBase64
Generates and gets the SHA hash of internal wff script as base64 encoded string. NB: this method should not be called underrender()
method because this method internally callsrender()
method.- Returns:
- the wff script (text/javascript) content converted to SHA-512 hash encoded in base64 string.
- Since:
- 3.0.1
-
setEnableDeferOnWffScript
protected final void setEnableDeferOnWffScript(boolean enable) It must be called from render method to take effect. By default it's set as true. So if Content-Security-Policy is implemented then script-src must allow data:.- Parameters:
enable
-- Since:
- 3.0.1
-
isEnableDeferOnWffScript
protected final boolean isEnableDeferOnWffScript()by default it's true.- Returns:
- true if enabled otherwise false
- Since:
- 3.0.1
-
isAutoremoveWffScript
protected final boolean isAutoremoveWffScript()By default it is true.- Returns:
- the current state
- Since:
- 3.0.1
-
setAutoremoveWffScript
protected final void setAutoremoveWffScript(boolean autoremoveWffScript) Automatically removes the wff script tag after loading it from the ui. By default it is true.- Parameters:
autoremoveWffScript
-- Since:
- 3.0.1
-
getPayloadProcessor
Deprecated.this method call may make deadlock somewhere in the application while using multiple threads. UseBrowserPage#newPayloadProcessor()
.Gets the same instance ofPayloadProcessor
per caller thread for this browser page. This PayloadProcessor can process incoming partial bytes from WebSocket. To manually create new PayloadProcessor use new PayloadProcessor(browserPage).- Returns:
- new instance of PayloadProcessor/thread
- Since:
- 3.0.2
-
removePayloadProcessor
Deprecated.this method call may make deadlock.Removes the current instance ofPayloadProcessor
of this caller thread for this browser page and new instance will be reinitialized when callinggetPayloadProcessor()
by the same thread.- Since:
- 3.0.2
-
newPayloadProcessor
Creates and returns new instance ofPayloadProcessor
for this browser page. This PayloadProcessor can process incoming partial bytes from WebSocket. To manually create new PayloadProcessor use new PayloadProcessor(browserPage). Use this PayloadProcessor instance only under one thread at a time for its complete payload parts.- Returns:
- new instance of PayloadProcessor each method call.
- Since:
- 3.0.11
-
getExecutor
gets the executor set bysetExecutor(java.util.concurrent.Executor)
.- Returns:
- return the executor object
- Since:
- 3.0.15
-
setExecutor
Sets the executor to runServerAsyncMethod.asyncMethod(com.webfirmframework.wffweb.wffbm.data.WffBMObject, com.webfirmframework.wffweb.tag.html.attribute.event.ServerAsyncMethod.Event)
,
NB: You may need only one copy of executor object for all browserPage instances in the project. Eg:
public static final Executor EXECUTOR = Executors.newCachedThreadPool(); browserPage.setExecutor(EXECUTOR);
When Java releases Virtual Thread we may be able to use as follows
public static final Executor EXECUTOR = Executors.newVirtualThreadExecutor(); browserPage.setExecutor(EXECUTOR);
- Parameters:
executor
-- Since:
- 3.0.15
-