Package com.openmashupos.mhttpserver.client

Examples of com.openmashupos.mhttpserver.client.MHTTPServer


      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();
  }
View Full Code Here

TOP

Related Classes of com.openmashupos.mhttpserver.client.MHTTPServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.