我是 Restlet 开发的新手,尝试添加标头来执行 HTTP 请求。我尝试了以下代码,但得到“400 bad request, header is not valid”
String url = "http://xxxxx";
Client c = new Client(Protocol.HTTP);
Request request = new Request(Method.GET, url);
HashMap attributes = new HashMap();
attributes.put = ("DeviceID", "myDeviceID");
attributes.put = ("Centent-Type", "myCT");
attributes.put = ("User-Agent", "my user agent");
attributes.put = ("ClientID", "myCid");
request.setAttributes(attributes);
Response r =c.handle(request);
我正在使用 Restlet 2.0。请帮忙。任何示例代码都会有很大帮助。提前致谢。KC