Package io.undertow.server.session
Interface SessionConfig
-
- All Known Implementing Classes:
PathParameterSessionConfig
,SessionCookieConfig
,SslSessionConfig
public interface SessionConfig
Interface that abstracts the process of attaching a session to an exchange. This includes both the HTTP side of attachment such as setting a cookie, as well as actually attaching the session to the exchange for use by later handlers.Generally this will just set a cookie.
- Author:
- Stuart Douglas
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SessionConfig.SessionCookieSource
-
Field Summary
Fields Modifier and Type Field Description static AttachmentKey<SessionConfig>
ATTACHMENT_KEY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearSession(HttpServerExchange exchange, java.lang.String sessionId)
Clears this session from the exchange, removing the attachment and making any changes to the response necessary, such as clearing cookies.java.lang.String
findSessionId(HttpServerExchange exchange)
Retrieves a session id of an existing session from an exchange.java.lang.String
rewriteUrl(java.lang.String originalUrl, java.lang.String sessionId)
SessionConfig.SessionCookieSource
sessionCookieSource(HttpServerExchange exchange)
void
setSessionId(HttpServerExchange exchange, java.lang.String sessionId)
Attaches the session to the exchange.
-
-
-
Field Detail
-
ATTACHMENT_KEY
static final AttachmentKey<SessionConfig> ATTACHMENT_KEY
-
-
Method Detail
-
setSessionId
void setSessionId(HttpServerExchange exchange, java.lang.String sessionId)
Attaches the session to the exchange. The method should attach the exchange under an attachment key, and should also modify the exchange to allow the session to be re-attached on the next request.Generally this will involve setting a cookie
Once a session has been attached it must be possible to retrieve it via
findSessionId(io.undertow.server.HttpServerExchange)
- Parameters:
exchange
- The exchangesessionId
- The session
-
clearSession
void clearSession(HttpServerExchange exchange, java.lang.String sessionId)
Clears this session from the exchange, removing the attachment and making any changes to the response necessary, such as clearing cookies.- Parameters:
exchange
- The exchangesessionId
- The session id
-
findSessionId
java.lang.String findSessionId(HttpServerExchange exchange)
Retrieves a session id of an existing session from an exchange.- Parameters:
exchange
- The exchange- Returns:
- The session id, or null
-
sessionCookieSource
SessionConfig.SessionCookieSource sessionCookieSource(HttpServerExchange exchange)
-
rewriteUrl
java.lang.String rewriteUrl(java.lang.String originalUrl, java.lang.String sessionId)
-
-