org.springframework.integration.http.dsl.Http Java Examples

The following examples show how to use org.springframework.integration.http.dsl.Http. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerSideEventsConfig.java    From spring-5-examples with MIT License 5 votes vote down vote up
@Bean
public IntegrationFlow sseFlow() {

  return IntegrationFlows.from(Http.inboundReactiveGateway("/sse")
                                   .requestMapping(m -> m.produces(MediaType.TEXT_EVENT_STREAM_VALUE)))
                         .handle((p, h) -> Flux.just("foo", "bar", "baz"))
                         .get();
}
 
Example #2
Source File: GreenfieldFunctionEnableBindingTests.java    From spring-cloud-stream with Apache License 2.0 5 votes vote down vote up
@Bean
public HttpRequestHandlingEndpointSupport doFoo(Source source) {
	HttpRequestHandlerEndpointSpec httpRequestHandler = Http
			.inboundChannelAdapter("/*")
			.requestMapping(requestMapping -> requestMapping
					.methods(HttpMethod.POST).consumes("*/*"))
			.requestChannel(source.output());
	return httpRequestHandler.get();
}
 
Example #3
Source File: SpringIntegrationWebMvcApplication.java    From springfox-demos with Apache License 2.0 5 votes vote down vote up
@Bean
public IntegrationFlow toUpperGetFlow() {
    return IntegrationFlows.from(
            Http.inboundGateway("/conversions/pathvariable/{upperLower}")
                    .requestMapping(r -> r
                            .methods(HttpMethod.GET)
                            .params("toConvert"))
                    .headerExpression("upperLower",
                            "#pathVariables.upperLower")
                    .payloadExpression("#requestParams['toConvert'][0]")
                    .id("toUpperLowerGateway"))
            .<String>handle((p, h) -> "upper".equals(h.get("upperLower")) ? p.toUpperCase() : p.toLowerCase())
            .get();
}
 
Example #4
Source File: SpringIntegrationWebMvcApplication.java    From springfox-demos with Apache License 2.0 5 votes vote down vote up
@Bean
public IntegrationFlow toUpperFlow() {
    return IntegrationFlows.from(
            Http.inboundGateway("/conversions/upper")
                    .requestMapping(r -> r.methods(HttpMethod.POST)
                            .consumes("text/plain"))
                    .requestPayloadType(String.class)
                    .id("toUpperGateway"))
            .<String>handle((p, h) -> p.toUpperCase())
            .get();
}
 
Example #5
Source File: SpringIntegrationWebMvcApplication.java    From springfox-demos with Apache License 2.0 5 votes vote down vote up
@Bean
public IntegrationFlow toLowerFlow() {
    return IntegrationFlows.from(
            Http.inboundGateway("/conversions/lower")
                    .requestMapping(r -> r.methods(HttpMethod.POST)
                            .consumes("application/json"))
                    .requestPayloadType(Foo.class)
                    .id("toLowerGateway"))
            .<Foo>handle((p, h) -> new Foo(p.getBar()
                    .toLowerCase()))
            .get();
}