0

I am currently working in a Spring Boot project with Spring Integration flow. I have the following Spring Integration xml:

<!-- CHANNELS -->
<int:channel id="channelInput"/>
<int:channel id="channelOutput"/>

<int-http:inbound-gateway id="http-inbound-gateway"
                          request-channel="channelInput"
                          reply-channel="channelOutput"
                          supported-methods="GET"
                          path="/urlTest"
                          >
    <int-http:request-mapping consumes="application/json"
                              produces="application/json"/>

</int-http:inbound-gateway>


<int:service-activator input-channel="channelInput"
                       ref="serviceClassImpl"
                       method="testMethod"
                       output-channel="channelOutput">
</int:service-activator>

When I tried to do a curl against localhost:8080/urlTest it gives me a 404.

Later I noticed we have a Jersey resource config class, in which one we have to register all the paths defined with the @Path annotation, so I suppose that 404 error is because I don't register that path in Jersey. But I am not sure, because I have never worked before with Jersey.

@Component
public class ApplicationJerseyConfig extends ResourceConfig {
  public ApplicationJerseyConfig() {
    property(ServletProperties.FILTER_STATIC_CONTENT_REGEX,"/(info|browser/.*|api/(swagger.json|info)?|.*/api-docs.?|console/.*|configuration/.*|.*.html|.*.jpg|.*.gif|.*.png|.*.map|.*.js|.*.css|.*.ttf)?");
    register(TestRest.class);
    }
}

How can I register the path defined in the gateway, "/urlTest", in the Jersey Resource Config?

Thank you in advance.

Cauthon
  • 1
  • 4
  • `TestRest` should be annotated with `@Path("urlTest")`. And you need a `@GET` method in that class – Paul Samsotha Oct 19 '16 at 15:55
  • @peeskillet Thank you for the quick answer. TestRest is another controller, with another endpoint. That rest controller has Path annotation in the endpoint and is working. The problem is with the path for Spring Integration. – Cauthon Oct 19 '16 at 15:57
  • Then what is supposed to be mapped to `/urlTest`? – Paul Samsotha Oct 19 '16 at 15:57
  • @peeskillet /urlTest is supposed to be the entry to Spring Integration flow and is calling by a external webservice. – Cauthon Oct 19 '16 at 16:06
  • I don't use SI, so let me ask you.. SI is the gateway that accesses Jersey? So SI is supposed to be in front of Jersey? Are they in the same application? – Paul Samsotha Oct 19 '16 at 16:08
  • Yes, they are in the same application. And maybe will be change in the future but for now SI is the application gateway for access. – Cauthon Oct 19 '16 at 16:13
  • So SI accepts HTTP requests, and then forwards to Jersey? Is that how it's supposed to work? Maybe [this is the problem](http://stackoverflow.com/q/29658240/2587435)? Not sure – Paul Samsotha Oct 19 '16 at 16:14
  • @peeskillet Sorry I forgot to write at the beginning the FILTER_STATIC_CONTENT_REGEX propertie. Also I tried to add ApplicationPath annotation and the FILTER_FORWARD_ON_404 , as you suggested in the other answer. Didn't work, also 404 error. – Cauthon Oct 19 '16 at 16:46

1 Answers1

0

Finally worked, I just have to add the path into the ServletProperties.FILTER_STATIC_CONTENT_REGEX of the ResourceConfig.

Cauthon
  • 1
  • 4