我正在为 android 做一个休息客户端并使用restlet。
因此,当我运行我的应用程序时,我得到 404 错误 - 尝试存储我的数据时未找到。我的启动并运行正常。
package com.example.app;
import org.restlet.resource.ClientResource;
import android.util.Log;
import com.example.app.models.Accounts;
import com.example.app.models.AccountsResource;
public class ServerConection {
private AccountsResource resource;
public ServerConection(){
ClientResource cr = new ClientResource("http://192.168.1.2:8080/api/accounts/");
resource = cr.wrap(AccountsResource.class);
}
public void send(Accounts account){
resource.store(account);
}
}
public interface AccountsResource {
@Get
public Accounts retrieve();
@Put
public void store(Accounts account);
@Delete
public void remove();
}
日志猫
10-18 19:55:12.658: E/AndroidRuntime(10290): FATAL EXCEPTION: Timer-0
10-18 19:55:12.658: E/AndroidRuntime(10290): Not Found (404) - Not Found
10-18 19:55:12.658: E/AndroidRuntime(10290): at org.restlet.resource.ClientResource$1.invoke(ClientResource.java:1663)
10-18 19:55:12.658: E/AndroidRuntime(10290): at $Proxy4.store(Native Method)
10-18 19:55:12.658: E/AndroidRuntime(10290): at com.example.app.ServerConection.send(ServerConection.java:26)
10-18 19:55:12.658: E/AndroidRuntime(10290): at com.example.app.AccountIntentService.sendAccount(AccountIntentService.java:56)
10-18 19:55:12.658: E/AndroidRuntime(10290): at com.example.app.AccountIntentService.access$1(AccountIntentService.java:55)
10-18 19:55:12.658: E/AndroidRuntime(10290): at com.example.app.AccountIntentService$2.run(AccountIntentService.java:44)
10-18 19:55:12.658: E/AndroidRuntime(10290): at java.util.Timer$TimerImpl.run(Timer.java:284)