私は実行する次のクラスを持っています
@Provider
@ServerInterceptor
@RedirectPrecedence
public class SubsidiaryOpenInterceptor implements PostProcessInterceptor, AcceptedByMethod {
@Override
public boolean accept(Class clazz, Method method) {
final Annotation[][] paramAnnotations = method.getParameterAnnotations();
for (Annotation[] paramAnnotation : paramAnnotations) {
for (Annotation a : paramAnnotation) {
if (a instanceof PathParam && ((PathParam) a).value().equals("idSubsidiary"))
return true;
}
}
return false;
}
@Override
public void postProcess(ServerResponse response) {
final Annotation[][] paramAnnotations = response.getResourceMethod().getParameterAnnotations();
for (Annotation[] paramAnnotation : paramAnnotations) {
for (Annotation a : paramAnnotation) {
if (a instanceof PathParam && ((PathParam) a).value().equals("idSubsidiary")) {
// get the value of "idSubsidiary", it should be an Integer, and do something.
}
}
}
}
}
@PathParam("idSubsidiary") Integer idSubsidiary
ここで、リクエストが行われた URL からidSubsidiary セットの値を取得したいと考えています。
この段階でそれを知ることは可能ですか?
フローのこの時点でこのデータを取得するために使用できる戦略はありますか?
MessageBodyWriterInterceptor を使用しようとしましたが、作成できませんでした。も使用しようとしました@Context HttpServletRequest req
が、成功しませんでした。