Example usage for org.springframework.util LinkedMultiValueMap keySet

List of usage examples for org.springframework.util LinkedMultiValueMap keySet

Introduction

In this page you can find the example usage for org.springframework.util LinkedMultiValueMap keySet.

Prototype

@Override
    public Set<K> keySet() 

Source Link

Usage

From source file:com.apress.prospringintegration.web.MultipartReceiver.java

@ServiceActivator
public void handleMultipartRequest(LinkedMultiValueMap<String, Object> multipartRequest) {
    System.out.println("Received multipart request: " + multipartRequest);
    for (String elementName : multipartRequest.keySet()) {
        if (elementName.equals("name")) {
            LinkedList value = (LinkedList) multipartRequest.get("name");
            String[] multiValues = (String[]) value.get(0);
            for (String name : multiValues) {
                System.out.println("Name: " + name);
            }//  w w w.ja v  a2 s  .  c  om
        } else if (elementName.equals("picture")) {
            System.out.println("Picture as UploadedMultipartFile: "
                    + ((UploadedMultipartFile) multipartRequest.getFirst("picture")).getOriginalFilename());
        }
    }
}

From source file:com.thoughtworks.go.server.service.ElasticAgentPluginService.java

public void heartbeat() {
    LinkedMultiValueMap<String, ElasticAgentMetadata> elasticAgentsOfMissingPlugins = agentService
            .allElasticAgents();// ww  w. j  ava2  s .c o  m
    //      pingMessage TTL is set lesser than elasticPluginHeartBeatInterval to ensure there aren't multiple ping request for the same plugin
    long pingMessageTimeToLive = elasticPluginHeartBeatInterval - 10000L;

    for (PluginDescriptor descriptor : elasticAgentPluginRegistry.getPlugins()) {
        List<ClusterProfile> clusterProfiles = clusterProfilesService.getPluginProfiles()
                .findByPluginId(descriptor.id());
        serverPingQueue.post(new ServerPingMessage(descriptor.id(), clusterProfiles), pingMessageTimeToLive);
        elasticAgentsOfMissingPlugins.remove(descriptor.id());
        serverHealthService.removeByScope(scope(descriptor.id()));
    }

    if (!elasticAgentsOfMissingPlugins.isEmpty()) {
        for (String pluginId : elasticAgentsOfMissingPlugins.keySet()) {
            Collection<String> uuids = elasticAgentsOfMissingPlugins.get(pluginId).stream()
                    .map(ElasticAgentMetadata::uuid).collect(Collectors.toList());
            String description = format(
                    "Elastic agent plugin with identifier %s has gone missing, but left behind %s agent(s) with UUIDs %s.",
                    pluginId, elasticAgentsOfMissingPlugins.get(pluginId).size(), uuids);
            serverHealthService.update(ServerHealthState.warning("Elastic agents with no matching plugins",
                    description, HealthStateType.general(scope(pluginId))));
            LOGGER.warn(description);
        }
    }
}

From source file:org.springframework.integration.samples.multipart.MultipartReceiver.java

@SuppressWarnings("rawtypes")
public void receive(LinkedMultiValueMap<String, Object> multipartRequest) {
    logger.info("Successfully received multipart request: " + multipartRequest);
    for (String elementName : multipartRequest.keySet()) {
        if (elementName.equals("company")) {
            LinkedList value = (LinkedList) multipartRequest.get("company");
            String[] multiValues = (String[]) value.get(0);
            for (String companyName : multiValues) {
                logger.info(elementName + " - " + companyName);
            }//  www .  ja v  a  2  s  . co  m
        } else if (elementName.equals("company-logo")) {
            logger.info(elementName + " - as UploadedMultipartFile: "
                    + ((UploadedMultipartFile) multipartRequest.getFirst("company-logo"))
                            .getOriginalFilename());
        }
    }
}