当前位置: 首页>>代码示例>>Java>>正文


Java RemoteService类代码示例

本文整理汇总了Java中com.google.gwt.user.client.rpc.RemoteService的典型用法代码示例。如果您正苦于以下问题:Java RemoteService类的具体用法?Java RemoteService怎么用?Java RemoteService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RemoteService类属于com.google.gwt.user.client.rpc包,在下文中一共展示了RemoteService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: determineProxyServiceBaseInterface

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/**
 * Attempts to determine the service interface class of the provided proxy
 * object.
 *
 * @since 0.5
 * @return the base service interface class
 * @throws ClassNotFoundException
 *             if attempt to find base interface from class ending in
 *             "Async" fails
 */
protected static Class<?> determineProxyServiceBaseInterface(Object proxy)
		throws ClassNotFoundException {
	for (Class<?> clazz : proxy.getClass().getInterfaces()) {
		if (RemoteService.class.isAssignableFrom(clazz)) {
			return clazz;
		}
		if (clazz.getName().endsWith(SyncProxy.ASYNC_POSTFIX)) {
			return Class.forName(clazz.getName().replace(
					SyncProxy.ASYNC_POSTFIX, ""));
		}
		// if (!ServiceDefTarget.class.equals(clazz)
		// && !HasRpcToken.class.equals(clazz)
		// && !SerializationStreamFactory.class.equals(clazz)) {
		// srvcIntf = Class.forName(clazz.getName().replace("Async",
		// ""));
		// }
	}
	return null;
}
 
开发者ID:jcricket,项目名称:gwt-syncproxy,代码行数:30,代码来源:RemoteServiceInvocationHandler.java

示例2: create

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/**
 * Similar action to Gwt.create(). This method assumes your service is
 * annotated with {@link RemoteServiceRelativePath} and that you have
 * appropriately set the base url: {@link #setBaseURL(String)}. See
 * {@link #suppressRelativePathWarning(boolean)} in the event your service
 * is not annotated with {@link RemoteServiceRelativePath}.
 *
 * @since 0.5
 * @param serviceIntf
 * @return
 */
@SuppressWarnings("unchecked")
public static <ServiceIntfAsync, ServiceIntf extends RemoteService> ServiceIntfAsync create(
		Class<ServiceIntf> serviceIntf) {
	logger.config("Create service: " + serviceIntf.getName());

	Class<ServiceIntfAsync> asyncServiceIntf;

	try {
		asyncServiceIntf = (Class<ServiceIntfAsync>) Class
				.forName(serviceIntf.getName() + ASYNC_POSTFIX);
	} catch (ClassNotFoundException e) {
		throw new SyncProxyException(serviceIntf, InfoType.SERVICE_BASE);
	}

	logger.config("Creating Async Service: " + asyncServiceIntf.getName());

	return createProxy(asyncServiceIntf, new ProxySettings());
}
 
开发者ID:jcricket,项目名称:gwt-syncproxy,代码行数:30,代码来源:SyncProxy.java

示例3: initServiceInstance

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
private RPCServiceExporter initServiceInstance(RPCServiceExporter exporter,
		Object service, Class<RemoteService>[] serviceInterfaces) {
	try {
		exporter.setResponseCachingDisabled(disableResponseCaching);
		exporter.setServletContext(getServletContext());
		exporter.setServletConfig(servletConfig);
		exporter.setService(service);
		exporter.setServiceInterfaces(serviceInterfaces);
		exporter
				.setThrowUndeclaredExceptionToServletContainer(throwUndeclaredExceptionToServletContainer);
		if (shouldCheckPermutationStrongName)
			exporter.setShouldCheckPermutationStrongName(true);
		exporter.afterPropertiesSet();
		return exporter;
	} catch (Exception e) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:ggeorgovassilis,项目名称:gwt-sl,代码行数:19,代码来源:GWTHandler.java

示例4: processCall

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
@Override
public String processCall(String payload) throws SerializationException {
  try {
    RPCRequest req = RPC.decodeRequest(payload, null, this);

    RemoteService service = getServiceInstance(req.getMethod().getDeclaringClass());

    return RPC.invokeAndEncodeResponse(service, req.getMethod(),
      req.getParameters(), req.getSerializationPolicy());
    
  } catch (IncompatibleRemoteServiceException ex) {
    log("IncompatibleRemoteServiceException in the processCall(String) method.",
        ex);
    return RPC.encodeResponseForFailure(null, ex);
  }
}
 
开发者ID:DavidWhitlock,项目名称:PortlandStateJava,代码行数:17,代码来源:GuiceRemoteServiceServlet.java

示例5: initGwtRpcServiceMap

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/**
 * Scans the application context and its parents for service beans that implement the {@link
 * com.google.gwt.user.client.rpc.RemoteService}
 *
 * @param appContext Application context
 *
 * @return Map<String, Object> A map of RemoteServiceRelativePath annotation values vs the RPC service instances
 */
private Map<String, Object> initGwtRpcServiceMap(final ApplicationContext appContext)
{
    // Create a map of rpc services keyed against the RemoteServiceRelativePath annotation value
    Map<String, Object> rpcServiceMap = new HashMap<String, Object>();

    // If Gwt RPC service beans exist already (may be explicitly configured through spring config xml file)
    // then add them first.
    Map<String, Object> existingGwtRpcServiceMap = getGwtRpcServiceMap();
    if (existingGwtRpcServiceMap != null)
    {
        rpcServiceMap.putAll(existingGwtRpcServiceMap);
    }

    if (appContext != null)
    {
        //Find the beans of type RemoteService
        String[] remoteServiceBeans = appContext.getBeanNamesForType(RemoteService.class);
        if (!ArrayUtils.isEmpty(remoteServiceBeans))
        {
            // If remoteServiceBeans are found then scan for Gwt Rpc beans
            scanForGwtRpcBeans(appContext, rpcServiceMap, remoteServiceBeans);
        }
    }
    return rpcServiceMap;
}
 
开发者ID:dpandya,项目名称:jsr286-gwt-rpc,代码行数:34,代码来源:PathBasedGwtRpcServiceResolver.java

示例6: findStorageTypes

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
@Override
public Set<JType> findStorageTypes() throws UnableToCompleteException{
  Set<JType> serializables = new HashSet<>();

  JClassType remoteSvcIntf = typeOracle.findType(RemoteService.class.getName());
  JClassType[] remoteSvcTypes = remoteSvcIntf.getSubtypes();
  for(JClassType remoteSvcType : remoteSvcTypes){
    for(JMethod method : remoteSvcType.getMethods()){
      JType type = method.getReturnType();
      if(JPrimitiveType.VOID != type){
        addIfIsValidType(serializables, type);
      }
      for(JType param : method.getParameterTypes()){
        addIfIsValidType(serializables, param);
      }
    }
  }

  return serializables;
}
 
开发者ID:seanchenxi,项目名称:gwt-storage,代码行数:21,代码来源:TypeRpcFinder.java

示例7: create

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked") // safe since we check whether the type is assignable
public <T> T create(Class<?> createdType) {
  // If we're creating a RemoteService, assume that the result of GWT.create is being assigned
  // to the async version of that service. Otherwise, assume it's being assigned to the same
  // type we're creating.
  Class<?> assignedType = RemoteService.class.isAssignableFrom(createdType)
      ? getAsyncType((Class<? extends RemoteService>) createdType)
      : createdType;

  // First check if we have a GwtMock for this exact being assigned to and use it if so.
  if (registeredMocks.containsKey(assignedType)) {
    return (T) registeredMocks.get(assignedType);
  }

  // Next check if we have a fake provider that can provide a fake for the type being created.
  T fake = (T) getFakeFromProviderMap(createdType, registeredProviders);
  if (fake != null) {
    return fake;
  }

  // If nothing has been registered, just return a new mock for the type being assigned.
  return (T) mock(assignedType, new ReturnsCustomMocks());
}
 
开发者ID:google,项目名称:gwtmockito,代码行数:25,代码来源:GwtMockito.java

示例8: getBean

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/**
 * Determine Spring bean to handle request based on request URL, e.g. a
 * request ending in /myService will be handled by bean with name
 * "myService".
 * 
 * @param request
 * @return handler bean
 */
protected Object getBean(HttpServletRequest request) {
	String service = getService(request);
	Object bean = getBean(service);
	if (!(bean instanceof RemoteService)) {
		throw new IllegalArgumentException("Spring bean is not a GWT RemoteService: " + service + " (" + bean + ")");
	}
	if (logger.isDebugEnabled()) {
	    logger.debug("Bean for service " + service + " is " + bean);
	}
	return bean;
}
 
开发者ID:kaaproject,项目名称:sandbox-frame,代码行数:20,代码来源:SpringGwtRemoteServiceServlet.java

示例9: processCall

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
@Override
public String processCall(final String payload)
		throws SerializationException {
	try {
		Object presentationService = applicationContext.getBean(serviceName
				.get());
		if (!(presentationService instanceof RemoteService)) {
			throw new IllegalArgumentException(
					"Requested Spring Bean is not a GWT RemoteService Presentation Service: "
							+ payload + " (" + presentationService + ")");
		}

		RPCRequest rpcRequest = RPC.decodeRequest(payload,
				presentationService.getClass(), this);
		if (presentationService instanceof AuthenticationServiceFacade
				&& rpcRequest.getMethod().equals(
						AuthenticationServiceFacade.class
								.getMethod("getXSRFSessionToken"))) {
			return RPC.encodeResponseForSuccess(rpcRequest.getMethod(),
					SecurityHelper.createXSRFToken(getThreadLocalRequest()));
		}
		return RPC.invokeAndEncodeResponse(presentationService,
				rpcRequest.getMethod(), rpcRequest.getParameters(),
				rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
	} catch (Exception e) {
		GWTPresentationException pex = new GWTPresentationException(
				e.getMessage());
		return RPC.encodeResponseForFailure(null, pex);
	}
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:31,代码来源:GwtRpcController.java

示例10: testGetInterfaces

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
@Test
public void testGetInterfaces() {
	MyAbstractTestClass instance = CGLibProxy.newInstance(MyTestClass.class);
	assertTrue(instance instanceof RemoteService);

	assertTrue(ReflectionUtils.getExposedInterfaces(instance.getClass()).length == 1);
}
 
开发者ID:ggeorgovassilis,项目名称:gwt-sl,代码行数:8,代码来源:ReflectionUtilsTest.java

示例11: scanForAnnotatedBeans

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/**
 * Scans the application context and its parents for service beans that
 * implement the {@link GWTRequestMapping}
 * 
 * @param appContext
 *            Application context
 */
private void scanForAnnotatedBeans(final ApplicationContext appContext) {
	if (appContext == null) {
		return;
	}
	for (String beanName : appContext
			.getBeanNamesForType(RemoteService.class)) {
		Object service = appContext.getBean(beanName);
		if (service == null)
			continue;
		final Class<?> beanClass = service.getClass();

		final RemoteServiceRelativePath requestMapping = ReflectionUtils
				.findAnnotation(beanClass, RemoteServiceRelativePath.class);
		if (requestMapping == null) {
			continue;
		}

		// Create serviceExporter to bind to
		String mapping = requestMapping.value();
		if (mapping.contains("/")){
			mapping = mapping.substring(mapping.lastIndexOf("/"));
		}
		if (getMappings().containsKey(mapping))
			logger.warn("Bean '" + mapping
					+ "' already in mapping, skipping.");
		else
			getMappings().put(mapping, service);
	}
	if (scanParentApplicationContext)
		scanForAnnotatedBeans(appContext.getParent());
}
 
开发者ID:ggeorgovassilis,项目名称:gwt-sl,代码行数:39,代码来源:GWTHandler.java

示例12: getExposedInterfaces

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/**
 * Return array of all interfaces that are implemented by clazz and extend
 * {@link RemoteService}.
 * 
 * @param clazz Class to scan for interfaces
 * @return Array of interfaces. May be empty but never null.
 */
@SuppressWarnings("unchecked")
public static Class<RemoteService>[] getExposedInterfaces(Class<?> clazz) {
	Set<Class<?>> interfaces = getInterfaces(clazz);
	for (Iterator<Class<?>> ite = interfaces.iterator(); ite.hasNext();) {
		Class<?> c = ite.next();
		if (!isExposed(c))
			ite.remove();
	}
	return interfaces.toArray(new Class[interfaces.size()]);
}
 
开发者ID:ggeorgovassilis,项目名称:gwt-sl,代码行数:18,代码来源:ReflectionUtils.java

示例13: getBean

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/**
 * Determine Spring bean to handle request based on request URL, e.g. a
 * request ending in /myService will be handled by bean with name
 * "myService".
 * 
 * @param request
 * @return handler bean
 */
protected Object getBean(HttpServletRequest request) {
	String service = getService(request);
	Object bean = getBean(service);
	if (!(bean instanceof RemoteService)) {
		throw new IllegalArgumentException("Spring bean is not a GWT RemoteService: " + service + " (" + bean + ")");
	}
	if (LOG.isDebugEnabled()) {
	    LOG.debug("Bean for service " + service + " is " + bean);
	}
	return bean;
}
 
开发者ID:kaaproject,项目名称:avro-ui,代码行数:20,代码来源:SpringGwtRemoteServiceServlet.java

示例14: getBean

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/**
 * Determine Spring bean to handle request based on request URL, e.g. a
 * request ending in /myService will be handled by bean with name
 * "myService".
 *
 * @param request the request
 * @return handler bean
 */
protected Object getBean(HttpServletRequest request) {
  String service = getService(request);
  Object bean = getBean(service);
  if (!(bean instanceof RemoteService)) {
    throw new IllegalArgumentException("Spring bean is not a GWT RemoteService: "
        + service + " (" + bean + ")");
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("Bean for service " + service + " is " + bean);
  }
  return bean;
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:21,代码来源:SpringGwtRemoteServiceServlet.java

示例15: getAsyncType

import com.google.gwt.user.client.rpc.RemoteService; //导入依赖的package包/类
/** Returns the corresponding async service type for the given remote service type. */
private Class<?> getAsyncType(Class<? extends RemoteService> type) {
  Class<?> asyncType;
  try {
    asyncType = Class.forName(type.getCanonicalName() + "Async");
  } catch (ClassNotFoundException e) {
    throw new IllegalArgumentException(
        type.getCanonicalName() + " does not have a corresponding async interface", e);
  }
  return asyncType;
}
 
开发者ID:google,项目名称:gwtmockito,代码行数:12,代码来源:GwtMockito.java


注:本文中的com.google.gwt.user.client.rpc.RemoteService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。