Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KatharsisInvokerBuilder and objectMapper #39

Closed
masterspambot opened this issue Jul 29, 2016 · 2 comments
Closed

KatharsisInvokerBuilder and objectMapper #39

masterspambot opened this issue Jul 29, 2016 · 2 comments

Comments

@masterspambot
Copy link
Member

From @weaselmetal on May 19, 2016 14:27

I was trying to do all the required configuration for an objectMapper to be used by katharsis. Registering the JsonModule would be an example. We are using katharsis as a filter (AbstractKatharsisFilter).
Here's the problem: when I pass a preconfigured objectMapper to KatharsisInvokerBuilder.objectMapper(...) then it will not be configured by katharsis to use katharsis' serializers, basically bypassing all of katharsis serialization functionality.
If I don't pass an objectMapper to this builder method, then katharsis will create a new, properly configured objectMapper, but it will be inaccessible to me for further configuration.

For now, I ended up extending KatharsisInvokerBuilder (which basically copies all code of super class) and also configure a passed objectMapper bean (spring managed).
This is an excerpt of the build() method:

@Override
public KatharsisInvoker build() throws Exception
{
    // ... all stuff above

    if (objectMapper == null)
    {
        objectMapper = createObjectMapper(resourceRegistry);

    } else
    {
        // that's the important thing to do!
        objectMapper.registerModule(createDataBindingModule(resourceRegistry));
    }

    // more stuff

    return new KatharsisInvoker(objectMapper, queryParamsBuilder, resourceRegistry,
            requestDispatcher);
}

This allows me to inject a properly configured objectMapper whenever I need do (de)serialize stuff.
Btw, I do miss javadoc direly.

Talking about javadoc, this documentation seems wrong:

/**
 * Set prefix to be searched when performing method matching and building building <i>links</i> objects in responses. The name of the configuration property is <tt>{@value}</tt>.
 */
public static final String WEB_PATH_PREFIX = "katharsis.config.web.path.prefix";

The specified prefix is NOT included in the created links. Link only uses defaultDomain plus resource type for the link. I think the docu should stick and the implementation should do what the javadoc says. Makes sense to me.
Thanks!

Copied from original issue: katharsis-project/katharsis-servlet#24

@masterspambot
Copy link
Member Author

From @chb0github on July 15, 2016 16:48

We will happily consider a PR. Also, this may have been addressed already with https://github.com/katharsis-project/katharsis-core/issues/353

@chb0github
Copy link
Contributor

closing due to no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants