/******************************************************************************* * Copyright (c) 2012 Association for Decentralized Information Management * in Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.maps.pojo; import java.net.Proxy; import java.net.ProxySelector; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import org.simantics.maps.IProxyUtil; /** * @author Tuukka Lehtonen */ public class AppletProxyUtil implements IProxyUtil { /** * @return IProxyService of the platform or null if the * service is not available. */ public Proxy getProxyService(final String url) { List l; try { l = ProxySelector.getDefault().select(new URI(url)); } catch (URISyntaxException e) { e.printStackTrace(); return null; } for(Proxy proxy : l) { if(proxy.type() == Proxy.Type.HTTP && proxy.address() != null) { return proxy; } } return null; } }