Hi,
I had some working application
Android/GWT client and GAE server. After upgrading my android version on my
smartphone the android client stopped working however GWT still working until
now.
I used last production version(GWT/GAE/Restlet) that was distributed more than
2 years ago.
Today i would like to fix the problem in Android client, but i get 400 Bad
Request.
I went over many documentation, forums, discussions, migration from restlet 1
to 2 with many possible solution, but nothing didn't work for me.
Please find below my code and i will appreciate if you can point me to the
resolution or can i try to make it working. Let me know if you need more
information of my app. Thank you!
Current versions:
Restlet: 2.0.15
GAE: 1.7.3
GWT: 2.4
************************************************************************************
ANDROID CLIENT:
public interface NoteResource
{
@Get
public NoteList retrieve(String userID);
@Put
public void store(SafeNote note);
@Delete
public void remove(String noteID);
}
Some code from the main class where i do invocation of the method
Engine.getInstance().getRegisteredClients().clear();
Engine.getInstance().getRegisteredClients().add(new
org.restlet.ext.net.HttpClientHelper(null));
ClientResource clientResource = new
ClientResource("http://someapp.appspot/note/get/" + userID);
noteResource = clientResource.wrap(NoteResource.class);
noteList = noteResource.retrieve(signedUser);
******************************************************************************************************************************
GAE SERVER
public class NoteApplication extends Application
{
private static final Logger logger =
Logger.getLogger(NoteApplication.class.getName());
/**
* 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, 8080);
component.getDefaultHost().attach(new NoteApplication());
component.start();
}
@Override
public synchronized 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("/note", NoteResourceImpl.class);
router.attach("/note/login", NoteResourceImpl.class);
TemplateRoute routeGet = router.attach("/note/get/{userID}",
NoteResourceImpl.class);
TemplateRoute routeDelete = router.attach("/note/delete/{NoteID}",
NoteResourceImpl.class);
Map<String, Variable> routeVariables =
routeGet.getTemplate().getVariables();
routeVariables.put("userID", new
Variable(Variable.TYPE_URI_QUERY_PARAM));
routeVariables = routeDelete.getTemplate().getVariables();
routeVariables.put("safeNoteID", new
Variable(Variable.TYPE_URI_QUERY_PARAM));
return router;
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=3027743