1 /* 2 * #%L 3 * Coser :: Web 4 * %% 5 * Copyright (C) 2010 - 2011 Ifremer, Codelutin, Chatellier Eric 6 * %% 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU Affero General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU Affero General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * #L% 20 */ 21 22 package fr.ifremer.coser.web.actions; 23 24 import fr.ifremer.coser.web.actions.common.AbstractCoserJspAction; 25 import org.apache.struts2.ServletActionContext; 26 27 import javax.servlet.http.HttpServletRequest; 28 import java.util.Date; 29 30 /** 31 * Action index, recupere la date de derniere mise à jour. 32 * 33 * @author chatellier 34 * @version $Revision$ 35 * <p/> 36 * Last update : $Date$ 37 * By : $Author$ 38 */ 39 public class IndexAction extends AbstractCoserJspAction { 40 41 /** serialVersionUID. */ 42 private static final long serialVersionUID = 1663244944108703571L; 43 44 protected Date dataUpdateDate; 45 46 public Date getDataUpdateDate() { 47 return dataUpdateDate; 48 } 49 50 /** 51 * Return l'url de l'application context inclut. 52 * 53 * @return l'url du context 54 */ 55 public String getContextUrl() { 56 HttpServletRequest request = ServletActionContext.getRequest(); 57 58 String url = request.getScheme() + "://" + request.getServerName(); 59 if (request.getServerPort() != 80) { 60 url += ":" + request.getServerPort(); 61 } 62 url += request.getContextPath(); 63 64 return url; 65 } 66 67 @Override 68 public String execute() { 69 70 dataUpdateDate = getService().getConfig().getLastDataUpdateDate(); 71 72 return SUCCESS; 73 } 74 75 // @Override 76 // public String execute() { 77 // 78 // WebService webService = ServiceFactory.getWebService(); 79 // 80 // try { 81 // dataUpdateDate = webService.getLastDataUpdateDate(); 82 // } catch (CoserBusinessException ex) { 83 // throw new CoserWebException("Can't get last update date", ex); 84 // } 85 // 86 // return SUCCESS; 87 // } 88 }