Package com.zaranux.os.client.programs

Source Code of com.zaranux.os.client.programs.ThirdPartyApp

package com.zaranux.os.client.programs;

import com.openmashupos.core.client.Mashlet;
import com.zaranux.os.client.core.Program;
import com.zaranux.os.client.util.Log;
import com.google.gwt.http.client.URL;

public class ThirdPartyApp extends Program {

  public ThirdPartyApp(String[] args)
  {
    this.args = args;
  }
  @Override
  protected void main(String[] args) {
    if(args.length <1)
    {
      Log.error("ThirdPartyApp.java: Application url is missing in the argument list");
      super.end();
      return;
    }
    String url = args[0];
    if(args.length >1)
      url += "?" + URL.encodeComponent(args[1]);
    for(int i = 2; i<args.length ; i++)
      url += "&" + URL.encodeComponent(args[i]);
    int protocolLen = 7; // http://
    if(url.startsWith("https"))
      protocolLen = 8;
    int slashIndex = url.indexOf('/', protocolLen + 1);
    this.setTitle((slashIndex>0) ? url.substring(protocolLen, slashIndex) : url.substring(protocolLen)); // domain name
    Mashlet mashlet = new Mashlet(url);
    setWidget(mashlet,400,350);
   
  }

}
TOP

Related Classes of com.zaranux.os.client.programs.ThirdPartyApp

TOP
Copyright © 2018 www.massapi.com. 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.