开发者

How can I get GWT RequestFactory to with in a Gadget?

How can I get GWT RequestFactory to with in a Gadget?

Getting GWT-RPC to work with Gadgets is explained here.

I'm looking for a analogous solution for RequestFactory.

I tried using the GadgetsRequestBuilder, so far I've managed to get the request to the server using:

requestFactory.initialize(eventBus, new DefaultRequestTransport() {

        @Override
        protected RequestBuilder createRequestBuilder() {
            return new GadgetsRequestBuilder(RequestBuilder.POST,
                    getRequestUrl());
        }

        @Override
        public String getRequestUrl() {
            return "http://....com/gadgetRequest";
        }

    });

But I end up with the following error:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:694) at com.google.gwt.autobean.server.impl.JsonSplittable.create(JsonSplittable.java:35) at com.google.gwt.autobean.shared.impl.StringQuoter.split(StringQuoter.java:35) at com.google.gwt.autobean.shared.AutoBeanCodex.decode(AutoBeanCodex.java:520) at com.go开发者_运维问答ogle.gwt.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:121)


The general approach for sending a RequestFactory payload should be the same as RPC. You can see the payload that's being received by the server by running it with the JVM flag -Dgwt.rpc.dumpPayload=true. My guess here is that the server is receiving a request with a zero-length payload. What happens if you set up a simple test involving a GadgetsRequestBuilder sending a POST request to your server? Do you still get the same zero-length payload behavior?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜