Java Code Examples for io.vertx.core.MultiMap#caseInsensitiveMultiMap()
The following examples show how to use
io.vertx.core.MultiMap#caseInsensitiveMultiMap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ParametersTestAPIClient.java From vertx-web with Apache License 2.0 | 6 votes |
/** * Call header_simple_explode_object with empty body. * @param color Parameter color inside header * @param handler The handler for the asynchronous request */ public void headerSimpleExplodeObject( Map<String, Object> color, Handler<AsyncResult<HttpResponse>> handler) { // Check required params if (color == null) throw new RuntimeException("Missing parameter color"); // Generate the uri String uri = "/header/simple/explode/object"; HttpRequest request = client.get(uri); MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap(); if (color != null) this.addHeaderObjectSimpleExplode("color", color, request); this.renderAndAttachCookieHeader(request, requestCookies); request.send(handler); }
Example 2
Source File: AuctionHandlerTest.java From prebid-server-java with Apache License 2.0 | 6 votes |
@Test public void shouldTolerateDuplicateQueryParamNames() { // given given(auctionRequestFactory.fromRequest(any(), anyLong())) .willReturn(Future.succeededFuture(givenAuctionContext(identity()))); final MultiMap params = MultiMap.caseInsensitiveMultiMap(); params.add("param", "value1"); params.add("param", "value2"); given(httpRequest.params()).willReturn(params); // when auctionHandler.handle(routingContext); // then final AuctionEvent auctionEvent = captureAuctionEvent(); final Map<String, String> obtainedParams = auctionEvent.getHttpContext().getQueryParams(); assertThat(obtainedParams.entrySet()).containsOnly(entry("param", "value1")); }
Example 3
Source File: S3Client.java From vertx-s3-client with Apache License 2.0 | 6 votes |
private MultiMap populateAclHeadersRequest(AclHeadersRequest aclHeadersRequest) { final MultiMap headers = MultiMap.caseInsensitiveMultiMap(); if (aclHeadersRequest.getAmzAcl() != null) { headers.add(Headers.X_AMZ_ACL, StringUtils.trim(aclHeadersRequest.getAmzAcl().getValue())); } if (StringUtils.trimToNull(aclHeadersRequest.getAmzGrantRead()) != null) { headers.add(Headers.X_AMZ_GRANT_READ, StringUtils.trim(aclHeadersRequest.getAmzGrantRead())); } if (StringUtils.trimToNull(aclHeadersRequest.getAmzGrantWrite()) != null) { headers.add(Headers.X_AMZ_GRANT_WRITE, StringUtils.trim(aclHeadersRequest.getAmzGrantWrite())); } if (StringUtils.trimToNull(aclHeadersRequest.getAmzGrantReadAcp()) != null) { headers.add(Headers.X_AMZ_GRANT_READ_ACP, StringUtils.trim(aclHeadersRequest.getAmzGrantReadAcp())); } if (StringUtils.trimToNull(aclHeadersRequest.getAmzGrantWriteAcp()) != null) { headers.add(Headers.X_AMZ_GRANT_WRITE_ACP, StringUtils.trim(aclHeadersRequest.getAmzGrantWriteAcp())); } if (StringUtils.trimToNull(aclHeadersRequest.getAmzGrantFullControl()) != null) { headers.add(Headers.X_AMZ_GRANT_FULL_CONTROL, StringUtils.trim(aclHeadersRequest.getAmzGrantFullControl())); } return headers; }
Example 4
Source File: ApiClient.java From vertx-web with Apache License 2.0 | 6 votes |
/** * Call query_spaceDelimited_noexplode_array with empty body. * @param color Parameter color inside query * @param handler The handler for the asynchronous request */ public void querySpaceDelimitedNoexplodeArray( List<Object> color, Handler<AsyncResult<HttpResponse>> handler) { // Check required params if (color == null) throw new RuntimeException("Missing parameter color"); // Generate the uri String uri = "/query/spaceDelimited/noexplode/array"; HttpRequest request = client.get(uri); MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap(); if (color != null) this.addQueryArraySpaceDelimited("color", color, request); this.renderAndAttachCookieHeader(request, requestCookies); request.send(handler); }
Example 5
Source File: ParametersTestAPIClient.java From vertx-web with Apache License 2.0 | 6 votes |
/** * Call query_pipeDelimited_noexplode_array with empty body. * @param color Parameter color inside query * @param handler The handler for the asynchronous request */ public void queryPipeDelimitedNoexplodeArray( List<Object> color, Handler<AsyncResult<HttpResponse>> handler) { // Check required params if (color == null) throw new RuntimeException("Missing parameter color"); // Generate the uri String uri = "/query/pipeDelimited/noexplode/array"; HttpRequest request = client.get(uri); MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap(); if (color != null) this.addQueryArrayPipeDelimited("color", color, request); this.renderAndAttachCookieHeader(request, requestCookies); request.send(handler); }
Example 6
Source File: HTTPRequestValidationTest.java From vertx-web with Apache License 2.0 | 6 votes |
@Test public void testFormURLEncodedOverrideWithIncludedTypes() throws Exception { HTTPRequestValidationHandler validationHandler = HTTPRequestValidationHandler.create().addFormParam("parameter", ParameterType.INT, true).addQueryParam("parameter", ParameterType.INT, true); router.route().handler(BodyHandler.create()); router.post("/testFormParam").handler(validationHandler); router.post("/testFormParam").handler(routingContext -> { RequestParameters params = routingContext.get("parsedParameters"); routingContext.response().setStatusMessage(params.formParameter("parameter").getInteger().toString()).end(); }).failureHandler(generateFailureHandler(false)); String formParam = getSuccessSample(ParameterType.INT).getInteger().toString(); String queryParam = getSuccessSample(ParameterType.INT).getInteger().toString(); MultiMap form = MultiMap.caseInsensitiveMultiMap(); form.add("parameter", formParam); testRequestWithForm(HttpMethod.POST, "/testFormParam?parameter=" + queryParam, FormType.FORM_URLENCODED, form, 200, formParam); }
Example 7
Source File: ApiClient.java From vertx-web with Apache License 2.0 | 6 votes |
/** * Call cookie_form_noexplode_array with empty body. * @param color Parameter color inside cookie * @param handler The handler for the asynchronous request */ public void cookieFormNoexplodeArray( List<Object> color, Handler<AsyncResult<HttpResponse>> handler) { // Check required params if (color == null) throw new RuntimeException("Missing parameter color"); // Generate the uri String uri = "/cookie/form/noexplode/array"; HttpRequest request = client.get(uri); MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap(); if (color != null) this.renderCookieArrayForm("color", color, requestCookies); this.renderAndAttachCookieHeader(request, requestCookies); request.send(handler); }
Example 8
Source File: FakeApiImpl.java From openapi-generator with Apache License 2.0 | 6 votes |
/** * * Test serialization of object with outer number type * @param body Input composite as post body (optional) * @param resultHandler Asynchronous result handler */ public void fakeOuterCompositeSerialize(OuterComposite body, Handler<AsyncResult<OuterComposite>> resultHandler) { Object localVarBody = body; // create path and map variables String localVarPath = "/fake/outer/composite"; // query params List<Pair> localVarQueryParams = new ArrayList<>(); // header params MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); // cookie params MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); // form params // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) Map<String, Object> localVarFormParams = new HashMap<>(); String[] localVarAccepts = { "*/*" }; String[] localVarContentTypes = { }; String[] localVarAuthNames = new String[] { }; TypeReference<OuterComposite> localVarReturnType = new TypeReference<OuterComposite>() {}; apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, localVarReturnType, resultHandler); }
Example 9
Source File: ParametersTestAPIClient.java From vertx-web with Apache License 2.0 | 6 votes |
/** * Call query_deepObject_explode_object with empty body. * @param color Parameter color inside query * @param handler The handler for the asynchronous request */ public void queryDeepObjectExplodeObject( Map<String, Object> color, Handler<AsyncResult<HttpResponse>> handler) { // Check required params if (color == null) throw new RuntimeException("Missing parameter color"); // Generate the uri String uri = "/query/deepObject/explode/object"; HttpRequest request = client.get(uri); MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap(); if (color != null) this.addQueryObjectDeepObjectExplode("color", color, request); this.renderAndAttachCookieHeader(request, requestCookies); request.send(handler); }
Example 10
Source File: MailEncoderTest.java From vertx-mail-client with Apache License 2.0 | 5 votes |
@Test public void testHeadersExist() { MailMessage message = new MailMessage(); MultiMap headers = MultiMap.caseInsensitiveMultiMap(); headers.set("mime-version", "2.1"); message.setHeaders(headers); String mime = new MailEncoder(message, HOSTNAME).encode().toLowerCase(Locale.ENGLISH); assertThat(mime, containsString("mime-version: 2.1")); assertThat(mime, not(containsString("mime-version: 1.0"))); }
Example 11
Source File: FakeClassnameTags123ApiImpl.java From openapi-generator with Apache License 2.0 | 5 votes |
/** * To test class name in snake case * To test class name in snake case * @param body client model (required) * @param resultHandler Asynchronous result handler */ public void testClassname(Client body, Handler<AsyncResult<Client>> resultHandler) { Object localVarBody = body; // verify the required parameter 'body' is set if (body == null) { resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'body' when calling testClassname")); return; } // create path and map variables String localVarPath = "/fake_classname_test"; // query params List<Pair> localVarQueryParams = new ArrayList<>(); // header params MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); // cookie params MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); // form params // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) Map<String, Object> localVarFormParams = new HashMap<>(); String[] localVarAccepts = { "application/json" }; String[] localVarContentTypes = { "application/json" }; String[] localVarAuthNames = new String[] { "api_key_query" }; TypeReference<Client> localVarReturnType = new TypeReference<Client>() {}; apiClient.invokeAPI(localVarPath, "PATCH", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, localVarReturnType, resultHandler); }
Example 12
Source File: UserApiImpl.java From openapi-generator with Apache License 2.0 | 5 votes |
/** * Logs user into the system * * @param username The user name for login (required) * @param password The password for login in clear text (required) * @param resultHandler Asynchronous result handler */ public void loginUser(String username, String password, Handler<AsyncResult<String>> resultHandler) { Object localVarBody = null; // verify the required parameter 'username' is set if (username == null) { resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'username' when calling loginUser")); return; } // verify the required parameter 'password' is set if (password == null) { resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'password' when calling loginUser")); return; } // create path and map variables String localVarPath = "/user/login"; // query params List<Pair> localVarQueryParams = new ArrayList<>(); localVarQueryParams.addAll(apiClient.parameterToPairs("", "username", username)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "password", password)); // header params MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); // cookie params MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); // form params // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) Map<String, Object> localVarFormParams = new HashMap<>(); String[] localVarAccepts = { "application/xml", "application/json" }; String[] localVarContentTypes = { }; String[] localVarAuthNames = new String[] { }; TypeReference<String> localVarReturnType = new TypeReference<String>() {}; apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, localVarReturnType, resultHandler); }
Example 13
Source File: TestVertxClientRequestToHttpServletRequest.java From servicecomb-java-chassis with Apache License 2.0 | 5 votes |
@Test public void testGetHeader() { MultiMap headers = MultiMap.caseInsensitiveMultiMap(); headers.add("name", "value"); new Expectations() { { clientRequest.headers(); result = headers; } }; Assert.assertEquals("value", request.getHeader("name")); }
Example 14
Source File: WebClientExamples.java From vertx-web with Apache License 2.0 | 5 votes |
public void sendMultipart(WebClient client) { MultiMap form = MultiMap.caseInsensitiveMultiMap(); form.set("firstName", "Dale"); form.set("lastName", "Cooper"); // Submit the form as a multipart form body client .post(8080, "myserver.mycompany.com", "/some-uri") .putHeader("content-type", "multipart/form-data") .sendForm(form) .onSuccess(res -> { // OK }); }
Example 15
Source File: S3Client.java From vertx-s3-client with Apache License 2.0 | 5 votes |
private MultiMap populateDeleteObjectHeaders(DeleteObjectRequest deleteObjectRequest) { final MultiMap headers = MultiMap.caseInsensitiveMultiMap(); if (StringUtils.trimToNull(deleteObjectRequest.getAmzMfa()) != null) { headers.add(Headers.X_AMZ_MFA, StringUtils.trim(deleteObjectRequest.getAmzMfa())); } return headers; }
Example 16
Source File: HonoHttpDevice.java From hono with Eclipse Public License 2.0 | 5 votes |
public MultiMap getHeaders() { final MultiMap headers = MultiMap.caseInsensitiveMultiMap(); headers.add(HttpHeaders.CONTENT_TYPE, contentType); if (ttd != null) { headers.add(Constants.HEADER_TIME_TILL_DISCONNECT, ttd.toString()); } return headers; }
Example 17
Source File: MailEncoderTest.java From vertx-mail-client with Apache License 2.0 | 5 votes |
@Test public void testFixedHeadersExist() { MailMessage message = new MailMessage(); MultiMap headers = MultiMap.caseInsensitiveMultiMap(); headers.set("Content-Type", "type"); message.setHeaders(headers); message.setFixedHeaders(true); String mime = new MailEncoder(message, HOSTNAME).encode(); assertThat(mime, containsString("Content-Type: type")); assertThat(mime, not(containsString("Content-Type: text/plain"))); }
Example 18
Source File: UserApiImpl.java From openapi-generator with Apache License 2.0 | 5 votes |
/** * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted (required) * @param resultHandler Asynchronous result handler */ public void deleteUser(String username, Handler<AsyncResult<Void>> resultHandler) { Object localVarBody = null; // verify the required parameter 'username' is set if (username == null) { resultHandler.handle(ApiException.fail(400, "Missing the required parameter 'username' when calling deleteUser")); return; } // create path and map variables String localVarPath = "/user/{username}".replaceAll("\\{" + "username" + "\\}", username.toString()); // query params List<Pair> localVarQueryParams = new ArrayList<>(); // header params MultiMap localVarHeaderParams = MultiMap.caseInsensitiveMultiMap(); // cookie params MultiMap localVarCookieParams = MultiMap.caseInsensitiveMultiMap(); // form params // TODO: sending files within multipart/form-data is not supported yet (because of vertx web-client) Map<String, Object> localVarFormParams = new HashMap<>(); String[] localVarAccepts = { }; String[] localVarContentTypes = { }; String[] localVarAuthNames = new String[] { }; apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccepts, localVarContentTypes, localVarAuthNames, null, resultHandler); }
Example 19
Source File: ServiceRequest.java From vertx-web with Apache License 2.0 | 4 votes |
private void init() { this.params = new JsonObject(); this.headers = MultiMap.caseInsensitiveMultiMap(); this.user = null; this.extra = null; }
Example 20
Source File: ApiClient.java From vertx-web with Apache License 2.0 | 4 votes |
/** * Call path_matrix_explode_string with empty body. * @param color Parameter color inside path * @param handler The handler for the asynchronous request */ public void pathMatrixExplodeString( String color, Handler<AsyncResult<HttpResponse>> handler) { // Check required params if (color == null) throw new RuntimeException("Missing parameter color in path"); // Generate the uri String uri = "/path/matrix/explode/string/{;color*}"; uri = uri.replaceAll("\\{{1}([.;?*+]*([^\\{\\}.;?*+]+)[^\\}]*)\\}{1}", "{$2}"); //Remove * . ; ? from url template uri = uri.replace("{color}", this.renderPathMatrix("color", color)); HttpRequest request = client.get(uri); MultiMap requestCookies = MultiMap.caseInsensitiveMultiMap(); this.renderAndAttachCookieHeader(request, requestCookies); request.send(handler); }