Forum How do I...?

httpProxy

satyavati
Hi Mikeday,

I want to set Proxy url. I have seen setHttpProxy() method which I can use
But I want to test if the proxyUrl is already set then don't set it again
or if hostName is changed or port is changed then set it again
If proxy is desabled then remove the proxy setting.

In java doc I could not find any method to get the HostName or port of Prince eg. getHostName()
not even getHttpProxy()

I am using prince 9.0 Is there any way to check the proxy settings
mikeday
No, you will need to cache them in your own code and check that way.
satyavati
Hi Mikeday

What do you mean by cache them.

We are setting the proxyHttp url like this
pdfGenerator = proxyHelper.princeXmlProxy(pdfGenerator);


        if (aPrince != null && proxyUtility.isProxyEnabled()) {
          IOCSLogger.putDebugLog(LOGGER, "executePrinceXmlStrategy--> proxy is not enabled, setting the proxy configuration.");
          //check if the proxy settings are enabled and if the proxy host/port has changed then set the new proxy settings
          String tmpPrinceHttpProxy = Protocol.HTTP + "://" + proxyUtility.getHostName() + ":" + Integer.parseInt(proxyUtility.getPort());
          aPrince.setHttpProxy(tmpPrinceHttpProxy);
        } else {
          aPrince.setHttpProxy(null);
        }


How setHttpProxy() work, will it set the proxy url at every conversion request.
What is the impact of setting it every time. Will it impact on performance.
mikeday
Set it every time, it is very cheap to set.