Weather Providers
The weather portlet ships with two different weather data providers, Yahoo Weather and World Weather Online. Both services require an API key which can be retrieved by a self-service registration process.
Yahoo Weather
- Update 3/15/2016: Portlet must change to support Oath 1. See https://developer.yahoo.com/weather/.
- ToC limits usage to non-commercial use
- Key only required for location lookups
- 2000 invocations per day (Weather portlet caching reduces invocations per day)
- Much nicer icons
- Provides forecasts only two days into the future
- API key requests at https://developer.apps.yahoo.com (log in and select My Projects from your avitar image on top right)
World Weather Online
- Update 3/29/2016: They no longer offer a free API key to new users.
- Free to both non-commercial and commercial users
- Requires a key for both weather and location lookups
- Requires 15 minute caching of each feed (already the weather portlet's default caching strategy)
- Limit of 500 requests / hour
- Provides forecasts several days into the future (configurable)
- API key requests at http://www.worldweatheronline.com/register.aspx
Configuring the Provider
Maven Overlay
The weather portlet has been included in uPortal since 3.2 via an overlay as src/main/webapp/WEB-INF/context/overlay/overlayContext.xml. This old file exists but the configuration has been moved to src/main/webapp/WEB-INF/context/applicationContext.xml.
Un-comment the provider you want to use in the applicationContext.xml
file and specify the API key for the service.
overlayContext.xml
<!-- worldweatheronline.com Weather DAO Implementation --> <!-- <bean id="weatherDaoImpl" class="org.jasig.portlet.weather.dao.worldwide.WorldWeatherOnlineDaoImpl"> <property name="key" value="YOURKEY"/> <property name="imageMapping"><value>classpath:wwo-image-mapping.properties</value></property> </bean> --> <!-- Yahoo! Weather DAO Implementation --> <bean id="weatherDaoImpl" class="org.jasig.portlet.weather.dao.yahoo.YahooWeatherDaoImpl"> <property name="key" value=""/> <!-- ENTER YOUR KEY HERE --> <property name="weatherParsingService" ref="weatherParsingService"/> <property name="locationParsingService" ref="locationParsingService"/> <property name="messageSource" ref="messageSource"/> </bean>
Custom WeatherPortlet Build
The applicationContext.xml
file is included in the WeatherPortlet release in the location referenced above. Just edit this file as instructed above.