Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * Licensed to the Apache Software Foundation (ASF) under one or more
   * contributor license agreements.  See the NOTICE file distributed with
   * this work for additional information regarding copyright ownership.
   * The ASF licenses this file to You under the Apache License, Version 2.0
   * (the "License"); you may not use this file except in compliance with
   * the License.  You may obtain a copy of the License at
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
 package org.apache.tomcat.bayeux.request;
 import static org.jboss.web.CoyoteMessages.MESSAGES;
 import java.util.List;
Handshake request Bayeux message.

Guy A. Molinari
Filip Hanik
 public class MetaUnsubscribeRequest extends RequestBase implements BayeuxRequest {
     protected static HashMap<String,ObjectresponseTemplate = new HashMap<String,Object>();
     static {
     public MetaUnsubscribeRequest(TomcatBayeux tbHttpEvent eventJSONObject jsReqthrows JSONException {

Check client request for validity. Per section 4.6.1 of the Bayuex spec a connect request must contain: 1) The "/meta/unsubscribe" channel identifier. 2) The clientId. 3) The subscription. This is the name of the channel of interest, or a pattern.

HttpError This method returns null if no errors were found
     public HttpError validate() {
         if(==null|| (!this.getTomcatBayeux().hasClient()))
             return new HttpError(400, .invalidBayeuxClientId(), null);
         if (==null||.length()==0)
             return new HttpError(400, .noBayeuxSubscription(), null);
         return null;//no error

De-register interest for one or more channels. Per section 2.2.1 of the Bayeux spec, a pattern may be specified. Sever relationships.
     public int process(int prevopsthrows BayeuxException {
         prevops = super.process(prevops);
          = (HashMap<StringObject>).clone();
         ClientImpl client = (ClientImpl)getTomcatBayeux().getClient();
         HttpError error = validate();
         if (error == null) {
             boolean wildcard = .indexOf('*')!=-1;
             boolean unsubscribed = false;
             if (wildcard) {
                 List<Channelchannels = getTomcatBayeux().getChannels();
                 Iterator<Channelit = channels.iterator();
                 while (it.hasNext()) {
                     ChannelImpl ch = (ChannelImpl);
                    if (ch.matches()) {
                        unsubscribed = true;
            }else {
                ChannelImpl ch = (ChannelImpl)getTomcatBayeux().getChannel(,true);
                unsubscribed = true;
            .put(., Boolean.valueOf(unsubscribed));
        }else {
            if (client==nullclient = TomcatBayeux.getErrorClient();
        try {
            JSONObject obj = new JSONObject();
        } catch (ServletException x) {
            throw new BayeuxException(x);
        } catch (IOException x) {
            throw new BayeuxException(x);
        return 0;
New to GrepCode? Check out our FAQ X