Re: jc and proxy

"Pierre Gilquin" <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
I used the following code in my main class :

     Properties pro = System.getProperties();
     boolean hasProxy = false;
     String proxy = pro.getProperty("proxySet");
     if (proxy != null && proxy.equals("true")) hasProxy = true;
     if (hasProxy)
        EOClientApplicationSupport.main(proxyArgsFromArgs(args));
      else
        EOClientApplicationSupport.main(args);


where proxyArgsFromArgs is defined by :

  private static String[] proxyArgsFromArgs(String[] args)
  {
          String applicationURL = "";
          int argsLength = args.length;
          int appURLIndex = 0;
          for (int i = 0; i < argsLength; ++i)
          {
            if (args[i].equals("-applicationURL")) {
              applicationURL = args[i + 1];
              appURLIndex = i + 1;
            }
          }

          if (appURLIndex == 0)
          {
            System.out.println("Missing -applicationURL argument. 
Exiting.");
            System.exit(1);
          }

          String restOfURL;
          String protocolEnd = "://";
          int startIndex = applicationURL.indexOf(protocolEnd);
          startIndex += protocolEnd.length();
          protocol = applicationURL.substring(0, startIndex);
          int endIndex = applicationURL.indexOf("/", startIndex);
          _host = applicationURL.substring(startIndex, endIndex);
          restOfURL = applicationURL.substring(endIndex,
                                                                             
              applicationURL.length());

          String hostName;
          int portNumber;
          endIndex = _host.indexOf(":");
          if (endIndex == -1)
          {
                  hostName = _host;
                  portNumber = 80;
          }
          else
          {
                  hostName = _host.substring(0, endIndex);
                  portNumber = Integer.valueOf(_host.substring(endIndex + 1,
                  _host.length())).intValue();
          }

          TCPProxy proxy = null;
          try {
                  proxy = new TCPProxy(hostName, portNumber, 8090, 8888);
          } catch (IOException e) {
                  e.printStackTrace();
                  System.exit(1);
          }
          int localPort = proxy.localListenPort();
//System.out.println("HERE?");
          applicationURL = protocol + "127.0.0.1" + ":" + localPort + 
restOfURL;

          args[appURLIndex] = applicationURL;

          return args;
  }


In the launch script of your Java app, you will need sommething like :

  -DproxySet=tru  -Dhttp.proxyHost=yourProxy -Dhttp.proxyPort=8080

I get this in this archive but I don't find it now. I hope that help.

Pierre Gilquin


----- Original Message ----- 
From: "Paolo Sommaruga" <[email protected]>
To: "WebObjects Dev List List Dev" <[email protected]>
Sent: Wednesday, June 14, 2006 12:38 PM
Subject: jc and proxy


> Hi,
>
> we have installed a java client (client side) application on a  customer 
> computer in order to perform some backoffice activities. The  problem is 
> that such computer (xp) can only use a proxy connection.  Someone has had 
> a such problem ?  There is a way to arrange the java  client connection 
> through a proxy server ?
>
> Thanks and Regards
>
>
> Paolo Sommaruga
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.