2010-08-12 1 views
4

내가 쓴 REST 서비스에 대한 간단한 클라이언트를 만드는 동안 smartGWT의 RestDataSource 클래스가 이해할 수있는 XML 유형으로 제한된다는 것을 알았다. 모든 REST 자원은 .. 다음과 같은 형식의 XML로 만 변형이 someField/someOtherField 태그입니다SmartGWT에서 REST 서비스 사용하기

<response> 
    <status>0</status> 
    <startRow>0</startRow> 
    <endRow>10</endRow> 
    <totalRows>50</totalRows> 
    <data> 
     <record> 
      <someField>value</someField> 
      <someOtherField>value</someOtherField> 
     </record> 
     <record> 
      <someField>value</someField> 
      <someOtherField>value</someOtherField> 
     </record> 
     ... 
    </data> 
</response> 

을 ... 응답해야합니다.

이 구조는 이름/값 쌍보다 조금 더 작지만 우리에게는 효과가 없습니다. 나는 다음 SmartGWT 쇼케이스에서이 데모를보고

...

과 같이 디스플레이에 대한 임의의 형식으로 XML을 소비하는 방법을 보여줍니다

http://www.smartclient.com/smartgwtee/showcase/#data_integration_server_rss

...

package com.smartgwt.sample.showcase.client.webservice; 

import com.smartgwt.client.data.DataSource; 
import com.smartgwt.client.data.fields.DataSourceTextField; 
import com.smartgwt.client.data.fields.DataSourceLinkField; 
import com.smartgwt.client.widgets.Canvas; 
import com.smartgwt.client.widgets.grid.ListGrid; 
import com.smartgwt.sample.showcase.client.PanelFactory; 
import com.smartgwt.sample.showcase.client.ShowcasePanel; 

public class RssSample implements EntryPoint { 

    public void onModuleLoad() { 
     DataSource dataSource = new DataSource(); 
     dataSource.setDataURL("http://rss.slashdot.org/Slashdot/slashdot"); 
     dataSource.setRecordXPath("//default:item"); 

     DataSourceTextField titleField = new DataSourceTextField("title", "Title"); 
     DataSourceLinkField linkField = new DataSourceLinkField("link", "Link"); 

     dataSource.setFields(titleField, linkField); 

     ListGrid grid = new ListGrid(); 
     grid.setAutoFetchData(true); 
     grid.setHeight(200); 
     grid.setWidth100(); 
     grid.setDataSource(dataSource); 

     grid.draw(); 
    } 

} 

이를 GET은 잘되지만 PUT, POST 및 DELETE는 어떻습니까?

누구나 일부 코드를 공유하거나 SmartGWT 클라이언트에서 다른 RESTful 작업을 수행하는 방법을 보여주는 리소스를 가리킬 수 있습니까?

감사

답변