Fórumok
Weather Portlet
Monalisa Sahu, módosítva 12 év-val korábban
Weather Portlet
New Member Bejegyzések: 2 Csatlakozás dátuma: 2012.02.28. Legújabb bejegyzések
Can anybody send me weather portlet
David H Nebinger, módosítva 12 év-val korábban
RE: Weather Portlet
Liferay Legend Bejegyzések: 14916 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Whatever you guys are working on, you should share notes.
Review all of the other recent posts on the weather portlet: where to get it, how to deploy it, how to configure it, and why invalid params result in blank screen.
Review all of the other recent posts on the weather portlet: where to get it, how to deploy it, how to configure it, and why invalid params result in blank screen.
Monalisa Sahu, módosítva 12 év-val korábban
RE: Weather Portlet
New Member Bejegyzések: 2 Csatlakozás dátuma: 2012.02.28. Legújabb bejegyzések
where should i put the war file of weather portlet in order to deploy it
David H Nebinger, módosítva 12 év-val korábban
RE: Weather Portlet
Liferay Legend Bejegyzések: 14916 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Again, this has all been covered in recent weeks as your friends have been doing the same things.
Search the forum to find the info.
Search the forum to find the info.
Dave Weitzel, módosítva 11 év-val korábban
RE: Weather Portlet
Regular Member Bejegyzések: 208 Csatlakozás dátuma: 2009.11.18. Legújabb bejegyzések
Google has now stopped providing the weather api used in the portlet so it is not usable until updated to a new API
Hitoshi Ozawa, módosítva 11 év-val korábban
RE: Weather Portlet
Liferay Legend Bejegyzések: 7942 Csatlakozás dátuma: 2010.03.24. Legújabb bejegyzések
It's already been fixed.
http://issues.liferay.com/browse/LPS-29542
http://issues.liferay.com/browse/LPS-29542
Jitendra Rajput, módosítva 11 év-val korábban
RE: Weather Portlet
Liferay Master Bejegyzések: 875 Csatlakozás dátuma: 2011.01.07. Legújabb bejegyzések
If you want to check code then look into WeatherWebCacheItem.java .
Old code with google API was like this
And new code with API change
Old code with google API was like this
public Object convert(String key) throws WebCacheException {
Weather weather = null;
try {
String text = HtmlUtil.stripComments(HttpUtil.URLtoString(
"https://www.google.com/ig/api?weather=" +
HttpUtil.encodeURL(_zip)));
int x = text.indexOf("temp_f data");
x = text.indexOf("\"", x) + 1;
int y = text.indexOf("\"", x);
float temperature = GetterUtil.getFloat(text.substring(x, y));
x = text.indexOf("/images", x);
y = text.indexOf("\"", x);
String iconURL = "https://www.google.com" + text.substring(x, y);
weather = new Weather(_zip, iconURL, temperature);
}
catch (Exception e) {
throw new WebCacheException(_zip);
}
return weather;
}
And new code with API change
public Object convert(String key) throws WebCacheException {
Weather weather = null;
try {
StringBundler sb = new StringBundler(5);
sb.append("http://free.worldweatheronline.com/feed/weather.ashx?key=");
sb.append(WeatherPropsUtil.get("world.weather.online.api.key"));
sb.append("&q=");
sb.append(HttpUtil.encodeURL(zipName));
sb.append("&format=xml");
String xml = HtmlUtil.stripComments(HttpUtil.URLtoString(sb.toString()));
Document document = SAXReaderUtil.read(xml);
Element rootElement = document.getRootElement();
Element currentConditionElement = rootElement.element(
"current_condition");
Element temperatureElement = currentConditionElement.element("temp_F");
float temperature = GetterUtil.getFloat(temperatureElement.getData());
Element iconElement = currentConditionElement.element("weatherIconUrl");
String iconURL = iconElement.getText();
weather = new Weather(zipName, iconURL, temperature);
}
catch (Exception e) {
throw new WebCacheException(zipName);
}
return weather;
}