equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package sun.net.www; |
26 package sun.net.www; |
27 import java.io.*; |
27 import java.io.*; |
28 import java.util.Calendar; |
|
29 import java.util.Date; |
|
30 import java.text.SimpleDateFormat; |
|
31 import java.net.URL; |
|
32 import java.net.FileNameMap; |
28 import java.net.FileNameMap; |
33 import java.util.Hashtable; |
29 import java.util.Hashtable; |
34 import java.util.Enumeration; |
30 import java.util.Enumeration; |
35 import java.util.Properties; |
31 import java.util.Properties; |
36 import java.util.StringTokenizer; |
32 import java.util.StringTokenizer; |
269 void parse(Properties entries) { |
265 void parse(Properties entries) { |
270 // first, strip out the platform-specific temp file template |
266 // first, strip out the platform-specific temp file template |
271 String tempFileTemplate = (String)entries.get("temp.file.template"); |
267 String tempFileTemplate = (String)entries.get("temp.file.template"); |
272 if (tempFileTemplate != null) { |
268 if (tempFileTemplate != null) { |
273 entries.remove("temp.file.template"); |
269 entries.remove("temp.file.template"); |
274 this.tempFileTemplate = tempFileTemplate; |
270 MimeTable.tempFileTemplate = tempFileTemplate; |
275 } |
271 } |
276 |
272 |
277 // now, parse the mime-type spec's |
273 // now, parse the mime-type spec's |
278 Enumeration<?> types = entries.propertyNames(); |
274 Enumeration<?> types = entries.propertyNames(); |
279 while (types.hasMoreElements()) { |
275 while (types.hasMoreElements()) { |
415 properties.put("temp.file.template", tempFileTemplate); |
411 properties.put("temp.file.template", tempFileTemplate); |
416 String tag; |
412 String tag; |
417 String user = System.getProperty("user.name"); |
413 String user = System.getProperty("user.name"); |
418 if (user != null) { |
414 if (user != null) { |
419 tag = "; customized for " + user; |
415 tag = "; customized for " + user; |
420 properties.save(os, filePreamble + tag); |
416 properties.store(os, filePreamble + tag); |
421 } |
417 } |
422 else { |
418 else { |
423 properties.save(os, filePreamble); |
419 properties.store(os, filePreamble); |
424 } |
420 } |
425 } |
421 } |
426 catch (IOException e) { |
422 catch (IOException e) { |
427 e.printStackTrace(); |
423 e.printStackTrace(); |
428 return false; |
424 return false; |