package com.ruoyi.utils.forest;
|
|
import com.dtflys.forest.http.ForestRequest;
|
import com.dtflys.forest.lifecycles.MethodAnnotationLifeCycle;
|
import com.dtflys.forest.reflection.ForestMethod;
|
|
public class UavAuthLifeCircle implements MethodAnnotationLifeCycle<UavAuth, Object> {
|
|
|
/**
|
* 发送请求前执行此方法
|
*/
|
@Override
|
public boolean beforeExecute(ForestRequest request) {
|
String token = (String) getAttribute(request, "token");
|
request.addHeader("x-auth-token", token);
|
return true;
|
}
|
|
/**
|
* 此方法在请求方法初始化的时候被调用
|
*/
|
|
@Override
|
public void onMethodInitialized(ForestMethod forestMethod, UavAuth uavAuth) {
|
}
|
}
|