com.kurento.kmf.jsonrpcconnector.client.JsonRpcClientLocal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kmf-jsonrpcconnector-client Show documentation
Show all versions of kmf-jsonrpcconnector-client Show documentation
JSON-RPC Protocol with transports based on http and websocket
/*
* (C) Copyright 2013 Kurento (http://kurento.org/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/
package com.kurento.kmf.jsonrpcconnector.client;
import static javax.websocket.CloseReason.CloseCodes.NORMAL_CLOSURE;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.kurento.kmf.jsonrpcconnector.JsonRpcHandler;
import com.kurento.kmf.jsonrpcconnector.JsonUtils;
import com.kurento.kmf.jsonrpcconnector.internal.JsonRpcHandlerManager;
import com.kurento.kmf.jsonrpcconnector.internal.JsonRpcRequestSenderHelper;
import com.kurento.kmf.jsonrpcconnector.internal.client.ClientSession;
import com.kurento.kmf.jsonrpcconnector.internal.client.TransactionImpl;
import com.kurento.kmf.jsonrpcconnector.internal.client.TransactionImpl.ResponseSender;
import com.kurento.kmf.jsonrpcconnector.internal.message.Message;
import com.kurento.kmf.jsonrpcconnector.internal.message.Request;
import com.kurento.kmf.jsonrpcconnector.internal.message.Response;
import com.kurento.kmf.jsonrpcconnector.internal.message.ResponseError;
public class JsonRpcClientLocal extends JsonRpcClient {
private static Logger log = LoggerFactory
.getLogger(JsonRpcClientLocal.class);
private JsonRpcHandler extends Object> remoteHandler;
private final JsonRpcHandlerManager remoteHandlerManager = new JsonRpcHandlerManager();
public JsonRpcClientLocal(JsonRpcHandler extends Object> paramHandler) {
this.remoteHandler = paramHandler;
this.remoteHandlerManager.setJsonRpcHandler(remoteHandler);
session = new ClientSession("XXX", null, this);
rsHelper = new JsonRpcRequestSenderHelper() {
@Override
public Response internalSendRequest(Request request,
Class resultClass) throws IOException {
return localSendRequest(request, resultClass);
}
@Override
protected void internalSendRequest(Request
© 2015 - 2025 Weber Informatics LLC | Privacy Policy