author | tasneems@symbian.org |
Mon, 08 Feb 2010 15:06:19 -0800 | |
changeset 112 | 19a90881080c |
parent 3 | d3477de62514 |
permissions | -rw-r--r-- |
3
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
1 |
// MimeType.java |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
2 |
// $Id: MimeType.java,v 1.4 2005-09-14 15:15:39 ylafon Exp $ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
3 |
// (c) COPYRIGHT MIT and INRIA, 1996. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
4 |
// Please first read the full copyright statement in file COPYRIGHT.html |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
5 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
6 |
package org.w3c.www.mime ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
7 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
8 |
import java.util.Vector; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
9 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
10 |
import java.io.PrintStream; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
11 |
import java.io.Serializable; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
12 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
13 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
14 |
* This class is used to represent parsed MIME types. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
15 |
* It creates this representation from a string based representation of |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
16 |
* the MIME type, as defined in the RFC 1345. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
17 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
18 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
19 |
public class MimeType implements Serializable, Cloneable { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
20 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
21 |
* List of well known MIME types: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
22 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
23 |
public static MimeType TEXT_HTML = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
24 |
public static MimeType APPLICATION_POSTSCRIPT = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
25 |
public static MimeType TEXT_PLAIN = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
26 |
public static MimeType APPLICATION_X_WWW_FORM_URLENCODED = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
27 |
public static MimeType APPLICATION_OCTET_STREAM = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
28 |
public static MimeType MULTIPART_FORM_DATA = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
29 |
public static MimeType APPLICATION_X_JAVA_AGENT = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
30 |
public static MimeType MESSAGE_HTTP = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
31 |
public static MimeType TEXT_CSS = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
32 |
public static MimeType TEXT_XML = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
33 |
public static MimeType APPLICATION_XML = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
34 |
public static MimeType TEXT = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
35 |
public static MimeType APPLICATION_RDF_XML = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
36 |
public static MimeType APPLICATION_XHTML_XML = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
37 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
38 |
public static String star = "*".intern(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
39 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
40 |
static { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
41 |
try { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
42 |
TEXT_HTML |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
43 |
= new MimeType("text/html"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
44 |
APPLICATION_POSTSCRIPT |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
45 |
= new MimeType ("application/postscript") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
46 |
TEXT_PLAIN |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
47 |
= new MimeType("text/plain") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
48 |
APPLICATION_X_WWW_FORM_URLENCODED |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
49 |
= new MimeType("application/x-www-form-urlencoded") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
50 |
APPLICATION_OCTET_STREAM |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
51 |
= new MimeType("application/octet-stream") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
52 |
MULTIPART_FORM_DATA |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
53 |
= new MimeType("multipart/form-data") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
54 |
APPLICATION_X_JAVA_AGENT |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
55 |
= new MimeType("application/x-java-agent") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
56 |
MESSAGE_HTTP |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
57 |
= new MimeType("message/http"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
58 |
TEXT_CSS |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
59 |
= new MimeType("text/css"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
60 |
TEXT_XML |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
61 |
= new MimeType("text/xml"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
62 |
TEXT |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
63 |
= new MimeType("text/*"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
64 |
APPLICATION_RDF_XML |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
65 |
= new MimeType("application/rdf+xml"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
66 |
APPLICATION_XHTML_XML |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
67 |
= new MimeType("application/xhtml+xml"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
68 |
APPLICATION_XML |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
69 |
= new MimeType("application/xml"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
70 |
} catch (MimeTypeFormatException e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
71 |
System.out.println ("httpd.MimeType: invalid static init.") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
72 |
System.exit (1) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
73 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
74 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
75 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
76 |
public final static int NO_MATCH = -1 ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
77 |
public final static int MATCH_TYPE = 1 ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
78 |
public final static int MATCH_SPECIFIC_TYPE = 2 ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
79 |
public final static int MATCH_SUBTYPE = 3 ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
80 |
public final static int MATCH_SPECIFIC_SUBTYPE = 4 ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
81 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
82 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
83 |
* String representation of type |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
84 |
* |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
85 |
* @serial |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
86 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
87 |
protected String type = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
88 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
89 |
* String representation of subtype |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
90 |
* |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
91 |
* @serial |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
92 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
93 |
protected String subtype = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
94 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
95 |
* parameter names |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
96 |
* |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
97 |
* @serial |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
98 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
99 |
protected String pnames[] = null; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
100 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
101 |
* parameter values |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
102 |
* |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
103 |
* @serial |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
104 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
105 |
protected String pvalues[] = null; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
106 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
107 |
* external form of this mime type |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
108 |
* |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
109 |
* @serial |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
110 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
111 |
protected String external = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
112 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
113 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
114 |
* How good the given MimeType matches the receiver of the method ? |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
115 |
* This method returns a matching level among: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
116 |
* <dl> |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
117 |
* <dt>NO_MATCH<dd>Types not matching,</dd> |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
118 |
* <dt>MATCH_TYPE<dd>Types match,</dd> |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
119 |
* <dt>MATCH_SPECIFIC_TYPE<dd>Types match exactly,</dd> |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
120 |
* <dt>MATCH_SUBTYPE<dd>Types match, subtypes matches too</dd> |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
121 |
* <dt>MATCH_SPECIFIC_SUBTYPE<dd>Types match, subtypes matches exactly</dd> |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
122 |
* </dl> |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
123 |
* The matches are ranked from worst match to best match, a simple |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
124 |
* Max ( match[i], matched) will give the best match. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
125 |
* @param other The other MimeType to match against ourself. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
126 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
127 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
128 |
public int match (MimeType other) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
129 |
int match = NO_MATCH; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
130 |
// match types: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
131 |
if ( (type == star) || (other.type == star) ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
132 |
return MATCH_TYPE; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
133 |
} else if ( type != other.type ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
134 |
return NO_MATCH ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
135 |
} else { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
136 |
match = MATCH_SPECIFIC_TYPE; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
137 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
138 |
// match subtypes: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
139 |
if ( (subtype == star) || (other.subtype == star) ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
140 |
match = MATCH_SUBTYPE ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
141 |
} else if ( subtype != other.subtype ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
142 |
return NO_MATCH; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
143 |
} else { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
144 |
match = MATCH_SPECIFIC_SUBTYPE; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
145 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
146 |
return match; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
147 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
148 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
149 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
150 |
* Find out if mime types are equivalent, based on heuristics |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
151 |
* like text/xml <=> application/xml and other problems related |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
152 |
* to format that may have multiple mime types. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
153 |
* Note that text/html and application/xhtml+xml are not exactly |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
154 |
* the same |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
155 |
* @param mtype, a MimeType |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
156 |
* @return a boolean, true if the two mime types are equivalent |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
157 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
158 |
public boolean equiv(MimeType mtype) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
159 |
if (match(mtype) == MATCH_SPECIFIC_SUBTYPE) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
160 |
return true; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
161 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
162 |
if ((match(TEXT_XML) == MATCH_SPECIFIC_SUBTYPE) || |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
163 |
(match(APPLICATION_XML)== MATCH_SPECIFIC_SUBTYPE) ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
164 |
if ((mtype.match(TEXT_XML) == MATCH_SPECIFIC_SUBTYPE) || |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
165 |
(mtype.match(APPLICATION_XML) == MATCH_SPECIFIC_SUBTYPE)) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
166 |
return true; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
167 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
168 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
169 |
return false; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
170 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
171 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
172 |
* A printable representation of this MimeType. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
173 |
* The printed representation is guaranteed to be parseable by the |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
174 |
* String constructor. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
175 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
176 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
177 |
public String toString () { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
178 |
if ( external == null ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
179 |
StringBuffer sb = new StringBuffer (type) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
180 |
sb.append((char) '/') ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
181 |
sb.append (subtype) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
182 |
if ( pnames != null ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
183 |
for (int i = 0 ; i < pnames.length; i++) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
184 |
sb.append(';'); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
185 |
sb.append(pnames[i]); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
186 |
if ( pvalues[i] != null ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
187 |
sb.append('='); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
188 |
sb.append(pvalues[i]); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
189 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
190 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
191 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
192 |
external = sb.toString().intern(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
193 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
194 |
return external ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
195 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
196 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
197 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
198 |
* Does this MIME type has some value for the given parameter ? |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
199 |
* @param name The parameter to check. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
200 |
* @return <strong>True</strong> if this parameter has a value, false |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
201 |
* otherwise. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
202 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
203 |
public boolean hasParameter (String name) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
204 |
if (name != null) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
205 |
if ( pnames != null ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
206 |
String lname = name.toLowerCase(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
207 |
for (int i = 0 ; i < pnames.length ; i++) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
208 |
if ( pnames[i].equals(name) ) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
209 |
return true ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
210 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
211 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
212 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
213 |
return false ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
214 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
215 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
216 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
217 |
* Get the major type of this mime type. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
218 |
* @return The major type, encoded as a String. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
219 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
220 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
221 |
public String getType() { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
222 |
return type; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
223 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
224 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
225 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
226 |
* Get the minor type (subtype) of this mime type. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
227 |
* @return The minor or subtype encoded as a String. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
228 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
229 |
public String getSubtype() { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
230 |
return subtype; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
231 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
232 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
233 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
234 |
* Get a mime type parameter value. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
235 |
* @param name The parameter whose value is to be returned. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
236 |
* @return The parameter value, or <b>null</b> if not found. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
237 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
238 |
public String getParameterValue (String name) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
239 |
if (name != null) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
240 |
if ( pnames != null ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
241 |
String lname = name.toLowerCase(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
242 |
for (int i = 0 ; i < pnames.length ; i++) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
243 |
if ( pnames[i].equals(lname) ) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
244 |
return pvalues[i]; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
245 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
246 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
247 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
248 |
return null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
249 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
250 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
251 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
252 |
* adds some parameters to a MimeType |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
253 |
* @param param a String array of parameter names |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
254 |
* @param values the corresponding String array of values |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
255 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
256 |
public void addParameters(String[] param, String[] values) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
257 |
// sanity check |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
258 |
if ((param == null) || (values == null) || |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
259 |
(values.length != param.length)) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
260 |
return; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
261 |
if (pnames == null) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
262 |
pnames = param; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
263 |
pvalues = values; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
264 |
} else { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
265 |
String[] nparam = new String[pnames.length+param.length]; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
266 |
String[] nvalues = new String[pvalues.length+values.length]; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
267 |
System.arraycopy(pnames, 0, nparam, 0, pnames.length); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
268 |
System.arraycopy(param, 0, nparam, pnames.length, param.length); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
269 |
System.arraycopy(pvalues, 0, nvalues, 0, pvalues.length); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
270 |
System.arraycopy(values,0, nvalues, pvalues.length, values.length); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
271 |
pnames = nparam; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
272 |
pvalues = nvalues; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
273 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
274 |
for (int i = 0; i < pnames.length; i++) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
275 |
pnames[i] = pnames[i].toLowerCase(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
276 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
277 |
external = null; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
278 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
279 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
280 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
281 |
* get a clone of this object |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
282 |
* @return another cloned instance of MimeType |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
283 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
284 |
public MimeType getClone() { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
285 |
try { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
286 |
return (MimeType) clone(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
287 |
} catch (CloneNotSupportedException ex) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
288 |
// should never happen as we are Cloneable! |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
289 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
290 |
// never reached |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
291 |
return null; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
292 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
293 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
294 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
295 |
* adds a parameterto a MimeType |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
296 |
* @param param the parameter name, as a String |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
297 |
* @param value the parameter value, as a Sting |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
298 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
299 |
public void addParameter(String param, String value) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
300 |
String[] p = new String[1]; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
301 |
String[] v = new String[1]; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
302 |
p[0] = param; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
303 |
v[0] = value; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
304 |
addParameters(p, v); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
305 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
306 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
307 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
308 |
* Set the parameter to a MimeType (replace old value if any). |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
309 |
* @param param the parameter name, as a String |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
310 |
* @param value the parameter value, as a Sting |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
311 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
312 |
public void setParameter(String param, String value) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
313 |
if (pnames == null) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
314 |
addParameter(param, value); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
315 |
} else { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
316 |
String lparam = param.toLowerCase(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
317 |
for (int i = 0 ; i < pnames.length ; i++) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
318 |
if (pnames[i].equals(lparam)) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
319 |
pvalues[i] = value; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
320 |
return; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
321 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
322 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
323 |
addParameter(lparam, value); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
324 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
325 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
326 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
327 |
/** |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
328 |
* Construct MimeType object for the given string. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
329 |
* The string should be the representation of the type. This methods |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
330 |
* tries to be compliant with HTTP1.1, p 15, although it is not |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
331 |
* (because of quoted-text not being accepted). |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
332 |
* FIXME |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
333 |
* @parameter spec A string representing a MimeType |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
334 |
* @return A MimeType object |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
335 |
* @exception MimeTypeFormatException if the string couldn't be parsed. |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
336 |
*/ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
337 |
public MimeType (String spec) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
338 |
throws MimeTypeFormatException |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
339 |
{ |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
340 |
int strl = spec.length() ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
341 |
int start = 0, look = -1 ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
342 |
// skip leading/trailing blanks: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
343 |
while ((start < strl) && (spec.charAt (start)) <= ' ') |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
344 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
345 |
while ((strl > start) && (spec.charAt (strl-1) <= ' ')) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
346 |
strl-- ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
347 |
// get the type: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
348 |
StringBuffer sb = new StringBuffer () ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
349 |
while ((start < strl) && ((look = spec.charAt(start)) != '/')) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
350 |
sb.append (Character.toLowerCase((char) look)) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
351 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
352 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
353 |
if ( look != '/' ) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
354 |
throw new MimeTypeFormatException (spec) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
355 |
this.type = sb.toString().intern() ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
356 |
// get the subtype: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
357 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
358 |
sb.setLength(0) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
359 |
while ((start < strl) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
360 |
&& ((look = spec.charAt(start)) > ' ') && (look != ';')) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
361 |
sb.append (Character.toLowerCase((char) look)) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
362 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
363 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
364 |
this.subtype = sb.toString().intern() ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
365 |
// get parameters, if any: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
366 |
while ((start < strl) && ((look = spec.charAt(start)) <= ' ')) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
367 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
368 |
if ( start < strl ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
369 |
if (spec.charAt(start) != ';') |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
370 |
throw new MimeTypeFormatException (spec) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
371 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
372 |
Vector vp = new Vector(4) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
373 |
Vector vv = new Vector(4) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
374 |
while ( start < strl ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
375 |
while ((start < strl) && (spec.charAt(start) <= ' ')) start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
376 |
// get parameter name: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
377 |
sb.setLength (0) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
378 |
while ((start < strl) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
379 |
&& ((look=spec.charAt(start)) > ' ') && (look != '=')) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
380 |
sb.append (Character.toLowerCase((char) look)) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
381 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
382 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
383 |
String name = sb.toString() ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
384 |
// get the value: |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
385 |
while ((start < strl) && (spec.charAt(start) <= ' ')) start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
386 |
if (spec.charAt(start) != '=') |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
387 |
throw new MimeTypeFormatException (spec) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
388 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
389 |
while ((start < strl) && |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
390 |
((spec.charAt(start) == '"') || |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
391 |
(spec.charAt(start) <= ' '))) start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
392 |
sb.setLength(0) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
393 |
while ((start < strl) |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
394 |
&& ((look=spec.charAt(start)) > ' ') |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
395 |
&& (look != ';') |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
396 |
&& (look != '"')) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
397 |
sb.append ((char) look) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
398 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
399 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
400 |
while ((start < strl) && (spec.charAt(start) != ';')) start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
401 |
start++ ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
402 |
String value = sb.toString() ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
403 |
vp.addElement(name); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
404 |
vv.addElement(value); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
405 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
406 |
this.pnames = new String[vp.size()]; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
407 |
vp.copyInto(pnames); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
408 |
this.pvalues = new String[vv.size()]; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
409 |
vv.copyInto(pvalues); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
410 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
411 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
412 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
413 |
public MimeType (String type, String subtype |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
414 |
, String pnames[], String pvalues[]) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
415 |
this.type = type.toLowerCase().intern() ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
416 |
this.subtype = subtype.toLowerCase().intern() ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
417 |
this.pnames = pnames; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
418 |
this.pvalues = pvalues; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
419 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
420 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
421 |
public MimeType (String type, String subtype) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
422 |
this.type = type.toLowerCase().intern(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
423 |
this.subtype = subtype.toLowerCase().intern(); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
424 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
425 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
426 |
public static void main (String args[]) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
427 |
if ( args.length == 1) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
428 |
MimeType type = null ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
429 |
try { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
430 |
type = new MimeType (args[0]) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
431 |
} catch (MimeTypeFormatException e) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
432 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
433 |
if ( type != null ) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
434 |
System.out.println (type) ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
435 |
if (type.getClone().match(type) == MATCH_SPECIFIC_SUBTYPE) { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
436 |
System.out.println("Clone OK"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
437 |
} else { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
438 |
System.out.println("Cloning failed"); |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
439 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
440 |
} else { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
441 |
System.out.println ("Invalid mime type specification.") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
442 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
443 |
} else { |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
444 |
System.out.println ("Usage: java MimeType <type-to-parse>") ; |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
445 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
446 |
} |
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
447 |
|
d3477de62514
Added new wizards for importing WRT projects. Added CSS Validator.
TasneemS@US-TASNEEMS
parents:
diff
changeset
|
448 |
} |