use of io.micronaut.http.uri.UriTemplate in project micronaut-core by micronaut-projects.
the class BookmarkControllerSpec method testBindingPagination.
@Test
public void testBindingPagination() {
UriTemplate template = new UriTemplate("/api/bookmarks/list{?offset,max,sort,order}");
Map<String, Object> params = new HashMap<>();
params.put("offset", 0);
params.put("max", 10);
HttpResponse response = client.toBlocking().exchange(template.expand(params));
assertEquals(HttpStatus.OK, response.status());
}
use of io.micronaut.http.uri.UriTemplate in project micronaut-core by micronaut-projects.
the class DeleteEndpointRouteBuilder method registerRoute.
@Override
protected void registerRoute(ExecutableMethod<?, ?> method, String id, Integer port) {
Class<?> declaringType = method.getDeclaringType();
UriTemplate template = buildUriTemplate(method, id);
UriRoute uriRoute = DELETE(template.toString(), declaringType, method.getMethodName(), method.getArgumentTypes());
if (port != null) {
uriRoute = uriRoute.exposedPort(port);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Created Route to @Endpoint {}: {}", method.getDeclaringType().getName(), uriRoute);
}
}
use of io.micronaut.http.uri.UriTemplate in project micronaut-core by micronaut-projects.
the class ReadEndpointRouteBuilder method registerRoute.
@Override
protected void registerRoute(ExecutableMethod<?, ?> method, String id, Integer port) {
Class<?> declaringType = method.getDeclaringType();
UriTemplate template = buildUriTemplate(method, id);
UriRoute uriRoute = GET(template.toString(), declaringType, method.getMethodName(), method.getArgumentTypes());
if (port != null) {
uriRoute = uriRoute.exposedPort(port);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Created Route to @Endpoint {}: {}", method.getDeclaringType().getName(), uriRoute);
}
uriRoute = HEAD(template.toString(), declaringType, method.getMethodName(), method.getArgumentTypes());
if (port != null) {
uriRoute = uriRoute.exposedPort(port);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Created Route to @Endpoint {}: {}", method.getDeclaringType().getName(), uriRoute);
}
}
use of io.micronaut.http.uri.UriTemplate in project micronaut-core by micronaut-projects.
the class WriteEndpointRouteBuilder method registerRoute.
@Override
protected void registerRoute(ExecutableMethod<?, ?> method, String id, Integer port) {
Class<?> declaringType = method.getDeclaringType();
UriTemplate template = buildUriTemplate(method, id);
String[] consumes = method.stringValues(Write.class, "consumes");
UriRoute uriRoute = POST(template.toString(), declaringType, method.getMethodName(), method.getArgumentTypes()).consumes(MediaType.of(consumes));
if (port != null) {
uriRoute = uriRoute.exposedPort(port);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Created Route to @Endpoint {}: {}", method.getDeclaringType().getName(), uriRoute);
}
}
use of io.micronaut.http.uri.UriTemplate in project micronaut-core by micronaut-projects.
the class MovieTicketControllerSpec method testBindingBean.
@Test
public void testBindingBean() {
UriTemplate template = new UriTemplate("/api/movie/ticket/terminator{?minPrice,maxPrice}");
Map<String, Object> params = new HashMap<>();
params.put("minPrice", 5.0);
params.put("maxPrice", 20.0);
HttpResponse response = client.toBlocking().exchange(template.expand(params));
assertEquals(HttpStatus.OK, response.status());
}
Aggregations