001/* 002 * Copyright 2002-2015 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.messaging.simp.stomp; 018 019import java.lang.reflect.Type; 020 021/** 022 * Abstract adapter class for {@link StompSessionHandler} with mostly empty 023 * implementation methods except for {@link #getPayloadType} which returns String 024 * as the default Object type expected for STOMP ERROR frame payloads. 025 * 026 * @author Rossen Stoyanchev 027 * @since 4.2 028 */ 029public abstract class StompSessionHandlerAdapter implements StompSessionHandler { 030 031 /** 032 * This implementation is empty. 033 */ 034 @Override 035 public void afterConnected(StompSession session, StompHeaders connectedHeaders) { 036 } 037 038 /** 039 * This implementation returns String as the expected payload type 040 * for STOMP ERROR frames. 041 */ 042 @Override 043 public Type getPayloadType(StompHeaders headers) { 044 return String.class; 045 } 046 047 /** 048 * This implementation is empty. 049 */ 050 @Override 051 public void handleFrame(StompHeaders headers, Object payload) { 052 } 053 054 /** 055 * This implementation is empty. 056 */ 057 @Override 058 public void handleException(StompSession session, StompCommand command, StompHeaders headers, 059 byte[] payload, Throwable exception) { 060 } 061 062 /** 063 * This implementation is empty. 064 */ 065 @Override 066 public void handleTransportError(StompSession session, Throwable exception) { 067 } 068 069}