├── .circleci └── config.yml ├── .gitignore ├── CHANGELOG.md ├── Dockerfile-template ├── LICENSE ├── README.md ├── createSite ├── dev-instructions.md ├── examples ├── pom.xml └── requestor-showcase │ ├── checkstyle-suppressions.xml │ ├── pom.xml │ └── src │ └── main │ ├── java │ └── io │ │ └── reinert │ │ └── requestor │ │ └── examples │ │ └── showcase │ │ ├── HasActivity.java │ │ ├── HasPlace.java │ │ ├── HasToken.java │ │ ├── MenuOption.java │ │ ├── Showcase.java │ │ ├── ShowcaseActivityMapper.java │ │ ├── ShowcaseClientFactory.java │ │ ├── ShowcaseDeferredFactory.java │ │ ├── ShowcasePlaceHistoryMapper.java │ │ ├── activity │ │ ├── AuthActivity.java │ │ ├── BinaryDataActivity.java │ │ ├── FiltersActivity.java │ │ ├── FluentRequestApiActivity.java │ │ ├── FormActivity.java │ │ ├── GettingStartedActivity.java │ │ ├── HomeActivity.java │ │ ├── InterceptorsActivity.java │ │ ├── RequestBuildingActivity.java │ │ ├── RequestInvokingActivity.java │ │ ├── RequestListeningActivity.java │ │ ├── SerializationActivity.java │ │ └── ShowcaseActivity.java │ │ ├── place │ │ ├── AuthPlace.java │ │ ├── BinaryDataPlace.java │ │ ├── FiltersPlace.java │ │ ├── FluentRequestApiPlace.java │ │ ├── FormPlace.java │ │ ├── GettingStartedPlace.java │ │ ├── HomePlace.java │ │ ├── InterceptorsPlace.java │ │ ├── RequestBuildingPlace.java │ │ ├── RequestInvokingPlace.java │ │ ├── RequestListeningPlace.java │ │ ├── SerializationPlace.java │ │ └── ShowcasePlace.java │ │ ├── ui │ │ ├── Auth.java │ │ ├── Auth.ui.xml │ │ ├── BinaryData.java │ │ ├── BinaryData.ui.xml │ │ ├── Filters.java │ │ ├── Filters.ui.xml │ │ ├── FluentRequestApi.java │ │ ├── FluentRequestApi.ui.xml │ │ ├── Form.java │ │ ├── Form.ui.xml │ │ ├── GettingStarted.java │ │ ├── GettingStarted.ui.xml │ │ ├── Home.java │ │ ├── Home.ui.xml │ │ ├── Interceptors.java │ │ ├── Interceptors.ui.xml │ │ ├── RequestBuilding.java │ │ ├── RequestBuilding.ui.xml │ │ ├── RequestInvoking.java │ │ ├── RequestInvoking.ui.xml │ │ ├── RequestListening.java │ │ ├── RequestListening.ui.xml │ │ ├── Serialization.java │ │ ├── Serialization.ui.xml │ │ └── loading │ │ │ ├── Loading.java │ │ │ ├── Loading.ui.xml │ │ │ └── event │ │ │ ├── HideLoadingEvent.java │ │ │ └── ShowLoadingEvent.java │ │ └── util │ │ ├── HighlightJs.java │ │ ├── Page.java │ │ └── Util.java │ ├── resources │ └── io │ │ └── reinert │ │ └── requestor │ │ └── examples │ │ └── showcase │ │ └── Showcase.gwt.xml │ └── webapp │ ├── WEB-INF │ └── web.xml │ ├── css │ ├── showcase.css │ └── zocial.css │ ├── favicon.ico │ ├── index.html │ └── js │ └── bootstrap-without-jquery.min.js ├── generate-site.sh ├── pom.xml ├── release.sh ├── requestor ├── core │ ├── pom.xml │ ├── requestor-annotations │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── annotations │ │ │ └── MediaType.java │ ├── requestor-core │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── reinert │ │ │ │ │ └── requestor │ │ │ │ │ └── core │ │ │ │ │ ├── AbstractProcessableRequest.java │ │ │ │ │ ├── AbstractProcessableResponse.java │ │ │ │ │ ├── AbstractRequestInvoker.java │ │ │ │ │ ├── AsyncRunner.java │ │ │ │ │ ├── Auth.java │ │ │ │ │ ├── AuthException.java │ │ │ │ │ ├── Base64Codec.java │ │ │ │ │ ├── BaseRequestSerializer.java │ │ │ │ │ ├── BaseResponseDeserializer.java │ │ │ │ │ ├── BaseService.java │ │ │ │ │ ├── CallbackDeferred.java │ │ │ │ │ ├── Deferred.java │ │ │ │ │ ├── DeferredPool.java │ │ │ │ │ ├── DelaySequence.java │ │ │ │ │ ├── DeserializableResponse.java │ │ │ │ │ ├── DeserializableResponseInProcess.java │ │ │ │ │ ├── DeserializerProvider.java │ │ │ │ │ ├── DirectInvoker.java │ │ │ │ │ ├── FilterManager.java │ │ │ │ │ ├── FilterManagerImpl.java │ │ │ │ │ ├── FormData.java │ │ │ │ │ ├── FormDataUrlEncodedSerializer.java │ │ │ │ │ ├── HasHeaders.java │ │ │ │ │ ├── HasPollingOptions.java │ │ │ │ │ ├── HasRequestOptions.java │ │ │ │ │ ├── Headers.java │ │ │ │ │ ├── HeadersDeserializer.java │ │ │ │ │ ├── HttpConnection.java │ │ │ │ │ ├── HttpDeserializationContext.java │ │ │ │ │ ├── HttpInvoker.java │ │ │ │ │ ├── HttpMethod.java │ │ │ │ │ ├── HttpPollingInvoker.java │ │ │ │ │ ├── HttpSerializationContext.java │ │ │ │ │ ├── HttpStatus.java │ │ │ │ │ ├── InProcess.java │ │ │ │ │ ├── IncomingResponse.java │ │ │ │ │ ├── IncomingResponseImpl.java │ │ │ │ │ ├── IncompatibleTypeException.java │ │ │ │ │ ├── InterceptorManager.java │ │ │ │ │ ├── InterceptorManagerImpl.java │ │ │ │ │ ├── LeafStore.java │ │ │ │ │ ├── Link.java │ │ │ │ │ ├── MockResponse.java │ │ │ │ │ ├── MutableRequest.java │ │ │ │ │ ├── MutableResponse.java │ │ │ │ │ ├── MutableSerializedRequest.java │ │ │ │ │ ├── MutableSerializedResponse.java │ │ │ │ │ ├── PollingOptions.java │ │ │ │ │ ├── PollingRequest.java │ │ │ │ │ ├── PollingRequestBuilder.java │ │ │ │ │ ├── PollingRequestInvoker.java │ │ │ │ │ ├── PollingStrategy.java │ │ │ │ │ ├── PreparedRequest.java │ │ │ │ │ ├── PreparedRequestImpl.java │ │ │ │ │ ├── Process.java │ │ │ │ │ ├── Processable.java │ │ │ │ │ ├── ProcessableRequest.java │ │ │ │ │ ├── ProcessableResponse.java │ │ │ │ │ ├── ProgressEvent.java │ │ │ │ │ ├── Provider.java │ │ │ │ │ ├── ProviderManager.java │ │ │ │ │ ├── ProviderManagerImpl.java │ │ │ │ │ ├── RawResponse.java │ │ │ │ │ ├── ReadProgress.java │ │ │ │ │ ├── Registration.java │ │ │ │ │ ├── Request.java │ │ │ │ │ ├── RequestAbortException.java │ │ │ │ │ ├── RequestAttempt.java │ │ │ │ │ ├── RequestBuilder.java │ │ │ │ │ ├── RequestBuilderImpl.java │ │ │ │ │ ├── RequestCancelException.java │ │ │ │ │ ├── RequestDispatchException.java │ │ │ │ │ ├── RequestDispatcher.java │ │ │ │ │ ├── RequestEvent.java │ │ │ │ │ ├── RequestEventImpl.java │ │ │ │ │ ├── RequestException.java │ │ │ │ │ ├── RequestFilter.java │ │ │ │ │ ├── RequestInAuthProcess.java │ │ │ │ │ ├── RequestInFilterProcess.java │ │ │ │ │ ├── RequestInInterceptProcess.java │ │ │ │ │ ├── RequestInProcess.java │ │ │ │ │ ├── RequestInSerializeProcess.java │ │ │ │ │ ├── RequestInterceptor.java │ │ │ │ │ ├── RequestInvoker.java │ │ │ │ │ ├── RequestInvokerImpl.java │ │ │ │ │ ├── RequestLogger.java │ │ │ │ │ ├── RequestOptions.java │ │ │ │ │ ├── RequestOptionsHolder.java │ │ │ │ │ ├── RequestProcessor.java │ │ │ │ │ ├── RequestRetrier.java │ │ │ │ │ ├── RequestSerializer.java │ │ │ │ │ ├── RequestTimeoutException.java │ │ │ │ │ ├── RequestorCore.java │ │ │ │ │ ├── Response.java │ │ │ │ │ ├── ResponseDeserializer.java │ │ │ │ │ ├── ResponseFilter.java │ │ │ │ │ ├── ResponseHeader.java │ │ │ │ │ ├── ResponseInDeserializeProcess.java │ │ │ │ │ ├── ResponseInFilterProcess.java │ │ │ │ │ ├── ResponseInInterceptProcess.java │ │ │ │ │ ├── ResponseInProcess.java │ │ │ │ │ ├── ResponseInterceptor.java │ │ │ │ │ ├── ResponseProcessor.java │ │ │ │ │ ├── RestInvoker.java │ │ │ │ │ ├── RestService.java │ │ │ │ │ ├── RetryPolicy.java │ │ │ │ │ ├── RetryPolicyImpl.java │ │ │ │ │ ├── RootStore.java │ │ │ │ │ ├── Saver.java │ │ │ │ │ ├── SerializableRequest.java │ │ │ │ │ ├── SerializableRequestInProcess.java │ │ │ │ │ ├── SerializationEngine.java │ │ │ │ │ ├── SerializationModule.java │ │ │ │ │ ├── SerializedRequest.java │ │ │ │ │ ├── SerializedRequestInProcess.java │ │ │ │ │ ├── SerializedResponse.java │ │ │ │ │ ├── SerializedResponseInProcess.java │ │ │ │ │ ├── SerializerManager.java │ │ │ │ │ ├── SerializerManagerImpl.java │ │ │ │ │ ├── SerializerProvider.java │ │ │ │ │ ├── Service.java │ │ │ │ │ ├── Session.java │ │ │ │ │ ├── Status.java │ │ │ │ │ ├── StatusFamily.java │ │ │ │ │ ├── Store.java │ │ │ │ │ ├── StoreManager.java │ │ │ │ │ ├── TypeProvider.java │ │ │ │ │ ├── UriWithQueryBuilder.java │ │ │ │ │ ├── WriteProgress.java │ │ │ │ │ ├── auth │ │ │ │ │ ├── BasicAuth.java │ │ │ │ │ ├── BearerAuth.java │ │ │ │ │ └── DigestAuth.java │ │ │ │ │ ├── callback │ │ │ │ │ ├── DualCallback.java │ │ │ │ │ ├── ExceptionCallback.java │ │ │ │ │ ├── ExceptionRequestCallback.java │ │ │ │ │ ├── PayloadCallback.java │ │ │ │ │ ├── PayloadResponseCallback.java │ │ │ │ │ ├── PayloadResponseRequestCallback.java │ │ │ │ │ ├── ReadCallback.java │ │ │ │ │ ├── ResponseCallback.java │ │ │ │ │ ├── ResponseRequestCallback.java │ │ │ │ │ ├── TimeoutCallback.java │ │ │ │ │ ├── TimeoutRequestCallback.java │ │ │ │ │ ├── VoidCallback.java │ │ │ │ │ └── WriteCallback.java │ │ │ │ │ ├── deferred │ │ │ │ │ ├── AbstractDeferred.java │ │ │ │ │ ├── DeferredObject.java │ │ │ │ │ ├── DeferredPollingRequest.java │ │ │ │ │ ├── DeferredPoolFactoryImpl.java │ │ │ │ │ ├── DeferredRequest.java │ │ │ │ │ ├── DoneCallback.java │ │ │ │ │ ├── FailCallback.java │ │ │ │ │ ├── ProgressCallback.java │ │ │ │ │ └── State.java │ │ │ │ │ ├── header │ │ │ │ │ ├── AcceptEncodingHeader.java │ │ │ │ │ ├── AcceptHeader.java │ │ │ │ │ ├── ContentEncodingHeader.java │ │ │ │ │ ├── ContentTypeHeader.java │ │ │ │ │ ├── Element.java │ │ │ │ │ ├── Header.java │ │ │ │ │ ├── LinkElement.java │ │ │ │ │ ├── LinkHeader.java │ │ │ │ │ ├── MultivaluedHeader.java │ │ │ │ │ ├── Param.java │ │ │ │ │ ├── QualityFactorHeader.java │ │ │ │ │ └── SimpleHeader.java │ │ │ │ │ ├── internal │ │ │ │ │ └── Reflection.java │ │ │ │ │ ├── payload │ │ │ │ │ ├── Payload.java │ │ │ │ │ ├── SerializedPayload.java │ │ │ │ │ ├── TextSerializedPayload.java │ │ │ │ │ └── type │ │ │ │ │ │ ├── CollectionPayloadType.java │ │ │ │ │ │ ├── CompositePayloadType.java │ │ │ │ │ │ ├── MapPayloadType.java │ │ │ │ │ │ ├── PayloadType.java │ │ │ │ │ │ ├── RootPayloadType.java │ │ │ │ │ │ └── SinglePayloadType.java │ │ │ │ │ ├── serialization │ │ │ │ │ ├── DeserializationContext.java │ │ │ │ │ ├── Deserializer.java │ │ │ │ │ ├── HandlesSubTypes.java │ │ │ │ │ ├── SerializationContext.java │ │ │ │ │ ├── SerializationException.java │ │ │ │ │ ├── Serializer.java │ │ │ │ │ ├── UnableToDeserializeException.java │ │ │ │ │ ├── UnableToSerializeException.java │ │ │ │ │ └── misc │ │ │ │ │ │ ├── TextSerializer.java │ │ │ │ │ │ └── VoidSerializer.java │ │ │ │ │ └── uri │ │ │ │ │ ├── Uri.java │ │ │ │ │ ├── UriBuilder.java │ │ │ │ │ ├── UriBuilderException.java │ │ │ │ │ ├── UriBuilderImpl.java │ │ │ │ │ ├── UriCodec.java │ │ │ │ │ ├── UriImpl.java │ │ │ │ │ ├── UriParseException.java │ │ │ │ │ ├── UriParser.java │ │ │ │ │ └── UriProxy.java │ │ │ └── resources │ │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── core │ │ │ │ └── Requestor.gwt.xml │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── core │ │ │ ├── FilterManagerImplJreTest.java │ │ │ ├── InterceptorManagerImplJreTest.java │ │ │ ├── LeafStoreJreTest.java │ │ │ ├── ProviderManagerImplJreTest.java │ │ │ ├── RequestorTestSuite.java │ │ │ ├── SerializerManagerImplJreTest.java │ │ │ ├── StoreJreTest.java │ │ │ ├── header │ │ │ ├── HeaderTestSuite.java │ │ │ ├── LinkHeaderJreTest.java │ │ │ ├── MultipleHeaderJreTest.java │ │ │ └── QualityFactorHeaderJreTest.java │ │ │ └── uri │ │ │ ├── NetUriCodec.java │ │ │ ├── UriBuilderJreTest.java │ │ │ ├── UriParserJreTest.java │ │ │ └── UriTestSuite.java │ └── requestor-java │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── java │ │ │ ├── ChunkedProgressEvent.java │ │ │ ├── FixedProgressEvent.java │ │ │ ├── RequestRedirectException.java │ │ │ ├── ScheduledExecutorAsyncRunner.java │ │ │ ├── payload │ │ │ ├── BinarySerializedPayload.java │ │ │ ├── CompositeSerializedPayload.java │ │ │ └── InputStreamSerializedPayload.java │ │ │ └── serialization │ │ │ ├── BinarySerializer.java │ │ │ ├── ByteSerializer.java │ │ │ ├── FileSerializer.java │ │ │ ├── FormDataMultiPartSerializer.java │ │ │ └── InputStreamSerializer.java │ │ └── test │ │ └── resources │ │ └── junit-platform.properties ├── ext │ ├── pom.xml │ ├── requestor-autobean │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── reinert │ │ │ │ │ └── requestor │ │ │ │ │ └── autobean │ │ │ │ │ ├── AutoBeanGeneratedModules.java │ │ │ │ │ ├── AutoBeanGeneratedModulesGenerator.java │ │ │ │ │ ├── AutoBeanModulesGenerator.java │ │ │ │ │ ├── RequestorAutoBean.java │ │ │ │ │ └── annotations │ │ │ │ │ └── AutoBeanSerializationModule.java │ │ │ └── resources │ │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── autobean │ │ │ │ └── RequestorAutoBean.gwt.xml │ │ │ └── test │ │ │ ├── java │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── core │ │ │ │ ├── RequestorAutoBeanGwtTest.java │ │ │ │ └── RequestorAutoBeanGwtTestSuite.java │ │ │ └── resources │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── autobean │ │ │ └── RequestorAutoBeanTest.gwt.xml │ ├── requestor-gson │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── java │ │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── gson │ │ │ │ ├── FilterableJsonWriter.java │ │ │ │ ├── GsonSerializer.java │ │ │ │ └── GsonSingletonProvider.java │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── gson │ │ │ ├── GsonSerializerTest.java │ │ │ └── RequestorGsonTestSuite.java │ ├── requestor-gwtjackson │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── reinert │ │ │ │ │ └── requestor │ │ │ │ │ └── gwtjackson │ │ │ │ │ ├── JsonGeneratedModules.java │ │ │ │ │ ├── RequestorGwtJackson.java │ │ │ │ │ ├── annotations │ │ │ │ │ └── JsonSerializationModule.java │ │ │ │ │ └── rebind │ │ │ │ │ ├── GwtJacksonProcessor.java │ │ │ │ │ ├── JsonGeneratedModulesGenerator.java │ │ │ │ │ ├── JsonObjectSerializerAssembler.java │ │ │ │ │ ├── JsonObjectSerializerCode.java │ │ │ │ │ ├── JsonObjectSerializerGenerator.java │ │ │ │ │ ├── JsonObjectSerializerSchema.java │ │ │ │ │ ├── SerializationModuleAssembler.java │ │ │ │ │ ├── SerializationModuleCode.java │ │ │ │ │ ├── SerializationModuleGenerator.java │ │ │ │ │ ├── SerializationModuleSchema.java │ │ │ │ │ ├── codegen │ │ │ │ │ ├── FieldAssembler.java │ │ │ │ │ ├── InnerTypeAssembler.java │ │ │ │ │ ├── MethodAssembler.java │ │ │ │ │ ├── Package.java │ │ │ │ │ ├── TypeAssembler.java │ │ │ │ │ └── TypeInfo.java │ │ │ │ │ ├── meta │ │ │ │ │ ├── gwtjackson │ │ │ │ │ │ ├── ObjectMapperMeta.java │ │ │ │ │ │ ├── ObjectReaderMeta.java │ │ │ │ │ │ └── ObjectWriterMeta.java │ │ │ │ │ └── requestor │ │ │ │ │ │ ├── DeserializationContextMeta.java │ │ │ │ │ │ ├── JsonObjectSerializerMeta.java │ │ │ │ │ │ ├── SerializationContextMeta.java │ │ │ │ │ │ └── SerializerMeta.java │ │ │ │ │ └── processing │ │ │ │ │ ├── ProcessingException.java │ │ │ │ │ └── ProcessingLogger.java │ │ │ └── resources │ │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── gwtjackson │ │ │ │ └── RequestorGwtJackson.gwt.xml │ │ │ └── test │ │ │ ├── java │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── gwtjackson │ │ │ │ ├── RequestorGwtJacksonGwtTest.java │ │ │ │ ├── RequestorJacksonGwtTestSuite.java │ │ │ │ └── rebind │ │ │ │ ├── GwtJacksonProcessorTest.java │ │ │ │ └── GwtJacksonTestSuite.java │ │ │ └── resources │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── gwtjackson │ │ │ └── RequestorGwtJacksonTest.gwt.xml │ ├── requestor-kotlin │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ └── kotlin │ │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── kotlin │ │ │ │ └── CoroutineAsyncRunner.kt │ │ │ └── test │ │ │ └── kotlin │ │ │ └── RequestorKotlinTest.kt │ ├── requestor-oauth2gwt │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ └── io │ │ │ │ │ └── reinert │ │ │ │ │ └── requestor │ │ │ │ │ └── gwt │ │ │ │ │ └── oauth2 │ │ │ │ │ ├── Auth.java │ │ │ │ │ ├── AuthImpl.java │ │ │ │ │ ├── AuthRequest.java │ │ │ │ │ ├── CookieStoreImpl.java │ │ │ │ │ ├── OAuth2Base.java │ │ │ │ │ ├── OAuth2ByHeader.java │ │ │ │ │ ├── OAuth2ByQueryParam.java │ │ │ │ │ ├── TokenInfo.java │ │ │ │ │ ├── TokenStore.java │ │ │ │ │ ├── TokenStoreImpl.java │ │ │ │ │ └── package-info.java │ │ │ └── resources │ │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── gwt │ │ │ │ └── oauth2 │ │ │ │ ├── RequestorOAuth2.gwt.xml │ │ │ │ └── public │ │ │ │ └── oauthWindow.html │ │ │ └── test │ │ │ └── java │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── gwt │ │ │ └── oauth2 │ │ │ ├── AuthTest.java │ │ │ └── RequestorOAuth2TestSuite.java │ └── requestor-vertx │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── vertx │ │ │ └── VertxAsyncRunner.java │ │ └── test │ │ └── java │ │ └── io │ │ └── reinert │ │ └── requestor │ │ └── vertx │ │ └── VertxAsyncRunnerTest.java ├── impl │ ├── pom.xml │ ├── requestor-gwt │ │ ├── pom.xml │ │ └── src │ │ │ ├── main │ │ │ ├── java │ │ │ │ ├── com │ │ │ │ │ └── google │ │ │ │ │ │ └── gwt │ │ │ │ │ │ └── http │ │ │ │ │ │ └── client │ │ │ │ │ │ └── RequestorRequest.java │ │ │ │ └── io │ │ │ │ │ └── reinert │ │ │ │ │ └── requestor │ │ │ │ │ └── gwt │ │ │ │ │ ├── FormDataOverlay.java │ │ │ │ │ ├── GwtAsyncRunner.java │ │ │ │ │ ├── GwtFormDataUrlEncodedSerializer.java │ │ │ │ │ ├── GwtRequestSerializer.java │ │ │ │ │ ├── GwtResponseDeserializer.java │ │ │ │ │ ├── GwtUriCodec.java │ │ │ │ │ ├── JsFormData.java │ │ │ │ │ ├── MD5.java │ │ │ │ │ ├── Requestor.java │ │ │ │ │ ├── ResponseType.java │ │ │ │ │ ├── payload │ │ │ │ │ └── SerializedJsPayload.java │ │ │ │ │ ├── serialization │ │ │ │ │ ├── JsonBooleanSerializer.java │ │ │ │ │ ├── JsonNumberSerializer.java │ │ │ │ │ ├── JsonObjectSerializer.java │ │ │ │ │ ├── JsonRecordReader.java │ │ │ │ │ ├── JsonRecordWriter.java │ │ │ │ │ ├── JsonSerializer.java │ │ │ │ │ ├── JsonStringSerializer.java │ │ │ │ │ ├── JsonValueSerializer.java │ │ │ │ │ └── OverlaySerializer.java │ │ │ │ │ ├── super │ │ │ │ │ └── io │ │ │ │ │ │ └── reinert │ │ │ │ │ │ └── requestor │ │ │ │ │ │ └── core │ │ │ │ │ │ └── internal │ │ │ │ │ │ └── Reflection.java │ │ │ │ │ ├── type │ │ │ │ │ ├── ArrayBuffer.java │ │ │ │ │ ├── Blob.java │ │ │ │ │ ├── Document.java │ │ │ │ │ ├── Json.java │ │ │ │ │ └── NativeType.java │ │ │ │ │ └── xhr │ │ │ │ │ ├── JsProgressEvent.java │ │ │ │ │ ├── NetworkErrorException.java │ │ │ │ │ ├── ProgressHandler.java │ │ │ │ │ ├── RequestPermissionException.java │ │ │ │ │ ├── XhrRequestDispatcher.java │ │ │ │ │ ├── XhrRequestDispatcherFactory.java │ │ │ │ │ └── XmlHttpRequest.java │ │ │ └── resources │ │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── gwt │ │ │ │ └── RequestorGwt.gwt.xml │ │ │ └── test │ │ │ ├── java │ │ │ └── io │ │ │ │ └── reinert │ │ │ │ └── requestor │ │ │ │ └── gwt │ │ │ │ ├── BaseServiceGwtTest.java │ │ │ │ ├── Book.java │ │ │ │ ├── BookJsonSerializer.java │ │ │ │ ├── CallbackGwtTest.java │ │ │ │ ├── PollingGwtTest.java │ │ │ │ ├── RequestFilterGwtTest.java │ │ │ │ ├── RequestInterceptorGwtTest.java │ │ │ │ ├── RequestorGwtTestSuite.java │ │ │ │ ├── ResponseFilterGwtTest.java │ │ │ │ ├── ResponseInterceptorGwtTest.java │ │ │ │ ├── RestServiceGwtTest.java │ │ │ │ ├── RetryGwtTest.java │ │ │ │ ├── SpecialTypeResponsesGwtTest.java │ │ │ │ ├── serialization │ │ │ │ ├── JsonBooleanSerializerJreTest.java │ │ │ │ ├── JsonNumberSerializerJreTest.java │ │ │ │ ├── JsonStringSerializerJreTest.java │ │ │ │ ├── OverlaySerializerGwtTest.java │ │ │ │ └── SerializationTestSuite.java │ │ │ │ └── test │ │ │ │ ├── Book.java │ │ │ │ ├── BookJsonSerializer.java │ │ │ │ ├── BookXmlSerializer.java │ │ │ │ ├── Person.java │ │ │ │ ├── PersonJso.java │ │ │ │ └── RestTest.java │ │ │ └── resources │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── gwt │ │ │ └── RequestorGwtTest.gwt.xml │ └── requestor-javanet │ │ ├── pom.xml │ │ └── src │ │ ├── main │ │ └── java │ │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── java │ │ │ └── net │ │ │ ├── JavaNetHttpConnection.java │ │ │ ├── JavaNetRequestDispatcher.java │ │ │ ├── JavaNetRequestDispatcherFactory.java │ │ │ ├── JavaNetUriCodec.java │ │ │ ├── Requestor.java │ │ │ ├── auth │ │ │ ├── CertAuth.java │ │ │ ├── PolicyTrustManager.java │ │ │ └── SslAuth.java │ │ │ └── ssl │ │ │ └── TrustPolicy.java │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── reinert │ │ │ └── requestor │ │ │ └── java │ │ │ └── net │ │ │ ├── GzipSerializationTest.java │ │ │ ├── HttpMethodTest.java │ │ │ ├── JavaNetTest.java │ │ │ ├── PollingTest.java │ │ │ ├── RequestEventTest.java │ │ │ ├── RequestorJavaNetTestSuite.java │ │ │ ├── RetryTest.java │ │ │ └── SerializationTest.java │ │ └── resources │ │ └── junit-platform.properties └── pom.xml ├── setup-dev.sh ├── src └── site │ ├── markdown │ └── index.md │ └── site.xml ├── tag.sh └── tools └── checkstyle ├── requestor-checkstyle-suppressions.xml ├── requestor-checkstyle.properties └── requestor-checkstyle.xml /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Use the latest 2.1 version of CircleCI pipeline process engine. 2 | # See: https://circleci.com/docs/2.0/configuration-reference 3 | version: 2.1 4 | 5 | shared: &shared 6 | steps: 7 | # Checkout the code as the first step. 8 | - checkout 9 | # Use mvn clean and package as the standard maven build phase 10 | - run: 11 | name: Build 12 | command: mvn -B -DskipTests clean package 13 | # Then run your tests! 14 | - run: 15 | name: Test 16 | command: mvn test 17 | 18 | jobs: 19 | java-8: 20 | docker: 21 | - image: cimg/openjdk:8.0 22 | steps: 23 | - checkout 24 | - run: 25 | name: Build 26 | command: mvn -B -DskipTests clean package 27 | - run: 28 | name: Test 29 | command: mvn -Dsurefire.argLine="" -Dgwt.extraJvmArgs="" test 30 | java-11: 31 | docker: 32 | - image: cimg/openjdk:11.0 33 | <<: *shared 34 | java-17: 35 | docker: 36 | - image: cimg/openjdk:17.0 37 | <<: *shared 38 | 39 | workflows: 40 | basic: 41 | jobs: 42 | - java-8 43 | - java-11 44 | - java-17 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # build * 2 | target 3 | war 4 | 5 | # Package Files # 6 | *.jar 7 | *.war 8 | 9 | # gwt caches and compiled units # 10 | war/gwt_bree/ 11 | gwt-unitCache/ 12 | 13 | # boilerplate generated classes # 14 | .apt_generated/ 15 | 16 | # more caches and things from deploy # 17 | war/WEB-INF/deploy/ 18 | war/WEB-INF/classes/ 19 | 20 | # checkstyle # 21 | .checkstyle 22 | 23 | # IDEA # 24 | *.iml 25 | .idea 26 | 27 | # eclipse # 28 | .classpath 29 | .settings 30 | .project 31 | 32 | # docker # 33 | Dockerfile 34 | -------------------------------------------------------------------------------- /Dockerfile-template: -------------------------------------------------------------------------------- 1 | FROM openjdk:8-jdk-alpine 2 | 3 | # graphviz is required by maven-javadoc-plugin (generate-site) 4 | RUN apk add --no-cache graphviz curl tar bash procps 5 | 6 | # Downloading and installing Maven 7 | # 1- Define a constant with the version of maven you want to install 8 | ARG MAVEN_VERSION=3.6.3 9 | 10 | # 2- Define a constant with the working directory 11 | ARG USER= 12 | ARG USER_ID= 13 | ARG WORK_DIR= 14 | 15 | RUN adduser --disabled-password -g '' -u $USER_ID $USER 16 | 17 | # 4- Define the URL where maven can be downloaded from 18 | ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries 19 | 20 | # 5- Create the directories, download maven, validate the download, install it, remove downloaded file and set links 21 | RUN mkdir -p /usr/share/maven /usr/share/maven/ref \ 22 | && echo "Downloading maven" \ 23 | && curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \ 24 | \ 25 | && echo "Unziping maven" \ 26 | && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \ 27 | \ 28 | && echo "Cleaning and setting links" \ 29 | && rm -f /tmp/apache-maven.tar.gz \ 30 | && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn 31 | 32 | # 6- Setup user dev environment 33 | USER $USER 34 | WORKDIR $WORK_DIR 35 | 36 | # 7- Define environmental variables required by Maven, like Maven_Home directory and where the maven repo is located 37 | ENV MAVEN_HOME /usr/share/maven 38 | ENV MAVEN_CONFIG "$USER/.m2" 39 | 40 | CMD "bash" 41 | -------------------------------------------------------------------------------- /dev-instructions.md: -------------------------------------------------------------------------------- 1 | # Dev Instructions 2 | 3 | ## First time only 4 | 5 | 1. sh setup-dev.sh 6 | 2. docker image build -t requestor-jdk8 . 7 | 3. docker container run -d -t -v /usr/reinert/requestor/:/usr/reinert/requestor --name requestor-dev requestor-jdk8 8 | 9 | ## Whenever you need to run or access the dev container 10 | 11 | 4. docker container start requestor-dev 12 | 5. docker exec -it requestor-dev bash 13 | -------------------------------------------------------------------------------- /examples/requestor-showcase/checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/HasActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | public interface HasActivity { 21 | Activity getActivity(); 22 | } 23 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/HasPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase; 17 | 18 | import com.google.gwt.place.shared.Place; 19 | 20 | public interface HasPlace { 21 | Place getPlace(String section); 22 | } 23 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/HasToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase; 17 | 18 | public interface HasToken { 19 | String getToken(); 20 | } 21 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/ShowcaseActivityMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | import com.google.gwt.activity.shared.ActivityMapper; 20 | import com.google.gwt.place.shared.Place; 21 | 22 | public class ShowcaseActivityMapper implements ActivityMapper { 23 | 24 | @Override 25 | public Activity getActivity(Place place) { 26 | return ((HasActivity) place).getActivity(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/ShowcasePlaceHistoryMapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase; 17 | 18 | import com.google.gwt.place.shared.Place; 19 | import com.google.gwt.place.shared.PlaceHistoryMapper; 20 | 21 | public class ShowcasePlaceHistoryMapper implements PlaceHistoryMapper { 22 | 23 | @Override 24 | public Place getPlace(String token) { 25 | String[] tokens = token.split(":"); 26 | String page = tokens[0]; 27 | String section = tokens.length > 1 ? tokens[1] : null; 28 | return MenuOption.of(page).getPlace(section); 29 | } 30 | 31 | @Override 32 | public String getToken(Place place) { 33 | return ((HasToken) place).getToken(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/activity/HomeActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.activity; 17 | 18 | import com.google.gwt.activity.shared.AbstractActivity; 19 | import com.google.gwt.event.shared.EventBus; 20 | import com.google.gwt.user.client.ui.AcceptsOneWidget; 21 | 22 | import io.reinert.requestor.examples.showcase.ui.Home; 23 | import io.reinert.requestor.examples.showcase.util.Page; 24 | 25 | public class HomeActivity extends AbstractActivity { 26 | 27 | private final Home home; 28 | 29 | public HomeActivity(Home home) { 30 | this.home = home; 31 | } 32 | 33 | @Override 34 | public void start(AcceptsOneWidget panel, EventBus eventBus) { 35 | Page.setTitle("Requestor", true); 36 | Page.setDescription("Request like a boss. \uD83D\uDE0E", true); 37 | panel.setWidget(home); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/activity/ShowcaseActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.activity; 17 | 18 | import com.google.gwt.activity.shared.AbstractActivity; 19 | import com.google.gwt.core.client.JavaScriptObject; 20 | import com.google.gwt.dom.client.Document; 21 | import com.google.gwt.dom.client.Element; 22 | 23 | public abstract class ShowcaseActivity extends AbstractActivity { 24 | 25 | private final String section; 26 | 27 | public ShowcaseActivity(String section) { 28 | this.section = section; 29 | } 30 | 31 | protected void scrollToSection() { 32 | if (section != null) { 33 | Element el = Document.get().getElementById(section); 34 | if (el != null) scrollTo(el); 35 | } 36 | } 37 | 38 | private native void scrollTo(JavaScriptObject el) /*-{ 39 | el.scrollIntoView(); 40 | }-*/; 41 | } 42 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/AuthPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.AuthActivity; 23 | 24 | public class AuthPlace extends ShowcasePlace { 25 | 26 | public AuthPlace(String section) { 27 | super(MenuOption.Tokens.AUTHENTICATION_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new AuthActivity(getSection(), Showcase.CLIENT_FACTORY.getAuth(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/BinaryDataPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.BinaryDataActivity; 23 | 24 | public class BinaryDataPlace extends ShowcasePlace { 25 | 26 | public BinaryDataPlace(String section) { 27 | super(MenuOption.Tokens.BINARY_DATA_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new BinaryDataActivity(getSection(), Showcase.CLIENT_FACTORY.getBinaryData(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/FiltersPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.FiltersActivity; 23 | 24 | public class FiltersPlace extends ShowcasePlace { 25 | 26 | public FiltersPlace(String section) { 27 | super(MenuOption.Tokens.FILTERS_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new FiltersActivity(getSection(), Showcase.CLIENT_FACTORY.getFilters(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/FluentRequestApiPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.FluentRequestApiActivity; 23 | 24 | public class FluentRequestApiPlace extends ShowcasePlace { 25 | 26 | public FluentRequestApiPlace(String section) { 27 | super(MenuOption.Tokens.REQUESTING_FLUENT_API_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new FluentRequestApiActivity(getSection(), Showcase.CLIENT_FACTORY.getFluentRequestApi(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/FormPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.FormActivity; 23 | 24 | public class FormPlace extends ShowcasePlace { 25 | 26 | public FormPlace(String section) { 27 | super(MenuOption.Tokens.FORM_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new FormActivity(getSection(), Showcase.CLIENT_FACTORY.getForm(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/GettingStartedPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.GettingStartedActivity; 23 | 24 | public class GettingStartedPlace extends ShowcasePlace { 25 | 26 | public GettingStartedPlace(String section) { 27 | super(MenuOption.Tokens.GETTING_STARTED_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new GettingStartedActivity(getSection(), Showcase.CLIENT_FACTORY.getGettingStarted()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/HomePlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | import com.google.gwt.place.shared.Place; 20 | 21 | import io.reinert.requestor.examples.showcase.HasActivity; 22 | import io.reinert.requestor.examples.showcase.HasToken; 23 | import io.reinert.requestor.examples.showcase.MenuOption; 24 | import io.reinert.requestor.examples.showcase.Showcase; 25 | import io.reinert.requestor.examples.showcase.activity.HomeActivity; 26 | 27 | public class HomePlace extends Place implements HasActivity, HasToken { 28 | 29 | @Override 30 | public Activity getActivity() { 31 | return new HomeActivity(Showcase.CLIENT_FACTORY.getHome()); 32 | } 33 | 34 | @Override 35 | public String getToken() { 36 | return MenuOption.Tokens.HOME_TOKEN; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/InterceptorsPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.InterceptorsActivity; 23 | 24 | public class InterceptorsPlace extends ShowcasePlace { 25 | 26 | public InterceptorsPlace(String section) { 27 | super(MenuOption.Tokens.INTERCEPTORS_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new InterceptorsActivity(getSection(), Showcase.CLIENT_FACTORY.getInterceptors(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/RequestBuildingPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.RequestBuildingActivity; 23 | 24 | public class RequestBuildingPlace extends ShowcasePlace { 25 | 26 | public RequestBuildingPlace(String section) { 27 | super(MenuOption.Tokens.REQUEST_BUILDING_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new RequestBuildingActivity(getSection(), Showcase.CLIENT_FACTORY.getBuildingRequests(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/RequestInvokingPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.RequestInvokingActivity; 23 | 24 | public class RequestInvokingPlace extends ShowcasePlace { 25 | 26 | public RequestInvokingPlace(String section) { 27 | super(MenuOption.Tokens.REQUEST_INVOKING_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new RequestInvokingActivity(getSection(), Showcase.CLIENT_FACTORY.getRequestInvoking(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/RequestListeningPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.RequestListeningActivity; 23 | 24 | public class RequestListeningPlace extends ShowcasePlace { 25 | 26 | public RequestListeningPlace(String section) { 27 | super(MenuOption.Tokens.REQUEST_LISTENING_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new RequestListeningActivity(getSection(), Showcase.CLIENT_FACTORY.getRequestListening(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/SerializationPlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.activity.shared.Activity; 19 | 20 | import io.reinert.requestor.examples.showcase.MenuOption; 21 | import io.reinert.requestor.examples.showcase.Showcase; 22 | import io.reinert.requestor.examples.showcase.activity.SerializationActivity; 23 | 24 | public class SerializationPlace extends ShowcasePlace { 25 | 26 | public SerializationPlace(String section) { 27 | super(MenuOption.Tokens.SERIALIZATION_TOKEN, section); 28 | } 29 | 30 | @Override 31 | public Activity getActivity() { 32 | return new SerializationActivity(getSection(), Showcase.CLIENT_FACTORY.getSerialization(), 33 | Showcase.CLIENT_FACTORY.getSession()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/place/ShowcasePlace.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.place; 17 | 18 | import com.google.gwt.place.shared.Place; 19 | 20 | import io.reinert.requestor.examples.showcase.HasActivity; 21 | import io.reinert.requestor.examples.showcase.HasToken; 22 | 23 | public abstract class ShowcasePlace extends Place implements HasToken, HasActivity { 24 | 25 | private final String page; 26 | private final String section; 27 | 28 | protected ShowcasePlace(String page, String section) { 29 | this.page = page; 30 | this.section = section; 31 | } 32 | 33 | @Override 34 | public String getToken() { 35 | return section != null ? page + ":" + section : page; 36 | } 37 | 38 | protected String getSection() { 39 | return section; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/ui/Home.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.ui; 17 | 18 | import com.google.gwt.core.client.GWT; 19 | import com.google.gwt.uibinder.client.UiBinder; 20 | import com.google.gwt.user.client.ui.Composite; 21 | import com.google.gwt.user.client.ui.HTMLPanel; 22 | 23 | public class Home extends Composite { 24 | 25 | interface HomeUiBinder extends UiBinder { } 26 | 27 | private static HomeUiBinder uiBinder = GWT.create(HomeUiBinder.class); 28 | 29 | public Home() { 30 | initWidget(uiBinder.createAndBindUi(this)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/ui/Home.ui.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 |

Simple and complete

21 |

22 | Requestor cares for the beauty and simplicity of your code while empowers complex network communication. 23 |

24 |

25 | This showcase application aims to expose some of the features provided by Requestor API. 26 | Welcome and enjoy! 27 |

28 |
29 |
-------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/ui/loading/event/HideLoadingEvent.java: -------------------------------------------------------------------------------- 1 | package io.reinert.requestor.examples.showcase.ui.loading.event; 2 | 3 | import com.google.gwt.event.shared.EventHandler; 4 | import com.google.gwt.event.shared.GwtEvent; 5 | 6 | public class HideLoadingEvent extends GwtEvent { 7 | 8 | public interface Handler extends EventHandler { 9 | void onHideLoading(HideLoadingEvent event); 10 | } 11 | 12 | public static Type TYPE = new Type(); 13 | 14 | public static Type getType() { 15 | return TYPE; 16 | } 17 | 18 | public Type getAssociatedType() { 19 | return TYPE; 20 | } 21 | 22 | protected void dispatch(Handler handler) { 23 | handler.onHideLoading(this); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/ui/loading/event/ShowLoadingEvent.java: -------------------------------------------------------------------------------- 1 | package io.reinert.requestor.examples.showcase.ui.loading.event; 2 | 3 | import com.google.gwt.event.shared.EventHandler; 4 | import com.google.gwt.event.shared.GwtEvent; 5 | 6 | public class ShowLoadingEvent extends GwtEvent { 7 | 8 | public interface Handler extends EventHandler { 9 | void onShowLoading(ShowLoadingEvent event); 10 | } 11 | 12 | public static Type TYPE = new Type(); 13 | 14 | public static Type getType() { 15 | return TYPE; 16 | } 17 | 18 | public Type getAssociatedType() { 19 | return TYPE; 20 | } 21 | 22 | protected void dispatch(Handler handler) { 23 | handler.onShowLoading(this); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/util/HighlightJs.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.util; 17 | 18 | import com.google.gwt.dom.client.Element; 19 | 20 | public final class HighlightJs { 21 | 22 | public static native void initHighlighting() /*-{ 23 | $wnd.hljs.initHighlighting(); 24 | }-*/; 25 | 26 | public static void highlightBlock(Element... e) { 27 | for (Element el : e) { 28 | highlightBlockNative(el); 29 | } 30 | } 31 | 32 | private static native void highlightBlockNative(Element e) /*-{ 33 | $wnd.hljs.highlightBlock(e); 34 | }-*/; 35 | 36 | public static native void configure(String tabReplace, boolean useBR) /*-{ 37 | $wnd.hljs.configure({ 38 | tabReplace: tabReplace, 39 | useBR: useBR 40 | }); 41 | }-*/; 42 | } 43 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/java/io/reinert/requestor/examples/showcase/util/Util.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.examples.showcase.util; 17 | 18 | import com.google.gwt.core.client.JavaScriptObject; 19 | 20 | import io.reinert.requestor.core.header.Header; 21 | 22 | public class Util { 23 | 24 | public static String formatHeaders(Iterable
headers) { 25 | StringBuilder sb = new StringBuilder("\"headers\": {\n"); 26 | for (Header header : headers) { 27 | sb.append(" \"").append(header.getName()).append("\": \"").append(header.getValue()).append("\",\n"); 28 | } 29 | return sb.replace(sb.length() - 2, sb.length(), "\n}").toString(); 30 | } 31 | 32 | public static native String formatJson(JavaScriptObject o) /*-{ 33 | return $wnd.JSON.stringify(o, null, 2); 34 | }-*/; 35 | 36 | public static native void log(JavaScriptObject o) /*-{ 37 | $wnd.console.log(o); 38 | }-*/; 39 | } 40 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/requestor-showcase/src/main/webapp/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reinert/requestor/7e2a8bf9db8bb6f25d2d7e67a638343896e000fd/examples/requestor-showcase/src/main/webapp/favicon.ico -------------------------------------------------------------------------------- /generate-site.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mvn clean install -P!project,examples 4 | mvn site -P!project,site # manually commit target/site in gh-pages branch -------------------------------------------------------------------------------- /requestor/core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 4.0.0 20 | 21 | 22 | io.reinert.requestor 23 | requestor-parent 24 | 1.5.0-SNAPSHOT 25 | 26 | 27 | pom 28 | 29 | io.reinert.requestor.core 30 | requestor-core-parent 31 | 32 | 33 | requestor-annotations 34 | requestor-core 35 | requestor-java 36 | 37 | 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-annotations/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 4.0.0 21 | 22 | 23 | io.reinert.requestor.core 24 | requestor-core-parent 25 | 1.5.0-SNAPSHOT 26 | 27 | 28 | requestor-annotations 29 | 30 | 31 | 32 | 33 | 34 | src/main/java 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/AsyncRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Functional interface that abstracts running a callback asynchronously. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface AsyncRunner { 24 | 25 | interface Lock { 26 | void await(long timeout) throws InterruptedException; 27 | 28 | boolean isAwaiting(); 29 | 30 | void signalAll(); 31 | } 32 | 33 | void run(Runnable runnable, long delayMillis); 34 | 35 | void sleep(long millis); 36 | 37 | void shutdown(); 38 | 39 | boolean isShutdown(); 40 | 41 | Lock getLock(); 42 | } 43 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/Auth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Abstraction for HTTP Authentication/Authorization methods. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface Auth { 24 | 25 | interface Provider extends io.reinert.requestor.core.Provider { } 26 | 27 | /** 28 | *

Performs the logic for making the request authenticated, then dispatch the request.

29 | * 30 | * 31 | *

IMPORTANT: You must call request#send() after the auth has finished in order to dispatch the 32 | * request, otherwise the request will never be sent.

33 | * 34 | *

The request can be sent only once.

35 | * 36 | * @param request The request about to be sent 37 | */ 38 | void auth(PreparedRequest request); 39 | } 40 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/AuthException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Exception for authentication issues. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class AuthException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = -5498790318874498527L; 26 | 27 | public AuthException() { 28 | super(); 29 | } 30 | 31 | public AuthException(String message) { 32 | super(message); 33 | } 34 | 35 | public AuthException(Throwable cause) { 36 | super(cause); 37 | } 38 | 39 | public AuthException(String message, Throwable cause) { 40 | super(message, cause); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/BaseRequestSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Base class for {@link RequestSerializer}. 20 | * 21 | * It serializes the request using the {@link SerializationEngine} and proceeds the request processing. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public class BaseRequestSerializer implements RequestSerializer { 26 | public void serialize(SerializableRequestInProcess request, SerializationEngine serializationEngine) { 27 | serializationEngine.serializeRequest(request); 28 | request.proceed(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/DeferredPool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A deferred pool capable creating new interconnected deferreds. 20 | * 21 | * @param The expected type in the invoked request 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface DeferredPool { 26 | 27 | interface Factory { 28 | DeferredPool create(SerializedRequest serializedRequest, AsyncRunner asyncRunner); 29 | } 30 | 31 | Deferred getDeferred(); 32 | 33 | PollingRequest getRequest(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/DeserializableResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import io.reinert.requestor.core.payload.Payload; 19 | 20 | /** 21 | *

A response capable of being deserialized.

22 | * 23 | *

Deserialization should happen only once.

24 | * 25 | * @author Danilo Reinert 26 | */ 27 | public interface DeserializableResponse extends SerializedResponse { 28 | 29 | void deserializePayload(Payload payload); 30 | 31 | void setContentType(String mediaType); 32 | 33 | Response getRawResponse(); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/DeserializableResponseInProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A {@link DeserializableResponse} capable of being processed. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface DeserializableResponseInProcess extends DeserializableResponse, SerializedResponseInProcess { } 24 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/DeserializerProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import io.reinert.requestor.core.serialization.Deserializer; 19 | 20 | /** 21 | * A {@link Provider} of {@link Deserializer}. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface DeserializerProvider extends Provider> { } 26 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/HasHeaders.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import io.reinert.requestor.core.header.Header; 19 | 20 | /** 21 | * Holds headers. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface HasHeaders { 26 | Headers getHeaders(); 27 | 28 | String getHeader(String headerName); 29 | 30 | boolean hasHeader(String headerName); 31 | 32 | /** 33 | * Adds a header overwriting existing headers with the same name. 34 | * 35 | * @param header The header to be inserted 36 | */ 37 | void setHeader(Header header); 38 | 39 | void setHeader(String headerName, String headerValue); 40 | 41 | /** 42 | * Removes a header and returns the removed header. 43 | * 44 | * @param headerName The name of the header 45 | * @return The removed header instance, if it exists 46 | */ 47 | Header delHeader(String headerName); 48 | } 49 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/HasPollingOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Represents a type that holds polling options. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface HasPollingOptions { 24 | 25 | boolean isPolling(); 26 | 27 | int getPollingInterval(); 28 | 29 | int getPollingLimit(); 30 | 31 | int getPollingCount(); 32 | 33 | PollingStrategy getPollingStrategy(); 34 | 35 | void stopPolling(); // The request may be polled one more time after stopPolling is called 36 | 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/HttpConnection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Represents a request connection. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface HttpConnection { 24 | 25 | void cancel(); 26 | 27 | boolean isPending(); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/HttpMethod.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Represents an HTTP Method. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public enum HttpMethod { 24 | 25 | GET("GET"), 26 | POST("POST"), 27 | PUT("PUT"), 28 | DELETE("DELETE"), 29 | PATCH("PATCH"), 30 | HEAD("HEAD"), 31 | OPTIONS("OPTIONS"); 32 | 33 | private final String value; 34 | 35 | HttpMethod(String value) { 36 | this.value = value; 37 | } 38 | 39 | public String getValue() { 40 | return value; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return value; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/HttpStatus.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Base interface for statuses used in responses. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface HttpStatus extends RequestEvent { 24 | 25 | /** 26 | * Get the associated status code. 27 | * 28 | * @return the status code. 29 | */ 30 | int getStatusCode(); 31 | 32 | /** 33 | * Get the class of status code. 34 | * 35 | * @return the class of status code. 36 | */ 37 | StatusFamily getFamily(); 38 | 39 | /** 40 | * Get the reason phrase. 41 | * 42 | * @return the reason phrase. 43 | */ 44 | String getReasonPhrase(); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/InProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A request that can be aborted or proceed to be sent. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface InProcess extends Store { 24 | 25 | void proceed(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/IncomingResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import java.util.concurrent.Future; 19 | 20 | import io.reinert.requestor.core.payload.SerializedPayload; 21 | 22 | /** 23 | * An HTTP response with futures. 24 | * 25 | * @author Danilo Reinert 26 | */ 27 | public interface IncomingResponse extends ResponseHeader { 28 | 29 | /** 30 | * Return the serialized payload future. 31 | * 32 | * @return the response's serialized payload future 33 | */ 34 | Future getSerializedPayload(); 35 | 36 | /** 37 | * Return the response payload future. 38 | * 39 | * @return the response's payload future 40 | */ 41 | Future getPayload(); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/IncompatibleTypeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * IncompatibleTypeException is the superclass exception related to type cast issues. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class IncompatibleTypeException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = -4728251744540681727L; 26 | 27 | public IncompatibleTypeException() { 28 | } 29 | 30 | public IncompatibleTypeException(String message) { 31 | super(message); 32 | } 33 | 34 | public IncompatibleTypeException(String message, Throwable throwable) { 35 | super(message, throwable); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/MutableResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A mutable deserialized response. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface MutableResponse extends MutableSerializedResponse, Response { 24 | 25 | /** 26 | * Input a payload to be serialized and then sent in the HTTP request body. 27 | * 28 | * @param payload The payload of the request 29 | */ 30 | void setPayload(Object payload); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/MutableSerializedResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import io.reinert.requestor.core.payload.SerializedPayload; 19 | 20 | /** 21 | * A serialized response with setters. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface MutableSerializedResponse extends SerializedResponse, HasHeaders { 26 | 27 | /** 28 | * Set the content type header of this response. 29 | * 30 | * @param mediaType The content type of this response 31 | */ 32 | void setContentType(String mediaType); 33 | 34 | /** 35 | * Input a serialized payload to be deserialized. 36 | * 37 | * @param serializedPayload The payload of the response 38 | */ 39 | void setSerializedPayload(SerializedPayload serializedPayload); 40 | 41 | } 42 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/PollingStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | *

Represents the HTTP Polling method.

20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public enum PollingStrategy { 24 | /** 25 | * The next request is dispatched as soon the previous is sent. 26 | */ 27 | SHORT, 28 | 29 | /** 30 | * The next request is dispatched after the previous receives a response. 31 | */ 32 | LONG; 33 | } 34 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/Process.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Represents a Request/Response processing step. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public enum Process { 24 | 25 | FILTER_REQUEST, 26 | SERIALIZE_REQUEST, 27 | INTERCEPT_REQUEST, 28 | AUTH_REQUEST, 29 | FILTER_RESPONSE, 30 | DESERIALIZE_RESPONSE, 31 | INTERCEPT_RESPONSE; 32 | 33 | public static Process[] all() { 34 | return Process.values(); 35 | } 36 | 37 | public static Process[] request() { 38 | return new Process[]{ FILTER_REQUEST, SERIALIZE_REQUEST, INTERCEPT_REQUEST, AUTH_REQUEST}; 39 | } 40 | 41 | public static Process[] response() { 42 | return new Process[]{ FILTER_RESPONSE, DESERIALIZE_RESPONSE, INTERCEPT_RESPONSE }; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/Processable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * An element capable of being processed in an async processing stack. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface Processable { 24 | void process(); 25 | } 26 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ProcessableRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A request capable of being processed. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface ProcessableRequest extends HasPollingOptions, SerializedRequestInProcess, 24 | SerializableRequestInProcess, Processable { 25 | } 26 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ProcessableResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A response capable of being processed. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface ProcessableResponse extends ResponseInProcess, DeserializableResponseInProcess, Processable { 24 | Response getRawResponse(); 25 | } 26 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/Provider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A simple class intended to create instances of some type. 20 | * 21 | * @param Type of object to instantiate. 22 | */ 23 | public interface Provider { 24 | 25 | /** 26 | * Instantiate T. 27 | * 28 | * @return an instance of T 29 | */ 30 | T getInstance(); 31 | } 32 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ProviderManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A container of {@link Provider}. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface ProviderManager { 24 | 25 | /** 26 | * Register a {@link Provider}. 27 | * 28 | * @param type the type related to the provider 29 | * @param provider the provider to register 30 | * 31 | * @return the {@link Registration} object, capable of cancelling this registration 32 | */ 33 | Registration register(Class type, Provider provider); 34 | 35 | /** 36 | * Register a {@link TypeProvider}. 37 | * 38 | * @param provider the provider to register 39 | * 40 | * @return the {@link Registration} object, capable of cancelling this registration 41 | */ 42 | Registration register(TypeProvider provider); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ReadProgress.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import io.reinert.requestor.core.payload.SerializedPayload; 19 | 20 | /** 21 | * Read progress of requests. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public class ReadProgress extends WriteProgress { 26 | 27 | private final ResponseHeader response; 28 | 29 | public ReadProgress(SerializedRequest request, ResponseHeader response, ProgressEvent progressEvent) { 30 | this(request, response, progressEvent, null); 31 | } 32 | 33 | public ReadProgress(SerializedRequest request, ResponseHeader response, ProgressEvent progressEvent, 34 | SerializedPayload chunk) { 35 | super(request, progressEvent, chunk); 36 | this.response = response; 37 | } 38 | 39 | public ResponseHeader getResponse() { 40 | return response; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/Registration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Registration objects returned when a request/response processor is registered 20 | * (e.g. via Requestor.register), used to deregister. 21 | * 22 | * @author Danilo Reinert 23 | */ 24 | public interface Registration { 25 | 26 | /** 27 | * Deregisters the processor associated with this registration if it is still attached to the requestor session. 28 | * If the processor is no longer attached to the session, this is a no-op. 29 | */ 30 | void cancel(); 31 | } 32 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestAbortException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Thrown to indicate that a request in process has been aborted before being invoked. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class RequestAbortException extends RequestException { 24 | 25 | private static final long serialVersionUID = 1153921460393658952L; 26 | 27 | protected RequestAbortException() { 28 | super(); 29 | } 30 | 31 | public RequestAbortException(RequestOptions requestOptions, String message) { 32 | super(requestOptions, message); 33 | } 34 | 35 | public RequestAbortException(RequestOptions requestOptions, String message, Throwable cause) { 36 | super(requestOptions, message, cause); 37 | } 38 | 39 | @Override 40 | public RequestEvent getEvent() { 41 | return RequestEvent.ABORT; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestDispatchException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Exception for dispatching {@link RequestOptions}s. 20 | */ 21 | public class RequestDispatchException extends RequestAbortException { 22 | 23 | private static final long serialVersionUID = 1490844880740718038L; 24 | 25 | protected RequestDispatchException() { 26 | super(); 27 | } 28 | 29 | public RequestDispatchException(RequestOptions requestOptions, String message) { 30 | super(requestOptions, message); 31 | } 32 | 33 | public RequestDispatchException(RequestOptions requestOptions, String message, Throwable throwable) { 34 | super(requestOptions, message, throwable); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * An extension interface implemented by request filters. 20 | * Request filters are intended to manipulate the request before it is sent to the server. 21 | * 22 | * @author Danilo Reinert 23 | */ 24 | public interface RequestFilter { 25 | 26 | interface Provider extends io.reinert.requestor.core.Provider { } 27 | 28 | /** 29 | * Filter method called before a request has been dispatched to a client transport layer. 30 | * 31 | * @param request The request to be dispatched. 32 | */ 33 | void filter(RequestInProcess request); 34 | } 35 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestInFilterProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A request that process a {@link RequestFilter}. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | class RequestInFilterProcess extends AbstractProcessableRequest { 24 | 25 | private final RequestFilter filter; 26 | 27 | public RequestInFilterProcess(ProcessableRequest request, RequestFilter filter) { 28 | super(request); 29 | this.filter = filter; 30 | } 31 | 32 | @Override 33 | public void process() { 34 | filter.filter(this); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestInInterceptProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A request that process a {@link RequestInterceptor}. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | class RequestInInterceptProcess extends AbstractProcessableRequest { 24 | 25 | private final RequestInterceptor interceptor; 26 | 27 | public RequestInInterceptProcess(ProcessableRequest request, RequestInterceptor interceptor) { 28 | super(request); 29 | this.interceptor = interceptor; 30 | } 31 | 32 | @Override 33 | public void process() { 34 | interceptor.intercept(this); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestInProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Allows on to modify some properties of an ongoing request. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface RequestInProcess extends MutableRequest, InProcess { 24 | 25 | void abort(MockResponse response); 26 | 27 | void abort(RequestAbortException error); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestInSerializeProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A request that process a {@link RequestSerializer}. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | class RequestInSerializeProcess extends AbstractProcessableRequest { 24 | 25 | private final SerializationEngine serializationEngine; 26 | private final RequestSerializer requestSerializer; 27 | 28 | public RequestInSerializeProcess(ProcessableRequest request, SerializationEngine serializationEngine, 29 | RequestSerializer requestSerializer) { 30 | super(request); 31 | this.serializationEngine = serializationEngine; 32 | this.requestSerializer = requestSerializer; 33 | } 34 | 35 | @Override 36 | public void process() { 37 | requestSerializer.serialize(this, serializationEngine); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Request interceptors are intended to manipulate the serialized request payload before it is sent to the server. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface RequestInterceptor { 24 | 25 | interface Provider extends io.reinert.requestor.core.Provider { } 26 | 27 | /** 28 | * Intercept method called immediately before a request is sent to a client transport layer. 29 | * 30 | * @param request The request to be sent. 31 | */ 32 | void intercept(SerializedRequestInProcess request); 33 | } 34 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestOptions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import java.util.Set; 19 | 20 | import io.reinert.requestor.core.payload.Payload; 21 | import io.reinert.requestor.core.uri.Uri; 22 | 23 | /** 24 | * Provides the request configuration. 25 | * 26 | * @author Danilo Reinert 27 | */ 28 | public interface RequestOptions { 29 | 30 | String getAccept(); 31 | 32 | String getContentType(); 33 | 34 | Headers getHeaders(); 35 | 36 | String getHeader(String name); 37 | 38 | HttpMethod getMethod(); 39 | 40 | Payload getPayload(); 41 | 42 | int getTimeout(); 43 | 44 | int getDelay(); 45 | 46 | RetryPolicy getRetryPolicy(); 47 | 48 | boolean isRetryEnabled(); 49 | 50 | Uri getUri(); 51 | 52 | Auth getAuth(); 53 | 54 | String getCharset(); 55 | 56 | Set getSkippedProcesses(); 57 | 58 | Session getSession(); 59 | 60 | } 61 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RequestSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Request serializers are intended to serialize the request payload before it is sent to the server. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface RequestSerializer { 24 | 25 | /** 26 | * Serialize method called after filters and before interceptors. 27 | * It should serialize the request using the SerializationEngine provided. 28 | * 29 | * @param request The request to be dispatched. 30 | */ 31 | void serialize(SerializableRequestInProcess request, SerializationEngine serializationEngine); 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ResponseDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Response deserializers are intended to deserialize the response payload after it's received from the server. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface ResponseDeserializer { 24 | 25 | /** 26 | * Deserialize method called after interceptors and before filters. 27 | * It should deserialize the response using the SerializationEngine provided. 28 | * 29 | * @param response The received response. 30 | */ 31 | void deserialize(DeserializableResponseInProcess response, SerializationEngine serializationEngine); 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ResponseFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * An extension interface implemented by response filters. 20 | * Response filters are intended to manipulate the response before the code that invoked its request receives it. 21 | * 22 | * @author Danilo Reinert 23 | */ 24 | public interface ResponseFilter { 25 | 26 | interface Provider extends io.reinert.requestor.core.Provider { } 27 | 28 | /** 29 | * Filter method called after a response has been provided for a request. 30 | * 31 | * @param response The received response. 32 | */ 33 | void filter(ResponseInProcess response); 34 | } 35 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ResponseInDeserializeProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A response that process a {@link ResponseDeserializer}. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | class ResponseInDeserializeProcess extends AbstractProcessableResponse { 24 | 25 | private final SerializationEngine serializationEngine; 26 | private final ResponseDeserializer responseDeserializer; 27 | 28 | public ResponseInDeserializeProcess(ProcessableResponse response, SerializationEngine serializationEngine, 29 | ResponseDeserializer responseDeserializer) { 30 | super(response); 31 | this.serializationEngine = serializationEngine; 32 | this.responseDeserializer = responseDeserializer; 33 | } 34 | 35 | @Override 36 | public void process() { 37 | responseDeserializer.deserialize(this, serializationEngine); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ResponseInFilterProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A response that process a {@link ResponseFilter}. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | class ResponseInFilterProcess extends AbstractProcessableResponse { 24 | 25 | private final ResponseFilter filter; 26 | 27 | public ResponseInFilterProcess(ProcessableResponse response, ResponseFilter filter) { 28 | super(response); 29 | this.filter = filter; 30 | } 31 | 32 | @Override 33 | public void process() { 34 | filter.filter(this); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ResponseInInterceptProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A response that process a {@link ResponseInterceptor}. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | class ResponseInInterceptProcess extends AbstractProcessableResponse { 24 | 25 | private final ResponseInterceptor interceptor; 26 | 27 | public ResponseInInterceptProcess(ProcessableResponse response, ResponseInterceptor interceptor) { 28 | super(response); 29 | this.interceptor = interceptor; 30 | } 31 | 32 | @Override 33 | public void process() { 34 | interceptor.intercept(this); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ResponseInProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Allows on to modify some properties of an incoming response. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface ResponseInProcess extends MutableResponse, SerializedResponseInProcess { 24 | } 25 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/ResponseInterceptor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Response interceptors are intended to manipulate the serialized response payload before it is sent to the server. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface ResponseInterceptor { 24 | 25 | interface Provider extends io.reinert.requestor.core.Provider { } 26 | 27 | /** 28 | * Intercept method called immediately after a response has been provided for a request. 29 | * 30 | * @param response The received response. 31 | */ 32 | void intercept(SerializedResponseInProcess response); 33 | } 34 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RestInvoker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import java.util.Collection; 19 | 20 | /** 21 | * An HTTP Invoker bound to a Resource type. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface RestInvoker { 26 | 27 | Request> get(Object... params); 28 | 29 | Request get(I id); 30 | 31 | Request post(R resource); 32 | 33 | Request patch(I id, R resource, String... fields); 34 | 35 | Request put(I id, R resource); 36 | 37 | Request delete(I id); 38 | 39 | RequestInvoker req(); 40 | 41 | RequestInvoker req(I id); 42 | 43 | } 44 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/RetryPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Abstraction for retry policies. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface RetryPolicy { 24 | 25 | interface Provider extends io.reinert.requestor.core.Provider { } 26 | 27 | /** 28 | *

Checks the request result and returns the time to wait until the next retry in milliseconds.

29 | * 30 | *

If the returned time is negative, then the request won't be retried and will fail.

31 | * 32 | * @param attempt The data of the request under submission 33 | * 34 | * @return The time in milliseconds of the next retry. 35 | * The request won't be retried If this number is negative. 36 | */ 37 | int retryIn(RequestAttempt attempt); 38 | } 39 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/Saver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Saves objects by key. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface Saver { 24 | 25 | /** 26 | * Saves the value associated with the key. 27 | * 28 | * @param key A key to associate the data 29 | * @param value The data to be persisted 30 | */ 31 | Saver save(String key, Object value); 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/SerializableRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import io.reinert.requestor.core.header.ContentTypeHeader; 19 | import io.reinert.requestor.core.payload.SerializedPayload; 20 | 21 | /** 22 | *

A request capable of being serialized.

23 | * 24 | *

Serialization should happen only once.

25 | * 26 | * @author Danilo Reinert 27 | */ 28 | public interface SerializableRequest extends RequestOptions, HasHeaders { 29 | 30 | void serializePayload(SerializedPayload serializedPayload); 31 | 32 | void setContentType(String mediaType); 33 | 34 | void setContentType(ContentTypeHeader header); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/SerializableRequestInProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A {@link SerializableRequest} capable of being processed. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface SerializableRequestInProcess extends SerializableRequest, InProcess { 24 | } 25 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/SerializationModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import java.util.List; 19 | 20 | import io.reinert.requestor.core.serialization.Serializer; 21 | 22 | /** 23 | * Module that holds auto-generated Serializers. 24 | *

25 | * 26 | * To declare a serialization module you must inherit this class and annotate it with a supported annotation that 27 | * enables you to specify which classes should have auto-generated serializers. 28 | * 29 | * @author Danilo Reinert 30 | */ 31 | public interface SerializationModule { 32 | 33 | List> getSerializers(); 34 | 35 | List> getTypeProviders(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/SerializedRequestInProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Allows on to modify the serialized payload of an ongoing request. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface SerializedRequestInProcess extends MutableSerializedRequest, RequestInProcess { 24 | } 25 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/SerializedResponseInProcess.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Allows one to modify the serialized payload of an incoming response. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface SerializedResponseInProcess extends MutableSerializedResponse, InProcess { 24 | 25 | Response getRawResponse(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/SerializerProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import io.reinert.requestor.core.serialization.Serializer; 19 | 20 | /** 21 | * A {@link Provider} of {@link Serializer}. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface SerializerProvider extends DeserializerProvider { 26 | 27 | @Override 28 | Serializer getInstance(); 29 | } 30 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/Service.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * Represents a subject-oriented client. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface Service extends HasRequestOptions, Store { 24 | 25 | /** 26 | * Get the main Session from which this Service was derived. 27 | * 28 | * @return the main Session 29 | */ 30 | Session getSession(); 31 | } 32 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/TypeProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | /** 19 | * A Provider that carries its type information. 20 | * 21 | * @param Type of object to instantiate. 22 | */ 23 | public interface TypeProvider extends Provider { 24 | 25 | /** 26 | * Get type of T. 27 | * 28 | * @return the class instance of T 29 | */ 30 | Class getType(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/DualCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.RequestException; 19 | import io.reinert.requestor.core.Response; 20 | 21 | /** 22 | * Callback that handles both load and error events. 23 | * 24 | * @author Danilo Reinert 25 | */ 26 | public interface DualCallback { 27 | 28 | void onError(RequestException error); 29 | 30 | void onLoad(Response response); 31 | } 32 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/ExceptionCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.RequestException; 19 | 20 | /** 21 | * Callback for request error events. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface ExceptionCallback { 26 | void execute(RequestException exception) throws Throwable; 27 | } 28 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/ExceptionRequestCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.PollingRequest; 19 | import io.reinert.requestor.core.RequestException; 20 | 21 | /** 22 | * Callback for request error events. 23 | * 24 | * @author Danilo Reinert 25 | */ 26 | public interface ExceptionRequestCallback { 27 | void execute(RequestException exception, PollingRequest request) throws Throwable; 28 | } 29 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/PayloadCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | /** 19 | * Callback for request load events. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface PayloadCallback { 24 | void execute(E e) throws Throwable; 25 | } 26 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/PayloadResponseCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.Response; 19 | 20 | /** 21 | * Callback for request load events. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface PayloadResponseCallback { 26 | void execute(E e, Response response) throws Throwable; 27 | } 28 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/PayloadResponseRequestCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.PollingRequest; 19 | import io.reinert.requestor.core.Response; 20 | 21 | /** 22 | * Callback for request load events. 23 | * 24 | * @author Danilo Reinert 25 | */ 26 | public interface PayloadResponseRequestCallback { 27 | void execute(E e, Response response, PollingRequest request) throws Throwable; 28 | } 29 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/ReadCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.ReadProgress; 19 | 20 | /** 21 | * Callback for request read progress events. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface ReadCallback { 26 | void execute(ReadProgress progress) throws Throwable; 27 | } 28 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/ResponseCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.Response; 19 | 20 | /** 21 | * Callback for request load events. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface ResponseCallback { 26 | void execute(Response response) throws Throwable; 27 | } 28 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/ResponseRequestCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.PollingRequest; 19 | import io.reinert.requestor.core.Response; 20 | 21 | /** 22 | * Callback for request load events. 23 | * 24 | * @author Danilo Reinert 25 | */ 26 | public interface ResponseRequestCallback { 27 | void execute(Response response, PollingRequest request) throws Throwable; 28 | } 29 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/TimeoutCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.RequestTimeoutException; 19 | 20 | /** 21 | * Callback for request timeout events. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface TimeoutCallback { 26 | void execute(RequestTimeoutException timeoutException) throws Throwable; 27 | } 28 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/TimeoutRequestCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.PollingRequest; 19 | import io.reinert.requestor.core.RequestTimeoutException; 20 | 21 | /** 22 | * Callback for request timeout events. 23 | * 24 | * @author Danilo Reinert 25 | */ 26 | public interface TimeoutRequestCallback { 27 | void execute(RequestTimeoutException timeoutException, PollingRequest request) throws Throwable; 28 | } 29 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/VoidCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | /** 19 | * Callback for request load events. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public interface VoidCallback { 24 | void execute() throws Throwable; 25 | } 26 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/callback/WriteCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.callback; 17 | 18 | import io.reinert.requestor.core.WriteProgress; 19 | 20 | /** 21 | * Callback for request progress events. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface WriteCallback { 26 | void execute(WriteProgress progress) throws Throwable; 27 | } 28 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/deferred/DeferredPoolFactoryImpl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.deferred; 17 | 18 | import io.reinert.requestor.core.AsyncRunner; 19 | import io.reinert.requestor.core.DeferredPool; 20 | import io.reinert.requestor.core.SerializedRequest; 21 | 22 | /** 23 | * Implementation of {@link DeferredPool.Factory} returning a {@link DeferredPollingRequest}. 24 | * 25 | * @author Danilo Reinert 26 | */ 27 | public class DeferredPoolFactoryImpl implements DeferredPool.Factory { 28 | 29 | public DeferredPool create(SerializedRequest serializedRequest, AsyncRunner asyncRunner) { 30 | return new DeferredPollingRequest(serializedRequest, asyncRunner); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/deferred/DoneCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2018 Ray Tsang 3 | * Copyright 2014-2021 Danilo Reinert 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package io.reinert.requestor.core.deferred; 18 | 19 | interface DoneCallback { 20 | void onDone(D result); 21 | } 22 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/deferred/FailCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2018 Ray Tsang 3 | * Copyright 2014-2021 Danilo Reinert 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package io.reinert.requestor.core.deferred; 18 | 19 | interface FailCallback { 20 | void onFail(F result); 21 | } 22 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/deferred/ProgressCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2018 Ray Tsang 3 | * Copyright 2014-2021 Danilo Reinert 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package io.reinert.requestor.core.deferred; 18 | 19 | interface ProgressCallback

{ 20 | void onProgress(P progress); 21 | } 22 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/deferred/State.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013-2018 Ray Tsang 3 | * Copyright 2014-2021 Danilo Reinert 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package io.reinert.requestor.core.deferred; 18 | 19 | enum State { 20 | 21 | /** 22 | * The Deferred is still pending - it could be created, submitted for execution, or currently running, but not 23 | * yet finished. 24 | */ 25 | PENDING, 26 | 27 | /** 28 | * The Deferred has finished running and a failure occurred. Thus, the Deferred is rejected. 29 | */ 30 | REJECTED, 31 | 32 | /** 33 | * The Deferred has finished running successfully. Thus, the Deferred is resolved. 34 | */ 35 | RESOLVED 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/header/ContentEncodingHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.header; 17 | 18 | import java.util.Arrays; 19 | 20 | /** 21 | * The HTTP Content-Encoding header. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public class ContentEncodingHeader extends SimpleHeader { 26 | 27 | public static final String HEADER_NAME = "Content-Encoding"; 28 | 29 | public ContentEncodingHeader(String value, Param... params) { 30 | super(HEADER_NAME, Element.of(value, Arrays.asList(params))); 31 | } 32 | 33 | public ContentEncodingHeader(String value) { 34 | super(HEADER_NAME, value); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/header/ContentTypeHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.header; 17 | 18 | import java.util.Arrays; 19 | 20 | /** 21 | * The HTTP Content-Type header. 22 | *

23 | * It's a simple header. 24 | * 25 | * @author Danilo Reinert 26 | */ 27 | public class ContentTypeHeader extends SimpleHeader { 28 | 29 | public ContentTypeHeader(String value, Param... params) { 30 | super("Content-Type", Element.of(value, Arrays.asList(params))); 31 | } 32 | 33 | public ContentTypeHeader(String value) { 34 | super("Content-Type", value); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/payload/type/PayloadType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.payload.type; 17 | 18 | import java.util.Map; 19 | 20 | /** 21 | * Represents the expected type in the response body. 22 | * 23 | * @author Danilo Reinert 24 | */ 25 | public interface PayloadType extends Iterable> { 26 | 27 | PayloadType VOID = new SinglePayloadType(Void.class); 28 | 29 | String ROOT_KEY = ""; 30 | 31 | Class getType(); 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/payload/type/RootPayloadType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.payload.type; 17 | 18 | import java.util.Collections; 19 | import java.util.Iterator; 20 | import java.util.Map; 21 | 22 | /** 23 | * Represents the expected type in the response body root. 24 | * 25 | * @author Danilo Reinert 26 | */ 27 | public abstract class RootPayloadType implements PayloadType { 28 | 29 | @Override 30 | public Iterator> iterator() { 31 | return Collections.singletonMap(ROOT_KEY, this).entrySet().iterator(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/payload/type/SinglePayloadType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.payload.type; 17 | 18 | /** 19 | * Represents a single expected type in the response body. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class SinglePayloadType extends RootPayloadType { 24 | 25 | private final Class type; 26 | 27 | public SinglePayloadType(Class type) { 28 | this.type = type; 29 | } 30 | 31 | public Class getType() { 32 | return type; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/serialization/HandlesSubTypes.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.serialization; 17 | 18 | import java.util.List; 19 | 20 | /** 21 | * It tells the {@link io.reinert.requestor.core.SerializerManager} to register an abstraction to 22 | * handle one or more subtypes 23 | * 24 | * @author Danilo Reinert 25 | */ 26 | public interface HandlesSubTypes { 27 | List> handledSubTypes(); 28 | } 29 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/serialization/SerializationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.serialization; 17 | 18 | /** 19 | * SerializationException is the superclass exception related to Serialization issues. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class SerializationException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = 5059195446714641062L; 26 | 27 | public SerializationException() { 28 | } 29 | 30 | public SerializationException(String s) { 31 | super(s); 32 | } 33 | 34 | public SerializationException(String s, Throwable throwable) { 35 | super(s, throwable); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/serialization/UnableToDeserializeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.serialization; 17 | 18 | /** 19 | * Represents an error occurred during deserialization. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class UnableToDeserializeException extends SerializationException { 24 | 25 | private static final long serialVersionUID = 1215208259454228521L; 26 | 27 | public UnableToDeserializeException() { 28 | } 29 | 30 | public UnableToDeserializeException(String message) { 31 | super(message); 32 | } 33 | 34 | public UnableToDeserializeException(String message, Throwable throwable) { 35 | super(message, throwable); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/serialization/UnableToSerializeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.serialization; 17 | 18 | /** 19 | * Represents an error occurred during serialization. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class UnableToSerializeException extends SerializationException { 24 | 25 | private static final long serialVersionUID = -7440592169752700491L; 26 | 27 | public UnableToSerializeException() { 28 | } 29 | 30 | public UnableToSerializeException(String message) { 31 | super(message); 32 | } 33 | 34 | public UnableToSerializeException(String message, Throwable throwable) { 35 | super(message, throwable); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/uri/UriBuilderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.uri; 17 | 18 | /** 19 | * Exception for URI building. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class UriBuilderException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = -6766072755614952104L; 26 | 27 | public UriBuilderException() { 28 | } 29 | 30 | public UriBuilderException(String message) { 31 | super(message); 32 | } 33 | 34 | public UriBuilderException(String message, Throwable throwable) { 35 | super(message, throwable); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/java/io/reinert/requestor/core/uri/UriParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015-2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.uri; 17 | 18 | /** 19 | * Exception for URI building. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class UriParseException extends RuntimeException { 24 | 25 | private static final long serialVersionUID = 869486299460636505L; 26 | 27 | public UriParseException() { 28 | } 29 | 30 | public UriParseException(String message) { 31 | super(message); 32 | } 33 | 34 | public UriParseException(String message, Throwable throwable) { 35 | super(message, throwable); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/main/resources/io/reinert/requestor/core/Requestor.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/test/java/io/reinert/requestor/core/ProviderManagerImplJreTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import java.util.Collection; 19 | 20 | import org.junit.Assert; 21 | import org.junit.Test; 22 | 23 | /** 24 | * Unit tests of {@link ProviderManagerImpl}. 25 | */ 26 | public class ProviderManagerImplJreTest { 27 | 28 | private ProviderManagerImpl manager = new ProviderManagerImpl(); 29 | 30 | @Test 31 | public void wrappedManagerShouldNotBeAffected() { 32 | final Provider collectionProvider = manager.get(Collection.class); 33 | assert collectionProvider != null; 34 | final Collection c = collectionProvider.getInstance(); 35 | Assert.assertEquals(c.size(), 0); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/test/java/io/reinert/requestor/core/RequestorTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import junit.framework.TestSuite; 22 | 23 | /** 24 | * Test suite for main package. 25 | */ 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses({ 28 | FilterManagerImplJreTest.class, 29 | SerializerManagerImplJreTest.class, 30 | }) 31 | public class RequestorTestSuite extends TestSuite { 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/test/java/io/reinert/requestor/core/header/HeaderTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.header; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import junit.framework.TestSuite; 22 | 23 | /** 24 | * Test suite for header package. 25 | */ 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses({ 28 | MultipleHeaderJreTest.class, 29 | QualityFactorHeaderJreTest.class, 30 | LinkHeaderJreTest.class}) 31 | public class HeaderTestSuite extends TestSuite { 32 | } 33 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/test/java/io/reinert/requestor/core/header/MultipleHeaderJreTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.header; 17 | 18 | import org.junit.Test; 19 | import org.junit.runner.RunWith; 20 | import org.mockito.runners.MockitoJUnitRunner; 21 | 22 | import static org.junit.Assert.assertEquals; 23 | 24 | /** 25 | * @author Danilo Reinert 26 | */ 27 | @RunWith(MockitoJUnitRunner.class) 28 | public class MultipleHeaderJreTest { 29 | 30 | @Test 31 | public void testGetValue() { 32 | final String expected = "a/b, x/y+z"; 33 | final MultivaluedHeader header = new MultivaluedHeader("ignored", "a/b", "x/y+z"); 34 | assertEquals(expected, header.getValue()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /requestor/core/requestor-core/src/test/java/io/reinert/requestor/core/uri/UriTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.uri; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import junit.framework.TestSuite; 22 | 23 | /** 24 | * Test suite for header package. 25 | */ 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses({ 28 | UriBuilderJreTest.class, 29 | UriParserJreTest.class}) 30 | public class UriTestSuite extends TestSuite { 31 | } 32 | -------------------------------------------------------------------------------- /requestor/core/requestor-java/src/main/java/io/reinert/requestor/java/ChunkedProgressEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.java; 17 | 18 | import io.reinert.requestor.core.ProgressEvent; 19 | 20 | public class ChunkedProgressEvent implements ProgressEvent { 21 | 22 | private static final long serialVersionUID = -6384493486672310466L; 23 | 24 | private final long bytesLoaded; 25 | 26 | public ChunkedProgressEvent(long bytesLoaded) { 27 | this.bytesLoaded = bytesLoaded; 28 | } 29 | 30 | @Override 31 | public boolean lengthComputable() { 32 | return false; 33 | } 34 | 35 | @Override 36 | public long loaded() { 37 | return bytesLoaded; 38 | } 39 | 40 | @Override 41 | public long total() { 42 | return 0L; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /requestor/core/requestor-java/src/main/java/io/reinert/requestor/java/FixedProgressEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.java; 17 | 18 | import io.reinert.requestor.core.ProgressEvent; 19 | 20 | public class FixedProgressEvent implements ProgressEvent { 21 | 22 | private static final long serialVersionUID = 8597956705684438230L; 23 | 24 | private final long bytesLoaded; 25 | private final long bytesTotal; 26 | 27 | public FixedProgressEvent(long bytesLoaded, long bytesTotal) { 28 | this.bytesLoaded = bytesLoaded; 29 | this.bytesTotal = bytesTotal; 30 | } 31 | 32 | @Override 33 | public boolean lengthComputable() { 34 | return true; 35 | } 36 | 37 | @Override 38 | public long loaded() { 39 | return bytesLoaded; 40 | } 41 | 42 | @Override 43 | public long total() { 44 | return bytesTotal; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /requestor/core/requestor-java/src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | junit.jupiter.execution.parallel.enabled = true 2 | -------------------------------------------------------------------------------- /requestor/ext/requestor-autobean/src/main/java/io/reinert/requestor/autobean/AutoBeanGeneratedModules.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.autobean; 17 | 18 | import io.reinert.requestor.core.SerializationModule; 19 | 20 | interface AutoBeanGeneratedModules { 21 | SerializationModule[] getSerializationModules(); 22 | } 23 | -------------------------------------------------------------------------------- /requestor/ext/requestor-autobean/src/main/java/io/reinert/requestor/autobean/annotations/AutoBeanSerializationModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.autobean.annotations; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Inherited; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Declares types that must have auto-generated json serializer.
26 | * The implementation is let to extension projects. 27 | */ 28 | @Inherited 29 | @Target({ElementType.TYPE}) 30 | @Retention(RetentionPolicy.RUNTIME) 31 | public @interface AutoBeanSerializationModule { 32 | 33 | /** 34 | * A list of types to generate to have json serializer generated. 35 | * 36 | * @return the types to generate serializers 37 | */ 38 | Class[] value(); 39 | } 40 | -------------------------------------------------------------------------------- /requestor/ext/requestor-autobean/src/main/resources/io/reinert/requestor/autobean/RequestorAutoBean.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /requestor/ext/requestor-autobean/src/test/java/io/reinert/requestor/core/RequestorAutoBeanGwtTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core; 17 | 18 | import com.google.gwt.junit.tools.GWTTestSuite; 19 | 20 | import junit.framework.Test; 21 | import junit.framework.TestSuite; 22 | 23 | public class RequestorAutoBeanGwtTestSuite extends GWTTestSuite { 24 | 25 | public static Test suite() { 26 | TestSuite suite = new TestSuite("Requestor AutoBean GWT Test Suite"); 27 | 28 | // Serialization 29 | suite.addTestSuite(RequestorAutoBeanGwtTest.class); 30 | 31 | return suite; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /requestor/ext/requestor-autobean/src/test/resources/io/reinert/requestor/autobean/RequestorAutoBeanTest.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gson/src/test/java/io/reinert/requestor/gson/RequestorGsonTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-2023 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gson; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import junit.framework.TestSuite; 22 | 23 | /** 24 | * Test suite for main package. 25 | */ 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses({ 28 | GsonSerializerTest.class 29 | }) 30 | public class RequestorGsonTestSuite extends TestSuite { 31 | } 32 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/JsonGeneratedModules.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson; 17 | 18 | import io.reinert.requestor.core.SerializationModule; 19 | 20 | interface JsonGeneratedModules { 21 | SerializationModule[] getSerializationModules(); 22 | } 23 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/annotations/JsonSerializationModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.annotations; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Inherited; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | /** 25 | * Declares types that must have auto-generated json serializer.
26 | * The implementation is let to extension projects. 27 | */ 28 | @Inherited 29 | @Target({ElementType.TYPE}) 30 | @Retention(RetentionPolicy.RUNTIME) 31 | public @interface JsonSerializationModule { 32 | 33 | /** 34 | * A list of types to generate to have json serializer generated. 35 | * 36 | * @return the types to generate serializers 37 | */ 38 | Class[] value(); 39 | } 40 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/rebind/meta/gwtjackson/ObjectMapperMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.rebind.meta.gwtjackson; 17 | 18 | /** 19 | * Metadata for {@link com.github.nmorel.gwtjackson.client.ObjectMapper}. 20 | */ 21 | public interface ObjectMapperMeta extends ObjectReaderMeta, ObjectWriterMeta { 22 | 23 | interface Method extends ObjectReaderMeta.Method, ObjectWriterMeta.Method { 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/rebind/meta/gwtjackson/ObjectReaderMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.rebind.meta.gwtjackson; 17 | 18 | /** 19 | * Metadata for {@link com.github.nmorel.gwtjackson.client.ObjectReader}. 20 | */ 21 | public interface ObjectReaderMeta { 22 | 23 | interface Method { 24 | String READ = "read"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/rebind/meta/gwtjackson/ObjectWriterMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.rebind.meta.gwtjackson; 17 | 18 | /** 19 | * Metadata for {@link com.github.nmorel.gwtjackson.client.ObjectWriter}. 20 | */ 21 | public interface ObjectWriterMeta { 22 | 23 | interface Method { 24 | String WRITE = "write"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/rebind/meta/requestor/DeserializationContextMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.rebind.meta.requestor; 17 | 18 | /** 19 | * Metadata for {@link io.reinert.requestor.core.serialization.DeserializationContext}. 20 | */ 21 | public interface DeserializationContextMeta { 22 | 23 | interface Method { 24 | String GET_RAW_TYPE = "getRawType"; 25 | String GET_PARAMETERIZED_TYPES = "getParameterizedTypes"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/rebind/meta/requestor/JsonObjectSerializerMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.rebind.meta.requestor; 17 | 18 | import io.reinert.requestor.gwt.serialization.JsonObjectSerializer; 19 | 20 | /** 21 | * Metadata for {@link JsonObjectSerializer}. 22 | */ 23 | public interface JsonObjectSerializerMeta extends SerializerMeta { 24 | 25 | interface Method extends SerializerMeta.Method { 26 | String READ_JSON = "readJson"; 27 | String WRITE_JSON = "writeJson"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/rebind/meta/requestor/SerializationContextMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.rebind.meta.requestor; 17 | 18 | /** 19 | * Metadata for {@link io.reinert.requestor.core.serialization.SerializationContext}. 20 | */ 21 | public interface SerializationContextMeta { 22 | 23 | interface Method { 24 | String GET_RAW_TYPE = "getRawType"; 25 | String GET_PARAMETERIZED_TYPES = "getParameterizedTypes"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/java/io/reinert/requestor/gwtjackson/rebind/meta/requestor/SerializerMeta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.rebind.meta.requestor; 17 | 18 | import io.reinert.requestor.core.serialization.Serializer; 19 | 20 | /** 21 | * Metadata for {@link Serializer}. 22 | */ 23 | public interface SerializerMeta { 24 | 25 | interface Method { 26 | String DESERIALIZE = "deserialize"; 27 | String SERIALIZE = "serialize"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/main/resources/io/reinert/requestor/gwtjackson/RequestorGwtJackson.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/test/java/io/reinert/requestor/gwtjackson/RequestorJacksonGwtTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson; 17 | 18 | import com.google.gwt.junit.tools.GWTTestSuite; 19 | 20 | import junit.framework.Test; 21 | import junit.framework.TestSuite; 22 | 23 | public class RequestorJacksonGwtTestSuite extends GWTTestSuite { 24 | 25 | public static Test suite() { 26 | TestSuite suite = new TestSuite("Requestor Gwt-Jackson GWT Test Suite"); 27 | 28 | // Serialization 29 | suite.addTestSuite(RequestorGwtJacksonGwtTest.class); 30 | 31 | return suite; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/test/java/io/reinert/requestor/gwtjackson/rebind/GwtJacksonTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwtjackson.rebind; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import junit.framework.TestSuite; 22 | 23 | /** 24 | * Test suite for main package. 25 | */ 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses({ 28 | // GwtJacksonProcessorTest.class 29 | }) 30 | public class GwtJacksonTestSuite extends TestSuite { 31 | } 32 | -------------------------------------------------------------------------------- /requestor/ext/requestor-gwtjackson/src/test/resources/io/reinert/requestor/gwtjackson/RequestorGwtJacksonTest.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /requestor/ext/requestor-kotlin/src/test/kotlin/RequestorKotlinTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.kotlin 17 | 18 | import io.reinert.requestor.java.net.Requestor 19 | 20 | import kotlinx.coroutines.* 21 | import kotlin.test.* 22 | 23 | class RequestorKotlinTest { 24 | 25 | @Test 26 | fun `make a simple request`() { 27 | var payload = "" 28 | runBlocking { 29 | val runner = CoroutineAsyncRunner(this, Dispatchers.IO) 30 | val session = Requestor.newSession(runner) 31 | 32 | session.req("https://httpbin.org/get") 33 | .get(String::class.java) 34 | .onLoad { res -> payload = res.getPayload() } 35 | } 36 | 37 | assertTrue { payload != "" } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /requestor/ext/requestor-oauth2gwt/src/main/java/io/reinert/requestor/gwt/oauth2/OAuth2ByHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.oauth2; 17 | 18 | import io.reinert.requestor.core.PreparedRequest; 19 | 20 | /** 21 | * OAuth2 authentication through the 22 | * Authorization Request Header Field method. 23 | * 24 | * @author Danilo Reinert 25 | */ 26 | public class OAuth2ByHeader extends OAuth2Base { 27 | 28 | public OAuth2ByHeader(String authUrl, String clientId, String... scopes) { 29 | super(authUrl, clientId, scopes); 30 | } 31 | 32 | @Override 33 | protected void doAuth(PreparedRequest request, TokenInfo tokenInfo) { 34 | request.setHeader("Authorization", tokenInfo.getTokenType() + ' ' + tokenInfo.getAccessToken()); 35 | request.send(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/ext/requestor-oauth2gwt/src/main/java/io/reinert/requestor/gwt/oauth2/OAuth2ByQueryParam.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.oauth2; 17 | 18 | import io.reinert.requestor.core.PreparedRequest; 19 | 20 | /** 21 | * OAuth2 authentication through the 22 | * URI Query Parameter method. 23 | * 24 | * @author Danilo Reinert 25 | */ 26 | public class OAuth2ByQueryParam extends OAuth2Base { 27 | 28 | public OAuth2ByQueryParam(String authUrl, String clientId, String... scopes) { 29 | super(authUrl, clientId, scopes); 30 | } 31 | 32 | @Override 33 | protected void doAuth(PreparedRequest request, TokenInfo tokenInfo) { 34 | request.setQueryParam("access_token", tokenInfo.getAccessToken()); 35 | request.send(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/ext/requestor-oauth2gwt/src/main/java/io/reinert/requestor/gwt/oauth2/TokenStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | package io.reinert.requestor.gwt.oauth2; 17 | 18 | /** 19 | * Interface for storing, retrieving, and clearing stored tokens. 20 | * 21 | * @author jasonhall@google.com (Jason Hall) 22 | */ 23 | interface TokenStore { 24 | public void set(String key, String value); 25 | 26 | public String get(String key); 27 | 28 | public void clear(); 29 | } 30 | -------------------------------------------------------------------------------- /requestor/ext/requestor-oauth2gwt/src/main/java/io/reinert/requestor/gwt/oauth2/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | * use this file except in compliance with the License. You may obtain a copy of 6 | * the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | * License for the specific language governing permissions and limitations under 14 | * the License. 15 | */ 16 | 17 | /** 18 | * Base package for managing user authentication using OAuth2 (draft 10). 19 | * 20 | *

21 | * The main class to use in this package is {@link io.reinert.requestor.gwt.oauth2.Auth}. 22 | * To begin the authentication process, call 23 | * {@link io.reinert.requestor.gwt.oauth2.Auth#login(AuthRequest, com.google.gwt.core.client.Callback)}. 24 | *

25 | * 26 | *

27 | * See {@link io.reinert.requestor.gwt.oauth2.Auth#login(AuthRequest, com.google.gwt.core.client.Callback)}. 28 | *

29 | */ 30 | package io.reinert.requestor.gwt.oauth2; 31 | 32 | -------------------------------------------------------------------------------- /requestor/ext/requestor-oauth2gwt/src/main/resources/io/reinert/requestor/gwt/oauth2/RequestorOAuth2.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /requestor/ext/requestor-oauth2gwt/src/main/resources/io/reinert/requestor/gwt/oauth2/public/oauthWindow.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /requestor/ext/requestor-oauth2gwt/src/test/java/io/reinert/requestor/gwt/oauth2/RequestorOAuth2TestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.oauth2; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import junit.framework.TestSuite; 22 | 23 | /** 24 | * Test suite for main package. 25 | */ 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses({ 28 | AuthTest.class}) 29 | public class RequestorOAuth2TestSuite extends TestSuite { 30 | } 31 | -------------------------------------------------------------------------------- /requestor/impl/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 4.0.0 20 | 21 | 22 | io.reinert.requestor 23 | requestor-parent 24 | 1.5.0-SNAPSHOT 25 | 26 | 27 | pom 28 | 29 | io.reinert.requestor.impl 30 | requestor-impl-parent 31 | 32 | 33 | requestor-gwt 34 | requestor-javanet 35 | 36 | 37 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/FormDataOverlay.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt; 17 | 18 | import com.google.gwt.core.client.JavaScriptObject; 19 | import com.google.gwt.dom.client.FormElement; 20 | 21 | public final class FormDataOverlay extends JavaScriptObject { 22 | 23 | protected FormDataOverlay() { 24 | } 25 | 26 | public static native FormDataOverlay create() /*-{ 27 | return new FormData(); 28 | }-*/; 29 | 30 | public static native FormDataOverlay create(FormElement formElement) /*-{ 31 | return new FormData(formElement); 32 | }-*/; 33 | 34 | public native void append(String name, String value) /*-{ 35 | this.append(name, value); 36 | }-*/; 37 | 38 | public native void append(String name, JavaScriptObject file, String fileName) /*-{ 39 | this.append(name, file, fileName); 40 | }-*/; 41 | } 42 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/JsFormData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt; 17 | 18 | import com.google.gwt.dom.client.FormElement; 19 | 20 | import io.reinert.requestor.core.FormData; 21 | 22 | /** 23 | * Represents FormData interface. 24 | * 25 | * @author Danilo Reinert 26 | */ 27 | public class JsFormData extends FormData { 28 | 29 | private final FormElement formElement; 30 | 31 | private JsFormData(FormElement formElement) { 32 | super(null, false); 33 | this.formElement = formElement; 34 | } 35 | 36 | public static JsFormData wrap(FormElement formElement) { 37 | return new JsFormData(formElement); 38 | } 39 | 40 | public FormElement getFormElement() { 41 | return formElement; 42 | } 43 | 44 | @Override 45 | public boolean isEmpty() { 46 | return (formElement == null || formElement.getElements().getLength() == 0) && super.isEmpty(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/super/io/reinert/requestor/core/internal/Reflection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.core.internal; 17 | 18 | /** 19 | * A utility class that provides reflection methods not compatible with GWT. 20 | * 21 | * @author Danilo Reinert 22 | */ 23 | public class Reflection { 24 | 25 | public static boolean isInnerClass(Class cls) { 26 | throw new UnsupportedOperationException(); 27 | } 28 | 29 | public static T newImpl(Class cls) { 30 | throw new UnsupportedOperationException(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/type/ArrayBuffer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.type; 17 | 18 | import com.google.gwt.core.client.JavaScriptObject; 19 | 20 | public class ArrayBuffer extends NativeType { 21 | 22 | public static String TYPE = "arraybuffer"; 23 | 24 | public ArrayBuffer(JavaScriptObject jso) { 25 | super(TYPE, jso); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/type/Blob.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.type; 17 | 18 | import com.google.gwt.core.client.JavaScriptObject; 19 | 20 | public class Blob extends NativeType { 21 | 22 | public static String TYPE = "blob"; 23 | 24 | public Blob(JavaScriptObject jso) { 25 | super(TYPE, jso); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/type/Document.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.type; 17 | 18 | import com.google.gwt.core.client.JavaScriptObject; 19 | 20 | public class Document extends NativeType { 21 | 22 | public static String TYPE = "document"; 23 | 24 | public Document(JavaScriptObject jso) { 25 | super(TYPE, jso); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/type/Json.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.type; 17 | 18 | import com.google.gwt.core.client.JavaScriptObject; 19 | 20 | public class Json extends NativeType { 21 | 22 | public static String TYPE = "json"; 23 | 24 | public Json(JavaScriptObject jso) { 25 | super(TYPE, jso); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/type/NativeType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.type; 17 | 18 | import com.google.gwt.core.client.JavaScriptObject; 19 | 20 | public class NativeType { 21 | 22 | private final String type; 23 | private final JavaScriptObject jso; 24 | 25 | public NativeType(String type, JavaScriptObject jso) { 26 | this.type = type; 27 | this.jso = jso; 28 | } 29 | 30 | public JavaScriptObject asJso() { 31 | return jso; 32 | } 33 | 34 | public String getType() { 35 | return type; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/java/io/reinert/requestor/gwt/xhr/ProgressHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.xhr; 17 | 18 | import io.reinert.requestor.core.ProgressEvent; 19 | 20 | /** 21 | * A progress callback for an XMLHttpRequest object. 22 | */ 23 | interface ProgressHandler { 24 | 25 | /** 26 | * This is called whenever the progress event of XMLHttpRequest is triggered. 27 | * 28 | * @param progress the progress data. 29 | */ 30 | void onProgress(ProgressEvent progress); 31 | } 32 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/main/resources/io/reinert/requestor/gwt/RequestorGwt.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/test/java/io/reinert/requestor/gwt/serialization/SerializationTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.gwt.serialization; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import junit.framework.TestSuite; 22 | 23 | /** 24 | * Test suite for serialization package. 25 | */ 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses({ 28 | JsonBooleanSerializerJreTest.class, 29 | JsonNumberSerializerJreTest.class, 30 | JsonStringSerializerJreTest.class}) 31 | public class SerializationTestSuite extends TestSuite { 32 | } 33 | -------------------------------------------------------------------------------- /requestor/impl/requestor-gwt/src/test/resources/io/reinert/requestor/gwt/RequestorGwtTest.gwt.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /requestor/impl/requestor-javanet/src/main/java/io/reinert/requestor/java/net/auth/PolicyTrustManager.java: -------------------------------------------------------------------------------- 1 | package io.reinert.requestor.java.net.auth; 2 | 3 | import java.security.cert.CertificateException; 4 | import java.security.cert.X509Certificate; 5 | 6 | import javax.net.ssl.TrustManager; 7 | import javax.net.ssl.X509TrustManager; 8 | 9 | import io.reinert.requestor.java.net.ssl.TrustPolicy; 10 | 11 | /** 12 | * Policy based {@link TrustManager}. 13 | * 14 | * @author Danilo Reinert 15 | */ 16 | class PolicyTrustManager implements X509TrustManager { 17 | 18 | private final X509TrustManager trustManager; 19 | private final TrustPolicy trustPolicy; 20 | 21 | PolicyTrustManager(TrustManager trustManager, TrustPolicy trustPolicy) { 22 | this.trustManager = (X509TrustManager) trustManager; 23 | this.trustPolicy = trustPolicy; 24 | } 25 | 26 | public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { 27 | this.trustManager.checkClientTrusted(chain, authType); 28 | } 29 | 30 | public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { 31 | if (!this.trustPolicy.isTrusted(chain, authType)) { 32 | this.trustManager.checkServerTrusted(chain, authType); 33 | } 34 | } 35 | 36 | public X509Certificate[] getAcceptedIssuers() { 37 | return this.trustManager.getAcceptedIssuers(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /requestor/impl/requestor-javanet/src/main/java/io/reinert/requestor/java/net/ssl/TrustPolicy.java: -------------------------------------------------------------------------------- 1 | package io.reinert.requestor.java.net.ssl; 2 | 3 | import java.security.cert.X509Certificate; 4 | 5 | /** 6 | * Defines a policy to trust server certificates in SSL connections. 7 | * 8 | * @author Danilo Reinert 9 | */ 10 | public interface TrustPolicy { 11 | 12 | TrustPolicy TRUST_ALL = (chain, authType) -> true; 13 | 14 | TrustPolicy TRUST_SELF_SIGNED = (chain, authType) -> chain.length == 1; 15 | 16 | boolean isTrusted(X509Certificate[] chain, String authType); 17 | } 18 | -------------------------------------------------------------------------------- /requestor/impl/requestor-javanet/src/test/java/io/reinert/requestor/java/net/RequestorJavaNetTestSuite.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 Danilo Reinert 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package io.reinert.requestor.java.net; 17 | 18 | import org.junit.runner.RunWith; 19 | import org.junit.runners.Suite; 20 | 21 | import junit.framework.TestSuite; 22 | 23 | /** 24 | * Test suite for main package. 25 | */ 26 | @RunWith(Suite.class) 27 | @Suite.SuiteClasses({ 28 | HttpMethodTest.class, 29 | RequestEventTest.class, 30 | SerializationTest.class, 31 | PollingTest.class, 32 | RetryTest.class 33 | }) 34 | public class RequestorJavaNetTestSuite extends TestSuite { 35 | } 36 | -------------------------------------------------------------------------------- /requestor/impl/requestor-javanet/src/test/resources/junit-platform.properties: -------------------------------------------------------------------------------- 1 | junit.jupiter.execution.parallel.enabled = true 2 | -------------------------------------------------------------------------------- /setup-dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cp Dockerfile-template Dockerfile 4 | 5 | UID=`id -u` 6 | PWD=`pwd` 7 | sed -i "s::$USER:g" Dockerfile 8 | sed -i "s::$UID:g" Dockerfile 9 | sed -i "s::$PWD:g" Dockerfile 10 | -------------------------------------------------------------------------------- /tag.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -n "$1" ]; then 4 | RV=`echo $1 | sed 's/\./\\\\./g'` 5 | REP="'0,//s:.*:$RV:g'" 6 | eval sed -i $REP pom.xml 7 | fi -------------------------------------------------------------------------------- /tools/checkstyle/requestor-checkstyle-suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tools/checkstyle/requestor-checkstyle.properties: -------------------------------------------------------------------------------- 1 | suppressions.file=target/checkstyle-suppressions.xml 2 | cache.file=target/checkstyle-cachefile 3 | --------------------------------------------------------------------------------