Disable ext entities in SourceHttpMessageConverter

This change disables the processing of external entities in
SourceHttpMessageConverter by default and provides an option to enable
it if required.
This commit is contained in:
Rossen Stoyanchev
2013-11-05 09:02:46 -05:00
parent 863570abb7
commit 7387cb990e
4 changed files with 228 additions and 58 deletions

View File

@@ -111,7 +111,16 @@ public abstract class StaxUtils {
* 1.4 {@link StAXSource}; {@code false} otherwise.
*/
public static boolean isStaxSource(Source source) {
return (source instanceof StaxSource || (jaxp14Available && Jaxp14StaxHandler.isStaxSource(source)));
return ((source instanceof StaxSource) || (jaxp14Available && Jaxp14StaxHandler.isStaxSource(source)));
}
/**
* Indicate whether the given class is a StAX Source class.
* @return {@code true} if {@code source} is a custom StAX source or JAXP
* 1.4 {@link StAXSource} class; {@code false} otherwise.
*/
public static boolean isStaxSourceClass(Class<? extends Source> clazz) {
return (StaxSource.class.equals(clazz) || (jaxp14Available && Jaxp14StaxHandler.isStaxSourceClass(clazz)));
}
@@ -348,6 +357,10 @@ public abstract class StaxUtils {
return (source instanceof StAXSource);
}
private static boolean isStaxSourceClass(Class<? extends Source> clazz) {
return StAXSource.class.equals(clazz);
}
private static boolean isStaxResult(Result result) {
return (result instanceof StAXResult);
}