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


Java ServiceDefTarget类代码示例

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


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

示例1: initXsrfProtection

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
private void initXsrfProtection(final LoginWindow loginWindow)
{
    XsrfTokenServiceAsync xsrf = (XsrfTokenServiceAsync)GWT.create(XsrfTokenService.class);
    ((ServiceDefTarget)xsrf).setServiceEntryPoint(GWT.getModuleBaseURL() + "xsrf");
    xsrf.getNewXsrfToken(new AsyncCallback<XsrfToken>() {
        @Override
        public void onSuccess(XsrfToken token)
        {
            ServiceHelper.setXsrfToken(token);
            doGetLoggedInUser(loginWindow);
        }
        @Override
        public void onFailure(Throwable caught)
        {
            WebPasswordSafe.handleServerFailure(caught);
        }
    });
}
 
开发者ID:alfameCom,项目名称:salasanasiilo,代码行数:19,代码来源:WebPasswordSafe.java

示例2: testRemoteService

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
public void testRemoteService() {
  MyAppGinjector injector = GWT.create(MyAppGinjector.class);

  // A remote service proxy
  MyRemoteServiceAsync service = injector.getMyRemoteServiceAsync();

  // Make sure that the returned object is a service proxy generated by GWT
  Object gwtCreatedService = GWT.create(MyRemoteService.class);
  assertEquals(gwtCreatedService.getClass(), service.getClass());

  // Make sure that the @RemoteServiceRelativePath annotation worked
  assertEquals(GWT.getModuleBaseURL() + "myRemoteService",
      ((ServiceDefTarget) service).getServiceEntryPoint());

  // Make sure that we always return the same instance
  assertSame(service, injector.getMyRemoteServiceAsync());
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:18,代码来源:InjectTest.java

示例3: getClassesToImport

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
String[] getClassesToImport() {
  return new String[] { com.mvp4g.client.history.PlaceService.class.getName(),
                        GWT.class.getName(),
                        com.google.gwt.user.client.History.class.getName(),
                        ServiceDefTarget.class.getName(),
                        PresenterInterface.class.getName(),
                        EventBus.class.getName(),
                        Mvp4gException.class.getName(),
                        HistoryConverter.class.getName(),
                        Mvp4gEventPasser.class.getName(),
                        Mvp4gModule.class.getName(),
                        GinModules.class.getName(),
                        Ginjector.class.getName(),
                        BaseEventBus.class.getName(),
                        EventFilter.class.getName(),
                        EventHandlerInterface.class.getName(),
                        List.class.getName(),
                        NavigationEventCommand.class.getName(),
                        NavigationConfirmationInterface.class.getName(),
                        RunAsyncCallback.class.getName(),
                        Mvp4gRunAsync.class.getName(),
                        Command.class.getName(),
                        HistoryProxyProvider.class.getName(),
                        DefaultHistoryProxy.class.getName() };
}
 
开发者ID:mvp4g,项目名称:mvp4g,代码行数:26,代码来源:Mvp4gGenerator.java

示例4: testGetDomainTree

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
public void testGetDomainTree() {
	// Create the service that we will test.
	AtomServiceAsync atomService = GWT.create(AtomService.class);
	ServiceDefTarget target = (ServiceDefTarget) atomService;
	target.setServiceEntryPoint(GWT.getModuleBaseURL() + "ATOM/rpc");

	// Since RPC calls are asynchronous, we will need to wait for a response
	// after this test method returns. This line tells the test runner to
	// wait
	// up to 10 seconds before timing out.
	delayTestFinish(Integer.MAX_VALUE);

	atomService.getDomainTree(authBackDoor, new AsyncCallback<DomainClass>() {

		public void onFailure(Throwable caught) {
			fail("Request failure: " + caught.getMessage());
		}

		public void onSuccess(DomainClass result) {
			assertEquals(result.getName(), domainObjectClassName);
			finishTest();
		}
	});
}
 
开发者ID:fhcampuswien,项目名称:atom,代码行数:25,代码来源:GwtTestATOM.java

示例5: CalendarProvider

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
public CalendarProvider() {
  // Initialize the service.
  //
  calService = (SchoolCalendarServiceAsync) GWT.create(SchoolCalendarService.class);

  // By default, we assume we'll make RPCs to a servlet, but see
  // updateRowData(). There is special support for canned RPC responses.
  // (Which is a totally demo hack, by the way :-)
  // 
  ServiceDefTarget target = (ServiceDefTarget) calService;

  // Use a module-relative URLs to ensure that this client code can find
  // its way home, even when the URL changes (as might happen when you
  // deploy this as a webapp under an external servlet container).
  String moduleRelativeURL = GWT.getModuleBaseURL() + "calendar";
  target.setServiceEntryPoint(moduleRelativeURL);
}
 
开发者ID:Peergos,项目名称:Peergos,代码行数:18,代码来源:SchoolCalendarWidget.java

示例6: testGreetingService

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
/**
 * This test will send a request to the server using the greetServer method in
 * GreetingService and verify the response.
 */
public void testGreetingService() {
  // Create the service that we will test.
  GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
  ServiceDefTarget target = (ServiceDefTarget) greetingService;
  target.setServiceEntryPoint(GWT.getModuleBaseURL() + "EssenceFrontEnd/greet");

  // Since RPC calls are asynchronous, we will need to wait for a response
  // after this test method returns. This line tells the test runner to wait
  // up to 10 seconds before timing out.
  delayTestFinish(10000);

  // Send a request to the server.
  greetingService.greetServer("GWT User", new AsyncCallback<String>() {
    public void onFailure(Throwable caught) {
      // The request resulted in an unexpected error.
      fail("Request failure: " + caught.getMessage());
    }

    public void onSuccess(String result) {
      // Verify that the response is correct.
      assertTrue(result.startsWith("Hello, GWT User!"));

      // Now that we have received a response, we need to tell the test runner
      // that the test is complete. You must call finishTest() after an
      // asynchronous test finishes successfully, or the test will time out.
      finishTest();
    }
  });
}
 
开发者ID:dpinney,项目名称:essence,代码行数:34,代码来源:GwtTestEssenceFrontEnd.java

示例7: getRPCService

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
public static RPCServiceAsync getRPCService() {
	RPCServiceAsync rpcService = (RPCServiceAsync) GWT.create(RPCService.class);
	ServiceDefTarget endpoint = (ServiceDefTarget) rpcService;        
	ClientFactory clientFactory = GWT.create(ClientFactory.class);
       EventBus eventBus = clientFactory.getEventBus();
	String rpcURL = "";
	String base_path = URLUtil.getBaseURL();
	rpcURL = base_path + "rpc";
	endpoint.setServiceEntryPoint(rpcURL);
	return rpcService;
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:12,代码来源:Util.java

示例8: makeRemoteLogHandler

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
public static Handler makeRemoteLogHandler(String remoteLoggingPath) {
    RemoteLoggingServiceAsync service = GWT.create(RemoteLoggingService.class);
    ((ServiceDefTarget) service).setServiceEntryPoint(remoteLoggingPath);
    Handler handler = GWT.create(XLoggerRemoteHandler.class);
    if (handler instanceof XLoggerRemoteHandler) {
        ((XLoggerRemoteHandler) handler).setService(service);
    }
    return handler;
}
 
开发者ID:spirylics,项目名称:x-gwt,代码行数:10,代码来源:XLoggerFactory.java

示例9: getRemoteServieAsyncObject

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
/**
 * Allows to allocate the remote service object
 * @param classObj the service class object for instantiation
 * @param URL_SUFFIX the url-suffix on the server t send the requests to
 * @return returns the remote service object
 */
public static <R> R getRemoteServieAsyncObject( R remoteService, final String URL_SUFFIX ) {
	ServiceDefTarget endpoint = (ServiceDefTarget) remoteService;
	String moduleRelativeURL = GWT.getModuleBaseURL() + URL_SUFFIX;
	endpoint.setServiceEntryPoint( moduleRelativeURL );
	
	return remoteService;
}
 
开发者ID:ivan-zapreev,项目名称:x-cure-chat,代码行数:14,代码来源:RPCAccessManager.java

示例10: getAsyncService

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
protected GreetingServiceAsync getAsyncService() {
	GreetingServiceAsync greetingService = GWT
			.create(GreetingService.class);
	ServiceDefTarget target = (ServiceDefTarget) greetingService;
	target.setServiceEntryPoint(GWT.getModuleBaseURL() + "spawebtest/greet");
	return greetingService;
}
 
开发者ID:jcricket,项目名称:gwt-syncproxy,代码行数:8,代码来源:GreetingServiceTest.java

示例11: handleServiceDefTarget

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
/**
 * Handles method invocations to the {@link ServiceDefTarget} interface
 * implemented by the service.
 */
protected Object handleServiceDefTarget(Object proxy, Method method,
		Object[] args) throws Throwable {
	if (ServiceDefTarget.class.getMethod("getSerializationPolicyName")
			.equals(method)) {
		return this.settings.getPolicyName();
	} else if (ServiceDefTarget.class.getMethod("setServiceEntryPoint",
			String.class).equals(method)) {
		this.serviceEntryPoint = (String) args[0];
		// Modify current base and relative Path to newly specific
		// serviceEntryPoint assuming that base path is part of
		// serviceEntryPoint
		// TODO May not be a valid assumption
		if (this.serviceEntryPoint.contains(this.settings
				.getModuleBaseUrl())) {
			this.settings
					.setRemoteServiceRelativePath(this.serviceEntryPoint
							.split(this.settings.getModuleBaseUrl())[1]);
		} else {
			this.logger.warning("Unable to determine base (orig: "
					+ this.settings.getModuleBaseUrl() + ") against: "
					+ this.serviceEntryPoint);
			throw new SyncProxyException(
					determineProxyServiceBaseInterface(proxy),
					InfoType.SERVICE_BASE_DELTA);
		}
		return null;
	} else if (ServiceDefTarget.class.getMethod("getServiceEntryPoint")
			.equals(method)) {
		return this.serviceEntryPoint;
	}
	// TODO handle all methods
	throw new MethodNotSupportedException("Method: " + method.getName()
			+ " in class: " + method.getDeclaringClass().getName()
			+ " not defined for class: " + proxy.getClass().getName());
}
 
开发者ID:jcricket,项目名称:gwt-syncproxy,代码行数:40,代码来源:RemoteServiceInvocationHandler.java

示例12: newProxyInstance

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
/**
 * @deprecated since 0.5, {@link #createProxy(Class, ProxySettings)} with
 *             {@link ProxySettings#setRemoteServiceRelativePath(String)},
 *             {@link ProxySettings#setCookieManager(CookieManager)},
 *             {@link ProxySettings#policyName}, and
 *             {@link ProxySettings#setWaitForInvocation(boolean)}
 */
@Deprecated
@SuppressWarnings("unchecked")
public static <ServiceIntf> ServiceIntf newProxyInstance(
		Class<ServiceIntf> serviceIntf, String moduleBaseURL,
		String serverBaseUrl, String remoteServiceRelativePath,
		String policyName, CookieManager cookieManager,
		boolean waitForInvocation) {
	if (cookieManager == null) {
		cookieManager = DEFAULT_COOKIE_MANAGER;
	}

	if (policyName == null) {
		try {
			POLICY_MAP.putAll(RpcPolicyFinder
					.fetchSerializationPolicyName(moduleBaseURL));
			policyName = POLICY_MAP.get(serviceIntf.getName());
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
	ServiceIntf i = (ServiceIntf) Proxy.newProxyInstance(SyncProxy.class
			.getClassLoader(), new Class[] { serviceIntf,
			ServiceDefTarget.class, HasRpcToken.class,
			SerializationStreamFactory.class },
			new RemoteServiceInvocationHandler(serverBaseUrl,
					remoteServiceRelativePath, policyName, cookieManager,
					waitForInvocation));
	return i;
}
 
开发者ID:jcricket,项目名称:gwt-syncproxy,代码行数:37,代码来源:SyncProxy.java

示例13: getServiceAsync

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
private MapTestServiceAsync getServiceAsync() {
    if (customFieldSerializerTestService == null) {
        customFieldSerializerTestService =
                (MapTestServiceAsync) GWT.create(MapTestService.class);
        ((ServiceDefTarget) customFieldSerializerTestService)
                .setServiceEntryPoint(GWT.getModuleBaseURL() + "map");
    }
    return customFieldSerializerTestService;
}
 
开发者ID:google,项目名称:FreeBuilder,代码行数:10,代码来源:MapTest.java

示例14: getServiceAsync

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
private NestedListTestServiceAsync getServiceAsync() {
    if (customFieldSerializerTestService == null) {
        customFieldSerializerTestService =
                (NestedListTestServiceAsync) GWT.create(NestedListTestService.class);
        ((ServiceDefTarget) customFieldSerializerTestService)
                .setServiceEntryPoint(GWT.getModuleBaseURL() + "nested-list");
    }
    return customFieldSerializerTestService;
}
 
开发者ID:google,项目名称:FreeBuilder,代码行数:10,代码来源:NestedListTest.java

示例15: getServiceAsync

import com.google.gwt.user.client.rpc.ServiceDefTarget; //导入依赖的package包/类
private StringListTestServiceAsync getServiceAsync() {
    if (customFieldSerializerTestService == null) {
        customFieldSerializerTestService =
                (StringListTestServiceAsync) GWT.create(StringListTestService.class);
        ((ServiceDefTarget) customFieldSerializerTestService)
                .setServiceEntryPoint(GWT.getModuleBaseURL() + "string-list");
    }
    return customFieldSerializerTestService;
}
 
开发者ID:google,项目名称:FreeBuilder,代码行数:10,代码来源:StringListTest.java


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