RE: Re: Bad Status(400) returned on Android Client by the store() resource method with GAE in HTTPS instead of HTTP
Ok. bad news... it still does not work :( So, to enable a better synchronization together here is my idea... I spent some time with the serialization example provided . So, I am going to work as you based on the serializationFullSource example provided here : http://wiki.restlet.org/docs_2.0/13-restlet/181-restlet/303-restlet.html. I removed the /serialization/lib/org.restlet.android-2.0snapshort.jar Next I replaced it with the last snapshot zip provided on your site (also tested with the M7), so, with org.restlet.jar : =Bad Request Next, I just added org.restlet.ext.net : same issue=Bad Request Finally, added the java line in the onCreate of the activity example: setConnectorService().getClientProtocols().add(Protocol.HTTPS); =Still Bad Request! I don't know what is specific /serialization/lib/org.restlet.android-2.0snapshort.jar why its name differs from org.restlet.jar, but upgrading the example to a higher jar generates also a Bad Request :( To be fully synchronized, to help me understanding my issue, so also helping finally improving Restlet, You will be kind if you could repackage the serializationFullSource based on the last M7 also snapshot by attaching it in your next reply... By the way,I will be able to test it on my android emulator environment (1.6 from my side) Thx in advance, Louis -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2458215
RE: Re: Bad Status(400) returned on Android Client by the store() resource method with GAE in HTTPS instead of HTTP
YES ! it works well now ! It was... a so small error : With the Eclipse autocompletion ( :lol:... or maybe by my brain failing...), I imported : import org.restlet.engine.http.connector.HttpClientHelper; instead of : import org.restlet.ext.net.HttpClientHelper; That's all ! so many hours lost due by this line :( So, in conclusion, if developers need to bring in their app, the minimum of restlet but having it working with https, on the client: Engine.getInstance().getRegisteredClients().clear(); Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(new Client(Protocol.HTTPS))); next only add org.restlet.jar org.restlet.ext.net.jar take care to add org.restlet.ext.net.HttpClientHelper not org.restlet.engine.http.connector.HttpClientHelper as import in the code... Otherwise : it will not work in https it will generate Error 400/Bad Request it will only work in http ! Maybe, it could be added in the faq, what to verify if your client generates Error 400(bad request) in https but works correctly in http ? I really would like to thank you for your patience kindness your example helped me to investigate in a so small error -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2458297
Re: Bad Status(400) returned on Android Client by the store() resource method with GAE in HTTPS instead of HTTP
Hi Thierry, Thx a lot for your quick reply. Anyway, adding the code below in the OnCreate before all others RestLet invocations/instanciations does not resolve the issue, still having the error. so as said it works well with GAE in http but not in https :( just also apologize as it is Bad Request not Bad Status. just took a look in the debugger Did you try this example : http://wiki.restlet.org/docs_2.0/13-restlet/181-restlet/303- restlet.html?layoutType=plain by replacing http with https in the android client url to reproduce the issue. Maybe did I forgot a org.restlet.ext.? something in the server war libs ? or on the client which force the store() to fail with https but not with http ? Don't know if I am the only one having https (no authentification only, encryption) issues with restlet but maybe having the example above upgraded to 2.0 m7 also having a version with https instead of http could be interesting ? -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2457734
To be shorter in the issue faster in explanation, did you try the example in the url below ?
To sumarize to be faster on the issue: I was talking about this example in my previous post, so, did you try this example : http://wiki.restlet.org/docs_2.0/13-restlet/181-restlet/303-restlet.html but by accessing your GAE with https in the URL instead of http, it should failed like my development As said, tried with the last snapshot : same issue ! for sure after removing xstream extensions as imcompatible with GAE so by only using org.restlet defaults. As said, with the last snapshot without xstream, so with only org.restlet.jar org.restlet.ext.servlet.jar, it works well in http but not in https :( thx in advance for your clarification. really don't understand why the android client receives a bad status exception in https when sending a store() command to the Google AppEngine restlet servlet :( -- http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=2457617
RE: Re: Bad Status(400) returned on Android Client by the store() resource method with GAE in HTTPS instead of HTTP
Arg, I really dont' understand why... but still having the issue, continues to work in html but not in https :( Did you try on a deployed instance of your webserver on the GAE appspot server ? the only jar used on my android client is org.restlet.jar I also put in the onCreate of my activity this as you recommended : getConnectorService().getClientProtocols().add(Protocol.FILE); getConnectorService().getClientProtocols().add(Protocol.HTTP); getConnectorService().getClientProtocols().add(Protocol.HTTPS); On the server, as said, I use also only org.restlet.jar org.restlet.jar, org.restlet.ext.servlet are put in the war here is my servlet application instansciation below... I also attached the web.xml in this post... as you will see my only differences are in the web.xml the servlet routing... all the other code is really similar to the example provided for android/gae implementation. I really would like in advance to thank each of you for providing an expert look/eye. Louis Servlet routing: package name.lecaroz.google.fleet.app.server.restlet; import java.io.File; import org.restlet.Application; import org.restlet.Component; import org.restlet.Restlet; import org.restlet.data.LocalReference; import org.restlet.data.Protocol; import org.restlet.resource.Directory; import org.restlet.routing.Router; public class RestLetApplication extends Application { /** * When launched as a standalone application. * * @param args * @throws Exception */ /* public static void main(String[] args) throws Exception { Component component = new Component(); component.getClients().add(Protocol.FILE); component.getServers().add(Protocol.HTTP, 8081); component.getDefaultHost().attach(new RestLetApplication()); component.start(); } @Override public Restlet createInboundRoot() { Router router = new Router(getContext()); getConnectorService().getClientProtocols().add(Protocol.FILE); // Serve the files generated by the GWT compilation step. File warDir = new File(); if (!war.equals(warDir.getName())) { warDir = new File(warDir, war/); } Directory dir = new Directory(getContext(), LocalReference .createFileReference(warDir)); router.attachDefault(dir); router.attach(/RestLet/ShipLocation, ShipLocationServerResource.class); return router; } */ /** * Creates a root Restlet that will receive all incoming calls. */ @Override public synchronized Restlet createInboundRoot() { getConnectorService().getClientProtocols().add(Protocol.FILE); getConnectorService().getClientProtocols().add(Protocol.HTTP); getConnectorService().getClientProtocols().add(Protocol.HTTPS); // Create a router Restlet that routes each call to a // new Resource Router router = new Router(getContext()); router.attachDefault(ShipLocationServerResource.class); return router; } }?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app context-param param-nameorg.restlet.clients/param-name param-valueCLAP FILE HTTP HTTPS/param-value /context-param !-- Servlets -- servlet servlet-namegreetServlet/servlet-name servlet-classname.lecaroz.google.fleet.app.server.GreetingServiceImpl/servlet-class /servlet servlet-mapping servlet-namegreetServlet/servlet-name url-pattern/googlefleet/greet/url-pattern /servlet-mapping !-- Default page to serve -- welcome-file-list welcome-fileGoogleFleet.html/welcome-file /welcome-file-list servlet servlet-namerestlet/servlet-name servlet-classorg.restlet.ext.servlet.ServerServlet/servlet-class init-param param-nameorg.restlet.application/param-name param-valuename.lecaroz.google.fleet.app.server.restlet.RestLetApplication/param-value /init-param /servlet servlet-mapping servlet-namerestlet/servlet-name url-pattern/RestLet/*/url-pattern /servlet-mapping !-- security-constraint web-resource-collection url-pattern/RestLet/*/url-pattern /web-resource-collection auth-constraint role-name*/role-name /auth-constraint /security-constraint -- /web-app