Package org.kohsuke.stapler.bind
Class BoundObjectTable
- java.lang.Object
-
- org.kohsuke.stapler.bind.BoundObjectTable
-
- All Implemented Interfaces:
StaplerFallback
public class BoundObjectTable extends Object implements StaplerFallback
Objects exported and bound by JavaScript proxies. TODO: think about some kind of eviction strategy, beyond the session eviction. Maybe it's not necessary, I don't know.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BoundObjectTable.Table
Per-session table that remembers all the bound instances.
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEBUG_LOGGING
True to activate debug logging of session fragments.static String
PREFIX
-
Constructor Summary
Constructors Constructor Description BoundObjectTable()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Bound
bind(Object o)
Binds an object temporarily and returns its URL.Bound
bindWeak(Object o)
Binds an object temporarily and returns its URL.void
doScript(StaplerRequest req, StaplerResponse rsp, String var, String methods)
This serves the script content for a bound object.BoundObjectTable.Table
getStaplerFallback()
Returns the object that is further searched for processing web requests.BoundObjectTable.Table
getTable()
Explicit call to create the table if one doesn't exist yet.static boolean
isValidJavaIdentifier(String name)
static boolean
isValidJavaScriptIdentifier(String variableName)
void
releaseMe()
Called from within the request handling of a bound object, to release the object explicitly.
-
-
-
Field Detail
-
PREFIX
public static final String PREFIX
- See Also:
- Constant Field Values
-
DEBUG_LOGGING
public static boolean DEBUG_LOGGING
True to activate debug logging of session fragments.
-
-
Method Detail
-
isValidJavaScriptIdentifier
public static boolean isValidJavaScriptIdentifier(String variableName)
-
isValidJavaIdentifier
public static boolean isValidJavaIdentifier(String name)
-
doScript
public void doScript(StaplerRequest req, StaplerResponse rsp, @QueryParameter String var, @QueryParameter String methods) throws IOException
This serves the script content for a bound object. Support CSP-compatible st:bind and similar methods of making objects accessible to JS.- Parameters:
req
-rsp
-var
- the variable name to assign the Stapler proxy tomethods
- the list of methods (needed forWithWellKnownURL
)- Throws:
IOException
-
getStaplerFallback
public BoundObjectTable.Table getStaplerFallback()
Description copied from interface:StaplerFallback
Returns the object that is further searched for processing web requests.- Specified by:
getStaplerFallback
in interfaceStaplerFallback
- Returns:
- If null or
this
is returned, stapler behaves as if the object didn't implement this interface (which means the request processing fails with 404.)
-
releaseMe
public void releaseMe()
Called from within the request handling of a bound object, to release the object explicitly.
-
getTable
public BoundObjectTable.Table getTable()
Explicit call to create the table if one doesn't exist yet.
-
-