diff options
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/Glacier2/SessionFactoryHelper.java | 16 | ||||
-rw-r--r-- | java/src/Glacier2/SessionHelper.java | 11 |
2 files changed, 21 insertions, 6 deletions
diff --git a/java/src/Glacier2/SessionFactoryHelper.java b/java/src/Glacier2/SessionFactoryHelper.java index 046f2c5780e..59c424ab7f7 100644 --- a/java/src/Glacier2/SessionFactoryHelper.java +++ b/java/src/Glacier2/SessionFactoryHelper.java @@ -217,6 +217,17 @@ public class SessionFactoryHelper } /** + * Sets the request context to use while establishing a connection to the Glacier2 router. + * + * @param context The request context. + */ + synchronized public void + setConnectContext(final java.util.Map<String, String> context) + { + _context = context; + } + + /** * Connects to the Glacier2 router using the associated SSL credentials. * * Once the connection is established, {@link SessionCallback#connected} is called on the callback object; @@ -228,7 +239,7 @@ public class SessionFactoryHelper connect() { SessionHelper session = new SessionHelper(_callback, createInitData()); - session.connect(); + session.connect(_context); return session; } @@ -246,7 +257,7 @@ public class SessionFactoryHelper connect(final String username, final String password) { SessionHelper session = new SessionHelper(_callback, createInitData()); - session.connect(username, password); + session.connect(username, password, _context); return session; } @@ -312,6 +323,7 @@ public class SessionFactoryHelper private boolean _secure = true; private int _port = 0; private int _timeout = 10000; + private java.util.Map<String, String> _context; private static final int GLACIER2_SSL_PORT = 4064; private static final int GLACIER2_TCP_PORT = 4063; } diff --git a/java/src/Glacier2/SessionHelper.java b/java/src/Glacier2/SessionHelper.java index 66b15a4ebd8..e4847745666 100644 --- a/java/src/Glacier2/SessionHelper.java +++ b/java/src/Glacier2/SessionHelper.java @@ -272,16 +272,18 @@ public class SessionHelper * * Once the connection is established, {@link SessionCallback#connected} is called on the callback object; * upon failure, {@link SessionCallback#exception} is called with the exception. + * + * @param context The request context to use when creating the session. */ synchronized protected void - connect() + connect(final java.util.Map<String, String> context) { connectImpl(new ConnectStrategy() { public SessionPrx connect(RouterPrx router) throws CannotCreateSessionException, PermissionDeniedException { - return router.createSessionFromSecureConnection(); + return router.createSessionFromSecureConnection(context); } }); } @@ -294,16 +296,17 @@ public class SessionHelper * * @param username The user name. * @param password The password. + * @param context The request context to use when creating the session. */ synchronized protected void - connect(final String username, final String password) + connect(final String username, final String password, final java.util.Map<String, String> context) { connectImpl(new ConnectStrategy() { public SessionPrx connect(RouterPrx router) throws CannotCreateSessionException, PermissionDeniedException { - return router.createSession(username, password); + return router.createSession(username, password, context); } }); } |