new Login((SystemCallAPI)Kernel.this);
}
public void thirdPartyCallHandler()
{
MHTTPServer mhttpServer = new MHTTPServer();
mhttpServer.registerService("/*", new Servlet()
{
public void serve(final TransactionContext context) {
Log.debug("received : "+ context.getRequest().getText());
String contentType = context.getRequest().getHeader("Content-Type");
boolean base64Data = Boolean.parseBoolean(context.getRequest().getHeader("Base64Contnet"));
String origin = context.getRequest().getHostname();
Log.debug("calling relay for message sent from " + origin + " to path " + context.getRequest().getPath() );
Proxy.getProxy(true).relay(context.getRequest().getPath(), context.getRequest().getText(), contentType, base64Data, origin, new AsyncCallback<Response>()
{
public void onSuccess(Response result)
{
com.openmashupos.mhttpserver.client.Response response = new com.openmashupos.mhttpserver.client.Response();
response.setText("" + result.getText());
Log.debug("relaying the response from server back : " + result.getText());
context.respond(response);
}
public void onFailure(Throwable caught)
{
Log.error("Exception during relaying .. Todo:"); // TODO: relay back the exception
}
}
);
}
});
mhttpServer.run();
}