Lines 25-31
import java.security.PrivilegedAction;
Link Here
|
25 |
import java.security.PrivilegedActionException; |
25 |
import java.security.PrivilegedActionException; |
26 |
import java.security.PrivilegedExceptionAction; |
26 |
import java.security.PrivilegedExceptionAction; |
27 |
import java.util.concurrent.Callable; |
27 |
import java.util.concurrent.Callable; |
28 |
|
|
|
29 |
import javax.servlet.http.HttpServletRequest; |
28 |
import javax.servlet.http.HttpServletRequest; |
30 |
import javax.servlet.jsp.PageContext; |
29 |
import javax.servlet.jsp.PageContext; |
31 |
import javax.xml.XMLConstants; |
30 |
import javax.xml.XMLConstants; |
Lines 183-196
public class XmlUtil {
Link Here
|
183 |
* @return a new Transformer |
182 |
* @return a new Transformer |
184 |
* @throws TransformerConfigurationException if there was a problem creating the Transformer from the XSLT |
183 |
* @throws TransformerConfigurationException if there was a problem creating the Transformer from the XSLT |
185 |
*/ |
184 |
*/ |
186 |
public static Transformer newTransformer(Source source) throws TransformerConfigurationException { |
185 |
public static Transformer newTransformer(Source source, JstlUriResolver uriResolver) throws TransformerConfigurationException { |
187 |
Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source); |
186 |
final URIResolver original = TRANSFORMER_FACTORY.getURIResolver(); |
188 |
// Although newTansformer() is not allowed to return null, Xalan does. |
187 |
try { |
189 |
// Trap that here by throwing the expected TransformerConfigurationException. |
188 |
TRANSFORMER_FACTORY.setURIResolver(uriResolver); |
190 |
if (transformer == null) { |
189 |
Transformer transformer = TRANSFORMER_FACTORY.newTransformer(source); |
191 |
throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid."); |
190 |
|
|
|
191 |
// Although newTransformer() is not allowed to return null, Xalan does. |
192 |
// Trap that here by throwing the expected TransformerConfigurationException. |
193 |
if (transformer == null) { |
194 |
throw new TransformerConfigurationException("newTransformer returned null. XSLT may be invalid."); |
195 |
} |
196 |
return transformer; |
197 |
} finally { |
198 |
//restore URI resolver on factory to what was before |
199 |
TRANSFORMER_FACTORY.setURIResolver(original); |
192 |
} |
200 |
} |
193 |
return transformer; |
|
|
194 |
} |
201 |
} |
195 |
|
202 |
|
196 |
/** |
203 |
/** |
197 |
- |
|
|