Java tutorial
/** * Copyright 2002-2013 ESUP-portail consortium * This program is free software; you can redistribute * it and/or modify it under the terms of the GNU * General Public License as published by the Free * Software Foundation augmented according to the * possibility of using it with programs developped under * the Apache licence published by the Apache Software Foundation. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * See the license terms site for more details : * http://www.esup-portail.org/license.html */ package org.esupportail.monitor.web.springmvc; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.portlet.ModelAndView; import org.esupportail.monitor.web.tools.*; /** * * Description : Controller principal <br/> * * @version Id : WebController.java, V1.0, mars 2013<br/> * Copyright (c) 2002-2013 Esup Portail (www.esup-portail.org)<br/> * Classe(s) : WebController <br/> * @author : Eric Doual - Doriane Duvivier */ @Controller public class WebController extends AbstractExceptionController { private boolean users = true; private List<ServerInfo> servers = null; @RequestMapping("VIEW") protected ModelAndView renderView(RenderRequest request, RenderResponse response) throws Exception { ModelMap model = new ModelMap(); servers = new ArrayList<ServerInfo>(); for (Iterator i = Config.getInstance().getServers().iterator(); i.hasNext();) { ServerInfo s = (ServerInfo) i.next(); s.getUsers().clear(); if (InfosCollector.fetch(s, users)) { servers.add(s); } } model.put("liste_serveurs", servers); return new ModelAndView("view", model); } @RequestMapping("ABOUT") public ModelAndView renderAboutView(RenderRequest request, RenderResponse response) throws Exception { ModelMap model = new ModelMap(); return new ModelAndView("about", model); } }