9 changed files with 213 additions and 40 deletions
-
18src/main/java/com/corundumstudio/socketio/Configuration.java
-
3src/main/java/com/corundumstudio/socketio/SocketIOServer.java
-
4src/main/java/com/corundumstudio/socketio/handler/PacketListener.java
-
52src/main/java/com/corundumstudio/socketio/listener/DefaultExceptionListener.java
-
32src/main/java/com/corundumstudio/socketio/listener/ExceptionListener.java
-
42src/main/java/com/corundumstudio/socketio/listener/ExceptionListenerAdapter.java
-
93src/main/java/com/corundumstudio/socketio/namespace/Namespace.java
-
7src/main/java/com/corundumstudio/socketio/namespace/NamespacesHub.java
-
2src/test/java/com/corundumstudio/socketio/handler/PacketHandlerTest.java
@ -0,0 +1,52 @@ |
|||||
|
/** |
||||
|
* Copyright 2012 Nikita Koksharov |
||||
|
* |
||||
|
* 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 com.corundumstudio.socketio.listener; |
||||
|
|
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
|
||||
|
import com.corundumstudio.socketio.SocketIOClient; |
||||
|
|
||||
|
public class DefaultExceptionListener extends ExceptionListenerAdapter { |
||||
|
|
||||
|
private final Logger log = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
@Override |
||||
|
public void onEventException(Exception e, SocketIOClient client) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onDisconnectException(Exception e, SocketIOClient client) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onConnectException(Exception e, SocketIOClient client) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onMessageException(Exception e, SocketIOClient client) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onJsonException(Exception e, SocketIOClient client) { |
||||
|
log.error(e.getMessage(), e); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
/** |
||||
|
* Copyright 2012 Nikita Koksharov |
||||
|
* |
||||
|
* 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 com.corundumstudio.socketio.listener; |
||||
|
|
||||
|
import com.corundumstudio.socketio.SocketIOClient; |
||||
|
|
||||
|
public interface ExceptionListener { |
||||
|
|
||||
|
void onEventException(Exception e, SocketIOClient client); |
||||
|
|
||||
|
void onDisconnectException(Exception e, SocketIOClient client); |
||||
|
|
||||
|
void onConnectException(Exception e, SocketIOClient client); |
||||
|
|
||||
|
void onMessageException(Exception e, SocketIOClient client); |
||||
|
|
||||
|
void onJsonException(Exception e, SocketIOClient client); |
||||
|
|
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
/** |
||||
|
* Copyright 2012 Nikita Koksharov |
||||
|
* |
||||
|
* 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 com.corundumstudio.socketio.listener; |
||||
|
|
||||
|
import com.corundumstudio.socketio.SocketIOClient; |
||||
|
|
||||
|
public class ExceptionListenerAdapter implements ExceptionListener { |
||||
|
|
||||
|
@Override |
||||
|
public void onEventException(Exception e, SocketIOClient client) { |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onDisconnectException(Exception e, SocketIOClient client) { |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onConnectException(Exception e, SocketIOClient client) { |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onMessageException(Exception e, SocketIOClient client) { |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void onJsonException(Exception e, SocketIOClient client) { |
||||
|
} |
||||
|
|
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue