Hi
We face similar issue in other project. I'll commit the fix we did in the
project, we added a similar code in NetLib class.
*GetMap.java*
URLConnection conn = Lib.net.setupProxy(context, imageUrl);
in = conn.getInputStream();
*NetLib.java*
public URLConnection setupProxy(ServiceContext context, URL url)
throws IOException
{
GeonetContext gc = (GeonetContext)
context.getHandlerContext(Geonet.CONTEXT_NAME);
SettingManager sm = gc.getBean(SettingManager.class);
boolean enabled = sm.getValueAsBool(ENABLED, false);
String host = sm.getValue(HOST);
String port = sm.getValue(PORT);
String username= sm.getValue(USERNAME);
String password= sm.getValue(PASSWORD);
String ignoreHostList = sm.getValue(IGNOREHOSTLIST);
URLConnection conn = null;
if (enabled) {
if (!Lib.type.isInteger(port)) {
Log.error(Geonet.GEONETWORK, "Proxy port is not an integer
: "+ port);
} else {
if (!isProxyHostException(url.getHost(), ignoreHostList)) {
InetSocketAddress sa = new InetSocketAddress(host,
Integer.parseInt(port));
Proxy proxy = new Proxy(Proxy.Type.HTTP, sa);
conn = url.openConnection(proxy);
if (username.trim().length() != 0) {
String encodedUserPwd = new
Base64().encodeAsString((username + ":" + password).getBytes());
conn.setRequestProperty("Accept-Charset", "UTF-8");
conn.setRequestProperty("Proxy-Authorization",
"Basic " + encodedUserPwd);
}
} else {
conn = url.openConnection();
}
}
} else {
conn = url.openConnection();
}
return conn;
}
I'll commit the fix soon.
Regards,
Jose García
On Fri, Apr 15, 2016 at 9:15 AM, amacar <amadej.pevec@anonymised.com> wrote:
Problem was, that GetMap.java class is not using proxy settings.
We solved with this piece of code
(
https://github.com/geonetwork/core-geonetwork/blob/develop/services/src/main/java/org/fao/geonet/services/region/GetMap.java#L272
).
Proxy proxy = null;
boolean useProxy =
settingManager.getValueAsBool(SettingManager.SYSTEM_PROXY_USE, false);
if (useProxy) {
String proxyHost =
settingManager.getValue(SettingManager.SYSTEM_PROXY_HOST);
String proxyPort =
settingManager.getValue(SettingManager.SYSTEM_PROXY_PORT);
//String username =
settingManager.getValue(SettingManager.SYSTEM_PROXY_USERNAME);
//String password =
settingManager.getValue(SettingManager.SYSTEM_PROXY_PASSWORD);
proxy = new Proxy(Proxy.Type.HTTP, new
InetSocketAddress(proxyHost,
Integer.valueOf(proxyPort)));
}
InputStream in = null;
try {
URL imageUrl = new URL(background);
in = useProxy ?
imageUrl.openConnection(proxy).getInputStream() : imageUrl.openStream();
image = ImageIO.read(in);
} catch (IOException e) {
image = new BufferedImage(imageDimensions.width,
imageDimensions.height, BufferedImage.TYPE_INT_ARGB);
error = e;
}finally {
if(in != null) {
IOUtils.closeQuietly(in);
}
--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Spatial-extent-background-map-is-not-shown-tp5255116p5261372.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork
--
*Vriendelijke groeten / Kind regards,Jose García
<http://www.geocat.net/>Veenderweg 136721 WD BennekomThe NetherlandsT: +31
(0)318 416664 <+31318416664> <https://www.facebook.com/geocatbv>
<https://twitter.com/geocat_bv>
<https://plus.google.com/u/1/+GeocatNetbv/posts>Please consider the
environment before printing this email.*