Package io.undertow.server.session
Class PathParameterSessionConfig
- java.lang.Object
-
- io.undertow.server.session.PathParameterSessionConfig
-
- All Implemented Interfaces:
SessionConfig
public class PathParameterSessionConfig extends java.lang.Object implements SessionConfig
Session config that is based on a path parameter and URL rewriting- Author:
- Stuart Douglas
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.undertow.server.session.SessionConfig
SessionConfig.SessionCookieSource
-
-
Field Summary
-
Fields inherited from interface io.undertow.server.session.SessionConfig
ATTACHMENT_KEY
-
-
Constructor Summary
Constructors Constructor Description PathParameterSessionConfig()PathParameterSessionConfig(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearSession(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.StringfindSessionId(HttpServerExchange exchange)Retrieves a session id of an existing session from an exchange.java.lang.StringrewriteUrl(java.lang.String url, java.lang.String sessionId)Return the specified URL with the specified session identifier suitably encoded.SessionConfig.SessionCookieSourcesessionCookieSource(HttpServerExchange exchange)voidsetSessionId(HttpServerExchange exchange, java.lang.String sessionId)Attaches the session to the exchange.
-
-
-
Method Detail
-
setSessionId
public void setSessionId(HttpServerExchange exchange, java.lang.String sessionId)
Description copied from interface:SessionConfigAttaches 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
SessionConfig.findSessionId(io.undertow.server.HttpServerExchange)- Specified by:
setSessionIdin interfaceSessionConfig- Parameters:
exchange- The exchangesessionId- The session
-
clearSession
public void clearSession(HttpServerExchange exchange, java.lang.String sessionId)
Description copied from interface:SessionConfigClears this session from the exchange, removing the attachment and making any changes to the response necessary, such as clearing cookies.- Specified by:
clearSessionin interfaceSessionConfig- Parameters:
exchange- The exchangesessionId- The session id
-
findSessionId
public java.lang.String findSessionId(HttpServerExchange exchange)
Description copied from interface:SessionConfigRetrieves a session id of an existing session from an exchange.- Specified by:
findSessionIdin interfaceSessionConfig- Parameters:
exchange- The exchange- Returns:
- The session id, or null
-
sessionCookieSource
public SessionConfig.SessionCookieSource sessionCookieSource(HttpServerExchange exchange)
- Specified by:
sessionCookieSourcein interfaceSessionConfig
-
rewriteUrl
public java.lang.String rewriteUrl(java.lang.String url, java.lang.String sessionId)Return the specified URL with the specified session identifier suitably encoded.- Specified by:
rewriteUrlin interfaceSessionConfig- Parameters:
url- URL to be encoded with the session idsessionId- Session id to be included in the encoded URL
-
-