org.itsnat.core
Interface ItsNatServletConfig

All Superinterfaces:
ItsNatUserData

public interface ItsNatServletConfig
extends ItsNatUserData

Is the wrapper object defined by ItsNat to wrap the javax.servlet.ServletConfig object.

The main use is to setup the default behavior of the servlet.

Author:
Jose Maria Arranz Santamaria

Method Summary
 java.lang.Object getArtifact(java.lang.String name)
          Returns the artifact with the specified name.
 int getClientErrorMode()
          Returns the default client error mode.
 int getCommMode()
          Returns the default communication mode, AJAX or SCRIPT, for events.
 java.text.DateFormat getDefaultDateFormat()
          Returns the default date format used by components such as ItsNatHTMLInputTextFormatted.
 java.lang.String getDefaultEncoding()
          Returns the encoding used.
 java.text.NumberFormat getDefaultNumberFormat()
          Returns the default number format used by components such as ItsNatHTMLInputTextFormatted.
 long getEventDispatcherMaxWait()
          Returns the default max wait until a server fired event with ItsNatDocument.dispatchEvent(org.w3c.dom.events.EventTarget,org.w3c.dom.events.Event) is processed by the client and returns.
 long getEventTimeout()
          Returns the default timeout in client of asynchronous AJAX/SCRIPT events.
 ItsNatServletContext getItsNatServletContext()
          Returns the application context.
 int getMaxOpenClientsByDocument()
          Returns the max number of open clients (owner and attached) associated to a document in server.
 javax.servlet.ServletConfig getServletConfig()
          Returns the servlet configuration object wrapped.
 int getUseGZip()
          Returns whether JavaScript code and/or markup sent to the client is automatically compressed if the browser accepts this encoding.
 boolean isAutoBuildComponents()
          Informs whether components are built automatically using the necessary markup declarations.
 boolean isAutoCleanEventListeners()
          Informs whether the auto clean event listeners mode is enabled.
 boolean isDebugMode()
          Informs whether the debug mode is enabled.
 boolean isEventsEnabled()
          Informs whether events (AJAX or SCRIPT based) are enabled.
 boolean isFastLoadMode()
          Informs whether the fast load mode is enabled.
 boolean isJoystickMode()
          Informs whether a joystick is enough to control, for instance, components (some kind of mouse, pointer or stylus not present or not necessary).
 boolean isLoadScriptInline()
          Informs whether the initial JavaScript code is sent inline into the loaded page or is loaded externally.
 boolean isMarkupDrivenComponents()
          Informs whether markup driven mode is used in components.
 boolean isNodeCacheEnabled()
          Informs whether the speed oriented node cache is enabled.
 boolean isOnLoadCacheStaticNodes(java.lang.String mime)
          Informs whether static nodes are serialized as text and globally cached when the template is loaded to save memory (it improves the performance too).
 boolean isReferrerEnabled()
          Informs whether referrer feature is enabled by default.
 boolean isReferrerPushEnabled()
          Informs whether referrer "push" feature is enabled by default.
 boolean isScriptingEnabled()
          Informs whether JavaScript is enabled.
 boolean isSelectionOnComponentsUsesKeyboard()
          Informs whether the keyboard is necessary for selection on components.
 boolean isUsePatternMarkupToRender()
          Informs whether dom utils and components use by default the original (saved as pattern) markup to render.
 boolean isUseXHRSyncOnUnloadEvent()
          Informs whether the internal unload event sent by ItsNat when end user leaves the page, is synchronously sent when the transport is AJAX (XMLHttpRequest) mode by default.
 void registerArtifact(java.lang.String name, java.lang.Object value)
          Registers an artifact with the specified name.
 java.lang.Object removeArtifact(java.lang.String name)
          Removes the artifact with the specified name.
 void setAutoBuildComponents(boolean value)
          Sets whether components are built automatically using the necessary markup declarations.
 void setAutoCleanEventListeners(boolean enabled)
          Sets whether the auto clean event listeners mode is enabled.
 void setClientErrorMode(int mode)
          Sets the default client error mode.
 void setCommMode(int commMode)
          Sets the default communication mode, AJAX or SCRIPT, for events.
 void setDebugMode(boolean debugMode)
          Sets the debug mode.
 void setDefaultDateFormat(java.text.DateFormat format)
          Sets the default date format used by components such as ItsNatHTMLInputTextFormatted.
 void setDefaultEncoding(java.lang.String encoding)
          Sets the encoding used.
 void setDefaultNumberFormat(java.text.NumberFormat format)
          Sets the default data format used by components such as ItsNatHTMLInputTextFormatted.
 void setEventDispatcherMaxWait(long wait)
          Sets the default max wait until a server fired event with ItsNatDocument.dispatchEvent(org.w3c.dom.events.EventTarget,org.w3c.dom.events.Event) is processed by the client and returns.
 void setEventsEnabled(boolean enabled)
          Sets whether events (AJAX or SCRIPT based) are enabled.
 void setEventTimeout(long timeout)
          Sets the default timeout of asynchronous AJAX/SCRIPT events.
 void setFastLoadMode(boolean fastLoadMode)
          Sets whether fast load mode is used.
 void setJoystickMode(boolean value)
          Informs whether a joystick is enough to control, for instance, components (mouse, pointer or stylus not present or not necessary).
 void setLoadScriptInline(boolean value)
          Sets the initial JavaScript code is sent inline into the loaded page or is loaded externally.
 void setMarkupDrivenComponents(boolean value)
          Sets whether markup driven mode is used in components.
 void setMaxOpenClientsByDocument(int value)
          Sets the max number of open clients (owner and attached) associated to a document in server.
 void setNodeCacheEnabled(boolean enable)
          Sets whether the speed oriented node cache is enabled.
 void setOnLoadCacheStaticNodes(java.lang.String mime, boolean cache)
          Sets whether static nodes are serialized as text and globally cached when the template is loaded to save memory (it improves the performance too).
 void setReferrerEnabled(boolean enabled)
          Sets whether referrer feature is enabled by default.
 void setReferrerPushEnabled(boolean enabled)
          Sets whether referrer "push" feature is enabled by default.
 void setScriptingEnabled(boolean enabled)
          Sets whether JavaScript is enabled.
 void setSelectionOnComponentsUsesKeyboard(boolean value)
          Informs whether the keyboard is necessary for selection on components
 void setUseGZip(int value)
          Sets whether JavaScript code and/or markup sent to the client is automatically compressed if the browser accepts this encoding.
 void setUsePatternMarkupToRender(boolean value)
          Sets whether dom utils and components use by default the original (saved as pattern) markup to render.
 void setUseXHRSyncOnUnloadEvent(boolean enabled)
          Sets whether the internal unload event sent by ItsNat when end user leaves the page, is synchronously sent when the transport is AJAX (XMLHttpRequest) mode by default.
 
Methods inherited from interface org.itsnat.core.ItsNatUserData
containsUserValueName, getUserValue, getUserValueNames, removeUserValue, setUserValue
 

Method Detail

getServletConfig

javax.servlet.ServletConfig getServletConfig()
Returns the servlet configuration object wrapped.

Returns:
the internal servlet configuration object.

getItsNatServletContext

ItsNatServletContext getItsNatServletContext()
Returns the application context.

This object instance is shared by all ItsNatServlets defined by the application.

Returns:
the application context.

registerArtifact

void registerArtifact(java.lang.String name,
                      java.lang.Object value)
Registers an artifact with the specified name.

Parameters:
name - the artifact name
value - the artifact.
See Also:
getArtifact(String), removeArtifact(String), NameValue

getArtifact

java.lang.Object getArtifact(java.lang.String name)
Returns the artifact with the specified name.

Parameters:
name - the artifact name to look for.
Returns:
the artifact or null if not found.
See Also:
registerArtifact(String,Object)

removeArtifact

java.lang.Object removeArtifact(java.lang.String name)
Removes the artifact with the specified name.

Parameters:
name - the artifact name to look for.
Returns:
the removed artifact.
See Also:
registerArtifact(String,Object)

getDefaultEncoding

java.lang.String getDefaultEncoding()
Returns the encoding used. This encoding is used to render to text and in the header sent to clients.

Returns:
the encoding, UTF-8 by default.
See Also:
setDefaultEncoding(String)

setDefaultEncoding

void setDefaultEncoding(java.lang.String encoding)
Sets the encoding used.

Parameters:
encoding - the new encoding.
See Also:
getDefaultEncoding()

isOnLoadCacheStaticNodes

boolean isOnLoadCacheStaticNodes(java.lang.String mime)
Informs whether static nodes are serialized as text and globally cached when the template is loaded to save memory (it improves the performance too).

This cache flag is configured by MIME type.

Parameters:
mime - the MIME type.
Returns:
true if caching is enabled. By default is true if mime is "text/html", "application/xhtml+xml" or "image/svg+xml" else is false.
See Also:
setOnLoadCacheStaticNodes(String,boolean)

setOnLoadCacheStaticNodes

void setOnLoadCacheStaticNodes(java.lang.String mime,
                               boolean cache)
Sets whether static nodes are serialized as text and globally cached when the template is loaded to save memory (it improves the performance too).

Parameters:
mime - the MIME type.
cache - true to enable the static node cache to the specified MIME.
See Also:
isOnLoadCacheStaticNodes(String)

isDebugMode

boolean isDebugMode()
Informs whether the debug mode is enabled.

In debug mode the framework makes more checks to ensure is correctly used.

Returns:
true if debug is enabled. True by default.
See Also:
setDebugMode(boolean)

setDebugMode

void setDebugMode(boolean debugMode)
Sets the debug mode.

Parameters:
debugMode - true to set debug mode.
See Also:
isDebugMode()

getClientErrorMode

int getClientErrorMode()
Returns the default client error mode.

This value specifies whether the browser catches JavaScript errors and if they are shown to the user using a JavaScript alert call.

This feature only affects to non-XML documents with scripting enabled not to fragments

Returns:
the default client error mode. By default ClientErrorMode.SHOW_SERVER_AND_CLIENT_ERRORS
See Also:
setClientErrorMode(int), ClientErrorMode

setClientErrorMode

void setClientErrorMode(int mode)
Sets the default client error mode.

Parameters:
mode - the default client error mode.
See Also:
getClientErrorMode()

getCommMode

int getCommMode()
Returns the default communication mode, AJAX or SCRIPT, for events.

This feature only affects to non-XML documents with events enabled not to fragments

Returns:
the communication mode. CommMode.XHR_ASYNC_HOLD by default.
See Also:
setCommMode(int)

setCommMode

void setCommMode(int commMode)
Sets the default communication mode, AJAX or SCRIPT, for events.

Parameters:
commMode - the new communication mode.
See Also:
getCommMode()

getEventTimeout

long getEventTimeout()
Returns the default timeout in client of asynchronous AJAX/SCRIPT events.

This feature only affects to non-XML documents with events enabled (not to fragments) and is ignored in synchronous AJAX events

When an unfinished request takes more time than the specified timeout, the request is aborted.

Returns:
the timeout of asynchronous AJAX/SCRIPT events in milliseconds. -1 by default (no timeout).
See Also:
setEventTimeout(long)

setEventTimeout

void setEventTimeout(long timeout)
Sets the default timeout of asynchronous AJAX/SCRIPT events.

Parameters:
timeout - the new timeout. If negative no timeout is defined.
See Also:
getEventTimeout()

getUseGZip

int getUseGZip()
Returns whether JavaScript code and/or markup sent to the client is automatically compressed if the browser accepts this encoding.

This feature only affects to documents not to fragments

Returns:
the bitwise value containing whether gzip is used to encode JavaScript code and/or markup. By default JavaScript code is compressed.
See Also:
setUseGZip(int)

setUseGZip

void setUseGZip(int value)
Sets whether JavaScript code and/or markup sent to the client is automatically compressed if the browser accepts this encoding.

A bitwise value must be used using UseGZip constants, for instance: setUseGZip(UseGZip.MARKUP | UseGZip.SCRIPT).

Parameters:
value - a bitwise value.
See Also:
getUseGZip(), UseGZip

isLoadScriptInline

boolean isLoadScriptInline()
Informs whether the initial JavaScript code is sent inline into the loaded page or is loaded externally.

This feature only affects to non-XML documents with scripting enabled not to fragments

Returns:
true if script is sent inline. True by default.
See Also:
setLoadScriptInline(boolean)

setLoadScriptInline

void setLoadScriptInline(boolean value)
Sets the initial JavaScript code is sent inline into the loaded page or is loaded externally.

Parameters:
value - true to sent inline.
See Also:
isLoadScriptInline()

isFastLoadMode

boolean isFastLoadMode()
Informs whether the fast load mode is enabled.

This feature only affects to non-XML documents with scripting enabled not to fragments

Returns:
true if fast mode is enabled. True by default.
See Also:
setFastLoadMode(boolean)

setFastLoadMode

void setFastLoadMode(boolean fastLoadMode)
Sets whether fast load mode is used.

Parameters:
fastLoadMode - true to enable fast load.
See Also:
isFastLoadMode()

isNodeCacheEnabled

boolean isNodeCacheEnabled()
Informs whether the speed oriented node cache is enabled.

This feature only affects to non-XML documents with scripting enabled not to fragments

Returns:
true if node cache is enabled. True by default.
See Also:
setNodeCacheEnabled(boolean)

setNodeCacheEnabled

void setNodeCacheEnabled(boolean enable)
Sets whether the speed oriented node cache is enabled.

Parameters:
enable - true to enable node cache.
See Also:
isNodeCacheEnabled()

isAutoBuildComponents

boolean isAutoBuildComponents()
Informs whether components are built automatically using the necessary markup declarations.

If this feature is enabled the initial document tree is automatically traversed, any component declared in markup is automatically built and registered into the component manager associated to a DOM element, including DOM elements added to the tree in any time.

When a node is removed from the tree the associated component if any is removed and disposed automatically.

This feature only affects to documents not to fragments

Returns:
true if automatic component build is enabled. False by default.
See Also:
setAutoBuildComponents(boolean)

setAutoBuildComponents

void setAutoBuildComponents(boolean value)
Sets whether components are built automatically using the necessary markup declarations.

Parameters:
value - true to enable automatic component build.
See Also:
isAutoBuildComponents()

getDefaultDateFormat

java.text.DateFormat getDefaultDateFormat()
Returns the default date format used by components such as ItsNatHTMLInputTextFormatted.

This feature only affects to documents not to fragments

Returns:
the default data format. By default returns DateFormat.getInstance().
See Also:
setDefaultDateFormat(DateFormat)

setDefaultDateFormat

void setDefaultDateFormat(java.text.DateFormat format)
Sets the default date format used by components such as ItsNatHTMLInputTextFormatted.

Parameters:
format - the default data format.
See Also:
getDefaultDateFormat()

getDefaultNumberFormat

java.text.NumberFormat getDefaultNumberFormat()
Returns the default number format used by components such as ItsNatHTMLInputTextFormatted.

This feature only affects to documents not to fragments

Returns:
the default data format. By default returns NumberFormat.getInstance().
See Also:
setDefaultNumberFormat(NumberFormat)

setDefaultNumberFormat

void setDefaultNumberFormat(java.text.NumberFormat format)
Sets the default data format used by components such as ItsNatHTMLInputTextFormatted.

Parameters:
format - the default data format.
See Also:
getDefaultNumberFormat()

getEventDispatcherMaxWait

long getEventDispatcherMaxWait()
Returns the default max wait until a server fired event with ItsNatDocument.dispatchEvent(org.w3c.dom.events.EventTarget,org.w3c.dom.events.Event) is processed by the client and returns.

This feature only affects to non-XML documents with events enabled not to fragments

Returns:
the default max wait in milliseconds. By default is 0 (undefined).
See Also:
setEventDispatcherMaxWait(long)

setEventDispatcherMaxWait

void setEventDispatcherMaxWait(long wait)
Sets the default max wait until a server fired event with ItsNatDocument.dispatchEvent(org.w3c.dom.events.EventTarget,org.w3c.dom.events.Event) is processed by the client and returns.

Parameters:
wait - the default max wait in milliseconds.
See Also:
getEventDispatcherMaxWait()

getMaxOpenClientsByDocument

int getMaxOpenClientsByDocument()
Returns the max number of open clients (owner and attached) associated to a document in server.

When this number is surpassed, older clients (clients not accesed for a long time ago) are invalidated/removed from the server.

A negative number means no limit.

This feature is useful to limit the number of attached clients and to clean orphan attached clients.

This feature only affects to non-XML documents with events enabled not to fragments

Returns:
the max number of open clients. Defaults to 10.
See Also:
setMaxOpenClientsByDocument(int)

setMaxOpenClientsByDocument

void setMaxOpenClientsByDocument(int value)
Sets the max number of open clients (owner and attached) associated to a document in server.

Parameters:
value - the new max number of open clients.
See Also:
getMaxOpenClientsByDocument()

isReferrerEnabled

boolean isReferrerEnabled()
Informs whether referrer feature is enabled by default.

This feature only affects to non-XML documents with events enabled not to fragments.

This feature only works if events are enabled.

Returns:
true if referrer is enabled. By default is false.
See Also:
setReferrerEnabled(boolean), isEventsEnabled(), ItsNatServletRequest.getItsNatDocumentReferrer()

setReferrerEnabled

void setReferrerEnabled(boolean enabled)
Sets whether referrer feature is enabled by default.

Parameters:
enabled - if referrer is enabled.
See Also:
isReferrerEnabled()

isReferrerPushEnabled

boolean isReferrerPushEnabled()
Informs whether referrer "push" feature is enabled by default.

This feature only affects to documents not to fragments

Returns:
true if referrer "push" is enabled, if false no document can be accessed by the referrer.
See Also:
setReferrerPushEnabled(boolean), isReferrerEnabled(), ItsNatDocument.addReferrerItsNatServletRequestListener(ItsNatServletRequestListener)

setReferrerPushEnabled

void setReferrerPushEnabled(boolean enabled)
Sets whether referrer "push" feature is enabled by default.

Parameters:
enabled - if referrer "push" is enabled.
See Also:
isReferrerPushEnabled()

isEventsEnabled

boolean isEventsEnabled()
Informs whether events (AJAX or SCRIPT based) are enabled.

This feature only affects to non-XML documents not to fragments.

Returns:
true if events are enabled. By default is true.
See Also:
setEventsEnabled(boolean)

setEventsEnabled

void setEventsEnabled(boolean enabled)
Sets whether events (AJAX or SCRIPT based) are enabled.

Parameters:
enabled - if events are enabled.
See Also:
isEventsEnabled()

isScriptingEnabled

boolean isScriptingEnabled()
Informs whether JavaScript is enabled.

This feature only affects to non-XML documents not to fragments.

Returns:
true if JavaScript is enabled. By default is true.
See Also:
setScriptingEnabled(boolean)

setScriptingEnabled

void setScriptingEnabled(boolean enabled)
Sets whether JavaScript is enabled.

If JavaScript is disabled then events are disabled too.

Parameters:
enabled - if JavaScript is enabled.
See Also:
isScriptingEnabled(), setEventsEnabled(boolean)

isAutoCleanEventListeners

boolean isAutoCleanEventListeners()
Informs whether the auto clean event listeners mode is enabled.

This feature only affects to non-XML documents not to fragments.

Returns:
true if enabled. By default is true.
See Also:
setAutoCleanEventListeners(boolean)

setAutoCleanEventListeners

void setAutoCleanEventListeners(boolean enabled)
Sets whether the auto clean event listeners mode is enabled.

Parameters:
enabled - if auto clean event listeners is enabled.
See Also:
isAutoCleanEventListeners()

isUseXHRSyncOnUnloadEvent

boolean isUseXHRSyncOnUnloadEvent()
Informs whether the internal unload event sent by ItsNat when end user leaves the page, is synchronously sent when the transport is AJAX (XMLHttpRequest) mode by default.

In some very concrete circumstances and old browsers like MSIE 6-7 synchronously AJAX events can hang the browser. If this method returns false, asynchronous mode is used.

This feature only affects to non-XML documents not to fragments.

Returns:
true if enabled. By default is true.
See Also:
setUseXHRSyncOnUnloadEvent(boolean)

setUseXHRSyncOnUnloadEvent

void setUseXHRSyncOnUnloadEvent(boolean enabled)
Sets whether the internal unload event sent by ItsNat when end user leaves the page, is synchronously sent when the transport is AJAX (XMLHttpRequest) mode by default.

Parameters:
enabled - if unload event is sent synchronously in AJAX mode.
See Also:
isUseXHRSyncOnUnloadEvent()

isUsePatternMarkupToRender

boolean isUsePatternMarkupToRender()
Informs whether dom utils and components use by default the original (saved as pattern) markup to render.

This feature only affects to documents not to fragments.

Returns:
true if the original markup is used. False by default.
See Also:
setUsePatternMarkupToRender(boolean)

setUsePatternMarkupToRender

void setUsePatternMarkupToRender(boolean value)
Sets whether dom utils and components use by default the original (saved as pattern) markup to render.

Parameters:
value - true to enable the use of original markup to render.
See Also:
isUsePatternMarkupToRender()

isSelectionOnComponentsUsesKeyboard

boolean isSelectionOnComponentsUsesKeyboard()
Informs whether the keyboard is necessary for selection on components.

Some components with multiple selection like free lists, tables and trees use the CTRL key for selection like the standard HTML select control uses it.

In mobile devices (without or with a "minimal" keyboard) CTRL key is not needed for selection in HTML select controls, because the CTRL key is "ever" pressed.

This flag can be used to simulate this behavior on the free components using the CTRL key.

This feature only affects to non-XML documents with events enabled not to fragments.

Returns:
true if selection uses keyboard. True by default.
See Also:
setSelectionOnComponentsUsesKeyboard(boolean)

setSelectionOnComponentsUsesKeyboard

void setSelectionOnComponentsUsesKeyboard(boolean value)
Informs whether the keyboard is necessary for selection on components

Parameters:
value - true to specify the keyboard is necessary for selection.
See Also:
isSelectionOnComponentsUsesKeyboard()

isJoystickMode

boolean isJoystickMode()
Informs whether a joystick is enough to control, for instance, components (some kind of mouse, pointer or stylus not present or not necessary).

Some mobile devices do not have stylus and some kind of joystick is the only way to "navigate" through the "live" elements, usually links, form controls and DOM nodes with event listeners associated.

This flag is useful as a hint for "free" components with selectable items. In joystick mode every selectable item have a mouse listener associated, therefore users can navigate to the desired item using the joystick. If not in joystick mode the component usually only need an event listener associated to the parent element of the component (because the mouse, pointer or stylus marks the selected item).

This feature only affects to non-XML documents with events enabled not to fragments.

Returns:
true if joystick mode is on. False by default.
See Also:
setJoystickMode(boolean)

setJoystickMode

void setJoystickMode(boolean value)
Informs whether a joystick is enough to control, for instance, components (mouse, pointer or stylus not present or not necessary).

Parameters:
value - true to enable joystick mode.
See Also:
isJoystickMode()

isMarkupDrivenComponents

boolean isMarkupDrivenComponents()
Informs whether markup driven mode is used in components.

This feature only affects to documents not to fragments and only some HTML form based components are affected.

Returns:
true if components are markup driven. False by default.
See Also:
setMarkupDrivenComponents(boolean)

setMarkupDrivenComponents

void setMarkupDrivenComponents(boolean value)
Sets whether markup driven mode is used in components.

Parameters:
value - true to enable markup driven.
See Also:
isMarkupDrivenComponents()


Copyright © 2007 Innowhere Software Services S.L. All Rights Reserved.