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.web.socket.sockjs; 018 019import org.springframework.core.NestedRuntimeException; 020 021/** 022 * Base class for exceptions raised while processing SockJS HTTP requests. 023 * 024 * @author Rossen Stoyanchev 025 * @since 4.0 026 */ 027@SuppressWarnings("serial") 028public class SockJsException extends NestedRuntimeException { 029 030 private final String sessionId; 031 032 033 /** 034 * Constructor for SockJsException. 035 * @param message the exception message 036 * @param cause the root cause 037 */ 038 public SockJsException(String message, Throwable cause) { 039 this(message, null, cause); 040 } 041 042 /** 043 * Constructor for SockJsException. 044 * @param message the exception message 045 * @param sessionId the SockJS session id 046 * @param cause the root cause 047 */ 048 public SockJsException(String message, String sessionId, Throwable cause) { 049 super(message, cause); 050 this.sessionId = sessionId; 051 } 052 053 054 /** 055 * Return the SockJS session id. 056 */ 057 public String getSockJsSessionId() { 058 return this.sessionId; 059 } 060 061}