*/
public int process(int prevops) throws BayeuxException {
prevops = super.process(prevops);
response = (HashMap<String, Object>)this.responseTemplate.clone();
ClientImpl client = (ClientImpl)getTomcatBayeux().getClient(clientId);
HttpError error = validate();
if (error == null) {
boolean wildcard = subscription.indexOf('*')!=-1;
boolean subscribed = false;
if (wildcard) {
List<Channel> channels = getTomcatBayeux().getChannels();
Iterator<Channel> it = channels.iterator();
while (it.hasNext()) {
ChannelImpl ch = (ChannelImpl)it.next();
if (ch.matches(subscription)) {
ch.subscribe(client);
subscribed = true;
}
}
}else {
ChannelImpl ch = (ChannelImpl)getTomcatBayeux().getChannel(subscription,true);
ch.subscribe(client);
subscribed = true;
}
response.put(Bayeux.SUCCESSFUL_FIELD, Boolean.valueOf(subscribed));
response.put(Bayeux.SUBSCRIPTION_FIELD,subscription);
((HashMap) response.get(Bayeux.ADVICE_FIELD)).put("reconnect", "retry");
((HashMap) response.get(Bayeux.ADVICE_FIELD)).put("interval", getReconnectInterval());
}else {
response.put(Bayeux.SUCCESSFUL_FIELD,Boolean.FALSE);
response.put(Bayeux.ERROR_FIELD, error.toString());
((HashMap) response.get(Bayeux.ADVICE_FIELD)).put("reconnect", "handshake");
if (client==null) client = TomcatBayeux.getErrorClient();
}
response.put(Bayeux.CLIENT_FIELD, client.getId());
response.put(Bayeux.TIMESTAMP_FIELD,getTimeStamp());