Example usage for org.springframework.util MultiValueMap add

List of usage examples for org.springframework.util MultiValueMap add

Introduction

In this page you can find the example usage for org.springframework.util MultiValueMap add.

Prototype

void add(K key, @Nullable V value);

Source Link

Document

Add the given single value to the current list of values for the given key.

Usage

From source file:org.springframework.web.util.UrlPathHelper.java

/**
 * Decode the given matrix variables via
 * {@link #decodeRequestString(HttpServletRequest, String)} unless
 * {@link #setUrlDecode(boolean)} is set to {@code true} in which case it is
 * assumed the URL path from which the variables were extracted is already
 * decoded through a call to//w ww.  j a  v a2 s  .com
 * {@link #getLookupPathForRequest(HttpServletRequest)}.
 * @param request current HTTP request
 * @param vars URI variables extracted from the URL path
 * @return the same Map or a new Map instance
 */
public MultiValueMap<String, String> decodeMatrixVariables(HttpServletRequest request,
        MultiValueMap<String, String> vars) {

    if (this.urlDecode) {
        return vars;
    } else {
        MultiValueMap<String, String> decodedVars = new LinkedMultiValueMap<>(vars.size());
        for (String key : vars.keySet()) {
            for (String value : vars.get(key)) {
                decodedVars.add(key, decodeInternal(request, value));
            }
        }
        return decodedVars;
    }
}

From source file:org.springframework.ws.wsdl.wsdl11.provider.AbstractPortTypesProvider.java

private void createOperations(Definition definition, PortType portType) throws WSDLException {
    MultiValueMap<String, Message> operations = new LinkedMultiValueMap<String, Message>();
    for (Iterator<?> iterator = definition.getMessages().values().iterator(); iterator.hasNext();) {
        Message message = (Message) iterator.next();
        String operationName = getOperationName(message);
        if (StringUtils.hasText(operationName)) {
            operations.add(operationName, message);
        }//from  w  w  w . j a v  a2 s . c om
    }
    if (operations.isEmpty() && logger.isWarnEnabled()) {
        logger.warn("No operations were created, make sure the WSDL contains messages");
    }
    for (String operationName : operations.keySet()) {
        Operation operation = definition.createOperation();
        operation.setName(operationName);
        List<Message> messages = operations.get(operationName);
        for (Message message : messages) {
            if (isInputMessage(message)) {
                Input input = definition.createInput();
                input.setMessage(message);
                populateInput(definition, input);
                operation.setInput(input);
            } else if (isOutputMessage(message)) {
                Output output = definition.createOutput();
                output.setMessage(message);
                populateOutput(definition, output);
                operation.setOutput(output);
            } else if (isFaultMessage(message)) {
                Fault fault = definition.createFault();
                fault.setMessage(message);
                populateFault(definition, fault);
                operation.addFault(fault);
            }
        }
        operation.setStyle(getOperationType(operation));
        operation.setUndefined(false);
        if (logger.isDebugEnabled()) {
            logger.debug("Adding operation [" + operation.getName() + "] to port type [" + portType.getQName()
                    + "]");
        }
        portType.addOperation(operation);
    }
}

From source file:org.squashtest.tm.plugin.testautomation.jenkins.TestAutomationJenkinsConnector.java

private MultiValueMap<TestAutomationProject, Couple<AutomatedExecutionExtender, Map<String, Object>>> reduceToParamdExecsByProject(
        Collection<Couple<AutomatedExecutionExtender, Map<String, Object>>> parameterizedExecutions) {
    MultiValueMap<TestAutomationProject, Couple<AutomatedExecutionExtender, Map<String, Object>>> execsByProject = new LinkedMultiValueMap<>();

    for (Couple<AutomatedExecutionExtender, Map<String, Object>> paramdExec : parameterizedExecutions) {
        execsByProject.add(paramdExec.getA1().getAutomatedProject(), paramdExec);
    }//from   ww  w .j a v a  2 s .  c o m

    return execsByProject;
}

From source file:org.squashtest.tm.service.internal.chart.ColumnPrototypeModification.java

private MultiValueMap<Long, CustomFieldBinding> populateBindingByCufId(List<Long> cufBindingIds) {

    List<CustomFieldBinding> bindings = cufBindingDao.findAllByIds(cufBindingIds);

    MultiValueMap<Long, CustomFieldBinding> bindingByCufId = new LinkedMultiValueMap<>();

    for (CustomFieldBinding binding : bindings) {
        Long id = binding.getCustomField().getId();
        bindingByCufId.add(id, binding);
    }// ww  w  . java2  s  . co  m
    return bindingByCufId;
}

From source file:org.thingsboard.server.controller.AbstractControllerTest.java

protected void populateParams(MockHttpServletRequestBuilder request, String... params) {
    if (params != null && params.length > 0) {
        Assert.assertEquals(0, params.length % 2);
        MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>();
        for (int i = 0; i < params.length; i += 2) {
            paramsMap.add(params[i], params[i + 1]);
        }/*w ww .  j a  v  a 2s  .  c  om*/
        request.params(paramsMap);
    }
}