1 23 24 package org.apache.slide.webdav.method; 25 26 27 import org.apache.slide.common.NamespaceAccessToken; 28 import org.apache.slide.event.EventDispatcher; 29 import org.apache.slide.webdav.WebdavException; 30 import org.apache.slide.webdav.WebdavServletConfig; 31 import org.apache.slide.webdav.event.NotificationTrigger; 32 import org.apache.slide.webdav.event.Subscriber; 33 import org.apache.slide.webdav.event.WebdavEvent; 34 import org.apache.slide.webdav.util.NotificationConstants; 35 import org.apache.slide.webdav.util.WebdavStatus; 36 37 38 42 public class UnsubscribeMethod extends AbstractWebdavMethod implements NotificationConstants { 43 protected static final String LOG_CHANNEL = UnsubscribeMethod.class.getName(); 44 45 51 public UnsubscribeMethod(NamespaceAccessToken token, 52 WebdavServletConfig config) { 53 super(token, config); 54 } 55 56 protected void parseRequest() throws WebdavException { 57 } 58 59 protected void executeRequest() throws WebdavException { 60 try { 61 if ( WebdavEvent.UNSUBSCRIBE.isEnabled() ) EventDispatcher.getInstance().fireVetoableEvent(WebdavEvent.UNSUBSCRIBE, new WebdavEvent(this)); 62 int []subscriptionIDs = requestHeaders.getSubscriptionId(); 63 for ( int i = 0; i < subscriptionIDs.length; i++ ) { 64 Subscriber subscriber = NotificationTrigger.getInstance().getSubscriber(subscriptionIDs[i]); 65 NotificationTrigger.getInstance().removeSubscriber(subscriber); 66 } 67 resp.setStatus(WebdavStatus.SC_OK); 68 } catch (Exception e) { 69 int statusCode = getErrorCode( (Exception )e ); 70 sendError( statusCode, e ); 71 throw new WebdavException( statusCode ); 72 } 73 } 74 } | Popular Tags |