Package com.google.gwt.user.client.rpc

Examples of com.google.gwt.user.client.rpc.RpcToken


    @Test public void testValidateXsrfToken() {
        IXsrfTokenService xsrfTokenService = mock(IXsrfTokenService.class);
        SecuredServiceExporter exporter = new SecuredServiceExporter(false, null);
        exporter.setXsrfTokenService(xsrfTokenService);

        RpcToken token = mock(RpcToken.class);
        exporter.validateXsrfToken(token);
        verify(xsrfTokenService).validateXsrfToken(token);
    }
View Full Code Here


            service.validateXsrfToken((RpcToken) null);
            fail("Expected RpcTokenException");
        } catch (RpcTokenException e) { }

        try {
            RpcToken token = mock(RpcToken.class);
            service.validateXsrfToken(token);
            fail("Expected RpcTokenException");
        } catch (RpcTokenException e) { }

        try {
            XsrfToken token = mock(XsrfToken.class);
            when(token.getToken()).thenReturn("blech");
            service.validateXsrfToken((RpcToken) token);
            fail("Expected RpcTokenException");
        } catch (RpcTokenException e) { }

        XsrfToken token = mock(XsrfToken.class);
        when(token.getToken()).thenReturn(GwtCookieXsrfTokenService.generateTokenFromCookie("value"));
        service.validateXsrfToken((RpcToken) token);
    }
View Full Code Here

    try {
      ServerSerializationStreamReader streamReader =
          new ServerSerializationStreamReader(classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      RpcToken rpcToken = null;
      if (streamReader.hasFlags(AbstractSerializationStream.FLAG_RPC_TOKEN_INCLUDED)) {
        // Read the RPC token
        rpcToken = (RpcToken) streamReader.deserializeValue(RpcToken.class);
      }
View Full Code Here

    HttpServletRequest req = getThreadLocalRequest();
   
    if (req.getParameter("throw") != null) {
      throw new RpcTokenException("This is OK. Testing RpcTokenException handler.");
    } else {
      RpcToken token = rpcRequest.getRpcToken();
      req.setAttribute(TOKEN, token);
    }
  }
View Full Code Here

  }
 
  @Override
  public RpcToken getRpcTokenFromRequest() {
    HttpServletRequest req = getThreadLocalRequest();
    RpcToken token = (RpcToken) req.getAttribute(RpcTokenAwareRemoteService.TOKEN);
    return token;
  }
View Full Code Here

    try {
      ServerSerializationStreamReader streamReader =
          new ServerSerializationStreamReader(classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      RpcToken rpcToken = null;
      if (streamReader.hasFlags(AbstractSerializationStream.FLAG_RPC_TOKEN_INCLUDED)) {
        // Read the RPC token
        rpcToken = (RpcToken) streamReader.deserializeValue(RpcToken.class);
      }
View Full Code Here

    try {
      ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
          classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      RpcToken rpcToken = null;
      if (streamReader.hasFlags(AbstractSerializationStream.FLAG_RPC_TOKEN_INCLUDED)) {
        // Read the RPC token
        rpcToken = (RpcToken) streamReader.deserializeValue(RpcToken.class);
      }
           
View Full Code Here

    try {
      ServerSerializationStreamReader streamReader = new ServerSerializationStreamReader(
          classLoader, serializationPolicyProvider);
      streamReader.prepareToRead(encodedRequest);

      RpcToken rpcToken = null;
      if (streamReader.hasFlags(AbstractSerializationStream.FLAG_RPC_TOKEN_INCLUDED)) {
        // Read the RPC token
        rpcToken = (RpcToken) streamReader.deserializeValue(RpcToken.class);
      }
           
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.rpc.RpcToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.