├── docs ├── legacy │ ├── Bootstrapping.md │ ├── ApplicationLifecycle.md │ ├── ArchitecturalProblemsWithWebApplications.md │ ├── SolvingProblems.md │ ├── Security1Introduction.md │ ├── Security3Authorization.md │ └── 11_UseCases4.md ├── 16_FAQ.md ├── 06_ConfiguringAndLogging.md └── 00_Introduction.md ├── tests ├── testsuite │ └── src │ │ ├── test │ │ ├── resources │ │ │ ├── staticfiles │ │ │ │ └── directory │ │ │ │ │ ├── file1 │ │ │ │ │ ├── file2 │ │ │ │ │ ├── file3 │ │ │ │ │ └── subdirectory │ │ │ │ │ ├── file4 │ │ │ │ │ └── file5 │ │ │ └── Xlogback.xml │ │ └── java │ │ │ └── com │ │ │ └── envimate │ │ │ └── httpmate │ │ │ └── tests │ │ │ ├── lowlevel │ │ │ ├── usecase │ │ │ │ └── usecases │ │ │ │ │ ├── SomeCheckedException.java │ │ │ │ │ ├── VoidUseCase.java │ │ │ │ │ ├── MyUseCaseInitializationException.java │ │ │ │ │ ├── ThrowCheckedExceptionUseCase.java │ │ │ │ │ └── FailInInitializerUseCase.java │ │ │ └── mapmate │ │ │ │ └── usecases │ │ │ │ └── MyUseCase.java │ │ │ └── givenwhenthen │ │ │ ├── builders │ │ │ ├── PathBuilder.java │ │ │ ├── HeaderBuilder.java │ │ │ ├── MethodBuilder.java │ │ │ └── BodyBuilder.java │ │ │ ├── client │ │ │ └── ClientFactory.java │ │ │ └── deploy │ │ │ └── awslambda │ │ │ └── lambdastatus │ │ │ ├── StackIdentifier.java │ │ │ └── LambdaStatusService.java │ │ └── main │ │ └── java │ │ └── com │ │ └── envimate │ │ └── httpmate │ │ └── tests │ │ ├── usecases │ │ ├── vooooid │ │ │ └── VoidUseCase.java │ │ ├── parameter │ │ │ ├── Parameter.java │ │ │ └── ParameterizedUseCase.java │ │ ├── twoparameters │ │ │ ├── Parameter1.java │ │ │ ├── Parameter2.java │ │ │ └── TwoParametersUseCase.java │ │ ├── simple │ │ │ └── TestUseCase.java │ │ ├── responsecontenttype │ │ │ ├── SetContentTypeInResponseValue.java │ │ │ └── SetContentTypeInResponseUseCase.java │ │ ├── responseheaders │ │ │ ├── HeadersInResponseReturnValue.java │ │ │ └── HeadersInResponseUseCase.java │ │ ├── echobody │ │ │ ├── EchoBodyValue.java │ │ │ └── EchoBodyUseCase.java │ │ ├── echocontenttype │ │ │ ├── EchoContentTypeValue.java │ │ │ └── EchoContentTypeUseCase.java │ │ ├── mapmate │ │ │ ├── MapMateUseCase.java │ │ │ └── mapmatedefinitions │ │ │ │ ├── CustomPrimitive2.java │ │ │ │ ├── CustomPrimitive3.java │ │ │ │ ├── CustomPrimitive4.java │ │ │ │ ├── CustomPrimitive1.java │ │ │ │ └── DataTransferObject.java │ │ ├── pathparameter │ │ │ ├── WildcardParameter.java │ │ │ └── WildCardUseCase.java │ │ ├── headers │ │ │ ├── HeadersParameter.java │ │ │ └── HeaderUseCase.java │ │ ├── echomultipart │ │ │ └── EchoMultipartUseCase.java │ │ ├── echopathandqueryparameters │ │ │ ├── EchoPathAndQueryParametersValue.java │ │ │ └── EchoPathAndQueryParametersUseCase.java │ │ └── queryparameters │ │ │ └── QueryParametersParameter.java │ │ └── Util.java └── aws-lambda-testfunction │ └── src │ └── test │ └── spotbugs │ └── spotbugs-exclude.xml ├── httpmate_logo.png ├── bitbucket-pipelines.yml ├── .gitignore ├── CHANGELOG.md ├── README.Java10.md ├── examples ├── documentation │ └── src │ │ ├── main │ │ ├── resources │ │ │ ├── myHtmlResource.html │ │ │ ├── start.html │ │ │ ├── form.html │ │ │ ├── login.html │ │ │ └── upload.html │ │ └── java │ │ │ └── com │ │ │ └── envimate │ │ │ └── httpmate │ │ │ └── documentation │ │ │ ├── jwt │ │ │ └── LoginException.java │ │ │ ├── xx_usecases │ │ │ ├── restaurant │ │ │ │ ├── ReservationConfirmation.java │ │ │ │ ├── RestaurantTimetable.java │ │ │ │ ├── Reservation.java │ │ │ │ └── ReservationSlot.java │ │ │ └── calculation │ │ │ │ └── domain │ │ │ │ └── CalculationResponse.java │ │ │ ├── PingUseCase.java │ │ │ ├── authentication │ │ │ └── UserDatabase.java │ │ │ ├── download │ │ │ └── DownloadExample.java │ │ │ ├── xx_client │ │ │ └── ClientExample.java │ │ │ ├── xx_logging │ │ │ └── LoggingExample.java │ │ │ └── react │ │ │ └── LoginException.java │ │ └── test │ │ ├── checkstyle │ │ └── checkstyle-suppressions.xml │ │ └── spotbugs │ │ └── spotbugs-exclude.xml ├── aws-lambda │ └── src │ │ ├── test │ │ ├── checkstyle │ │ │ └── checkstyle-suppressions.xml │ │ └── spotbugs │ │ │ └── spotbugs-exclude.xml │ │ └── main │ │ └── java │ │ └── com │ │ └── envimate │ │ └── httpmate │ │ └── examples │ │ └── awslambda │ │ └── usecases │ │ └── ValidationException.java └── hello-world │ └── src │ ├── test │ ├── spotbugs │ │ └── spotbugs-exclude.xml │ └── checkstyle │ │ └── checkstyle-suppressions.xml │ └── main │ └── java │ └── com │ └── envimate │ └── httpmate │ └── examples │ └── helloworld │ └── HelloWorldUseCase.java ├── integrations ├── jetty-with-websockets │ └── src │ │ ├── test │ │ └── java │ │ │ └── websockets │ │ │ ├── exampleproject │ │ │ ├── MessageArrived.java │ │ │ └── usecases │ │ │ │ ├── login │ │ │ │ └── LoginUseCase.java │ │ │ │ └── SendMessageResponse.java │ │ │ └── givenwhenthen │ │ │ ├── configurations │ │ │ └── artificial │ │ │ │ └── usecases │ │ │ │ ├── both │ │ │ │ └── BothUseCase.java │ │ │ │ ├── queryfoo │ │ │ │ └── QueryFooUseCase.java │ │ │ │ ├── normal │ │ │ │ └── NormalUseCase.java │ │ │ │ ├── echo │ │ │ │ └── EchoUseCase.java │ │ │ │ ├── query │ │ │ │ └── QueryUseCase.java │ │ │ │ ├── headers │ │ │ │ └── HeaderUseCase.java │ │ │ │ ├── pathparameter │ │ │ │ └── ParameterUseCase.java │ │ │ │ └── exception │ │ │ │ └── UseCaseException.java │ │ │ ├── builder │ │ │ └── HeadersStage.java │ │ │ └── FreePortPool.java │ │ └── main │ │ └── java │ │ └── com │ │ └── envimate │ │ └── httpmate │ │ └── jettywithwebsockets │ │ └── PortStage.java ├── jetty │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── envimate │ │ │ └── httpmate │ │ │ └── jetty │ │ │ └── PortStage.java │ │ └── test │ │ ├── checkstyle │ │ └── checkstyle-suppressions.xml │ │ └── spotbugs │ │ └── spotbugs-exclude.xml ├── spark │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── envimate │ │ │ └── httpmate │ │ │ └── spark │ │ │ └── PortStage.java │ │ └── test │ │ └── spotbugs │ │ └── spotbugs-exclude.xml ├── client │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── envimate │ │ │ └── httpmate │ │ │ └── client │ │ │ ├── clientbuilder │ │ │ └── PortStage.java │ │ │ ├── ClientResponseMapper.java │ │ │ ├── HttpClientRequestBody.java │ │ │ ├── issuer │ │ │ ├── real │ │ │ │ ├── ConnectionFactory.java │ │ │ │ ├── Connection.java │ │ │ │ └── Protocol.java │ │ │ ├── bypass │ │ │ │ └── SynchronizationWrapper.java │ │ │ └── Issuer.java │ │ │ └── body │ │ │ └── multipart │ │ │ ├── builder │ │ │ ├── FileNameStage.java │ │ │ └── ContentStage.java │ │ │ └── MultipartRequestException.java │ │ └── test │ │ └── checkstyle │ │ └── checkstyle-suppressions.xml ├── websocket │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── envimate │ │ │ └── httpmate │ │ │ └── websockets │ │ │ ├── WebSocketDelegate.java │ │ │ ├── WebSocketForEventFilter.java │ │ │ ├── builder │ │ │ ├── EventStage.java │ │ │ └── That.java │ │ │ ├── WebSocketMetrics.java │ │ │ ├── closing │ │ │ └── WebSocketCloser.java │ │ │ └── registry │ │ │ └── WebSocketNotFoundException.java │ │ └── test │ │ ├── checkstyle │ │ └── checkstyle-suppressions.xml │ │ └── spotbugs │ │ └── spotbugs-exclude.xml ├── usecases │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── envimate │ │ └── httpmate │ │ └── usecases │ │ └── EventFilter.java ├── mapmate │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── envimate │ │ │ └── httpmate │ │ │ └── mapmate │ │ │ ├── builder │ │ │ ├── DeserializerStage.java │ │ │ └── MarshallerTypeStage.java │ │ │ └── MapMateIntegration.java │ │ └── test │ │ └── spotbugs │ │ └── spotbugs-exclude.xml ├── aws-lambda │ └── src │ │ └── test │ │ └── spotbugs │ │ └── spotbugs-exclude.xml ├── multipart │ └── src │ │ ├── test │ │ ├── checkstyle │ │ │ └── checkstyle-suppressions.xml │ │ └── spotbugs │ │ │ └── spotbugs-exclude.xml │ │ └── main │ │ └── java │ │ └── com │ │ └── envimate │ │ └── httpmate │ │ └── multipart │ │ └── MultipartChainKeys.java └── servlet │ └── src │ └── test │ └── spotbugs │ └── spotbugs-exclude.xml └── core └── src └── main └── java └── com └── envimate └── httpmate ├── closing └── ClosingAction.java ├── chains ├── ConfiguratorBuilder.java ├── FinalConsumer.java ├── rules │ └── Action.java ├── Processor.java ├── NoChainForNameException.java └── ChainModule.java ├── backchannel ├── BackChannelTrigger.java └── BackChannelFactory.java ├── marshalling ├── With.java ├── Marshaller.java └── Unmarshaller.java ├── purejavaendpoint └── PortStage.java ├── logger └── LoggerImplementation.java ├── handler ├── Handler.java └── NoHandlerFoundException.java ├── cors └── policy │ ├── AllowedOrigins.java │ ├── AllowedHeaders.java │ └── AllowedMethods.java ├── security ├── authentication │ └── Authenticator.java └── authorization │ └── Authorizer.java ├── exceptions └── ExceptionMapper.java ├── path └── statemachine │ └── StateMachineMatcher.java ├── generator ├── GenerationCondition.java └── builder │ └── MethodStage.java ├── util ├── ObjectNotPresentException.java └── CustomTypeValidationException.java ├── http └── headers │ ├── accept │ └── MimeTypeElementMatcher.java │ └── cookies │ └── SameSitePolicy.java ├── debug └── DebugConfigurator.java └── responsetemplate └── ResponseTemplate.java /docs/legacy/Bootstrapping.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/legacy/ApplicationLifecycle.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/resources/staticfiles/directory/file1: -------------------------------------------------------------------------------- 1 | this is file1 -------------------------------------------------------------------------------- /tests/testsuite/src/test/resources/staticfiles/directory/file2: -------------------------------------------------------------------------------- 1 | this is file2 -------------------------------------------------------------------------------- /tests/testsuite/src/test/resources/staticfiles/directory/file3: -------------------------------------------------------------------------------- 1 | this is file3 -------------------------------------------------------------------------------- /httpmate_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/envimate/httpmate/HEAD/httpmate_logo.png -------------------------------------------------------------------------------- /tests/testsuite/src/test/resources/staticfiles/directory/subdirectory/file4: -------------------------------------------------------------------------------- 1 | this is file4 -------------------------------------------------------------------------------- /tests/testsuite/src/test/resources/staticfiles/directory/subdirectory/file5: -------------------------------------------------------------------------------- 1 | this is file5 -------------------------------------------------------------------------------- /docs/legacy/ArchitecturalProblemsWithWebApplications.md: -------------------------------------------------------------------------------- 1 | # Separation business logic vs. infrastructure 2 | 3 | # Duplication of validation code in frontend and backend -------------------------------------------------------------------------------- /docs/16_FAQ.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | 3 | ## How do you clean up resources? 4 | After you are done using HttpMate, you should call `httpMate.close()` in order to clean 5 | up allocated resources. 6 | -------------------------------------------------------------------------------- /bitbucket-pipelines.yml: -------------------------------------------------------------------------------- 1 | image: maven:3.5.4-jdk-11 2 | 3 | pipelines: 4 | default: 5 | - step: 6 | name: Build and Test 7 | script: 8 | - mvn -B clean package -DskipTests 9 | - mvn -B verify 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | target 3 | .envrc 4 | .idea/* 5 | !.idea/checkstyle-idea.xml 6 | !.idea/findbugs-idea.xml 7 | !.idea/copyright 8 | !.idea/inspectionProfiles 9 | !.idea/runConfigurations 10 | !.idea/codeStyleSettings.xml 11 | **.idea/ 12 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [1.0.20](https://search.maven.org/artifact/com.envimate.httpmate/core/1.0.20/jar) - 2019-06-11 8 | 9 | 10 | * New Builder for convenience. 11 | * Update dependencies. 12 | 13 | -------------------------------------------------------------------------------- /docs/legacy/SolvingProblems.md: -------------------------------------------------------------------------------- 1 | # Solving problems 2 | During the usage of HttpMate, you might run into problems. The following paragraphs will provide 3 | means to fix these problems. 4 | 5 | ## Visualizing data 6 | Whenever you come across data-holding objects in HttpMate, like for example HttpRequest 7 | or HttpResponse, these objects provide a `describe()` method which returns a String containing 8 | a neat representation of the objects contents. This way, you can easily inspect incoming requests, etc. -------------------------------------------------------------------------------- /docs/legacy/Security1Introduction.md: -------------------------------------------------------------------------------- 1 | # Security I: Introduction 2 | 3 | Security is a requirement in most web application nowadays. HttpMate was designed 4 | with this aspect in mind from the very beginning. 5 | As HttpMate is a tool made for seasoned software developers, it was very important 6 | to not only provide security mechanisms, but to enable secure development 7 | by crafting these aspects to be as usable as possible and adhering to established 8 | architectural principles. 9 | 10 | The following chapters will walk you through the aspects of authentication, 11 | authorization, request filtering and CORS. -------------------------------------------------------------------------------- /README.Java10.md: -------------------------------------------------------------------------------- 1 | How to run with Java 10 2 | ======================= 3 | 4 | https://sdkman.io/ 5 | $ sdk use java 10.0.2-oracle 6 | $ mvn -s settings.xml -B verify 7 | 8 | Known Issues 9 | ============ 10 | 11 | https://issues.apache.org/jira/browse/GROOVY-8339 (does not seem to affect the build) 12 | ``` 13 | ... 14 | WARNING: An illegal reflective access operation has occurred 15 | WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/home/lestephane/.m2/repository/org/codehaus/groovy/groovy/2.4.14/groovy-2.4.14.jar) to method java.lang.Object.finalize() 16 | ... 17 | ``` 18 | 19 | -------------------------------------------------------------------------------- /docs/legacy/Security3Authorization.md: -------------------------------------------------------------------------------- 1 | # Security III: Authorization 2 | 3 | In order to authorize requests, you need to implement the `Authorizer` interface: 4 | 5 | ```java 6 | public final MyAuthorizer implements HttpAuthorizer { 7 | 8 | @Override 9 | public boolean isAuthorized(final Optional user, final HttpRequest request) { 10 | return user.map(User::getName) 11 | .map("admin"::equals) 12 | .orElse(false); 13 | } 14 | } 15 | ``` 16 | An authorizer returns `true` if the request has been authorized and `false` if not. 17 | 18 | The `MyAuthorizer` authorizer can now be registered in an HttpMate configuration. This works the same for any flavour. The following 19 | example shows integrating it into the example configuration of the [Authentication](#authentication) section: 20 | 21 | ```java 22 | aLowLevelHttpMate() 23 | .get("/hello", (request, response) -> response.setBody("hi!")) 24 | .thatIs().configured(toAuthenticateRequests().beforeBodyProcessing().using(new MyAuthenticator())) 25 | .build(); 26 | ``` 27 | -------------------------------------------------------------------------------- /examples/documentation/src/main/resources/myHtmlResource.html: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 |

My Html Resource

24 | This is some example content. 25 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/exampleproject/MessageArrived.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.exampleproject; 23 | 24 | public class MessageArrived { 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/closing/ClosingAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.closing; 23 | 24 | public interface ClosingAction { 25 | void close(); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/chains/ConfiguratorBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.chains; 23 | 24 | public interface ConfiguratorBuilder { 25 | Configurator build(); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/backchannel/BackChannelTrigger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.backchannel; 23 | 24 | public interface BackChannelTrigger { 25 | void trigger(); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/marshalling/With.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.marshalling; 23 | 24 | public interface With { 25 | MarshallingModuleBuilder with(T marshaller); 26 | } 27 | -------------------------------------------------------------------------------- /integrations/jetty/src/main/java/com/envimate/httpmate/jetty/PortStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.jetty; 23 | 24 | public interface PortStage { 25 | JettyEndpoint listeningOnThePort(int port); 26 | } 27 | -------------------------------------------------------------------------------- /integrations/spark/src/main/java/com/envimate/httpmate/spark/PortStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.spark; 23 | 24 | public interface PortStage { 25 | SparkEndpoint listeningOnThePort(int port); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/purejavaendpoint/PortStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.purejavaendpoint; 23 | 24 | public interface PortStage { 25 | PureJavaEndpoint listeningOnThePort(int port); 26 | } 27 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/jwt/LoginException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.jwt; 23 | 24 | public final class LoginException extends RuntimeException { 25 | } 26 | -------------------------------------------------------------------------------- /examples/documentation/src/main/resources/start.html: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | 24 |

Welcome to the portal

25 | The secret 26 | Logout 27 | 28 | 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/logger/LoggerImplementation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.logger; 23 | 24 | @FunctionalInterface 25 | public interface LoggerImplementation { 26 | void log(LogMessage logMessage); 27 | } 28 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/clientbuilder/PortStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.clientbuilder; 23 | 24 | public interface PortStage { 25 | ProtocolStage withThePort(int port); 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/handler/Handler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.handler; 23 | 24 | import com.envimate.httpmate.chains.MetaData; 25 | 26 | public interface Handler { 27 | void handle(MetaData metaData); 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/marshalling/Marshaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.marshalling; 23 | 24 | import java.util.Map; 25 | 26 | public interface Marshaller { 27 | String marshall(Map map); 28 | } 29 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/vooooid/VoidUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.vooooid; 23 | 24 | public final class VoidUseCase { 25 | 26 | public void doVoid() { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/marshalling/Unmarshaller.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.marshalling; 23 | 24 | import java.util.Map; 25 | 26 | public interface Unmarshaller { 27 | Map unmarshall(String string); 28 | } 29 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/ClientResponseMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client; 23 | 24 | public interface ClientResponseMapper { 25 | T map(RawClientResponse response, Class targetType); 26 | } 27 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/HttpClientRequestBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client; 23 | 24 | import java.io.InputStream; 25 | 26 | public interface HttpClientRequestBody { 27 | InputStream get(); 28 | } 29 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/lowlevel/usecase/usecases/SomeCheckedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.lowlevel.usecase.usecases; 23 | 24 | public final class SomeCheckedException extends Exception { 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/chains/FinalConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.chains; 23 | 24 | import java.io.IOException; 25 | 26 | public interface FinalConsumer { 27 | void consume(MetaData metaData) throws IOException; 28 | } 29 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/xx_usecases/restaurant/ReservationConfirmation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.xx_usecases.restaurant; 23 | 24 | public final class ReservationConfirmation { 25 | } 26 | -------------------------------------------------------------------------------- /integrations/websocket/src/main/java/com/envimate/httpmate/websockets/WebSocketDelegate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.websockets; 23 | 24 | public interface WebSocketDelegate { 25 | 26 | void sendText(String text); 27 | 28 | void close(); 29 | } 30 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/givenwhenthen/builders/PathBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.givenwhenthen.builders; 23 | 24 | public interface PathBuilder { 25 | MethodBuilder aRequestToThePath(String path); 26 | } 27 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/lowlevel/usecase/usecases/VoidUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.lowlevel.usecase.usecases; 23 | 24 | public final class VoidUseCase { 25 | 26 | public void doNothing() { 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/cors/policy/AllowedOrigins.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.cors.policy; 23 | 24 | import com.envimate.httpmate.cors.domain.Origin; 25 | 26 | public interface AllowedOrigins { 27 | boolean isAllowed(Origin origin); 28 | } 29 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/PingUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation; 23 | 24 | public final class PingUseCase { 25 | 26 | public void ping() { 27 | System.out.println("Ping!"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/main/java/com/envimate/httpmate/jettywithwebsockets/PortStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.jettywithwebsockets; 23 | 24 | public interface PortStage { 25 | JettyEndpointWithWebSocketsSupport listeningOnThePort(int port); 26 | } 27 | -------------------------------------------------------------------------------- /integrations/usecases/src/main/java/com/envimate/httpmate/usecases/EventFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.usecases; 23 | 24 | import java.util.Map; 25 | 26 | public interface EventFilter { 27 | boolean filter(Class clazz, Map event); 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/security/authentication/Authenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.security.authentication; 23 | 24 | import java.util.Optional; 25 | 26 | public interface Authenticator { 27 | 28 | Optional authenticate(T challenge); 29 | } 30 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/lowlevel/usecase/usecases/MyUseCaseInitializationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.lowlevel.usecase.usecases; 23 | 24 | public final class MyUseCaseInitializationException extends RuntimeException { 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/chains/rules/Action.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.chains.rules; 23 | 24 | import com.envimate.httpmate.chains.ChainName; 25 | 26 | import java.util.Optional; 27 | 28 | public interface Action { 29 | Optional target(); 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/cors/policy/AllowedHeaders.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.cors.policy; 23 | 24 | import com.envimate.httpmate.cors.domain.RequestedHeader; 25 | 26 | public interface AllowedHeaders { 27 | boolean isAllowed(RequestedHeader requestedHeader); 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/cors/policy/AllowedMethods.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.cors.policy; 23 | 24 | import com.envimate.httpmate.cors.domain.RequestedMethod; 25 | 26 | public interface AllowedMethods { 27 | boolean isAllowed(RequestedMethod requestedMethod); 28 | } 29 | -------------------------------------------------------------------------------- /examples/documentation/src/main/resources/form.html: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 |
24 | Name:
25 | Profession: 26 | 27 |
28 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/chains/Processor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.chains; 23 | 24 | public interface Processor { 25 | 26 | default String identifier() { 27 | return this.getClass().getSimpleName(); 28 | } 29 | 30 | void apply(MetaData metaData); 31 | } 32 | -------------------------------------------------------------------------------- /examples/documentation/src/main/resources/login.html: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 |
24 | Username:
25 | Password: 26 | 27 |
28 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/parameter/Parameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.parameter; 23 | 24 | public final class Parameter { 25 | 26 | @Override 27 | public String toString() { 28 | return "parameter"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/security/authorization/Authorizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.security.authorization; 23 | 24 | import com.envimate.httpmate.chains.MetaData; 25 | 26 | @FunctionalInterface 27 | public interface Authorizer { 28 | boolean isAuthorized(MetaData metaData); 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/exceptions/ExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.exceptions; 23 | 24 | import com.envimate.httpmate.chains.MetaData; 25 | 26 | @FunctionalInterface 27 | public interface ExceptionMapper { 28 | void map(T exception, MetaData metaData); 29 | } 30 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/twoparameters/Parameter1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.twoparameters; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class Parameter1 { 28 | public final String value; 29 | } 30 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/twoparameters/Parameter2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.twoparameters; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class Parameter2 { 28 | public final String value; 29 | } 30 | -------------------------------------------------------------------------------- /integrations/mapmate/src/main/java/com/envimate/httpmate/mapmate/builder/DeserializerStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.mapmate.builder; 23 | 24 | import com.envimate.mapmate.deserialization.Deserializer; 25 | 26 | public interface DeserializerStage { 27 | T andTheDeserializer(Deserializer deserializer); 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/path/statemachine/StateMachineMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.path.statemachine; 23 | 24 | import java.util.Map; 25 | import java.util.Optional; 26 | 27 | public interface StateMachineMatcher { 28 | Optional> matchAndReturnCaptures(T element); 29 | } 30 | -------------------------------------------------------------------------------- /integrations/websocket/src/test/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/authentication/UserDatabase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.authentication; 23 | 24 | public interface UserDatabase { 25 | boolean authenticate(String username, String password); 26 | 27 | boolean hasAdminRights(String username); 28 | } 29 | -------------------------------------------------------------------------------- /examples/documentation/src/main/resources/upload.html: -------------------------------------------------------------------------------- 1 | 21 | 22 | 23 | 24 |

Simple File Uploads in Java

25 |
26 | 27 | 28 |
29 | 30 | -------------------------------------------------------------------------------- /integrations/mapmate/src/main/java/com/envimate/httpmate/mapmate/builder/MarshallerTypeStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.mapmate.builder; 23 | 24 | import com.envimate.mapmate.marshalling.MarshallingType; 25 | 26 | public interface MarshallerTypeStage { 27 | T toTheMarshallerType(MarshallingType marshallingType); 28 | } 29 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/issuer/real/ConnectionFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.issuer.real; 23 | 24 | interface ConnectionFactory extends AutoCloseable { 25 | Connection getConnectionTo(Endpoint endpoint); 26 | 27 | @Override 28 | default void close() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/configurations/artificial/usecases/both/BothUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.configurations.artificial.usecases.both; 23 | 24 | public final class BothUseCase { 25 | 26 | public String both() { 27 | return "this is both"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/chains/NoChainForNameException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.chains; 23 | 24 | public final class NoChainForNameException extends RuntimeException { 25 | 26 | NoChainForNameException(final ChainName name) { 27 | super("No chain registered for name " + name.name() + "."); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/configurations/artificial/usecases/queryfoo/QueryFooUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.configurations.artificial.usecases.queryfoo; 23 | 24 | public final class QueryFooUseCase { 25 | 26 | public String echo() { 27 | return "foo"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/givenwhenthen/client/ClientFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.givenwhenthen.client; 23 | 24 | import com.envimate.httpmate.tests.givenwhenthen.deploy.Deployment; 25 | 26 | public interface ClientFactory { 27 | HttpClientWrapper createClient(Deployment deployment); 28 | } 29 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/simple/TestUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.simple; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class TestUseCase { 28 | 29 | public String testUseCase() { 30 | return "foo"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/issuer/real/Connection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.issuer.real; 23 | 24 | import org.apache.http.HttpClientConnection; 25 | 26 | public interface Connection extends AutoCloseable { 27 | HttpClientConnection connectionObject(); 28 | 29 | @Override 30 | void close(); 31 | } 32 | -------------------------------------------------------------------------------- /integrations/websocket/src/main/java/com/envimate/httpmate/websockets/WebSocketForEventFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.websockets; 23 | 24 | import com.envimate.httpmate.chains.MetaData; 25 | 26 | import java.util.Map; 27 | 28 | public interface WebSocketForEventFilter { 29 | boolean test(MetaData metaData, Map event); 30 | } 31 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/configurations/artificial/usecases/normal/NormalUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.configurations.artificial.usecases.normal; 23 | 24 | public final class NormalUseCase { 25 | 26 | public String normalUseCase() { 27 | return "just a normal response"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/responsecontenttype/SetContentTypeInResponseValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.responsecontenttype; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public class SetContentTypeInResponseValue { 28 | public final String value; 29 | } 30 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/lowlevel/usecase/usecases/ThrowCheckedExceptionUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.lowlevel.usecase.usecases; 23 | 24 | public final class ThrowCheckedExceptionUseCase { 25 | 26 | public void fail() throws SomeCheckedException { 27 | throw new SomeCheckedException(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/documentation/src/test/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/lowlevel/mapmate/usecases/MyUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.lowlevel.mapmate.usecases; 23 | 24 | import com.envimate.httpmate.tests.lowlevel.mapmate.usecases.domain.MyRequest; 25 | 26 | public final class MyUseCase { 27 | 28 | public void doSomething(final MyRequest myRequest) { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/download/DownloadExample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.download; 23 | 24 | public final class DownloadExample { 25 | 26 | public static void main(String[] args) { 27 | //HttpMate.anHttpMate() 28 | // .get("/download", (request, response) -> ) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/configurations/artificial/usecases/echo/EchoUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.configurations.artificial.usecases.echo; 23 | 24 | public final class EchoUseCase { 25 | 26 | public String echo(final EchoParameter echoParameter) { 27 | return echoParameter.value(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/body/multipart/builder/FileNameStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.body.multipart.builder; 23 | 24 | public interface FileNameStage { 25 | 26 | default ContentStage withoutAFileName() { 27 | return withTheFileName(null); 28 | } 29 | 30 | ContentStage withTheFileName(String fileName); 31 | } 32 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/configurations/artificial/usecases/query/QueryUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.configurations.artificial.usecases.query; 23 | 24 | public final class QueryUseCase { 25 | 26 | public String run(final QueryParameter queryParameter) { 27 | return queryParameter.value(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/responseheaders/HeadersInResponseReturnValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.responseheaders; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public class HeadersInResponseReturnValue { 28 | public final String key; 29 | public final String value; 30 | } 31 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/twoparameters/TwoParametersUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.twoparameters; 23 | 24 | public final class TwoParametersUseCase { 25 | 26 | public String go(final Parameter1 parameter1, final Parameter2 parameter2) { 27 | return parameter1.value + " " + parameter2.value; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/generator/GenerationCondition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.generator; 23 | 24 | import com.envimate.httpmate.chains.MetaData; 25 | 26 | public interface GenerationCondition { 27 | 28 | default boolean isSubsetOf(final GenerationCondition other) { 29 | return false; 30 | } 31 | 32 | boolean generate(MetaData metaData); 33 | } 34 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/configurations/artificial/usecases/headers/HeaderUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.configurations.artificial.usecases.headers; 23 | 24 | public final class HeaderUseCase { 25 | 26 | public String run(final HeaderParameter headerParameter) { 27 | return headerParameter.value(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/xx_usecases/restaurant/RestaurantTimetable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.xx_usecases.restaurant; 23 | 24 | public final class RestaurantTimetable { 25 | 26 | public ReservationConfirmation reserve(final Reservation reservation) { 27 | throw new UnsupportedOperationException(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /integrations/jetty/src/test/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/builder/HeadersStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.builder; 23 | 24 | import websockets.givenwhenthen.WhenOrThen; 25 | 26 | public interface HeadersStage { 27 | 28 | default WhenOrThen withoutHeaders() { 29 | return withTheHeaders(); 30 | } 31 | 32 | WhenOrThen withTheHeaders(String... headers); 33 | } 34 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/echobody/EchoBodyValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.echobody; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class EchoBodyValue { 28 | private final String body; 29 | 30 | @Override 31 | public String toString() { 32 | return body; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /docs/06_ConfiguringAndLogging.md: -------------------------------------------------------------------------------- 1 | # Configuring HttpMate and Logging 2 | 3 | HttpMate is a flexible web framework. In order to 4 | customize it to your needs, you need a way to configure it. 5 | The HttpMate builder offers a `.configured()` method for this. 6 | It takes a `Configurator` object as an argument. All HttpMate 7 | integrations described throughout this guide will offer convenient 8 | static methods that create these configurators for you 9 | (we will call them *configurator methods* in the following chapters). 10 | As an example, if you want to configure how HttpMate will log, 11 | you can use the configurator methods provided in the `LoggerConfigurators` class: 12 | 13 | - `toLogUsing()` - logs using the passed implementation of the `Logger` interface 14 | 15 | - `toLogToStdout()` - logs everything to `STDOUT` 16 | 17 | - `toLogToStderr()` - logs everything to `STDERR` 18 | 19 | - `toLogToStdoutAndStderr()` - logs messages to `STDOUT` and exceptions to `STDERR` 20 | 21 | - `toDropAllLogMessages()` - does not log at all 22 | 23 | The default setting is to log to both `STDOUT` and `STDERR` - if you want to 24 | change that to log only to `STDOUT`, the configuration would look like this: 25 | 26 | ```java 27 | final HttpMate build = anHttpMate() 28 | [...] 29 | .configured(toLogToStdout()) 30 | .build(); 31 | ``` -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/issuer/bypass/SynchronizationWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.issuer.bypass; 23 | 24 | public class SynchronizationWrapper { 25 | private volatile T object; 26 | 27 | public T getObject() { 28 | return object; 29 | } 30 | 31 | public void setObject(T object) { 32 | this.object = object; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/configurations/artificial/usecases/pathparameter/ParameterUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.configurations.artificial.usecases.pathparameter; 23 | 24 | public final class ParameterUseCase { 25 | 26 | public String run(final ParameterParameter parameterParameter) { 27 | return parameterParameter.value(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /integrations/websocket/src/main/java/com/envimate/httpmate/websockets/builder/EventStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.websockets.builder; 23 | 24 | import com.envimate.httpmate.chains.Configurator; 25 | 26 | public interface EventStage { 27 | 28 | //To forwardingTheEvent(String eventType); 29 | 30 | //That closingOn(String eventType); 31 | 32 | Configurator build(); 33 | } 34 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/exampleproject/usecases/login/LoginUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.exampleproject.usecases.login; 23 | 24 | import websockets.exampleproject.domain.UserRepository; 25 | 26 | public final class LoginUseCase { 27 | private final UserRepository userRepository = new UserRepository(); 28 | 29 | public void login(final LoginRequest loginRequest) { 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /integrations/jetty/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /integrations/spark/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /examples/aws-lambda/src/test/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /integrations/aws-lambda/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /integrations/mapmate/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /integrations/multipart/src/test/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /integrations/multipart/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /integrations/servlet/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/givenwhenthen/builders/HeaderBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.givenwhenthen.builders; 23 | 24 | import com.envimate.httpmate.tests.givenwhenthen.Then; 25 | 26 | public interface HeaderBuilder { 27 | HeaderBuilder withTheHeader(String key, String value); 28 | 29 | HeaderBuilder withContentType(String contentType); 30 | 31 | Then isIssued(); 32 | } 33 | -------------------------------------------------------------------------------- /examples/aws-lambda/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /examples/hello-world/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | 28 | -------------------------------------------------------------------------------- /tests/aws-lambda-testfunction/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/givenwhenthen/builders/MethodBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.givenwhenthen.builders; 23 | 24 | public interface MethodBuilder { 25 | BodyBuilder viaTheGetMethod(); 26 | 27 | BodyBuilder viaThePostMethod(); 28 | 29 | BodyBuilder viaThePutMethod(); 30 | 31 | BodyBuilder viaTheDeleteMethod(); 32 | 33 | BodyBuilder viaTheOptionsMethod(); 34 | } 35 | -------------------------------------------------------------------------------- /integrations/websocket/src/main/java/com/envimate/httpmate/websockets/builder/That.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.websockets.builder; 23 | 24 | import com.envimate.httpmate.websockets.WebSocketForEventFilter; 25 | 26 | public interface That { 27 | 28 | default T allWebSockets() { 29 | return allWebSocketsThat((category, event) -> true); 30 | } 31 | 32 | T allWebSocketsThat(WebSocketForEventFilter filter); 33 | } 34 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/echocontenttype/EchoContentTypeValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.echocontenttype; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class EchoContentTypeValue { 28 | private final String value; 29 | 30 | @Override 31 | public String toString() { 32 | return value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/mapmate/MapMateUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.mapmate; 23 | 24 | import com.envimate.httpmate.tests.usecases.mapmate.mapmatedefinitions.DataTransferObject; 25 | 26 | public class MapMateUseCase { 27 | 28 | public DataTransferObject echoDTO(final DataTransferObject dataTransferObject) { 29 | return dataTransferObject; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/pathparameter/WildcardParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.pathparameter; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class WildcardParameter { 28 | private final String pathParameter; 29 | 30 | @Override 31 | public String toString() { 32 | return pathParameter; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/generator/builder/MethodStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.generator.builder; 23 | 24 | import com.envimate.httpmate.http.HttpRequestMethod; 25 | 26 | public interface MethodStage { 27 | default T andRequestMethod(final HttpRequestMethod requestMethod) { 28 | return andRequestMethods(requestMethod); 29 | } 30 | 31 | T andRequestMethods(HttpRequestMethod... requestMethods); 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/util/ObjectNotPresentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.util; 23 | 24 | public final class ObjectNotPresentException extends RuntimeException { 25 | 26 | private ObjectNotPresentException() { 27 | super("Requested object was null"); 28 | } 29 | 30 | public static ObjectNotPresentException objectNotPresentException() { 31 | return new ObjectNotPresentException(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/mapmate/mapmatedefinitions/CustomPrimitive2.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.mapmate.mapmatedefinitions; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor(staticName = "customPrimitive2") 27 | public class CustomPrimitive2 { 28 | private final String content; 29 | 30 | public String map() { 31 | return content; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/mapmate/mapmatedefinitions/CustomPrimitive3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.mapmate.mapmatedefinitions; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor(staticName = "customPrimitive3") 27 | public class CustomPrimitive3 { 28 | private final String content; 29 | 30 | public String map() { 31 | return content; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/mapmate/mapmatedefinitions/CustomPrimitive4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.mapmate.mapmatedefinitions; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor(staticName = "customPrimitive4") 27 | public class CustomPrimitive4 { 28 | private final String content; 29 | 30 | public String map() { 31 | return content; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/responseheaders/HeadersInResponseUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.responseheaders; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class HeadersInResponseUseCase { 28 | 29 | public HeadersInResponseReturnValue headersInReponse() { 30 | return new HeadersInResponseReturnValue("foo", "bar"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/givenwhenthen/builders/BodyBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.givenwhenthen.builders; 23 | 24 | import com.envimate.httpmate.tests.givenwhenthen.MultipartBuilder; 25 | 26 | public interface BodyBuilder { 27 | HeaderBuilder withAnEmptyBody(); 28 | 29 | HeaderBuilder withTheBody(String body); 30 | 31 | HeaderBuilder withTheMultipartBody(MultipartBuilder multipartBuilder); 32 | } 33 | -------------------------------------------------------------------------------- /docs/00_Introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | HttpMate is a modern and lightweight http framework for the Java ecosystem. This guide will 3 | explain everything you need to know to use it successfully in your projects. 4 | It will start by walking you through all basic concepts of http 5 | and how they can be used with HttpMate. It will cover topics like normal 6 | request processing, downloads, uploads, security, websockets and a lot more. 7 | If you are new to HttpMate, just start from the very beginning with 8 | the quickstart. 9 | 10 | Beyond "normal" http handling that works similar to other projects like Jetty, 11 | HttpMate is structured to mitigate architectural problems 12 | commonly found in serious projects. 13 | One of the issues that is addressed in HttpMate is keeping an architectural boundary 14 | between the code that handles http processing (infrastructure code) and 15 | the code that handles your actual business logic (domain code). 16 | In our experience, it is quite hard to achieve this goal using the common and 17 | established application frameworks of the Java ecosystem. 18 | HttpMate offers a solution to this problem by directly serving your domain 19 | logic, without the need of an intermediate layer consisting of annotations and/or 20 | "controllers". If you are an advanced reader and are primarily interested 21 | in the architectural features of HttpMate, you may skip to the "UseCases" 22 | section. -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/mapmate/mapmatedefinitions/CustomPrimitive1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.mapmate.mapmatedefinitions; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor(staticName = "customPrimitive1") 27 | public final class CustomPrimitive1 { 28 | private final String content; 29 | 30 | public String map() { 31 | return content; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/lowlevel/usecase/usecases/FailInInitializerUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.lowlevel.usecase.usecases; 23 | 24 | public final class FailInInitializerUseCase { 25 | 26 | public FailInInitializerUseCase() { 27 | throw new MyUseCaseInitializationException(); 28 | } 29 | 30 | public void performUseCase() { 31 | throw new UnsupportedOperationException(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/backchannel/BackChannelFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.backchannel; 23 | 24 | import com.envimate.httpmate.chains.MetaDataKey; 25 | 26 | import static com.envimate.httpmate.chains.MetaDataKey.metaDataKey; 27 | 28 | public interface BackChannelFactory { 29 | MetaDataKey BACK_CHANNEL_FACTORY = metaDataKey("BACK_CHANNEL_FACTORY"); 30 | 31 | BackChannelTrigger createTrigger(Runnable action); 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/http/headers/accept/MimeTypeElementMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.http.headers.accept; 23 | 24 | public interface MimeTypeElementMatcher { 25 | 26 | static MimeTypeElementMatcher parse(final String raw) { 27 | if("*".equals(raw)) { 28 | return candidate -> true; 29 | } else { 30 | return raw::equals; 31 | } 32 | } 33 | 34 | boolean matches(String candidate); 35 | } 36 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/givenwhenthen/deploy/awslambda/lambdastatus/StackIdentifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.givenwhenthen.deploy.awslambda.lambdastatus; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class StackIdentifier { 28 | private final String stackIdentifier; 29 | 30 | public String getStackIdentifier() { 31 | return stackIdentifier; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/aws-lambda/src/main/java/com/envimate/httpmate/examples/awslambda/usecases/ValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.examples.awslambda.usecases; 23 | 24 | public final class ValidationException extends RuntimeException { 25 | public final String field; 26 | public final String message; 27 | 28 | public ValidationException(final String field, final String message) { 29 | this.field = field; 30 | this.message = message; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/issuer/real/Protocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.issuer.real; 23 | 24 | import lombok.AccessLevel; 25 | import lombok.RequiredArgsConstructor; 26 | 27 | @RequiredArgsConstructor(access = AccessLevel.PRIVATE) 28 | public enum Protocol { 29 | HTTP("http"), HTTPS("https"); 30 | private final String identifier; 31 | 32 | public String identifier() { 33 | return this.identifier; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/headers/HeadersParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.headers; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | import java.util.Map; 27 | 28 | @RequiredArgsConstructor 29 | public final class HeadersParameter { 30 | private final Map headers; 31 | 32 | @Override 33 | public String toString() { 34 | return headers.get("testheader"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/echobody/EchoBodyUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.echobody; 23 | 24 | import com.envimate.httpmate.tests.usecases.ToStringWrapper; 25 | import lombok.RequiredArgsConstructor; 26 | 27 | @RequiredArgsConstructor 28 | public final class EchoBodyUseCase { 29 | 30 | public ToStringWrapper echo(final EchoBodyValue value) { 31 | return ToStringWrapper.toStringWrapper(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/hello-world/src/main/java/com/envimate/httpmate/examples/helloworld/HelloWorldUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.examples.helloworld; 23 | 24 | import static com.envimate.httpmate.examples.helloworld.HelloMessageResponse.helloMessage; 25 | import static com.envimate.httpmate.examples.helloworld.Message.message; 26 | 27 | public final class HelloWorldUseCase { 28 | 29 | public HelloMessageResponse hello() { 30 | return helloMessage(message("Qwer")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/responsecontenttype/SetContentTypeInResponseUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.responsecontenttype; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor 27 | public final class SetContentTypeInResponseUseCase { 28 | 29 | public SetContentTypeInResponseValue setContentTypeInResponseUseCase() { 30 | return new SetContentTypeInResponseValue("foobar"); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/http/headers/cookies/SameSitePolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.http.headers.cookies; 23 | 24 | import lombok.AccessLevel; 25 | import lombok.RequiredArgsConstructor; 26 | 27 | @RequiredArgsConstructor(access = AccessLevel.PRIVATE) 28 | public enum SameSitePolicy { 29 | STRICT("Strict"), LAX("Lax"), NONE("None"); 30 | 31 | private final String stringValue; 32 | 33 | String stringValue() { 34 | return stringValue; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/xx_usecases/restaurant/Reservation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.xx_usecases.restaurant; 23 | 24 | public final class Reservation { 25 | private final ReservationSlot slot; 26 | private final int numberOfPersons; 27 | 28 | public Reservation(final ReservationSlot slot, final int numberOfPersons) { 29 | this.slot = slot; 30 | this.numberOfPersons = numberOfPersons; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/exampleproject/usecases/SendMessageResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.exampleproject.usecases; 23 | 24 | import lombok.EqualsAndHashCode; 25 | import lombok.ToString; 26 | 27 | @ToString 28 | @EqualsAndHashCode 29 | public final class SendMessageResponse { 30 | private SendMessageResponse() { 31 | } 32 | 33 | public static SendMessageResponse sendMessageResponse() { 34 | return new SendMessageResponse(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /integrations/websocket/src/main/java/com/envimate/httpmate/websockets/WebSocketMetrics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.websockets; 23 | 24 | import com.envimate.httpmate.chains.MetaDataKey; 25 | 26 | import static com.envimate.httpmate.chains.MetaDataKey.metaDataKey; 27 | 28 | public final class WebSocketMetrics { 29 | public static final MetaDataKey NUMBER_OF_ACTIVE_WEB_SOCKETS = metaDataKey("NUMBER_OF_ACTIVE_WEB_SOCKETS"); 30 | 31 | private WebSocketMetrics() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /integrations/multipart/src/main/java/com/envimate/httpmate/multipart/MultipartChainKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.multipart; 23 | 24 | import com.envimate.httpmate.chains.MetaDataKey; 25 | 26 | import static com.envimate.httpmate.chains.MetaDataKey.metaDataKey; 27 | 28 | public final class MultipartChainKeys { 29 | public static final MetaDataKey MULTIPART_ITERATOR_BODY = metaDataKey("MULTIPART_ITERATOR_BODY"); 30 | 31 | private MultipartChainKeys() { 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/echomultipart/EchoMultipartUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.echomultipart; 23 | 24 | import com.envimate.httpmate.tests.usecases.ToStringWrapper; 25 | 26 | import static com.envimate.httpmate.tests.usecases.ToStringWrapper.toStringWrapper; 27 | 28 | public final class EchoMultipartUseCase { 29 | 30 | public ToStringWrapper echo(final EchoMultipartValue value) { 31 | return toStringWrapper(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/chains/ChainModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.chains; 23 | 24 | import static com.envimate.httpmate.chains.ModuleIdentifier.fromClass; 25 | 26 | public interface ChainModule extends Configurator { 27 | 28 | default ModuleIdentifier identifier() { 29 | return fromClass(this.getClass()); 30 | } 31 | 32 | @Override 33 | default void configure(final DependencyRegistry dependencyRegistry) { 34 | } 35 | 36 | void register(ChainExtender extender); 37 | } 38 | -------------------------------------------------------------------------------- /docs/legacy/11_UseCases4.md: -------------------------------------------------------------------------------- 1 | # Usecases IV: Validation 2 | 3 | ## Custom Primitives 4 | An important aspect of Domain-Driven Design (DDD) is the usage of *custom primitives* 5 | or *value objects* over conventional primitive datatypes (String, int, double, etc.). 6 | 7 | A custom primitive is a 8 | 9 | Let's consider an online shopping portal. On checkout, your shopping cart 10 | contains varying amounts of different products. 11 | Each item in a shopping cart therefore has a quantity (how many) and a product id (what). 12 | If we followed Java programming by the book, we would probably model the quantity with 13 | as an `int` and the 14 | 15 | ```java 16 | public final class ShoppingCartItem { 17 | private final 18 | private final Quantity quantity; 19 | } 20 | ``` 21 | 22 | ```java 23 | public final class Quantity { 24 | private final int quantity; 25 | 26 | public Quantity(final int quantity) { 27 | if(quantity < 0) { 28 | throw new IllegalArgumentException("quantity must not be negative"); 29 | } 30 | this.quantity = quantity; 31 | } 32 | } 33 | ``` 34 | 35 | ```java 36 | public final class ProductId { 37 | private final String id; 38 | 39 | public ProductId(final String id) { 40 | if(id == null) { 41 | throw new IllegalArgumentException("id must not be null"); 42 | } 43 | this.id = id; 44 | } 45 | } 46 | ``` 47 | 48 | We can now design a shopping cart: 49 | 50 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/xx_client/ClientExample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.xx_client; 23 | 24 | import static com.envimate.httpmate.client.HttpMateClient.aHttpMateClientForTheHost; 25 | 26 | public final class ClientExample { 27 | 28 | public static void main(final String[] args) { 29 | aHttpMateClientForTheHost("example.org") 30 | .withThePort(8080) 31 | .viaHttps() 32 | .build(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/xx_logging/LoggingExample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.xx_logging; 23 | 24 | import static com.envimate.httpmate.HttpMate.anHttpMate; 25 | import static com.envimate.httpmate.logger.LoggerConfigurators.toLogToStdout; 26 | 27 | public final class LoggingExample { 28 | 29 | public static void main(String[] args) { 30 | anHttpMate() 31 | .configured(toLogToStdout()) 32 | .build(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/FreePortPool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen; 23 | 24 | import java.util.concurrent.atomic.AtomicInteger; 25 | 26 | public final class FreePortPool { 27 | private static final int STARTING_PORT = 9000; 28 | private static AtomicInteger currentPort = new AtomicInteger(STARTING_PORT); 29 | 30 | private FreePortPool() { 31 | } 32 | 33 | public static int freePort() { 34 | return currentPort.incrementAndGet(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/java/com/envimate/httpmate/tests/givenwhenthen/deploy/awslambda/lambdastatus/LambdaStatusService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.givenwhenthen.deploy.awslambda.lambdastatus; 23 | 24 | import com.amazonaws.services.lambda.invoke.LambdaFunction; 25 | 26 | import java.util.Map; 27 | 28 | public interface LambdaStatusService { 29 | 30 | @LambdaFunction(functionName = "webmate-infra-deployment-status-Deployment-Status") 31 | Map status(StackIdentifier stackIdentifier); 32 | } 33 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/echopathandqueryparameters/EchoPathAndQueryParametersValue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.echopathandqueryparameters; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | import java.util.Map; 27 | 28 | @RequiredArgsConstructor 29 | public final class EchoPathAndQueryParametersValue { 30 | private final Map map; 31 | 32 | @Override 33 | public String toString() { 34 | return map.toString(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/mapmate/mapmatedefinitions/DataTransferObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.mapmate.mapmatedefinitions; 23 | 24 | import lombok.RequiredArgsConstructor; 25 | 26 | @RequiredArgsConstructor(staticName = "dataTransferObject") 27 | public class DataTransferObject { 28 | public final CustomPrimitive1 value1; 29 | public final CustomPrimitive2 value2; 30 | public final CustomPrimitive3 value3; 31 | public final CustomPrimitive4 value4; 32 | } 33 | -------------------------------------------------------------------------------- /examples/hello-world/src/test/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/issuer/Issuer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.issuer; 23 | 24 | import com.envimate.httpmate.client.HttpClientRequest; 25 | import com.envimate.httpmate.client.RawClientResponse; 26 | 27 | import java.util.function.Function; 28 | 29 | public interface Issuer extends AutoCloseable { 30 | T issue(HttpClientRequest request, 31 | Function responseMapper); 32 | 33 | @Override 34 | default void close() { 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/debug/DebugConfigurator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.debug; 23 | 24 | import com.envimate.httpmate.chains.Configurator; 25 | 26 | import static com.envimate.httpmate.chains.Configurator.toUseModules; 27 | import static com.envimate.httpmate.debug.DebugModule.debugModule; 28 | 29 | public final class DebugConfigurator { 30 | 31 | private DebugConfigurator() { 32 | } 33 | 34 | public static Configurator toBeInDebugMode() { 35 | return toUseModules(debugModule()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /integrations/jetty-with-websockets/src/test/java/websockets/givenwhenthen/configurations/artificial/usecases/exception/UseCaseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package websockets.givenwhenthen.configurations.artificial.usecases.exception; 23 | 24 | import lombok.AccessLevel; 25 | import lombok.RequiredArgsConstructor; 26 | 27 | @RequiredArgsConstructor(access = AccessLevel.PRIVATE) 28 | public class UseCaseException extends RuntimeException { 29 | 30 | public static UseCaseException useCaseException() { 31 | return new UseCaseException(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/xx_usecases/restaurant/ReservationSlot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.xx_usecases.restaurant; 23 | 24 | import java.util.Date; 25 | 26 | public final class ReservationSlot { 27 | private final Date start; 28 | 29 | private ReservationSlot(final Date start) { 30 | this.start = start; 31 | } 32 | 33 | public static String parseReservationSlot(final String asString) { 34 | throw new UnsupportedOperationException(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/testsuite/src/test/resources/Xlogback.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{48} - %msg%n 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/xx_usecases/calculation/domain/CalculationResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.xx_usecases.calculation.domain; 23 | 24 | public final class CalculationResponse { 25 | public final Integer result; 26 | 27 | public CalculationResponse(final Integer result) { 28 | this.result = result; 29 | } 30 | 31 | public static CalculationResponse calculationResult(final Integer result) { 32 | return new CalculationResponse(result); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests; 23 | 24 | import java.util.Optional; 25 | 26 | import static java.util.Optional.empty; 27 | import static java.util.Optional.of; 28 | 29 | public final class Util { 30 | 31 | private Util() { 32 | } 33 | 34 | public static Optional extractUsername(final String keyValue) { 35 | if (keyValue.startsWith("username=")) { 36 | return of(keyValue.substring(9)); 37 | } 38 | return empty(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/handler/NoHandlerFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.handler; 23 | 24 | import com.envimate.httpmate.chains.MetaData; 25 | 26 | public final class NoHandlerFoundException extends RuntimeException { 27 | 28 | private NoHandlerFoundException(final String message) { 29 | super(message); 30 | } 31 | 32 | public static NoHandlerFoundException noHandlerFoundException(final MetaData metaData) { 33 | return new NoHandlerFoundException("No handler found for: " + metaData); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/body/multipart/MultipartRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.body.multipart; 23 | 24 | public final class MultipartRequestException extends RuntimeException { 25 | 26 | private MultipartRequestException(final Throwable cause) { 27 | super("Exception while building multipart request", cause); 28 | } 29 | 30 | static MultipartRequestException multipartRequestException(final Throwable cause) { 31 | return new MultipartRequestException(cause); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /integrations/websocket/src/main/java/com/envimate/httpmate/websockets/closing/WebSocketCloser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.websockets.closing; 23 | 24 | import com.envimate.httpmate.backchannel.BackChannelTrigger; 25 | import lombok.AccessLevel; 26 | import lombok.EqualsAndHashCode; 27 | import lombok.RequiredArgsConstructor; 28 | import lombok.ToString; 29 | 30 | @ToString 31 | @EqualsAndHashCode 32 | @RequiredArgsConstructor(access = AccessLevel.PRIVATE) 33 | public final class WebSocketCloser { 34 | private final BackChannelTrigger backChannelTrigger; 35 | } 36 | -------------------------------------------------------------------------------- /integrations/websocket/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/util/CustomTypeValidationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.util; 23 | 24 | public final class CustomTypeValidationException extends IllegalArgumentException { 25 | private static final long serialVersionUID = -5137712128096384694L; 26 | 27 | private CustomTypeValidationException(final String s) { 28 | super(s); 29 | } 30 | 31 | public static CustomTypeValidationException customTypeValidationException(final String message) { 32 | return new CustomTypeValidationException(message); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /integrations/mapmate/src/main/java/com/envimate/httpmate/mapmate/MapMateIntegration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.mapmate; 23 | 24 | import com.envimate.mapmate.builder.MapMate; 25 | 26 | import static com.envimate.httpmate.mapmate.MapMateIntegrationBuilder.mapMateIntegration; 27 | 28 | public final class MapMateIntegration { 29 | 30 | private MapMateIntegration() { 31 | } 32 | 33 | public static MapMateIntegrationBuilder toMarshalRequestAndResponseBodiesUsingMapMate(final MapMate mapMate) { 34 | return mapMateIntegration(mapMate); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /integrations/websocket/src/main/java/com/envimate/httpmate/websockets/registry/WebSocketNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.websockets.registry; 23 | 24 | public final class WebSocketNotFoundException extends RuntimeException { 25 | 26 | private WebSocketNotFoundException(final String message) { 27 | super(message); 28 | } 29 | 30 | public static WebSocketNotFoundException webSocketNotFoundException(final WebSocketId webSocketId) { 31 | return new WebSocketNotFoundException("no websocket for id: " + webSocketId.id()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/envimate/httpmate/responsetemplate/ResponseTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.responsetemplate; 23 | 24 | import com.envimate.httpmate.chains.MetaData; 25 | 26 | import static com.envimate.httpmate.HttpMateChainKeys.RESPONSE_STATUS; 27 | import static com.envimate.httpmate.http.Http.StatusCodes.OK; 28 | 29 | @FunctionalInterface 30 | public interface ResponseTemplate { 31 | 32 | ResponseTemplate EMPTY_RESPONSE_TEMPLATE = metaData -> { 33 | metaData.set(RESPONSE_STATUS, OK); 34 | }; 35 | 36 | void apply(MetaData metaData); 37 | } 38 | -------------------------------------------------------------------------------- /integrations/client/src/test/checkstyle/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/echopathandqueryparameters/EchoPathAndQueryParametersUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.echopathandqueryparameters; 23 | 24 | import com.envimate.httpmate.tests.usecases.ToStringWrapper; 25 | 26 | import static com.envimate.httpmate.tests.usecases.ToStringWrapper.toStringWrapper; 27 | 28 | public final class EchoPathAndQueryParametersUseCase { 29 | 30 | public ToStringWrapper echo(final EchoPathAndQueryParametersValue value) { 31 | return toStringWrapper(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /examples/documentation/src/test/spotbugs/spotbugs-exclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/headers/HeaderUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.headers; 23 | 24 | import com.envimate.httpmate.tests.usecases.ToStringWrapper; 25 | import lombok.RequiredArgsConstructor; 26 | 27 | import static com.envimate.httpmate.tests.usecases.ToStringWrapper.toStringWrapper; 28 | 29 | @RequiredArgsConstructor 30 | public final class HeaderUseCase { 31 | 32 | public ToStringWrapper header(final HeadersParameter headersParameter) { 33 | return toStringWrapper(headersParameter); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/parameter/ParameterizedUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.parameter; 23 | 24 | import com.envimate.httpmate.tests.usecases.ToStringWrapper; 25 | import lombok.RequiredArgsConstructor; 26 | 27 | import static com.envimate.httpmate.tests.usecases.ToStringWrapper.toStringWrapper; 28 | 29 | @RequiredArgsConstructor 30 | public final class ParameterizedUseCase { 31 | 32 | public ToStringWrapper parameterized(final Parameter parameter) { 33 | return toStringWrapper(parameter); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /integrations/client/src/main/java/com/envimate/httpmate/client/body/multipart/builder/ContentStage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.client.body.multipart.builder; 23 | 24 | import com.envimate.httpmate.client.body.multipart.Part; 25 | 26 | import java.io.InputStream; 27 | 28 | import static com.envimate.httpmate.util.Streams.stringToInputStream; 29 | 30 | public interface ContentStage { 31 | 32 | default Part withTheContent(final String content) { 33 | return withTheContent(stringToInputStream(content)); 34 | } 35 | 36 | Part withTheContent(InputStream content); 37 | } 38 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/pathparameter/WildCardUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.pathparameter; 23 | 24 | import com.envimate.httpmate.tests.usecases.ToStringWrapper; 25 | import lombok.RequiredArgsConstructor; 26 | 27 | import static com.envimate.httpmate.tests.usecases.ToStringWrapper.toStringWrapper; 28 | 29 | @RequiredArgsConstructor 30 | public final class WildCardUseCase { 31 | 32 | public ToStringWrapper wildcard(final WildcardParameter parameter) { 33 | return toStringWrapper(parameter); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/echocontenttype/EchoContentTypeUseCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.echocontenttype; 23 | 24 | import com.envimate.httpmate.tests.usecases.ToStringWrapper; 25 | import lombok.RequiredArgsConstructor; 26 | 27 | import static com.envimate.httpmate.tests.usecases.ToStringWrapper.toStringWrapper; 28 | 29 | @RequiredArgsConstructor 30 | public final class EchoContentTypeUseCase { 31 | 32 | public ToStringWrapper echo(final EchoContentTypeValue value) { 33 | return toStringWrapper(value); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/testsuite/src/main/java/com/envimate/httpmate/tests/usecases/queryparameters/QueryParametersParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.tests.usecases.queryparameters; 23 | 24 | import java.util.Map; 25 | 26 | public final class QueryParametersParameter { 27 | private final Map queryParameters; 28 | 29 | public QueryParametersParameter(final Map queryParameters) { 30 | this.queryParameters = queryParameters; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return queryParameters.toString(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /examples/documentation/src/main/java/com/envimate/httpmate/documentation/react/LoginException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019 envimate GmbH - https://envimate.com/. 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | 22 | package com.envimate.httpmate.documentation.react; 23 | 24 | import static com.envimate.httpmate.util.Validators.validateNotNullNorEmpty; 25 | 26 | public final class LoginException extends RuntimeException { 27 | 28 | private LoginException(final String message) { 29 | super(message); 30 | } 31 | 32 | public static LoginException loginException(final String message) { 33 | validateNotNullNorEmpty(message, "message"); 34 | return new LoginException(message); 35 | } 36 | } 37 | --------------------------------------------------------------------------------