簡體   English   中英

smartGWT rpc的服務器端訪問數據

[英]Server side access data for smartGWT rpc

在服務器端,我想知道如何從SmartGwt訪問RPCRequest中使用的數據。

這是SmartGwt客戶端代碼:

  private void update() {
        RPCRequest request = new RPCRequest();
        request.setData("RPC text from client");
        request.setActionURL("/Empi-MT/resources/empi/update");
        request.setContentType("text/xml");

        RPCManager.sendRequest(request,
            new RPCCallback() {

                public void execute(RPCResponse response, Object obj, RPCRequest request) {
                    SC.say("Response from the server:" + obj);
                }
            });
    }

這是RESTful Java服務器代碼。

    @POST
    @Consumes("text/xml")
    @Produces("text/xml")
    @Path("/update")
    public String update() {
        return "We got to here";
    }

這個簡單的代碼可以正常工作,但是現在我需要知道如何訪問RPCRequest中的數據。 如何在服務器代碼中做到這一點?

謝謝,

您看起來好像朝着錯誤的方向前進; 如果此“更新”操作是對某些對象的CRUD操作,則要使用DataSources-查看“數據集成”的“快速入門”概述,重點是RestDataSource。

http://www.smartclient.com/releases/SmartGWT_Quick_Start_Guide.pdf

另外,您似乎正在開始使用生成的REST服務,這幾乎總是錯誤的-請參閱以下常見問題解答:

http://forums.smartclient.com/showthread.php?t=8159#aExistingRest

最后,如果這真的不是CRUD操作,則要在RPCRequest上設置useSimpleHttp,然后此屬性的文檔說明可以發送數據的不同方式。

http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/rpc/RPCRequest.html#getUseSimpleHttp ()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM