Example usage for io.vertx.core MultiMap entries

List of usage examples for io.vertx.core MultiMap entries

Introduction

In this page you can find the example usage for io.vertx.core MultiMap entries.

Prototype

@GenIgnore(GenIgnore.PERMITTED_TYPE)
List<Map.Entry<String, String>> entries();

Source Link

Document

Returns all entries in the multi-map.

Usage

From source file:com.atypon.wayf.request.RequestParamMapper.java

License:Apache License

public static void mapParams(RoutingContext routingContext, Object pojo) {
    MultiMap params = routingContext.request().params();

    for (Map.Entry<String, String> queryParam : params.entries()) {
        if (enumConverterUtilsBean.getPropertyUtils().isWriteable(pojo, queryParam.getKey())) {
            try {
                enumConverterUtilsBean.setProperty(pojo, queryParam.getKey(), queryParam.getValue());
            } catch (IllegalAccessException | InvocationTargetException e) {
                throw new ServiceException(HttpStatus.SC_INTERNAL_SERVER_ERROR,
                        "Could not process query param [" + queryParam.getKey() + "]");
            }/*from  w  w w .  ja va 2s .c  o  m*/
        }
    }
}

From source file:com.hubrick.vertx.rest.impl.DefaultRestClientRequest.java

License:Apache License

private MultiKey createCacheKey(String uri, MultiMap headers, byte[] body) {
    return new MultiKey(uri, headers.entries().stream().map(e -> e.getKey() + ": " + e.getValue()).sorted()
            .collect(Collectors.toList()), Arrays.hashCode(body));
}

From source file:de.braintags.netrelay.model.PasswordLostClaim.java

License:Open Source License

private void transfer(MultiMap mm, Map<String, String> destination) {
    mm.entries().forEach(entry -> destination.put(entry.getKey(), entry.getValue()));
}

From source file:io.nitor.api.backend.proxy.Proxy.java

License:Apache License

static void copyEndToEndHeaders(MultiMap from, MultiMap to) {
    for (Map.Entry<String, String> entry : from.entries()) {
        if (!hopByHopHeaders.contains(entry.getKey())) {
            to.add(entry.getKey(), entry.getValue());
        }//from  w w w  . java2  s.co  m
    }

    String connectionHeader = from.get("connection");
    if (connectionHeader != null) {
        for (String name : connectionHeaderValueRE.split(connectionHeader.trim())) {
            to.remove(name);
        }
    }
}

From source file:org.eclipse.hono.devices.HonoHttpDevice.java

License:Open Source License

/**
 * Send messages to Hono HTTP adapter in a sequence.
 * <p>/*from   w  ww  . j  a  va2s .co  m*/
 * Alternate the event every 4th time to be an event.
 */
protected void sendData() {
    // Send single messages sequentially in a loop and print a summary of the message deliveries.
    System.out.println(String.format("Total number of messages: %s", messages.size()));

    messages.stream().forEachOrdered(messageType -> {
        final MultiMap headerMap = MultiMap.caseInsensitiveMultiMap();
        headerMap.add(HttpHeaders.CONTENT_TYPE, messageType.contentType);
        Optional.ofNullable(messageType.ttd).ifPresent(
                timeToDeliver -> headerMap.add(Constants.HEADER_TIME_TIL_DISCONNECT, timeToDeliver.toString()));

        System.out.println(String.format("Sending message type %s", messageType.toString()));

        final CompletableFuture<MultiMap> responseFuture = sendMessage(messageType.payload, headerMap,
                messageType.isEvent);
        try {
            final MultiMap resultMap = responseFuture.get();
            System.out.println(String.format("Got %d response keys.", resultMap.size()));
            resultMap.entries().stream().forEach(entry -> {
                System.out.println(String.format("  %s:%s", entry.getKey(), entry.getValue()));
            });
        } catch (final InterruptedException e) {
            e.printStackTrace();
        } catch (final ExecutionException e) {
            e.printStackTrace();
        }
    });

    // give some time for flushing asynchronous message buffers before shutdown
    vertx.setTimer(2000, timerId -> {
        vertx.close();
    });
}

From source file:org.jberet.vertx.rest.JBeretRouterConfig.java

License:Open Source License

private static Properties getJobParameters(final RoutingContext routingContext) {
    final MultiMap params = routingContext.request().params();
    final List<Map.Entry<String, String>> entries = params.entries();
    final Properties jobParams = new Properties();
    for (Map.Entry<String, String> entry : entries) {
        final String key = entry.getKey();
        final String value = entry.getValue();
        jobParams.setProperty(key, value);
    }/*  w ww .jav  a 2 s .  co m*/
    return jobParams;
}