Changeset 3827
- Timestamp:
- 06/30/11 04:29:38 (11 months ago)
- Location:
- print/trunk
- Files:
-
- 1 removed
- 6 modified
-
. (modified) (1 prop)
-
.gitignore (deleted)
-
src/main/java/org/mapfish/print/PDFUtils.java (modified) (2 diffs)
-
src/main/java/org/mapfish/print/config/Config.java (modified) (2 diffs)
-
src/main/java/org/mapfish/print/config/layout/Layouts.java (modified) (1 diff)
-
src/main/webapp/WEB-INF/web.xml (modified) (1 diff)
-
src/main/webapp/config.yaml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
print/trunk
- Property svn:ignore
-
old new 1 .gitignore 2 .gradle 3 build 1 4 target 2 build3 .gradle
-
- Property svn:ignore
-
print/trunk/src/main/java/org/mapfish/print/PDFUtils.java
r3826 r3827 266 266 267 267 private static final Pattern FORMAT_PATTERN = Pattern.compile("^format\\s+(%[-+# 0,(]*\\d*(\\.\\d*)?(d))\\s+(.*)$"); 268 269 public static String getValueFromString(String val) { 270 String str = val; 271 while (true) { 272 Matcher matcher = VAR_REGEXP.matcher(val); 273 if (matcher.find()) { 274 str = val.substring(0, matcher.start()); 275 final String varName = matcher.group(1); // varName == key 276 str += getDateValue(varName); 277 val = val.substring(matcher.end()); 278 } else { 279 break; 280 } 281 } 282 return str; 283 } 284 285 private static String getDateValue(String key) { 286 String val = ""; 287 if (key.equals("now")) { 288 val = new Date().toString(); 289 } else if (key.startsWith("now ")) { 290 val = formatTime(key); 291 } 292 return val; 293 } 268 294 269 295 private static String getContextValue(RenderingContext context, PJsonObject params, String key) { … … 332 358 return new Date().toString(); 333 359 } 360 } 361 362 private static String formatTime(String key) throws IllegalArgumentException { 363 SimpleDateFormat format = new SimpleDateFormat(key.substring(4)); 364 return format.format(new Date()); 334 365 } 335 366 -
print/trunk/src/main/java/org/mapfish/print/config/Config.java
r3826 r3827 32 32 import org.json.JSONWriter; 33 33 import org.mapfish.print.InvalidValueException; 34 import org.mapfish.print.PDFUtils; 34 35 import org.mapfish.print.config.layout.Layout; 35 36 import org.mapfish.print.config.layout.Layouts; … … 395 396 String name = null; 396 397 if(layout != null) { 397 name = layout.getOutputFilename(); 398 } 399 398 name = PDFUtils.getValueFromString(layout.getOutputFilename()); // get the string if it has ${now} or ${now DATEFORMAT} in it 399 } 400 400 return name == null ? outputFilename : name; 401 401 } -
print/trunk/src/main/java/org/mapfish/print/config/layout/Layouts.java
r3789 r3827 29 29 */ 30 30 public class Layouts extends HashMap<String, Layout> { 31 public static class Wrapper extends DefaultMapWrapper { 31 /** 32 * 33 */ 34 private static final long serialVersionUID = 1L; 35 36 public static class Wrapper extends DefaultMapWrapper { 32 37 public Wrapper(Class<Layout> type) { 33 38 super(type); -
print/trunk/src/main/webapp/WEB-INF/web.xml
r3826 r3827 9 9 <init-param> 10 10 <param-name>config</param-name> 11 <param-value>config Vector.yaml</param-value>11 <param-value>config.yaml</param-value> 12 12 </init-param> 13 13 </servlet> -
print/trunk/src/main/webapp/config.yaml
r3826 r3827 45 45 host: demo.mapfish.org 46 46 port: 80 47 - !dnsMatch48 host: basemap-web.zen.landcareresearch.co.nz49 port: 8050 47 51 48 # the default fileName for the files downloaded from the servlet
