katharsis-project / katharsis-framework

Katharsis adds powerful layer for RESTful endpoints providing implementenation of JSON:API standard
http://katharsis.io
Apache License 2.0
135 stars 65 forks source link

KatharsisFilterV2 in spring should be applied last #166

Closed sushrutb closed 7 years ago

sushrutb commented 8 years ago

https://github.com/katharsis-project/katharsis-framework/pull/124

Similar issue when using Katharsis with Spring Boot.

Custom HandleInterceptor does not get called when Katharsis is enabled.

sushrutb commented 8 years ago

Let me know why adding katharsis filter is leading to ignoring interceptors. Thanks.

chb0github commented 8 years ago

Do you have a sample bit of code to repo it? Just fork the spring sample directory

On Tue, Oct 18, 2016, 6:55 PM sushrutb notifications@github.com wrote:

Let me know why adding katharsis filter is leading to ignoring interceptors. Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/katharsis-project/katharsis-framework/issues/166#issuecomment-254689330, or mute the thread https://github.com/notifications/unsubscribe-auth/ABaI0DOxOAJulgYNQOK2eGG1EQPoF2OKks5q1Xh7gaJpZM4KYPnY .

sushrutb commented 8 years ago

Thanks for the reply. Here is a code samples. https://github.com/sushrutb/katharsis-examples/commit/79758630f8f0dedf699da9799b3b85045df29c8f

DummyInterceptor is called for all urls which are not JSON API annotated. You can try hitting a random url http://localhost:8080/xyz for example, and put a debug point in preHandle. preHandle does get called, url of course gives 404 in the end. When you hit http://localhost:8080/api/tasks , prehandle or other interceptor methods are not called.

sushrutb commented 8 years ago

Hi @chb0github , any suggestions on how to get interceptor to work?

On 19 Oct 2016 12:58 PM, "Christian Bongiorno" notifications@github.com wrote:

Do you have a sample bit of code to repo it? Just fork the spring sample directory

On Tue, Oct 18, 2016, 6:55 PM sushrutb notifications@github.com wrote:

Let me know why adding katharsis filter is leading to ignoring interceptors. Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/katharsis-project/katharsis-framework/ issues/166#issuecomment-254689330, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABaI0DOxOAJulgYNQOK2eGG1EQPoF2OKks5q1Xh7gaJpZM4KYPnY .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/katharsis-project/katharsis-framework/issues/166#issuecomment-254689815, or mute the thread https://github.com/notifications/unsubscribe-auth/ANqYINBODwFNrGyD2JE3KWCDNNL4AvAPks5q1XlNgaJpZM4KYPnY .

chb0github commented 8 years ago

I haven't had a chance to look. I will try to have a look later today

On Wed, Oct 19, 2016, 2:15 PM sushrutb notifications@github.com wrote:

Hi Chris, any suggestions on how to get interceptor to work?

On 19 Oct 2016 12:58 PM, "Christian Bongiorno" notifications@github.com wrote:

Do you have a sample bit of code to repo it? Just fork the spring sample directory

On Tue, Oct 18, 2016, 6:55 PM sushrutb notifications@github.com wrote:

Let me know why adding katharsis filter is leading to ignoring interceptors. Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/katharsis-project/katharsis-framework/ issues/166#issuecomment-254689330, or mute the thread https://github.com/notifications/unsubscribe-auth/ ABaI0DOxOAJulgYNQOK2eGG1EQPoF2OKks5q1Xh7gaJpZM4KYPnY .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/katharsis-project/katharsis-framework/issues/166#issuecomment-254689815 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ANqYINBODwFNrGyD2JE3KWCDNNL4AvAPks5q1XlNgaJpZM4KYPnY

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/katharsis-project/katharsis-framework/issues/166#issuecomment-254943198, or mute the thread https://github.com/notifications/unsubscribe-auth/ABaI0CrWez0h7RjhdGkaU1dW2FvzTjtxks5q1oiPgaJpZM4KYPnY .

chb0github commented 8 years ago

Ok, I took your code, as is: and hit

http://localhost:8080/tasks

and the service produces:

2016-10-24 09:59:18.000  INFO 12867 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 29 ms
In interceptor: preHandle

when I hit:

http://localhost:8080/api/tasks

Then the server gets no output but I see the JSONAPI.

Here is what I think is going on:

Katharsis is not a Spring MVC application -- it's using spring for DI but it's actually coming through a classic filter chain and totally sidestepping Spring -- So, katharsis is basically commandeering that space in the application before spring can get involved and thus spring never even receives the dispatch request.

If you tell me what you need to accomplish I might be able to help you another way. But, I am pretty confident in my theory and changing it would be significant work.

I am happy to help, but the change requested would require (potentially) rewriting the stack

sushrutb commented 8 years ago

Appreciate your time Chris. I agree with your theory. I would recommend updating documentation for katharsis to reflect this. Katharsis side stepping spring completely is something a developer might need to know.

For now, we have been able to make progress by implementing katharsis as an interceptor, which we have last in the order chain. But I dont think it is a clean solution and we most likely will move away from katharsis.

hvgotcodes commented 7 years ago

Also potentially fatal for us. @sushrutb how did you "implement katharsis as an interceptor"? Did you stick with Katharsis?

sushrutb commented 7 years ago

yes, I am able to Katharsis to work as interceptor. Code should be available on https://github.com/MYOB-Technology/katharsis-spring . It is not an ideal solution though and I am considering moving away from katharsis.

On 29 November 2016 at 13:29, hvgotcodes notifications@github.com wrote:

Also potentially fatal for us. @sushrutb https://github.com/sushrutb how did you "implement katharsis as an interceptor"? Did you stick with Katharsis?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/katharsis-project/katharsis-framework/issues/166#issuecomment-263458737, or mute the thread https://github.com/notifications/unsubscribe-auth/ANqYIHe-lqWIlimv45rvjRC8Tj7_GFBvks5rC44bgaJpZM4KYPnY .

-- Best Regards, Sushrut http://sushrutbidwai.com http://sushrutbidwai.com

chb0github commented 7 years ago

already discussed in #36 . Closed