@Override public RemotingChannel newRemotingChannel(String id, String uri, int maxConcurrentRequests) { try { RemotingChannel channel = newRemotingChannel(id, new URI(uri), maxConcurrentRequests); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; } catch (URISyntaxException e) { throw new IllegalArgumentException("Bad uri: " + uri, e); } }
/** * Implementation of login * Should not be called directly, called by {@link org.granite.client.tide.Identity#login} * * @param username user name * @param password password */ public void login(String username, String password) { remotingChannel.setCredentials(new UsernamePasswordCredentials(username, password)); for (MessagingChannel messagingChannel : messagingChannelsByType.values()) messagingChannel.setCredentials(new UsernamePasswordCredentials(username, password)); }
remotingChannel.logout(new ResultFaultIssuesResponseListener() { @Override public void onResult(final ResultEvent event) {
/** * Called by {@link org.granite.client.tide.Identity} after session has expired */ public void sessionExpired() { log.info("Application session expired"); logoutState.sessionExpired(); context.getEventBus().raiseEvent(context, SESSION_EXPIRED); context.getEventBus().raiseEvent(context, LOGOUT); remotingChannel.logout(false); for (MessagingChannel messagingChannel : messagingChannelsByType.values()) messagingChannel.logout(false); sessionId = null; if (remotingChannel instanceof SessionAwareChannel) ((SessionAwareChannel)remotingChannel).setSessionId(null); for (MessagingChannel messagingChannel : messagingChannelsByType.values()) messagingChannel.setSessionId(null); }
@Override public RemotingChannel newRemotingChannel(String id, String uri) { try { RemotingChannel channel = newRemotingChannel(id, new URI(uri)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; } catch (URISyntaxException e) { throw new IllegalArgumentException("Bad uri: " + uri, e); } }
/** * Implementation of login using a specific charset for username/password encoding * Should not be called directly, called by {@link org.granite.client.tide.Identity#login} * * @param username user name * @param password password * @param charset charset used for encoding */ public void login(String username, String password, Charset charset) { remotingChannel.setCredentials(new UsernamePasswordCredentials(username, password, charset)); for (MessagingChannel messagingChannel : messagingChannelsByType.values()) messagingChannel.setCredentials(new UsernamePasswordCredentials(username, password, charset)); }
/** * Set default time to live on all channels * @param timeToLive time to live in milliseconds */ public void setDefaultTimeToLive(long timeToLive) { defaultTimeToLive = timeToLive; if (channelFactory != null) channelFactory.setDefaultTimeToLive(timeToLive); for (MessagingChannel messagingChannel : messagingChannelsByType.values()) messagingChannel.setDefaultTimeToLive(timeToLive); if (remotingChannel != null) remotingChannel.setDefaultTimeToLive(timeToLive); }
@Override public RemotingChannel newRemotingChannel(String id, URI uri, int maxConcurrentRequests) { if (getRemotingTransport() == null) throw new RuntimeException("Remoting transport not defined, start the ChannelFactory first"); if (!getRemotingTransport().isStarted() && !getRemotingTransport().start()) throw new TransportException("Could not start remoting transport: " + getRemotingTransport()); RemotingChannel channel = defaultChannelBuilder.buildRemotingChannel(getRemotingChannelClass(), id, uri, maxConcurrentRequests, getRemotingTransport(), newMessagingCodec(AMF0Message.class)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public RemotingChannel newRemotingChannel(String id, ServerApp serverApp, int maxConcurrentRequests) { if (getRemotingTransport() == null) throw new RuntimeException("Remoting transport not defined, start the ChannelFactory first"); if (!getRemotingTransport().isStarted() && !getRemotingTransport().start()) throw new TransportException("Could not start remoting transport: " + getRemotingTransport()); RemotingChannel channel = defaultChannelBuilder.buildRemotingChannel(getRemotingChannelClass(), id, serverApp, maxConcurrentRequests, getRemotingTransport(), newMessagingCodec(AMF0Message.class)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public RemotingChannel newRemotingChannel(String id, URI uri, int maxConcurrentRequests) { if (getRemotingTransport() == null) throw new RuntimeException("Remoting transport not defined, start the ChannelFactory first"); if (!getRemotingTransport().isStarted() && !getRemotingTransport().start()) throw new TransportException("Could not start remoting transport: " + getRemotingTransport()); RemotingChannel channel = defaultChannelBuilder.buildRemotingChannel(getRemotingChannelClass(), id, uri, maxConcurrentRequests, getRemotingTransport(), newMessagingCodec(AMF0Message.class)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public RemotingChannel newRemotingChannel(String id, ServerApp serverApp, int maxConcurrentRequests) { if (getRemotingTransport() == null) throw new RuntimeException("Remoting transport not defined, start the ChannelFactory first"); if (!getRemotingTransport().isStarted() && !getRemotingTransport().start()) throw new TransportException("Could not start remoting transport: " + getRemotingTransport()); RemotingChannel channel = defaultChannelBuilder.buildRemotingChannel(getRemotingChannelClass(), id, serverApp, maxConcurrentRequests, getRemotingTransport(), newMessagingCodec(AMF0Message.class)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }