public class SpreadsheetWebApp
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SpreadsheetWebApp.Context
The Context class represents the context within which a spreadsheet widget operates.
|
static class |
SpreadsheetWebApp.SecurityContextDispatcher
The class provides a mechanism to execute runnables asynchronously in a separate thread associated
with the related security context.
|
| Modifier and Type | Field and Description |
|---|---|
private java.util.Set<java.lang.Integer> |
activeWidgets
The set of active spreadsheet widget ids
|
private static java.lang.String |
CONTEXT_PATH
The static part of context path
|
private static java.util.Map<java.lang.Integer,SpreadsheetWebApp.Context> |
contexts
A map that stores the Spreadsheet application contexts.
|
private static java.lang.ThreadLocal<java.lang.String> |
currentRequestOrigURI
Thread-local storage for current request
|
private static SpreadsheetWebApp |
instance
Singleton instance of the SpreadsheetWebApp class.
|
private static java.util.concurrent.atomic.AtomicInteger |
lastContextId
Represents an atomic integer that is used to generate a unique context ID.
|
private static CentralLogger |
LOG
Logger
|
private org.eclipse.jetty.webapp.WebAppContext |
webApp
WebAppContext for managing the web application's servlet context.
|
| Constructor and Description |
|---|
SpreadsheetWebApp() |
| Modifier and Type | Method and Description |
|---|---|
static SpreadsheetWebApp.Context |
getContext()
Returns the spreadsheet web app context belonging to the current HTTP request (i.e.
|
static SpreadsheetWebApp.Context |
getContext(int contextId)
Returns the spreadsheet web app context associated with the specified contextId.
|
static int |
getContextId()
Returns the ID if the spreadsheet web app context belonging to the current HTTP request (i.e.
|
static int |
getContextId(java.lang.String path)
Retrieves the ID of the spreadsheet web app context from the supplied path.
|
static java.lang.String |
getCurrentRequestOrigURI()
Returns the current request URI
|
static SheetEventHandler |
getEventHandler()
Returns the SheetEventHandler instance belonging to the current HTTP request (i.e.
|
static SpreadsheetWebApp |
getInstance()
Retrieves the singleton instance of the SpreadsheetWebApp.
|
private static <T> T |
getPrivateFieldValue(java.lang.Class clazz,
java.lang.Object targetObject,
java.lang.String fieldName)
Returns the value of a private field in the given object without throwing checked exceptions.
|
private java.io.File |
getWARPath()
Returns the path of the spreadsheet backed war file.
|
static int |
getWidgetId()
Returns the spreadsheet widget ID belonging to the current HTTP request (i.e.
|
org.eclipse.jetty.server.Handler |
init()
Initializes the web application.
|
boolean |
isStarted(int widgetId)
Checks if the web application is started for a specific widget ID.
|
static int |
onSpreadsheetWidgetCreated(SpreadsheetWidget widget,
SheetEventHandler eventHandler)
This method is called when a SpreadsheetWidget is created.
|
static void |
onSpreadsheetWidgetDeleted(SpreadsheetWidget widget)
Removes the context associated with a deleted SpreadsheetWidget.
|
static void |
postServerEvent(int contextId,
java.lang.Runnable run)
The method invokes
ClientExports.postServerEvent(ServerEvent) asynchronously
in a thread associated with the security context related to the supplied spreadsheet web
app context. |
static void |
postServerEvent(SpreadsheetWebApp.Context context,
java.lang.Runnable run)
The method invokes
ClientExports.postServerEvent(ServerEvent) asynchronously
in a thread associated with the security context related to the supplied spreadsheet web
app context. |
java.lang.String |
start(int widgetId)
Starts the web application for a specific spreadsheet widget identified by its widget ID.
|
void |
stop(int widgetId)
Stops the web application for a specific widget ID.
|
private static final CentralLogger LOG
private static final SpreadsheetWebApp instance
private static final java.lang.String CONTEXT_PATH
private org.eclipse.jetty.webapp.WebAppContext webApp
private java.util.Set<java.lang.Integer> activeWidgets
private static java.lang.ThreadLocal<java.lang.String> currentRequestOrigURI
private static java.util.concurrent.atomic.AtomicInteger lastContextId
private static java.util.Map<java.lang.Integer,SpreadsheetWebApp.Context> contexts
public static SpreadsheetWebApp getInstance()
public static java.lang.String getCurrentRequestOrigURI()
public org.eclipse.jetty.server.Handler init()
public java.lang.String start(int widgetId)
widgetId - The ID of the widget for which the web application is to be started.public boolean isStarted(int widgetId)
widgetId - The ID of the widget to check.public void stop(int widgetId)
widgetId - The ID of the widget for which the web application is to be stopped.public static int onSpreadsheetWidgetCreated(SpreadsheetWidget widget, SheetEventHandler eventHandler)
widget - The SpreadsheetWidget that was created.eventHandler - The SheetEventHandler that will handle events for the SpreadsheetWidget.public static void onSpreadsheetWidgetDeleted(SpreadsheetWidget widget)
widget - The SpreadsheetWidget that was deleted.public static int getWidgetId()
public static SheetEventHandler getEventHandler()
public static SpreadsheetWebApp.Context getContext()
public static int getContextId()
public static SpreadsheetWebApp.Context getContext(int contextId)
contextId - The identifier of the context object to retrieve.public static int getContextId(java.lang.String path)
path - The path of the current HTTP request.public static void postServerEvent(int contextId,
java.lang.Runnable run)
ClientExports.postServerEvent(ServerEvent) asynchronously
in a thread associated with the security context related to the supplied spreadsheet web
app context.contextId - ID representing a valid spreadsheet web app context.run - The code to be executed when the server event is handled on the server.public static void postServerEvent(SpreadsheetWebApp.Context context, java.lang.Runnable run)
ClientExports.postServerEvent(ServerEvent) asynchronously
in a thread associated with the security context related to the supplied spreadsheet web
app context.context - A valid spreadsheet web app context.run - The code to be executed when the server event is handled on the server.private static <T> T getPrivateFieldValue(java.lang.Class clazz,
java.lang.Object targetObject,
java.lang.String fieldName)
clazz - the class whose private field is to be readtargetObject - the object whose private field is to be readfieldName - the name of the private field to be readprivate java.io.File getWARPath()