Method to prepare the request params for upload functionality

@param requestElements the request elements
960683
private void prepareUploadParams(RequestElements requestElements) {
		Map<String, String> requestHeaders = requestElements.getRequestHeaders();
		UploadRequestElements uploadRequestElements = requestElements.getUploadRequestElements();
		String boundaryId = uploadRequestElements.getBoundaryId();
		String formMetadataName = "file_metadata_" + boundaryId.substring(0, 5) + "_" + uploadRequestElements.getElementsId();
		String formContentName = "file_content_" + boundaryId.substring(0, 5) + "_" + uploadRequestElements.getElementsId();
		String contentType = ContentTypes.getContentType(getSerializationRequestFormat());
		
		Attachable attachable = (Attachable) requestElements.getEntity();
		String fileName = (attachable.getFileName() != null) ? "; filename=\"" + attachable.getFileName() + "\"" : "";
		String fileType = (attachable.getContentType() != null) ? "Content-Type: " + attachable.getContentType() + "\r\n" : "";
		
		String entityBoundary = String.format(UploadRequestElements.TEMPLATE_ENTITY_BOUNDARY, boundaryId, formMetadataName, contentType);
		String contentBoundary = String.format(UploadRequestElements.TEMPLATE_CONTENT_BOUNDARY, boundaryId, formContentName, fileName, fileType);
		
		requestHeaders.put(RequestElements.HEADER_PARAM_CONTENT_TYPE, ContentTypes.MULTIPART_FORMDATA.toString() + "; boundary=" + boundaryId);
		
		uploadRequestElements.setBoundaryForEntity(entityBoundary);
		uploadRequestElements.setBoundaryForContent(contentBoundary);
	}
895272
private void addPostParams(final Request request) {
        if (defaults != null) {
            request.addPostParam("Defaults", Converter.mapToJson(defaults));
        }
    }
812700
private void addPostParams(final Request request) {
        if (availableAddOnSid != null) {
            request.addPostParam("AvailableAddOnSid", availableAddOnSid);
        }

        if (acceptTermsOfService != null) {
            request.addPostParam("AcceptTermsOfService", acceptTermsOfService.toString());
        }

        if (configuration != null) {
            request.addPostParam("Configuration", Converter.mapToJson(configuration));
        }

        if (uniqueName != null) {
            request.addPostParam("UniqueName", uniqueName);
        }
    }
1041078
protected static void setSelected(TreeElement node, String selected, ServletRequest request)
    {
        assert(node != null) : "parameter 'node' must not be null";
        assert(selected != null) : "parameter 'selected' must not be null";
        assert(request != null) : "parameter 'requested' must not be null";

        if (node.getName().equals(selected)) {
            node.onSelect(request);
            node.setSelected(true);
        }
        else {
            if (node.isSelected()) {
                node.onSelect(request);
                node.setSelected(false);
            }
        }

        TreeElement children[] = node.getChildren();
        assert(children != null);
        for (int i = 0; i < children.length; i++) {
            setSelected(children[i], selected, request);
        }
    }
362289
private void addPostParams(final Request request) {
        if (friendlyName != null) {
            request.addPostParam("FriendlyName", friendlyName);
        }

        if (maxSize != null) {
            request.addPostParam("MaxSize", maxSize.toString());
        }
    }
272072
private void addPostParams(final Request request) {
        if (fieldType != null) {
            request.addPostParam("FieldType", fieldType);
        }

        if (uniqueName != null) {
            request.addPostParam("UniqueName", uniqueName);
        }
    }
573497
private void addPostParams(final Request request) {
        if (friendlyName != null) {
            request.addPostParam("FriendlyName", friendlyName);
        }

        if (eventCallbackUrl != null) {
            request.addPostParam("EventCallbackUrl", eventCallbackUrl.toString());
        }

        if (eventsFilter != null) {
            request.addPostParam("EventsFilter", eventsFilter);
        }

        if (multiTaskEnabled != null) {
            request.addPostParam("MultiTaskEnabled", multiTaskEnabled.toString());
        }

        if (template != null) {
            request.addPostParam("Template", template);
        }

        if (prioritizeQueueOrder != null) {
            request.addPostParam("PrioritizeQueueOrder", prioritizeQueueOrder.toString());
        }
    }
263014
@InterfaceAudience.Public
    public void setHeaders(Map<String, Object> requestHeadersParam) {
        if (requestHeadersParam != null && !requestHeaders.equals(requestHeadersParam)) {
            requestHeaders = requestHeadersParam;
        }
    }
632751
public void uploadFiles(
        String[] fieldNames,
        final I_CmsJavaScriptObjectCallback fileCallback,
        I_CmsErrorCallback errorCallback) {

        Set<String> fieldSet = new HashSet<String>();
        for (String field : fieldNames) {
            fieldSet.add(field);
        }

        m_formWrapper.uploadFields(fieldSet, new Function<Map<String, String>, Void>() {

            public Void apply(Map<String, String> input) {

                fileCallback.call(CmsJsUtils.convertMapToJsObject(input));
                return null;
            }
        }, errorCallback);
    }
889034
void processFormSubmitRequest(HttpServletRequest request) {

        String formDataId = getFormDataId(request);
        List<FileItem> items = CmsRequestUtil.readMultipartFileItems(request);
        m_storedFormData.put(formDataId, items);
    }
658621
private void addPostParams(final Request request) {
        if (attributes != null) {
            request.addPostParam("Attributes", attributes);
        }

        if (dateCreated != null) {
            request.addPostParam("DateCreated", dateCreated.toString());
        }

        if (dateUpdated != null) {
            request.addPostParam("DateUpdated", dateUpdated.toString());
        }
    }
699911
private void addPostParams(final Request request) {
        if (statusCallback != null) {
            request.addPostParam("StatusCallback", statusCallback.toString());
        }

        if (uniqueName != null) {
            request.addPostParam("UniqueName", uniqueName);
        }
    }
1353506
private void addPostParams(final Request request) {
        if (uniqueName != null) {
            request.addPostParam("UniqueName", uniqueName);
        }

        if (domainSuffix != null) {
            request.addPostParam("DomainSuffix", domainSuffix);
        }
    }
202748
private void addPostParams(final Request request) {
        if (to != null) {
            request.addPostParam("To", to);
        }

        if (channel != null) {
            request.addPostParam("Channel", channel);
        }

        if (customMessage != null) {
            request.addPostParam("CustomMessage", customMessage);
        }
    }
648934
private void addPostParams(final Request request) {
        if (dateExpiry != null) {
            request.addPostParam("DateExpiry", dateExpiry.toString());
        }

        if (ttl != null) {
            request.addPostParam("Ttl", ttl.toString());
        }

        if (mode != null) {
            request.addPostParam("Mode", mode.toString());
        }

        if (status != null) {
            request.addPostParam("Status", status.toString());
        }

        if (participants != null) {
            for (Map<String, Object> prop : participants) {
                request.addPostParam("Participants", Converter.mapToJson(prop));
            }
        }
    }
1239617
private void addQueryParams(final Request request) {
        if (from != null) {
            request.addQueryParam("From", from);
        }

        if (to != null) {
            request.addQueryParam("To", to);
        }

        if (dateCreatedOnOrBefore != null) {
            request.addQueryParam("DateCreatedOnOrBefore", dateCreatedOnOrBefore.toString());
        }

        if (dateCreatedAfter != null) {
            request.addQueryParam("DateCreatedAfter", dateCreatedAfter.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1229416
private void addPostParams(final Request request) {
        if (defaultActivitySid != null) {
            request.addPostParam("DefaultActivitySid", defaultActivitySid);
        }

        if (eventCallbackUrl != null) {
            request.addPostParam("EventCallbackUrl", eventCallbackUrl.toString());
        }

        if (eventsFilter != null) {
            request.addPostParam("EventsFilter", eventsFilter);
        }

        if (friendlyName != null) {
            request.addPostParam("FriendlyName", friendlyName);
        }

        if (multiTaskEnabled != null) {
            request.addPostParam("MultiTaskEnabled", multiTaskEnabled.toString());
        }

        if (timeoutActivitySid != null) {
            request.addPostParam("TimeoutActivitySid", timeoutActivitySid);
        }

        if (prioritizeQueueOrder != null) {
            request.addPostParam("PrioritizeQueueOrder", prioritizeQueueOrder.toString());
        }
    }