Changeset 423
- Timestamp:
- 03/19/12 19:03:09 (12 years ago)
- Location:
- tapas
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/common/implementation/com/ether/EtherHelper.java
r422 r423 82 82 } 83 83 84 // TODO : supprimer cette méthode et utiliser JSON pour récupérer pIdPIdList85 @Nullable86 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 else100 pfIdPIdPair.setFirstValue( (T1) Integer.valueOf( pfIdPIdSplit[0] ) );101 102 if( T2Class.equals( String.class ) )103 pfIdPIdPair.setSecondValue( (T2) pfIdPIdSplit[1] );104 else105 pfIdPIdPair.setSecondValue( (T2) Integer.valueOf( pfIdPIdSplit[1] ) );106 pfIdPIdList.add( pfIdPIdPair );107 }108 return pfIdPIdList;109 }110 111 84 /** 112 85 * This method writes the text into the file filePath -
tapas/web/resources/jsp/dataProtocol_en.jsp
r416 r423 3 3 qsdkmqldksfsdjfkl 4 4 <BR/> 5 <a href="project?methodName=downloadFileDataProtocol ">5 <a href="project?methodName=downloadFileDataProtocolEn"> 6 6 <button class="dataProtocolDownloadButton">Download</button> 7 7 </a> -
tapas/web/resources/jsp/dataProtocol_fr.jsp
r416 r423 3 3 qsdkmqldksfsdjfkl 4 4 <BR/> 5 <a href="project?methodName=downloadFileDataProtocol ">5 <a href="project?methodName=downloadFileDataProtocolFr"> 6 6 <button class="dataProtocolDownloadButton">Télécharger</button> 7 7 </a> -
tapas/web/resources/templates/templateBackoffice_script.jsp
r414 r423 13 13 14 14 /** *********** VARIABLES *********** **/ 15 this.webmaster = "rboipsl@ipsl.jussieu.fr";15 this.webmaster = <%=WebHelper.getProperty(request, "mail.webmaster")%>; 16 16 this.jSONUser = <%=WebHelper.getJSONUser( request )%> ? <%=WebHelper.getJSONUser( request )%> : false; 17 17 -
tapas/web/resources/templates/templateEther_script.jsp
r416 r423 13 13 14 14 /** *********** VARIABLES *********** **/ 15 // TODO : vérifier cette adresse de webmaster !!!!16 15 this.language = '<spring:message code="language"/>'; 17 this.webmaster = "rboipsl@ipsl.jussieu.fr";16 this.webmaster = <%=WebHelper.getProperty(request, "mail.webmaster")%>; 18 17 this.jSONUser = <%=WebHelper.getJSONUser( request )%> ? <%=WebHelper.getJSONUser( request )%> : false; 19 18 -
tapas/web/src/com/ether/ControllerEponge.java
r422 r423 199 199 200 200 @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() 202 207 { 203 208 } … … 207 212 private static final String VIEW_INIT = "init"; 208 213 private static final String VIEW_DATA_PROTOCOL_EN = "project/home_dataProtocol_en"; 214 // TODO : mettre les bons fichiers de Dataprotocol 209 215 private static final String DOWNLOAD_DATA_PROTOCOL_EN = "bib.txt"; 216 private static final String DOWNLOAD_DATA_PROTOCOL_FR = "bib.txt"; 210 217 } -
tapas/web/src/com/ether/ControllerEther.java
r422 r423 39 39 import java.util.List; 40 40 import java.util.Map; 41 import java.util.Properties;42 41 43 42 public class ControllerEther … … 56 55 57 56 /** 57 * This method returns a property writed in the properties file 58 * 58 59 * @return 59 60 * @throws WebException … … 65 66 { 66 67 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 ); 70 69 } 71 70 catch( IOException e ) … … 172 171 return null; 173 172 } 174 // TODO : mettre le downloadPath en properties175 173 else if( null != methodDescription.getDownloadFile() && !"".equals( methodDescription.getDownloadFile() ) ) 176 174 { 177 175 final String fileName = methodDescription.getDownloadFile(); 178 final String downloadPath = "/home_local/";176 final String downloadPath = getProperty( "downloadPath" ); 179 177 180 178 response.setContentType( "multipart/zip" ); -
tapas/web/src/com/ether/WebHelper.java
r412 r423 12 12 import javax.servlet.http.HttpServletRequest; 13 13 import javax.servlet.http.HttpServletResponse; 14 import java.io.FileInputStream; 14 15 import java.io.IOException; 15 16 import java.io.PrintWriter; 16 17 import java.security.InvalidParameterException; 18 import java.util.Properties; 17 19 18 20 public final class WebHelper … … 90 92 } 91 93 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 } 92 131 93 132 private static final Log LOGGER = LogFactory.getLog( WebHelper.class ); … … 95 134 public static final int STATUS_CODE_SERVICE_EXCEPTION = 500; 96 135 private static final String CONTENT_TYPE_TEXT_JSON = "text/javascript;charset=" + UTF8Charset.getEncoding(); 136 private static final String PROPERTIES_FILE = "tapas.properties"; 97 137 } -
tapas/web/src/tapas.properties
r422 r423 1 1 mail.host=mailhost.ipsl.jussieu.fr 2 2 mail.webmaster=rboipsl@ipsl.jussieu.fr 3 downloadPath=/home_local/
Note: See TracChangeset
for help on using the changeset viewer.