2011-06-14 75 views

回答

0

您可以編寫自己的HTTP請求,例如使用HTTPURLConnection。您可以在此處設置請求方法,並根據適當的方式更改網址或/和正文。

URL url = new URL("http://www.example.com/resource"); 
    HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 
    connection.setRequestMethod("GET"); 
    // etc 

這樣您就可以使用標準的java.net API。

1

您可以使用commons-httpclient庫(http://hc.apache.org/httpcomponents-client-ga/)向您的REST服務和gson(http://code.google.nl/)提出請求。 COM/p /谷歌GSON /)序列化/反序列化的Java對象,JSON

0

你並不需要使用Jersey客戶端,它只是一個網址,你可以使用:

new URL("http://locationofservice").openConnection();