Home Rest function fails before the start
Reply: 0

Rest function fails before the start

user1581
1#
user1581 Published in July 19, 2018, 3:29 pm

Making API Rest testing, sometimes I meet with a situation, when a Rest function fails, but even the first breakpoint in it is not reached. Obviously, some preliminary settings fail. But what exactly?

Here is the header of the function:

@RequestMapping(value = { "/export" }, method = RequestMethod.POST, produces = "text/plain;charset=UTF-8")
public Object exportConfiguration(@RequestBody ConfigurationExport configurationExport) {
    try {
        // at return here stands the breakpoint that is never reached:
        return configurationExporterProvider.export(configurationExport);

The body of request is:

{}

As a response I am getting:

            <td>HTTP ERROR: 415 Unsupported Media Type
                <p>Problem accessing /cc/api/configuration/export
                    <pre id="message">Unsupported Media Type</pre>

OK, thought I - something happens when trying to load the body into configurationExport. But there is no throwing errors in that class constructor:

private ConfigurationExport() {
    documentTypes = new ArrayList<>();
    valueSets = new ArrayList<>();
    configuration = new Configuration();
}

And setters and getters created by Lombok. And Lombok, surely, does not know anything about any Media Types.

I agree with application returning me the response with an error message. But where does it appear? Where and how should I look for it?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.32268 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO