Package com.glideapi.session
Class PerRequestStrategy
java.lang.Object
com.glideapi.session.PerRequestStrategy
- All Implemented Interfaces:
SessionStrategy
Session strategy that creates a new session for every request.
This provides maximum isolation at the cost of higher overhead.
Each API call gets its own fresh session.
Best for: Short-lived operations, maximum security requirements, or testing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear any cached sessions.Get a valid session, creating a new one if necessary.getSession(String scope) Get a valid session with specific scopes, creating a new one if necessary.Get a valid session asynchronously.
-
Constructor Details
-
PerRequestStrategy
-
-
Method Details
-
getSession
Description copied from interface:SessionStrategyGet a valid session, creating a new one if necessary.- Specified by:
getSessionin interfaceSessionStrategy- Returns:
- A valid session
- Throws:
Exception- if session creation fails
-
getSession
Description copied from interface:SessionStrategyGet a valid session with specific scopes, creating a new one if necessary.- Specified by:
getSessionin interfaceSessionStrategy- Parameters:
scope- Space-separated list of scopes to request- Returns:
- A valid session
- Throws:
Exception- if session creation fails
-
getSessionAsync
Description copied from interface:SessionStrategyGet a valid session asynchronously.- Specified by:
getSessionAsyncin interfaceSessionStrategy- Returns:
- CompletableFuture that will complete with a valid session
-
clearCache
public void clearCache()Description copied from interface:SessionStrategyClear any cached sessions. Useful for forcing a fresh session on the next request.- Specified by:
clearCachein interfaceSessionStrategy
-