Merge pull request #486 from ascrutae/zhangxin/fix/support-spring-3.x

support  @RequestMapping annotation of spring 3.x
This commit is contained in:
吴晟 Wu Sheng 2017-09-30 14:07:37 +08:00 committed by GitHub
commit 55edf9780b
1 changed files with 2 additions and 1 deletions

View File

@ -16,6 +16,7 @@ import org.skywalking.apm.network.trace.component.ComponentsDefine;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.ServletWebRequest;
/**
* The <code>ControllerServiceMethodInterceptor</code> only use the first mapping value.
@ -58,7 +59,7 @@ public class ControllerServiceMethodInterceptor implements InstanceMethodsAround
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
Object ret) throws Throwable {
HttpServletResponse response = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse();
HttpServletResponse response = ((ServletWebRequest)RequestContextHolder.getRequestAttributes()).getResponse();
AbstractSpan span = ContextManager.activeSpan();
if (response.getStatus() >= 400) {