Hi,
I've created a simple gwt-restlet testproject.
Snippet from the server which runs on localhost port 28080
@Override
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/crm/organisaties/kristalsoftware",
OrganisatieServerResource.class);
return router;
}
When I type http://localhost:28080/crm/organisaties/kristalsoftware in Firefox,
then I see the expected result.
GET /crm/organisaties/kristalsoftware HTTP/1.1
Host: localhost:28080
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.9)
Gecko/20100315 Firefox/3.5.9
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.1 200 OK
Transfer-Encoding: chunked
Date: Fri, 02 Jul 2010 12:38:29 GMT
Accept-Ranges: bytes
Server: Restlet-Framework/2.0rc4
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
Content-Type: application/x-java-serialized-object+gwt; charset=UTF-8
----------------------------------------------------------
The serverlog shows also the expected lines:
Jul 2, 2010 2:37:53 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2010-07-02 14:37:53 0:0:0:0:0:0:0:1%0 - -
28080 GET /crm/organisaties/kristalsoftware - 200 -
0 459 http://localhost:28080 Mozilla/5.0 (Macintosh; U; Intel Mac OS
X 10.6; en-US; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9 -
But when I make the call from within the gwt client, then the client throws an
exception and I see no GET but an OPTIONS method which is not supported by my
serverimplementation.
Jul 2, 2010 1:47:48 PM org.restlet.engine.log.LogFilter afterHandle
INFO: 2010-07-02 13:47:48 0:0:0:0:0:0:0:1%0 - -
28080 OPTIONS /crm/organisaties/kristalsoftware - 405 323
0 62 http://localhost:28080 Mozilla/5.0 (Macintosh; U; Intel Mac OS
X 10.6; en-US; rv:1.9.1.9) Gecko/20100315 Firefox/3.5.9 -
My question is: Where does that OPTIONS method comes from ?
<snippet from my client>
package nl.kristalsoftware.crudrest.client;
import org.restlet.client.resource.ClientProxy;
import org.restlet.client.resource.Delete;
import org.restlet.client.resource.Get;
import org.restlet.client.resource.Put;
import org.restlet.client.resource.Result;
public interface OrganisatieResourceProxy extends ClientProxy {
@Get
public void retreive(Result<OrganisatieData> callback);
@Put
public void store(OrganisatieData data, Result<OrganisatieData>
callback);
@Delete
public void remove(Result<OrganisatieData> callback);
}
organisatieResource.getClientResource().setReference("http://localhost:28080/crm/organisaties/kristalsoftware");
organisatieResource.getClientResource().getClientInfo().getAcceptedMediaTypes().add(new
Preference<MediaType>(MediaType.APPLICATION_JAVA_OBJECT_GWT));
organisatieResource.retreive(new Result<OrganisatieData>() {
...
}
The Exception:
Internal Connector Error (1002) - (NS_ERROR_NOT_AVAILABLE): Component returned
failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.statusText]
QueryInterface: function QueryInterface() {
[native code]
}
result: 2147746065
filename: http://127.0.0.1:8888
lineNumber: 30
columnNumber: 0
inner: null
data: null
initialize: function initialize() {
[native code]
}
at
nl.kristalsoftware.crudrest.client.OrganisatieResourceProxyProxy$3.handle(OrganisatieResourceProxyProxy.java:87)
at
org.restlet.client.engine.http.adapter.ClientAdapter$1.handle(ClientAdapter.java:102)
at
org.restlet.client.engine.http.GwtClientCall$2.onResponseReceived(GwtClientCall.java:245)
at
com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
at
com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:393)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at
com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
at
com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
at
com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
at
com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
at
com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at
com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at
com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at
com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
at java.lang.Thread.run(Thread.java:637)
Do I miss something here ?
Any help is much appreciated
Regards
Sjoerd
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2629096