Changeset 423


Ignore:
Timestamp:
03/19/12 19:03:09 (12 years ago)
Author:
vmipsl
Message:

properties webmaster
dataProtocol

Location:
tapas
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • tapas/common/implementation/com/ether/EtherHelper.java

    r422 r423  
    8282    } 
    8383 
    84     // TODO : supprimer cette méthode et utiliser JSON pour récupérer pIdPIdList 
    85     @Nullable 
    86     public static <T1 extends Object, T2 extends Object> List<Pair<T1, T2>> extractpfIdPIdListFromString( @NotNull final String pfIdPIdArrayString, @NotNull final Class<T1> T1Class, @NotNull final Class<T2> T2Class ) 
    87     { 
    88         if( pfIdPIdArrayString.isEmpty() ) 
    89             return null; 
    90  
    91         final String[] pfIDPIdArray = pfIdPIdArrayString.split( "," ); 
    92         final List<Pair<T1, T2>> pfIdPIdList = new ArrayList<Pair<T1, T2>>( pfIDPIdArray.length ); 
    93         for( final String pfIdPId : pfIDPIdArray ) 
    94         { 
    95             final String[] pfIdPIdSplit = pfIdPId.split( "-" ); 
    96             final Pair<T1, T2> pfIdPIdPair = new Pair<T1, T2>(); 
    97             if( T1Class.equals( String.class ) ) 
    98                 pfIdPIdPair.setFirstValue( (T1) pfIdPIdSplit[0] ); 
    99             else 
    100                 pfIdPIdPair.setFirstValue( (T1) Integer.valueOf( pfIdPIdSplit[0] ) ); 
    101  
    102             if( T2Class.equals( String.class ) ) 
    103                 pfIdPIdPair.setSecondValue( (T2) pfIdPIdSplit[1] ); 
    104             else 
    105                 pfIdPIdPair.setSecondValue( (T2) Integer.valueOf( pfIdPIdSplit[1] ) ); 
    106             pfIdPIdList.add( pfIdPIdPair ); 
    107         } 
    108         return pfIdPIdList; 
    109     } 
    110  
    11184    /** 
    11285     * This method writes the text into the file filePath 
  • tapas/web/resources/jsp/dataProtocol_en.jsp

    r416 r423  
    33qsdkmqldksfsdjfkl 
    44<BR/> 
    5 <a href="project?methodName=downloadFileDataProtocol"> 
     5<a href="project?methodName=downloadFileDataProtocolEn"> 
    66    <button class="dataProtocolDownloadButton">Download</button> 
    77</a> 
  • tapas/web/resources/jsp/dataProtocol_fr.jsp

    r416 r423  
    33qsdkmqldksfsdjfkl 
    44<BR/> 
    5 <a href="project?methodName=downloadFileDataProtocol"> 
     5<a href="project?methodName=downloadFileDataProtocolFr"> 
    66    <button class="dataProtocolDownloadButton">Télécharger</button> 
    77</a> 
  • tapas/web/resources/templates/templateBackoffice_script.jsp

    r414 r423  
    1313 
    1414            /** *********** VARIABLES *********** **/ 
    15             this.webmaster = "rboipsl@ipsl.jussieu.fr"; 
     15            this.webmaster = <%=WebHelper.getProperty(request, "mail.webmaster")%>; 
    1616            this.jSONUser = <%=WebHelper.getJSONUser( request )%> ? <%=WebHelper.getJSONUser( request )%> : false; 
    1717 
  • tapas/web/resources/templates/templateEther_script.jsp

    r416 r423  
    1313 
    1414            /** *********** VARIABLES *********** **/ 
    15             // TODO : vérifier cette adresse de webmaster !!!! 
    1615            this.language = '<spring:message code="language"/>'; 
    17             this.webmaster = "rboipsl@ipsl.jussieu.fr"; 
     16            this.webmaster = <%=WebHelper.getProperty(request, "mail.webmaster")%>; 
    1817            this.jSONUser = <%=WebHelper.getJSONUser( request )%> ? <%=WebHelper.getJSONUser( request )%> : false; 
    1918 
  • tapas/web/src/com/ether/ControllerEponge.java

    r422 r423  
    199199 
    200200    @ControllerMethod(downloadFile = DOWNLOAD_DATA_PROTOCOL_EN) 
    201     public void downloadFileDataProtocol() 
     201    public void downloadFileDataProtocolEn() 
     202    { 
     203    } 
     204 
     205    @ControllerMethod(downloadFile = DOWNLOAD_DATA_PROTOCOL_FR) 
     206    public void downloadFileDataProtocolFr() 
    202207    { 
    203208    } 
     
    207212    private static final String VIEW_INIT = "init"; 
    208213    private static final String VIEW_DATA_PROTOCOL_EN = "project/home_dataProtocol_en"; 
     214    // TODO : mettre les bons fichiers de Dataprotocol 
    209215    private static final String DOWNLOAD_DATA_PROTOCOL_EN = "bib.txt"; 
     216    private static final String DOWNLOAD_DATA_PROTOCOL_FR = "bib.txt"; 
    210217} 
  • tapas/web/src/com/ether/ControllerEther.java

    r422 r423  
    3939import java.util.List; 
    4040import java.util.Map; 
    41 import java.util.Properties; 
    4241 
    4342public class ControllerEther 
     
    5655 
    5756    /** 
     57     * This method returns a property writed in the properties file 
     58     * 
    5859     * @return 
    5960     * @throws WebException 
     
    6566        { 
    6667            final String webInfPath = getServletContext().getRealPath( "WEB-INF" ); 
    67             final Properties prop = new Properties(); 
    68             prop.load( new FileInputStream( webInfPath + "/classes/tapas.properties" ) ); 
    69             return prop.getProperty( property ); 
     68            return WebHelper.getProperty( webInfPath, property ); 
    7069        } 
    7170        catch( IOException e ) 
     
    172171                return null; 
    173172            } 
    174             // TODO : mettre le downloadPath en properties 
    175173            else if( null != methodDescription.getDownloadFile() && !"".equals( methodDescription.getDownloadFile() ) ) 
    176174            { 
    177175                final String fileName = methodDescription.getDownloadFile(); 
    178                 final String downloadPath = "/home_local/"; 
     176                final String downloadPath = getProperty( "downloadPath" ); 
    179177 
    180178                response.setContentType( "multipart/zip" ); 
  • tapas/web/src/com/ether/WebHelper.java

    r412 r423  
    1212import javax.servlet.http.HttpServletRequest; 
    1313import javax.servlet.http.HttpServletResponse; 
     14import java.io.FileInputStream; 
    1415import java.io.IOException; 
    1516import java.io.PrintWriter; 
    1617import java.security.InvalidParameterException; 
     18import java.util.Properties; 
    1719 
    1820public final class WebHelper 
     
    9092    } 
    9193 
     94    /** 
     95     * Returns the property writed in the properties file 
     96     * 
     97     * @param request 
     98     * @param property 
     99     * @return 
     100     * @throws WebException 
     101     */ 
     102    public static String getProperty( @NotNull final HttpServletRequest request, @NotNull final String property ) 
     103            throws WebException 
     104    { 
     105        try 
     106        { 
     107            final String webInfPath = request.getSession().getServletContext().getRealPath( "WEB-INF" ); 
     108            return getProperty( webInfPath, property ); 
     109        } 
     110        catch( IOException e ) 
     111        { 
     112            throw new WebException( WebException.WebCode.ERROR_TO_READ_FILE_PROPERTIES, e ); 
     113        } 
     114    } 
     115 
     116    /** 
     117     * Returns the property writed in the properties file 
     118     * 
     119     * @param webInfPath 
     120     * @param property 
     121     * @return 
     122     * @throws IOException 
     123     */ 
     124    public static String getProperty( @NotNull final String webInfPath, @NotNull final String property ) 
     125            throws IOException 
     126    { 
     127        final Properties prop = new Properties(); 
     128        prop.load( new FileInputStream( webInfPath + "/classes/" + PROPERTIES_FILE ) ); 
     129        return prop.getProperty( property ); 
     130    } 
    92131 
    93132    private static final Log LOGGER = LogFactory.getLog( WebHelper.class ); 
     
    95134    public static final int STATUS_CODE_SERVICE_EXCEPTION = 500; 
    96135    private static final String CONTENT_TYPE_TEXT_JSON = "text/javascript;charset=" + UTF8Charset.getEncoding(); 
     136    private static final String PROPERTIES_FILE = "tapas.properties"; 
    97137} 
  • tapas/web/src/tapas.properties

    r422 r423  
    11mail.host=mailhost.ipsl.jussieu.fr 
    22mail.webmaster=rboipsl@ipsl.jussieu.fr 
     3downloadPath=/home_local/ 
Note: See TracChangeset for help on using the changeset viewer.