@Operation(httpMethods = {"POST", "GET"}, path = "token") public Map<String, GadgetsHandlerApi.BaseResponse> token(BaseRequestItem request) throws ProtocolException { return new AbstractExecutor() { @Override protected Callable<CallableData> createJob(String url, BaseRequestItem request) throws ProcessingException { return createTokenJob(url, request); } }.execute(request); }
MethodCaller methodCaller = new MethodCaller(m, true); String opName = m.getName(); if (!StringUtils.isEmpty(op.name())) { opName = op.name(); for (String httpMethod : op.httpMethods()) { if (!StringUtils.isEmpty(httpMethod)) { httpMethod = httpMethod.toUpperCase(); if (StringUtils.isEmpty(op.path())) { sortedSet.add(new RestPath('/' + serviceName + service.path(), restHandler)); } else { sortedSet.add(new RestPath('/' + serviceName + op.path(), restHandler));
private void createRpcHandler(Provider<?> handlerProvider, Service service, Operation op, Method m) { try { MethodCaller methodCaller = new MethodCaller(m, false); String opName = m.getName(); // Use the override if its defined if (op.name().length() > 0) { opName = op.name(); } RpcInvocationHandler rpcHandler = new RpcInvocationHandler(methodCaller, handlerProvider, beanJsonConverter, new ExecutionListenerWrapper(service.name(), opName, executionListener)); rpcOperations.put(service.name() + '.' + opName, rpcHandler); } catch (NoSuchMethodException nme) { LOG.log(Level.INFO, "No RPC binding for " + service.name() + '.' + m.getName()); } }
public Future<?> execute(Map<String, String[]> parameters, Reader body, SecurityToken token, BeanConverter converter) { RequestItem item; try { // bind the body contents if available if (body != null) { parameters.put(operation.bodyParam(), new String[]{IOUtils.toString(body)}); } item = methodCaller.getRestRequestItem(parameters, token, converter, beanJsonConverter); } catch (Exception e) { return Futures.immediateFailedFuture(e); } try { listener.executing(item); return methodCaller.call(handlerProvider.get(), item); } catch (Exception e) { return Futures.immediateFailedFuture(e); } finally { listener.executed(item); } } }
MethodCaller methodCaller = new MethodCaller(m, true); String opName = m.getName(); if (!StringUtils.isEmpty(op.name())) { opName = op.name(); for (String httpMethod : op.httpMethods()) { if (!StringUtils.isEmpty(httpMethod)) { httpMethod = httpMethod.toUpperCase(); if (StringUtils.isEmpty(op.path())) { sortedSet.add(new RestPath('/' + serviceName + service.path(), restHandler)); } else { sortedSet.add(new RestPath('/' + serviceName + op.path(), restHandler));
private void createRpcHandler(Provider<?> handlerProvider, Service service, Operation op, Method m) { try { MethodCaller methodCaller = new MethodCaller(m, false); String opName = m.getName(); // Use the override if its defined if (op.name().length() > 0) { opName = op.name(); } RpcInvocationHandler rpcHandler = new RpcInvocationHandler(methodCaller, handlerProvider, beanJsonConverter, new ExecutionListenerWrapper(service.name(), opName, executionListener)); rpcOperations.put(service.name() + '.' + opName, rpcHandler); } catch (NoSuchMethodException nme) { LOG.log(Level.INFO, "No RPC binding for " + service.name() + '.' + m.getName()); } }
public Future<?> execute(Map<String, String[]> parameters, Reader body, SecurityToken token, BeanConverter converter) { RequestItem item; try { // bind the body contents if available if (body != null) { parameters.put(operation.bodyParam(), new String[]{IOUtils.toString(body)}); } item = methodCaller.getRestRequestItem(parameters, token, converter, beanJsonConverter); } catch (Exception e) { return Futures.immediateFailedFuture(e); } try { listener.executing(item); return methodCaller.call(handlerProvider.get(), item); } catch (Exception e) { return Futures.immediateFailedFuture(e); } finally { listener.executed(item); } } }
@Operation(httpMethods = "GET", path = "/@metadata.supportedFields") public Set<String> supportedFields(RequestItem request) { return ImmutableSet.copyOf(beanFilter .getBeanFields(GadgetsHandlerApi.MetadataResponse.class, 5)); }
MethodCaller methodCaller = new MethodCaller(m, true); String opName = m.getName(); if (!Strings.isNullOrEmpty(op.name())) { opName = op.name(); for (String httpMethod : op.httpMethods()) { if (!Strings.isNullOrEmpty(httpMethod)) { httpMethod = httpMethod.toUpperCase(); if (Strings.isNullOrEmpty(op.path())) { sortedSet.add(new RestPath('/' + serviceName + service.path(), restHandler)); } else { sortedSet.add(new RestPath('/' + serviceName + op.path(), restHandler));
private void createRpcHandler(Provider<?> handlerProvider, Service service, Operation op, Method m) { try { MethodCaller methodCaller = new MethodCaller(m, false); String opName = m.getName(); // Use the override if its defined if (op.name().length() > 0) { opName = op.name(); } RpcInvocationHandler rpcHandler = new RpcInvocationHandler(methodCaller, handlerProvider, beanJsonConverter, new ExecutionListenerWrapper(service.name(), opName, executionListener)); rpcOperations.put(service.name() + '.' + opName, rpcHandler); } catch (NoSuchMethodException nme) { LOG.log(Level.INFO, "No RPC binding for " + service.name() + '.' + m.getName()); } }
public Future<?> execute(Map<String, String[]> parameters, Reader body, SecurityToken token, BeanConverter converter) { RequestItem item; try { // bind the body contents if available if (body != null) { parameters.put(operation.bodyParam(), new String[]{IOUtils.toString(body)}); } item = methodCaller.getRestRequestItem(parameters, token, converter, beanJsonConverter); } catch (Exception e) { return Futures.immediateFailedFuture(e); } try { listener.executing(item); return methodCaller.call(handlerProvider.get(), item); } catch (Exception e) { return Futures.immediateFailedFuture(e); } finally { listener.executed(item); } } }
@Operation(httpMethods = "GET", path = "/@token.supportedFields") public Set<String> tokenSupportedFields(RequestItem request) { return ImmutableSet.copyOf( beanFilter.getBeanFields(GadgetsHandlerApi.TokenResponse.class, 5)); }
MethodCaller methodCaller = new MethodCaller(m, true); String opName = m.getName(); if (!Strings.isNullOrEmpty(op.name())) { opName = op.name(); for (String httpMethod : op.httpMethods()) { if (!Strings.isNullOrEmpty(httpMethod)) { httpMethod = httpMethod.toUpperCase(); if (Strings.isNullOrEmpty(op.path())) { sortedSet.add(new RestPath('/' + serviceName + service.path(), restHandler)); } else { sortedSet.add(new RestPath('/' + serviceName + op.path(), restHandler));
private void createRpcHandler(Provider<?> handlerProvider, Service service, Operation op, Method m) { try { MethodCaller methodCaller = new MethodCaller(m, false); String opName = m.getName(); // Use the override if its defined if (op.name().length() > 0) { opName = op.name(); } RpcInvocationHandler rpcHandler = new RpcInvocationHandler(methodCaller, handlerProvider, beanJsonConverter, new ExecutionListenerWrapper(service.name(), opName, executionListener)); rpcOperations.put(service.name() + '.' + opName, rpcHandler); } catch (NoSuchMethodException nme) { LOG.log(Level.INFO, "No RPC binding for " + service.name() + '.' + m.getName()); } }
public Future<?> execute(Map<String, String[]> parameters, Reader body, SecurityToken token, BeanConverter converter) { RequestItem item; try { // bind the body contents if available if (body != null) { parameters.put(operation.bodyParam(), new String[]{IOUtils.toString(body)}); } item = methodCaller.getRestRequestItem(parameters, token, converter, beanJsonConverter); } catch (Exception e) { return ImmediateFuture.errorInstance(e); } try { listener.executing(item); return methodCaller.call(handlerProvider.get(), item); } catch (Exception e) { return ImmediateFuture.errorInstance(e); } finally { listener.executed(item); } } }
@Operation(httpMethods = "GET", path = "/@js.supportedFields") public Set<String> jsSupportedFields(RequestItem request) { return ImmutableSet.copyOf( beanFilter.getBeanFields(GadgetsHandlerApi.JsResponse.class, 5)); }
MethodCaller methodCaller = new MethodCaller(m, true); String opName = m.getName(); if (!Strings.isNullOrEmpty(op.name())) { opName = op.name(); for (String httpMethod : op.httpMethods()) { if (!Strings.isNullOrEmpty(httpMethod)) { httpMethod = httpMethod.toUpperCase(); if (Strings.isNullOrEmpty(op.path())) { sortedSet.add(new RestPath('/' + serviceName + service.path(), restHandler)); } else { sortedSet.add(new RestPath('/' + serviceName + op.path(), restHandler));
private void createRpcHandler(Provider<?> handlerProvider, Service service, Operation op, Method m) { try { MethodCaller methodCaller = new MethodCaller(m, false); String opName = m.getName(); // Use the override if its defined if (op.name().length() > 0) { opName = op.name(); } RpcInvocationHandler rpcHandler = new RpcInvocationHandler(methodCaller, handlerProvider, beanJsonConverter, new ExecutionListenerWrapper(service.name(), opName, executionListener)); rpcOperations.put(service.name() + '.' + opName, rpcHandler); } catch (NoSuchMethodException nme) { LOG.log(Level.INFO, "No RPC binding for " + service.name() + '.' + m.getName()); } }
public Future<?> execute(Map<String, String[]> parameters, Reader body, SecurityToken token, BeanConverter converter) { RequestItem item; try { // bind the body contents if available if (body != null) { parameters.put(operation.bodyParam(), new String[]{IOUtils.toString(body)}); } item = methodCaller.getRestRequestItem(parameters, token, converter, beanJsonConverter); } catch (Exception e) { return ImmediateFuture.errorInstance(e); } try { listener.executing(item); return methodCaller.call(handlerProvider.get(), item); } catch (Exception e) { return ImmediateFuture.errorInstance(e); } finally { listener.executed(item); } } }
@Operation(httpMethods = {"POST", "GET"}, path = "metadata.get") public Map<String, GadgetsHandlerApi.BaseResponse> metadata(BaseRequestItem request) throws ProtocolException { return new AbstractExecutor<GadgetsHandlerApi.MetadataResponse>() { @Override protected Callable<GadgetsHandlerApi.MetadataResponse> createJob(String url, BaseRequestItem request) { return createMetadataJob(url, request); } }.execute(request); }