Code Monkey home page Code Monkey logo

Comments (5)

kazaff avatar kazaff commented on June 14, 2024

这个bug还没空来看?你跑过demo吗,demo里面难道也调用不到?--- by @li-shen from QQ

是的,也调不到,我追源码,restprotocol是把extend的值统一交给RESTEasy框架来管理,应该是靠后者来实现jax-rs规范吧?也就是说问题不在dubbox,而是要从RESTEasy下手吧?

from dubbox.

kazaff avatar kazaff commented on June 14, 2024

经过我自己的测试,发现单独使用resteasy,最新版本下也存在这个问题,不过目前看来,更换成官方提供的preProcessInterceptor是可以满足要求的,具体细节还需要看一下resteasy源码,不过该拦截器接口已经被官方提示不建议使用。如下代码

public class MyPreProcessInterceptor implements PreProcessInterceptor {
    public ServerResponse preProcess(HttpRequest request, ResourceMethodInvoker method) throws Failure, WebApplicationException{

        System.out.println("Reader interceptor invoked");
        return null;
    }
}

官方文档上解释的也很笼统,我在ResourceMethodInvoker源码中甚至根本就不没有找到对应的readerInterceptors声明(只有writerInterceptors),而且发现preProcessInterceptor被当做Filter来处理了,好乱啊~~

根据文档中下面这句话:

ReaderInterceptors wrap around the execution of MessageBodyReaders.

我还尝试了使用POST以表单形式提交参数,试图测试是否可以触发,结果也是徒劳的~

from dubbox.

li-shen avatar li-shen commented on June 14, 2024

我看了一下,这个不是bug。在不需要做反序列化的比如get场景,reader inteceptor肯定就不会被调用。

from dubbox.

kazaff avatar kazaff commented on June 14, 2024

如果做认证的话,就不能用这个拦截器了~
那一般都应该考虑如何做呢?

from dubbox.

li-shen avatar li-shen commented on June 14, 2024

用filter吧,不用interceptor。另外dubbo自己也有filter

from dubbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.