SWS-548 - Expose suppressNamespace and suppressXSIType as properties to CastorMarshaller

This commit is contained in:
Arjen Poutsma
2009-08-18 10:45:20 +00:00
parent 20f5f99e9a
commit 5680cd4a19
3 changed files with 184 additions and 24 deletions

View File

@@ -17,6 +17,7 @@
package org.springframework.web.servlet.mvc.annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
@@ -147,17 +148,21 @@ public class DefaultAnnotationHandlerMapping extends AbstractDetectingUrlHandler
*/
protected String[] determineUrlsForHandlerMethods(Class<?> handlerType) {
final Set<String> urls = new LinkedHashSet<String>();
ReflectionUtils.doWithMethods(handlerType, new ReflectionUtils.MethodCallback() {
public void doWith(Method method) {
RequestMapping mapping = method.getAnnotation(RequestMapping.class);
if (mapping != null) {
String[] mappedPaths = mapping.value();
for (String mappedPath : mappedPaths) {
addUrlsForPath(urls, mappedPath);
Class<?>[] handlerTypes =
Proxy.isProxyClass(handlerType) ? handlerType.getInterfaces() : new Class<?>[]{handlerType};
for (Class<?> currentHandlerType : handlerTypes) {
ReflectionUtils.doWithMethods(currentHandlerType, new ReflectionUtils.MethodCallback() {
public void doWith(Method method) {
RequestMapping mapping = AnnotationUtils.findAnnotation(method, RequestMapping.class);
if (mapping != null) {
String[] mappedPaths = mapping.value();
for (String mappedPath : mappedPaths) {
addUrlsForPath(urls, mappedPath);
}
}
}
}
});
});
}
return StringUtils.toStringArray(urls);
}