From 61d13547e13d141f2f12c17e9ffd0a6f742ad72a Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Fri, 18 Oct 2013 15:15:24 -0400 Subject: [PATCH] Remove @UnsubscribeEvent The STOMP UNSUBSCRIBE message does not have a destination header so there is no obvious simple way to do a mapping and the need for it is not clear yet. --- .../simp/annotation/UnsubscribeEvent.java | 43 ------------------- .../AnnotationMethodMessageHandler.java | 7 --- 2 files changed, 50 deletions(-) delete mode 100644 spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/UnsubscribeEvent.java diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/UnsubscribeEvent.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/UnsubscribeEvent.java deleted file mode 100644 index 434b5a0a84..0000000000 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/annotation/UnsubscribeEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002-2013 the original author or authors. - * - * Licensed 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * 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.springframework.messaging.simp.annotation; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - - -/** - * Annotation for mapping unsubscribe events onto specific handler methods based - * on the destination for the message (e.g. STOMP UNSUBSCRIBE message). - * - * @author Rossen Stoyanchev - * @since 4.0 - */ -@Target({ElementType.TYPE, ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface UnsubscribeEvent { - - /** - * Destination value(s) for the subscription. - */ - String[] value() default {}; - -} diff --git a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AnnotationMethodMessageHandler.java b/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AnnotationMethodMessageHandler.java index 71f5765e38..48652a0c8d 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AnnotationMethodMessageHandler.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/simp/handler/AnnotationMethodMessageHandler.java @@ -65,7 +65,6 @@ import org.springframework.messaging.simp.SimpMessageSendingOperations; import org.springframework.messaging.simp.SimpMessageType; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.messaging.simp.annotation.SubscribeEvent; -import org.springframework.messaging.simp.annotation.UnsubscribeEvent; import org.springframework.messaging.simp.annotation.support.PrincipalMethodArgumentResolver; import org.springframework.messaging.simp.annotation.support.SendToMethodReturnValueHandler; import org.springframework.messaging.simp.annotation.support.SubscriptionMethodReturnValueHandler; @@ -120,8 +119,6 @@ public class AnnotationMethodMessageHandler implements MessageHandler, Applicati private Map subscribeMethods = new HashMap(); - private Map unsubscribeMethods = new HashMap(); - private final Map, ExceptionHandlerMethodResolver> exceptionHandlerCache = new ConcurrentHashMap, ExceptionHandlerMethodResolver>(64); @@ -308,7 +305,6 @@ public class AnnotationMethodMessageHandler implements MessageHandler, Applicati initHandlerMethods(handler, handlerType, MessageMapping.class, this.messageMethods); initHandlerMethods(handler, handlerType, SubscribeEvent.class, this.subscribeMethods); - initHandlerMethods(handler, handlerType, UnsubscribeEvent.class, this.unsubscribeMethods); } private void initHandlerMethods(Object handler, Class handlerType, @@ -365,9 +361,6 @@ public class AnnotationMethodMessageHandler implements MessageHandler, Applicati else if (SimpMessageType.SUBSCRIBE.equals(messageType)) { handleMessageInternal(message, this.subscribeMethods); } - else if (SimpMessageType.UNSUBSCRIBE.equals(messageType)) { - handleMessageInternal(message, this.unsubscribeMethods); - } } private void handleMessageInternal(Message message, Map handlerMethods) { -- GitLab