134 |
} |
} |
135 |
} |
} |
136 |
} |
} |
137 |
if (in == null && url != null) |
if (in == null) |
138 |
{ |
{ |
139 |
systemId = url.toString(); |
if (url != null) |
|
node = (Node) nodeCache.get(systemId); |
|
|
// Is the resource up to date? |
|
|
URLConnection conn = url.openConnection(); |
|
|
Long llm = (Long) lastModifiedCache.get(systemId); |
|
|
if (llm != null) |
|
|
{ |
|
|
lastLastModified = llm.longValue(); |
|
|
conn.setIfModifiedSince(lastLastModified); |
|
|
} |
|
|
conn.connect(); |
|
|
lastModified = conn.getLastModified(); |
|
|
if (node != null && |
|
|
lastModified > 0L && |
|
|
lastModified <= lastLastModified) |
|
140 |
{ |
{ |
141 |
// Resource unchanged |
systemId = url.toString(); |
142 |
return new DOMSource(node, systemId); |
node = (Node) nodeCache.get(systemId); |
143 |
|
// Is the resource up to date? |
144 |
|
URLConnection conn = url.openConnection(); |
145 |
|
Long llm = (Long) lastModifiedCache.get(systemId); |
146 |
|
if (llm != null) |
147 |
|
{ |
148 |
|
lastLastModified = llm.longValue(); |
149 |
|
conn.setIfModifiedSince(lastLastModified); |
150 |
|
} |
151 |
|
conn.connect(); |
152 |
|
lastModified = conn.getLastModified(); |
153 |
|
if (node != null && |
154 |
|
lastModified > 0L && |
155 |
|
lastModified <= lastLastModified) |
156 |
|
{ |
157 |
|
// Resource unchanged |
158 |
|
return new DOMSource(node, systemId); |
159 |
|
} |
160 |
|
else |
161 |
|
{ |
162 |
|
// Resource new or modified |
163 |
|
in = conn.getInputStream(); |
164 |
|
nodeCache.put(systemId, node); |
165 |
|
lastModifiedCache.put(systemId, new Long(lastModified)); |
166 |
|
} |
167 |
} |
} |
168 |
else |
else |
169 |
{ |
{ |
170 |
// Resource new or modified |
throw new TransformerException("can't resolve URL: " + |
171 |
in = conn.getInputStream(); |
systemId); |
|
nodeCache.put(systemId, node); |
|
|
lastModifiedCache.put(systemId, new Long(lastModified)); |
|
172 |
} |
} |
173 |
} |
} |
174 |
InputSource input = new InputSource(in); |
InputSource input = new InputSource(in); |
215 |
{ |
{ |
216 |
url = new URL(href); |
url = new URL(href); |
217 |
} |
} |
218 |
|
else |
219 |
|
{ |
220 |
|
// See below |
221 |
|
throw new MalformedURLException(systemId); |
222 |
|
} |
223 |
} |
} |
224 |
return url; |
return url; |
225 |
} |
} |