├── .github ├── dependabot.yml ├── project.yml ├── quarkus-github-bot.yml └── workflows │ ├── build.yml │ ├── pre-release.yml │ ├── release-perform.yml │ └── release-prepare.yml ├── .gitignore ├── LICENSE.txt ├── README.md ├── core ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── undertow │ │ │ ├── Handlers.java │ │ │ ├── Undertow.java │ │ │ ├── UndertowLogger.java │ │ │ ├── UndertowMessages.java │ │ │ ├── Version.java │ │ │ ├── attribute │ │ │ ├── AuthenticationTypeExchangeAttribute.java │ │ │ ├── BytesSentAttribute.java │ │ │ ├── CompositeExchangeAttribute.java │ │ │ ├── ConstantExchangeAttribute.java │ │ │ ├── CookieAttribute.java │ │ │ ├── DateTimeAttribute.java │ │ │ ├── ExchangeAttribute.java │ │ │ ├── ExchangeAttributeBuilder.java │ │ │ ├── ExchangeAttributeParser.java │ │ │ ├── ExchangeAttributeWrapper.java │ │ │ ├── ExchangeAttributes.java │ │ │ ├── HostAndPortAttribute.java │ │ │ ├── IdentUsernameAttribute.java │ │ │ ├── LocalIPAttribute.java │ │ │ ├── LocalPortAttribute.java │ │ │ ├── LocalServerNameAttribute.java │ │ │ ├── NullAttribute.java │ │ │ ├── PathParameterAttribute.java │ │ │ ├── PredicateContextAttribute.java │ │ │ ├── QueryParameterAttribute.java │ │ │ ├── QueryStringAttribute.java │ │ │ ├── QuotingExchangeAttribute.java │ │ │ ├── ReadOnlyAttributeException.java │ │ │ ├── RelativePathAttribute.java │ │ │ ├── RemoteHostAttribute.java │ │ │ ├── RemoteIPAttribute.java │ │ │ ├── RemoteUserAttribute.java │ │ │ ├── RequestHeaderAttribute.java │ │ │ ├── RequestLineAttribute.java │ │ │ ├── RequestMethodAttribute.java │ │ │ ├── RequestPathAttribute.java │ │ │ ├── RequestProtocolAttribute.java │ │ │ ├── RequestSchemeAttribute.java │ │ │ ├── RequestURLAttribute.java │ │ │ ├── ResolvedPathAttribute.java │ │ │ ├── ResponseCodeAttribute.java │ │ │ ├── ResponseHeaderAttribute.java │ │ │ ├── ResponseTimeAttribute.java │ │ │ ├── SecureExchangeAttribute.java │ │ │ ├── SslCipherAttribute.java │ │ │ ├── SslClientCertAttribute.java │ │ │ ├── SslSessionIdAttribute.java │ │ │ ├── SubstituteEmptyWrapper.java │ │ │ ├── ThreadNameAttribute.java │ │ │ └── TransportProtocolAttribute.java │ │ │ ├── predicate │ │ │ ├── AndPredicate.java │ │ │ ├── AuthenticationRequiredPredicate.java │ │ │ ├── ContainsPredicate.java │ │ │ ├── EqualsPredicate.java │ │ │ ├── ExistsPredicate.java │ │ │ ├── FalsePredicate.java │ │ │ ├── IdempotentPredicate.java │ │ │ ├── MaxContentSizePredicate.java │ │ │ ├── MethodPredicate.java │ │ │ ├── MinContentSizePredicate.java │ │ │ ├── NotPredicate.java │ │ │ ├── OrPredicate.java │ │ │ ├── PathMatchPredicate.java │ │ │ ├── PathPrefixPredicate.java │ │ │ ├── PathSuffixPredicate.java │ │ │ ├── PathTemplatePredicate.java │ │ │ ├── Predicate.java │ │ │ ├── PredicateBuilder.java │ │ │ ├── PredicateParser.java │ │ │ ├── Predicates.java │ │ │ ├── PredicatesHandler.java │ │ │ ├── RegularExpressionPredicate.java │ │ │ ├── SecurePredicate.java │ │ │ └── TruePredicate.java │ │ │ ├── security │ │ │ ├── api │ │ │ │ ├── AuthenticatedSessionManager.java │ │ │ │ ├── AuthenticationMechanism.java │ │ │ │ ├── AuthenticationMechanismContext.java │ │ │ │ ├── AuthenticationMechanismFactory.java │ │ │ │ ├── AuthenticationMode.java │ │ │ │ ├── GSSAPIServerSubjectFactory.java │ │ │ │ ├── NonceManager.java │ │ │ │ ├── NotificationReceiver.java │ │ │ │ ├── SecurityContext.java │ │ │ │ ├── SecurityContextFactory.java │ │ │ │ ├── SecurityNotification.java │ │ │ │ └── SessionNonceManager.java │ │ │ ├── handlers │ │ │ │ ├── AbstractConfidentialityHandler.java │ │ │ │ ├── AbstractSecurityContextAssociationHandler.java │ │ │ │ ├── AuthenticationCallHandler.java │ │ │ │ ├── AuthenticationConstraintHandler.java │ │ │ │ ├── AuthenticationMechanismsHandler.java │ │ │ │ ├── CachedAuthenticatedSessionHandler.java │ │ │ │ ├── NotificationReceiverHandler.java │ │ │ │ ├── SecurityActions.java │ │ │ │ ├── SecurityInitialHandler.java │ │ │ │ └── SinglePortConfidentialityHandler.java │ │ │ ├── idm │ │ │ │ ├── Account.java │ │ │ │ ├── Credential.java │ │ │ │ ├── DigestAlgorithm.java │ │ │ │ ├── DigestCredential.java │ │ │ │ ├── ExternalCredential.java │ │ │ │ ├── GSSContextCredential.java │ │ │ │ ├── IdentityManager.java │ │ │ │ ├── PasswordCredential.java │ │ │ │ └── X509CertificateCredential.java │ │ │ └── impl │ │ │ │ ├── AbstractSecurityContext.java │ │ │ │ ├── AuthenticationInfoToken.java │ │ │ │ ├── BasicAuthenticationMechanism.java │ │ │ │ ├── CachedAuthenticatedSessionMechanism.java │ │ │ │ ├── ClientCertAuthenticationMechanism.java │ │ │ │ ├── DigestAuthenticationMechanism.java │ │ │ │ ├── DigestAuthorizationToken.java │ │ │ │ ├── DigestQop.java │ │ │ │ ├── DigestWWWAuthenticateToken.java │ │ │ │ ├── ExternalAuthenticationMechanism.java │ │ │ │ ├── FormAuthenticationMechanism.java │ │ │ │ ├── GSSAPIAuthenticationMechanism.java │ │ │ │ ├── GenericHeaderAuthenticationMechanism.java │ │ │ │ ├── InMemorySingleSignOnManager.java │ │ │ │ ├── SecurityActions.java │ │ │ │ ├── SecurityContextFactoryImpl.java │ │ │ │ ├── SecurityContextImpl.java │ │ │ │ ├── SimpleNonceManager.java │ │ │ │ ├── SingleSignOn.java │ │ │ │ ├── SingleSignOnAuthenticationMechanism.java │ │ │ │ └── SingleSignOnManager.java │ │ │ ├── server │ │ │ ├── AggregateConnectorStatistics.java │ │ │ ├── BasicSSLSessionInfo.java │ │ │ ├── ConnectorStatistics.java │ │ │ ├── ConnectorStatisticsImpl.java │ │ │ ├── Connectors.java │ │ │ ├── DefaultExchangeHandler.java │ │ │ ├── DefaultResponseListener.java │ │ │ ├── ExchangeCompletionListener.java │ │ │ ├── HandlerWrapper.java │ │ │ ├── HttpContinue.java │ │ │ ├── HttpHandler.java │ │ │ ├── HttpServerExchange.java │ │ │ ├── JvmRouteHandler.java │ │ │ ├── ListenerRegistry.java │ │ │ ├── OpenListener.java │ │ │ ├── ResponseCommitListener.java │ │ │ ├── RoutingHandler.java │ │ │ ├── SecureCookieCommitListener.java │ │ │ ├── UndertowServerContainer.java │ │ │ ├── handlers │ │ │ │ ├── AccessControlListHandler.java │ │ │ │ ├── AllowedMethodsHandler.java │ │ │ │ ├── AttachmentHandler.java │ │ │ │ ├── BlockingHandler.java │ │ │ │ ├── ByteRangeHandler.java │ │ │ │ ├── CanonicalPathHandler.java │ │ │ │ ├── ConfiguredPushHandler.java │ │ │ │ ├── Cookie.java │ │ │ │ ├── CookieImpl.java │ │ │ │ ├── CookieSameSiteMode.java │ │ │ │ ├── DateHandler.java │ │ │ │ ├── DisableCacheHandler.java │ │ │ │ ├── DisallowedMethodsHandler.java │ │ │ │ ├── ExceptionHandler.java │ │ │ │ ├── ForwardedHandler.java │ │ │ │ ├── GracefulShutdownHandler.java │ │ │ │ ├── HttpContinueAcceptingHandler.java │ │ │ │ ├── HttpContinueReadHandler.java │ │ │ │ ├── HttpTraceHandler.java │ │ │ │ ├── HttpUpgradeHandshake.java │ │ │ │ ├── IPAddressAccessControlHandler.java │ │ │ │ ├── JDBCLogHandler.java │ │ │ │ ├── LocalNameResolvingHandler.java │ │ │ │ ├── MetricsHandler.java │ │ │ │ ├── NameVirtualHostHandler.java │ │ │ │ ├── OriginHandler.java │ │ │ │ ├── PathHandler.java │ │ │ │ ├── PathSeparatorHandler.java │ │ │ │ ├── PathTemplateHandler.java │ │ │ │ ├── PeerNameResolvingHandler.java │ │ │ │ ├── PredicateContextHandler.java │ │ │ │ ├── PredicateHandler.java │ │ │ │ ├── ProxyPeerAddressHandler.java │ │ │ │ ├── RedirectHandler.java │ │ │ │ ├── RequestDumpingHandler.java │ │ │ │ ├── RequestLimit.java │ │ │ │ ├── RequestLimitingHandler.java │ │ │ │ ├── ResponseCodeHandler.java │ │ │ │ ├── ResponseRateLimitingHandler.java │ │ │ │ ├── SSLHeaderHandler.java │ │ │ │ ├── SameSiteCookieHandler.java │ │ │ │ ├── SecureCookieHandler.java │ │ │ │ ├── SetAttributeHandler.java │ │ │ │ ├── SetHeaderHandler.java │ │ │ │ ├── StoredResponseHandler.java │ │ │ │ ├── StuckThreadDetectionHandler.java │ │ │ │ ├── URLDecodingHandler.java │ │ │ │ ├── accesslog │ │ │ │ │ ├── AccessLogHandler.java │ │ │ │ │ ├── AccessLogReceiver.java │ │ │ │ │ ├── DefaultAccessLogReceiver.java │ │ │ │ │ ├── ExtendedAccessLogParser.java │ │ │ │ │ ├── JBossLoggingAccessLogReceiver.java │ │ │ │ │ └── LogFileHeaderGenerator.java │ │ │ │ ├── builder │ │ │ │ │ ├── HandlerBuilder.java │ │ │ │ │ ├── HandlerParser.java │ │ │ │ │ ├── PredicatedHandler.java │ │ │ │ │ ├── PredicatedHandlersParser.java │ │ │ │ │ ├── ResponseCodeHandlerBuilder.java │ │ │ │ │ └── RewriteHandlerBuilder.java │ │ │ │ ├── cache │ │ │ │ │ ├── DirectBufferCache.java │ │ │ │ │ ├── LRUCache.java │ │ │ │ │ └── LimitedBufferSlicePool.java │ │ │ │ ├── error │ │ │ │ │ └── SimpleErrorPageHandler.java │ │ │ │ ├── form │ │ │ │ │ ├── EagerFormParsingHandler.java │ │ │ │ │ ├── FormData.java │ │ │ │ │ ├── FormDataParser.java │ │ │ │ │ ├── FormEncodedDataDefinition.java │ │ │ │ │ ├── FormParserFactory.java │ │ │ │ │ ├── MultiPartParserDefinition.java │ │ │ │ │ └── MultipartParser.java │ │ │ │ └── resource │ │ │ │ │ ├── CachedResource.java │ │ │ │ │ ├── CachingResourceManager.java │ │ │ │ │ ├── ClassPathResourceManager.java │ │ │ │ │ ├── DefaultResourceSupplier.java │ │ │ │ │ ├── DirectoryUtils.java │ │ │ │ │ ├── FileResource.java │ │ │ │ │ ├── FileResourceManager.java │ │ │ │ │ ├── PathResource.java │ │ │ │ │ ├── PathResourceManager.java │ │ │ │ │ ├── PreCompressedResourceSupplier.java │ │ │ │ │ ├── RangeAwareResource.java │ │ │ │ │ ├── Resource.java │ │ │ │ │ ├── ResourceChangeEvent.java │ │ │ │ │ ├── ResourceHandler.java │ │ │ │ │ ├── ResourceManager.java │ │ │ │ │ ├── ResourceSupplier.java │ │ │ │ │ └── URLResource.java │ │ │ └── session │ │ │ │ ├── InMemorySessionManager.java │ │ │ │ ├── PathParameterSessionConfig.java │ │ │ │ ├── SecureRandomSessionIdGenerator.java │ │ │ │ ├── Session.java │ │ │ │ ├── SessionAttachmentHandler.java │ │ │ │ ├── SessionConfig.java │ │ │ │ ├── SessionCookieConfig.java │ │ │ │ ├── SessionIdGenerator.java │ │ │ │ ├── SessionListener.java │ │ │ │ ├── SessionListeners.java │ │ │ │ ├── SessionManager.java │ │ │ │ ├── SessionManagerStatistics.java │ │ │ │ └── SslSessionConfig.java │ │ │ └── util │ │ │ ├── AbstractAttachable.java │ │ │ ├── Attachable.java │ │ │ ├── AttachmentKey.java │ │ │ ├── AttachmentList.java │ │ │ ├── BadRequestException.java │ │ │ ├── Bits.java │ │ │ ├── ByteActivityCallback.java │ │ │ ├── ByteRange.java │ │ │ ├── CanonicalPathUtils.java │ │ │ ├── Certificates.java │ │ │ ├── ChainedHandlerWrapper.java │ │ │ ├── ConcurrentDirectDeque.java │ │ │ ├── Cookies.java │ │ │ ├── CopyOnWriteMap.java │ │ │ ├── DateUtils.java │ │ │ ├── DirectByteBufferDeallocator.java │ │ │ ├── ETag.java │ │ │ ├── ETagUtils.java │ │ │ ├── FastConcurrentDirectDeque.java │ │ │ ├── FileUtils.java │ │ │ ├── FlexBase64.java │ │ │ ├── HeaderToken.java │ │ │ ├── HeaderTokenParser.java │ │ │ ├── Headers.java │ │ │ ├── HexConverter.java │ │ │ ├── HttpAttachments.java │ │ │ ├── HttpString.java │ │ │ ├── HttpTokens.java │ │ │ ├── ImmediateAuthenticationMechanismFactory.java │ │ │ ├── IoUtils.java │ │ │ ├── LegacyCookieSupport.java │ │ │ ├── LocaleUtils.java │ │ │ ├── MalformedMessageException.java │ │ │ ├── Methods.java │ │ │ ├── MimeMappings.java │ │ │ ├── NetworkUtils.java │ │ │ ├── NewInstanceObjectPool.java │ │ │ ├── ObjectPool.java │ │ │ ├── ParameterLimitException.java │ │ │ ├── PathMatcher.java │ │ │ ├── PathTemplate.java │ │ │ ├── PathTemplateMatch.java │ │ │ ├── PathTemplateMatcher.java │ │ │ ├── PipeliningExecutor.java │ │ │ ├── PooledObject.java │ │ │ ├── PortableConcurrentDirectDeque.java │ │ │ ├── Protocols.java │ │ │ ├── QValueParser.java │ │ │ ├── QueryParameterUtils.java │ │ │ ├── RedirectBuilder.java │ │ │ ├── RequestTooBigException.java │ │ │ ├── Rfc6265CookieSupport.java │ │ │ ├── SameSiteNoneIncompatibleClientChecker.java │ │ │ ├── SameThreadExecutor.java │ │ │ ├── Sessions.java │ │ │ ├── SimpleAttachmentKey.java │ │ │ ├── SimpleObjectPool.java │ │ │ ├── SubstringMap.java │ │ │ ├── TruncatedResponseException.java │ │ │ ├── URLUtils.java │ │ │ ├── UndertowConnectorLogger.java │ │ │ └── UndertowConnectorMessages.java │ ├── java9 │ │ └── io │ │ │ └── undertow │ │ │ └── util │ │ │ └── FastConcurrentDirectDeque.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ ├── io.undertow.attribute.ExchangeAttributeBuilder │ │ │ ├── io.undertow.predicate.PredicateBuilder │ │ │ ├── io.undertow.server.handlers.builder.HandlerBuilder │ │ │ └── io.undertow.xnio.client.ClientProvider │ │ └── io │ │ └── undertow │ │ └── version.properties │ └── test │ ├── java │ └── io │ │ └── undertow │ │ ├── predicate │ │ └── PredicateParsingTestCase.java │ │ ├── server │ │ ├── ConnectionTerminationTestCase.java │ │ ├── EncodedEncodedSlashTestCase.java │ │ ├── ExchangeCompletionListenerTestCase.java │ │ ├── HttpServerExchangeTestCase.java │ │ ├── InvalidHtpRequestTestCase.java │ │ ├── MaxRequestSizeTestCase.java │ │ ├── NewlineInHeadersTestCase.java │ │ ├── StopTestCase.java │ │ ├── handlers │ │ │ ├── AllowedMethodsTestCase.java │ │ │ ├── BadRequestTestCase.java │ │ │ ├── BlockingServerStreamResetTestCase.java │ │ │ ├── ChunkedRequestNotConsumedTestCase.java │ │ │ ├── ChunkedRequestTrailersTestCase.java │ │ │ ├── ChunkedRequestTransferCodingTestCase.java │ │ │ ├── ChunkedResponseTrailersTestCase.java │ │ │ ├── ChunkedResponseTransferCodingTestCase.java │ │ │ ├── DateHandlerTestCase.java │ │ │ ├── ExceptionHandlerTestCase.java │ │ │ ├── FixedLengthRequestTestCase.java │ │ │ ├── FixedLengthResponseTestCase.java │ │ │ ├── ForwardedHandlerTestCase.java │ │ │ ├── GracefulShutdownTestCase.java │ │ │ ├── HeadTestCase.java │ │ │ ├── HttpContinueAcceptingHandlerTestCase.java │ │ │ ├── HttpContinueTestCase.java │ │ │ ├── IPAddressAccessControlHandlerUnitTestCase.java │ │ │ ├── JDBCLogDatabaseTestCase.java │ │ │ ├── LongURLTestCase.java │ │ │ ├── LotsOfHeadersRequestTestCase.java │ │ │ ├── LotsOfHeadersResponseTestCase.java │ │ │ ├── LotsOfQueryParametersTestCase.java │ │ │ ├── MetricsHandlerTestCase.java │ │ │ ├── OriginTestCase.java │ │ │ ├── PathTemplateHandlerTestCase.java │ │ │ ├── PreChunkedResponseTransferCodingTestCase.java │ │ │ ├── PredicatedHandlersTestCase.java │ │ │ ├── QueryParametersTestCase.java │ │ │ ├── RangeRequestTestCase.java │ │ │ ├── RedirectTestCase.java │ │ │ ├── RequestLimitingHandlerTestCase.java │ │ │ ├── RoutingHandlerTestCase.java │ │ │ ├── SameSiteCookieHandlerTestCase.java │ │ │ ├── SecureCookieHandlerTestCase.java │ │ │ ├── SetAttributeTestCase.java │ │ │ ├── SimpleNonBlockingServerTestCase.java │ │ │ ├── UserAgentAccessControlHandlerUnitTestCase.java │ │ │ ├── VirtualHostTestCase.java │ │ │ ├── accesslog │ │ │ │ ├── AccessLogFileTestCase.java │ │ │ │ ├── AccessLogTestCase.java │ │ │ │ └── ExtendedAccessLogFileTestCase.java │ │ │ ├── builder │ │ │ │ └── PredicatedHandlersParserTestCase.java │ │ │ ├── error │ │ │ │ └── SimpleErrorPageHandlerTestCase.java │ │ │ ├── file │ │ │ │ ├── FileHandlerIndexTestCase.java │ │ │ │ ├── FileHandlerStressTestCase.java │ │ │ │ ├── FileHandlerSymlinksTestCase.java │ │ │ │ ├── FileHandlerTestCase.java │ │ │ │ ├── PathResourceManagerTestCase.java │ │ │ │ ├── PreCompressedResourceTestCase.java │ │ │ │ ├── page.html │ │ │ │ └── subdir │ │ │ │ │ └── a.txt │ │ │ ├── form │ │ │ │ ├── FormDataParserTestCase.java │ │ │ │ ├── MultipartFormDataParserTestCase.java │ │ │ │ └── uploadfile.txt │ │ │ ├── path │ │ │ │ └── PathTestCase.java │ │ │ ├── range.txt │ │ │ └── session │ │ │ │ ├── InMemorySessionTestCase.java │ │ │ │ ├── SSLSessionTestCase.java │ │ │ │ └── URLRewritingSessionTestCase.java │ │ ├── security │ │ │ ├── AuthenticationTestBase.java │ │ │ ├── BasicAuthenticationTestCase.java │ │ │ ├── ClientCertRenegotiationTestCase.java │ │ │ ├── ClientCertTestCase.java │ │ │ ├── DigestAuthentication2069TestCase.java │ │ │ ├── DigestAuthenticationAuthTestCase.java │ │ │ ├── FormAuthTestCase.java │ │ │ ├── GenericHeaderAuthenticationTestCase.java │ │ │ ├── KerberosKDCUtil.java │ │ │ ├── ParseDigestAuthorizationTokenTestCase.java │ │ │ ├── SimpleConfidentialRedirectTestCase.java │ │ │ ├── SpnegoAuthenticationTestCase.java │ │ │ ├── SpnegoBasicAuthenticationTestCase.java │ │ │ ├── SpnegoDigestAuthenticationTestCase.java │ │ │ └── SsoTestCase.java │ │ └── ssl │ │ │ ├── ComplexSSLTestCase.java │ │ │ └── SimpleSSLTestCase.java │ │ ├── testutils │ │ ├── AjpIgnore.java │ │ ├── DefaultServer.java │ │ ├── HttpClientUtils.java │ │ ├── HttpOneOnly.java │ │ ├── HttpsIgnore.java │ │ ├── MockHttpExchange.java │ │ ├── ProxyIgnore.java │ │ ├── TestHttpClient.java │ │ └── category │ │ │ ├── FunctionalTest.java │ │ │ └── UnitTest.java │ │ └── util │ │ ├── CanonicalPathUtilsTestCase.java │ │ ├── CompletionLatchHandler.java │ │ ├── ContentTypeParsingTestCase.java │ │ ├── CookiesTestCase.java │ │ ├── DateUtilsTestCase.java │ │ ├── ETagUtilsTestCase.java │ │ ├── FlexBase64TestCase.java │ │ ├── HeaderOrderTestCase.java │ │ ├── HeaderTokenParserTestCase.java │ │ ├── HeadersUtilsTestCase.java │ │ ├── LocaleUtilsTestCase.java │ │ ├── NetworkUtilsAddressParsingTestCase.java │ │ ├── NodeStatusCodesTestCase.java │ │ ├── PathMatcherTestCase.java │ │ ├── PathTemplateTestCase.java │ │ ├── SameSiteNoneIncompatibleClientCheckerTestCase.java │ │ ├── SubstringMapTestCase.java │ │ ├── TestVersion.java │ │ ├── URLUtilsTestCase.java │ │ ├── mime-multiline.txt │ │ ├── mime-utf8.txt │ │ ├── mime1.txt │ │ ├── mime2.txt │ │ ├── mime3.txt │ │ └── mime4.txt │ └── resources │ ├── ajp-apache-site │ ├── byteman-netwok.btm │ ├── ca.crt │ ├── client.keystore │ ├── client.truststore │ ├── krb5.conf │ ├── ldif │ ├── krbtgt.ldif │ ├── partition.ldif │ ├── server.ldif │ └── user.ldif │ ├── logging.properties │ ├── server.keystore │ ├── server.pem │ └── server.truststore ├── coverage-report └── pom.xml ├── examples ├── README ├── conf │ └── nodes.xml ├── pom.xml └── src │ └── main │ ├── java │ └── io │ │ └── undertow │ │ └── examples │ │ ├── Runner.java │ │ ├── UndertowExample.java │ │ ├── chat │ │ ├── ChatServer.java │ │ └── index.html │ │ ├── fileserving │ │ └── FileServer.java │ │ ├── helloworld │ │ └── HelloWorldServer.java │ │ ├── http2 │ │ ├── client.keystore │ │ ├── client.truststore │ │ ├── server.keystore │ │ ├── server.pem │ │ └── server.truststore │ │ ├── jsrwebsockets │ │ ├── JSRWebSocketServer.java │ │ ├── JsrChatWebSocketEndpoint.java │ │ └── index.html │ │ ├── reverseproxy │ │ ├── ModClusterProxyServer.java │ │ └── ReverseProxyServer.java │ │ ├── security │ │ └── basic │ │ │ ├── BasicAuthServer.java │ │ │ └── MapIdentityManager.java │ │ ├── servlet │ │ ├── MessageServlet.java │ │ └── ServletServer.java │ │ ├── sessionhandling │ │ └── SessionServer.java │ │ ├── sse │ │ ├── ServerSentEventsServer.java │ │ └── index.html │ │ ├── websockets │ │ ├── WebSocketServer.java │ │ └── index.html │ │ └── websockets_extension │ │ ├── WebSocketServer.java │ │ └── index.html │ └── resources │ └── logging.properties ├── http-core ├── pom.xml └── src │ └── main │ └── java │ └── io │ └── undertow │ └── httpcore │ ├── BlockingHttpExchange.java │ ├── BufferAllocator.java │ ├── ClientAuth.java │ ├── CompletedListener.java │ ├── ConnectionSSLSessionInfo.java │ ├── DefaultBlockingHttpExchange.java │ ├── ExchangeHandler.java │ ├── HttpExchange.java │ ├── HttpExchangeBase.java │ ├── HttpHeaderNames.java │ ├── HttpMethodNames.java │ ├── HttpProtocolNames.java │ ├── InputChannel.java │ ├── IoCallback.java │ ├── OutputChannel.java │ ├── PreCommitListener.java │ ├── RenegotiationRequiredException.java │ ├── SSLSessionInfo.java │ ├── StatusCodes.java │ ├── UndertowEngine.java │ ├── UndertowInputStream.java │ ├── UndertowOption.java │ ├── UndertowOptionMap.java │ ├── UndertowOptions.java │ ├── UndertowOutputStream.java │ └── WriteFunction.java ├── pom.xml ├── servlet ├── pom.xml └── src │ ├── main │ ├── java │ │ └── io │ │ │ └── undertow │ │ │ └── servlet │ │ │ ├── ExceptionLog.java │ │ │ ├── ServletExtension.java │ │ │ ├── Servlets.java │ │ │ ├── UndertowServletLogger.java │ │ │ ├── UndertowServletMessages.java │ │ │ ├── api │ │ │ ├── AuthMethodConfig.java │ │ │ ├── AuthorizationManager.java │ │ │ ├── ClassIntrospecter.java │ │ │ ├── ConfidentialPortManager.java │ │ │ ├── CrawlerSessionManagerConfig.java │ │ │ ├── DefaultServletConfig.java │ │ │ ├── Deployment.java │ │ │ ├── DeploymentInfo.java │ │ │ ├── DeploymentManager.java │ │ │ ├── ErrorPage.java │ │ │ ├── ExceptionHandler.java │ │ │ ├── FilterInfo.java │ │ │ ├── FilterMappingInfo.java │ │ │ ├── HttpMethodSecurityInfo.java │ │ │ ├── InstanceFactory.java │ │ │ ├── InstanceHandle.java │ │ │ ├── LegacyThreadSetupActionWrapper.java │ │ │ ├── LifecycleInterceptor.java │ │ │ ├── ListenerInfo.java │ │ │ ├── LoggingExceptionHandler.java │ │ │ ├── LoginConfig.java │ │ │ ├── MetricsCollector.java │ │ │ ├── MimeMapping.java │ │ │ ├── SecurityConstraint.java │ │ │ ├── SecurityInfo.java │ │ │ ├── SecurityRoleRef.java │ │ │ ├── ServletContainer.java │ │ │ ├── ServletContainerInitializerInfo.java │ │ │ ├── ServletDispatcher.java │ │ │ ├── ServletInfo.java │ │ │ ├── ServletSecurityInfo.java │ │ │ ├── ServletSessionConfig.java │ │ │ ├── ServletStackTraces.java │ │ │ ├── SessionConfigWrapper.java │ │ │ ├── SessionManagerFactory.java │ │ │ ├── SessionPersistenceManager.java │ │ │ ├── SingleConstraintMatch.java │ │ │ ├── ThreadSetupAction.java │ │ │ ├── ThreadSetupHandler.java │ │ │ ├── TransportGuaranteeType.java │ │ │ └── WebResourceCollection.java │ │ │ ├── attribute │ │ │ ├── ServletContextAttribute.java │ │ │ ├── ServletNameAttribute.java │ │ │ ├── ServletRelativePathAttribute.java │ │ │ ├── ServletRequestAttribute.java │ │ │ ├── ServletRequestCharacterEncodingAttribute.java │ │ │ ├── ServletRequestLineAttribute.java │ │ │ ├── ServletRequestLocaleAttribute.java │ │ │ ├── ServletRequestParameterAttribute.java │ │ │ ├── ServletRequestURLAttribute.java │ │ │ ├── ServletRequestedSessionIdAttribute.java │ │ │ ├── ServletRequestedSessionIdFromCookieAttribute.java │ │ │ ├── ServletRequestedSessionIdValidAttribute.java │ │ │ ├── ServletSessionAttribute.java │ │ │ └── ServletSessionIdAttribute.java │ │ │ ├── compat │ │ │ └── rewrite │ │ │ │ ├── Resolver.java │ │ │ │ ├── RewriteCond.java │ │ │ │ ├── RewriteConfig.java │ │ │ │ ├── RewriteConfigFactory.java │ │ │ │ ├── RewriteHandler.java │ │ │ │ ├── RewriteMap.java │ │ │ │ ├── RewriteRule.java │ │ │ │ ├── Substitution.java │ │ │ │ └── UndertowResolver.java │ │ │ ├── core │ │ │ ├── ApplicationListeners.java │ │ │ ├── ContextClassLoaderSetupAction.java │ │ │ ├── DefaultAuthorizationManager.java │ │ │ ├── DeploymentImpl.java │ │ │ ├── DeploymentManagerImpl.java │ │ │ ├── ErrorPages.java │ │ │ ├── InMemorySessionManagerFactory.java │ │ │ ├── Lifecycle.java │ │ │ ├── LifecyleInterceptorInvocation.java │ │ │ ├── ManagedFilter.java │ │ │ ├── ManagedFilters.java │ │ │ ├── ManagedListener.java │ │ │ ├── ManagedServlet.java │ │ │ ├── ManagedServlets.java │ │ │ ├── MetricsChainHandler.java │ │ │ ├── SecurityActions.java │ │ │ ├── ServletBlockingHttpExchange.java │ │ │ ├── ServletContainerImpl.java │ │ │ ├── ServletExtensionHolder.java │ │ │ ├── ServletRequestContextThreadSetupAction.java │ │ │ ├── ServletUpgradeListener.java │ │ │ ├── SessionListenerBridge.java │ │ │ ├── WebConnectionImpl.java │ │ │ └── WriterOutputStream.java │ │ │ ├── handlers │ │ │ ├── CrawlerSessionManagerHandler.java │ │ │ ├── DefaultServlet.java │ │ │ ├── FilterHandler.java │ │ │ ├── MarkSecureHandler.java │ │ │ ├── RedirectDirHandler.java │ │ │ ├── SecurityActions.java │ │ │ ├── ServletChain.java │ │ │ ├── ServletDebugPageHandler.java │ │ │ ├── ServletDispatchingHandler.java │ │ │ ├── ServletHandler.java │ │ │ ├── ServletInitialHandler.java │ │ │ ├── ServletPathMatch.java │ │ │ ├── ServletPathMatches.java │ │ │ ├── ServletPathMatchesData.java │ │ │ ├── ServletRequestContext.java │ │ │ ├── SessionRestoringHandler.java │ │ │ └── security │ │ │ │ ├── CachedAuthenticatedSessionHandler.java │ │ │ │ ├── SSLInformationAssociationHandler.java │ │ │ │ ├── SecurityPathMatch.java │ │ │ │ ├── SecurityPathMatches.java │ │ │ │ ├── ServletAuthenticationCallHandler.java │ │ │ │ ├── ServletAuthenticationConstraintHandler.java │ │ │ │ ├── ServletConfidentialityConstraintHandler.java │ │ │ │ ├── ServletFormAuthenticationMechanism.java │ │ │ │ ├── ServletSecurityConstraintHandler.java │ │ │ │ ├── ServletSecurityRoleHandler.java │ │ │ │ ├── ServletSingleSignOnAuthenticationMechainism.java │ │ │ │ └── ServletSingleSignOnAuthenticationMechanism.java │ │ │ ├── osgi │ │ │ └── Activator.java │ │ │ ├── predicate │ │ │ ├── DirectoryPredicate.java │ │ │ ├── DispatcherTypePredicate.java │ │ │ └── FilePredicate.java │ │ │ ├── spec │ │ │ ├── AsyncContextImpl.java │ │ │ ├── ContentTypeInfo.java │ │ │ ├── FilterConfigImpl.java │ │ │ ├── FilterRegistrationImpl.java │ │ │ ├── HttpServletRequestImpl.java │ │ │ ├── HttpServletResponseImpl.java │ │ │ ├── HttpSessionImpl.java │ │ │ ├── MappingImpl.java │ │ │ ├── PartImpl.java │ │ │ ├── PushBuilderImpl.java │ │ │ ├── RequestDispatcherImpl.java │ │ │ ├── SecurityActions.java │ │ │ ├── ServletConfigImpl.java │ │ │ ├── ServletConnectionImpl.java │ │ │ ├── ServletContextImpl.java │ │ │ ├── ServletCookieAdaptor.java │ │ │ ├── ServletInputStreamImpl.java │ │ │ ├── ServletOutputStreamImpl.java │ │ │ ├── ServletPrintWriter.java │ │ │ ├── ServletPrintWriterDelegate.java │ │ │ ├── ServletRegistrationImpl.java │ │ │ └── SessionCookieConfigImpl.java │ │ │ └── util │ │ │ ├── ConstructorInstanceFactory.java │ │ │ ├── DefaultClassIntrospector.java │ │ │ ├── EmptyEnumeration.java │ │ │ ├── ImmediateInstanceFactory.java │ │ │ ├── ImmediateInstanceHandle.java │ │ │ ├── InMemorySessionPersistence.java │ │ │ ├── IteratorEnumeration.java │ │ │ └── SavedRequest.java │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── io.undertow.attribute.ExchangeAttributeBuilder │ │ ├── io.undertow.predicate.PredicateBuilder │ │ └── io.undertow.server.handlers.builder.HandlerBuilder │ └── test │ ├── java │ └── io │ │ └── undertow │ │ └── servlet │ │ └── test │ │ ├── HandlerListingTestCase.java │ │ ├── SimpleServletTestCase.java │ │ ├── async │ │ ├── AnotherAsyncServlet.java │ │ ├── AsyncDispatchServlet.java │ │ ├── AsyncDoubleCompleteServlet.java │ │ ├── AsyncErrorServlet.java │ │ ├── AsyncServlet.java │ │ ├── SimpleAsyncTestCase.java │ │ └── TestAsyncRespWrapper.java │ │ ├── charset │ │ ├── CharacterEncodingTestCase.java │ │ ├── CharsetServlet.java │ │ ├── DefaultCharacterEncodingServlet.java │ │ ├── DefaultCharacterEncodingTestCase.java │ │ ├── DefaultCharsetFormParserServlet.java │ │ ├── DefaultCharsetServlet.java │ │ ├── DefaultCharsetTestCase.java │ │ ├── EchoServlet.java │ │ ├── ParameterCharacterEncodingTestCase.java │ │ └── UnmappableCharacterTestCase.java │ │ ├── compat │ │ └── rewrite │ │ │ └── RewriteTestCase.java │ │ ├── crosscontext │ │ └── CrossContextClassLoaderTestCase.java │ │ ├── defaultservlet │ │ ├── DefaultServletCachedResourceTestCase.java │ │ ├── DefaultServletCachingTestCase.java │ │ ├── DefaultServletTestCase.java │ │ ├── GetDateFilter.java │ │ ├── HelloFilter.java │ │ ├── NoOpFilter.java │ │ ├── SecurityRedirectTestCase.java │ │ ├── ServletAndResourceWelcomeFileTestCase.java │ │ ├── WelcomeFileSecurityTestCase.java │ │ ├── WelcomeFileTestCase.java │ │ ├── disallowed.sh │ │ ├── filterpath │ │ │ └── filtered.txt │ │ ├── foo │ │ │ └── .gitkeep │ │ ├── index.html │ │ ├── path │ │ │ └── .gitkeep │ │ └── range.txt │ │ ├── dispatcher │ │ ├── DispatcherForwardTestCase.java │ │ ├── DispatcherIncludeTestCase.java │ │ ├── ForwardServlet.java │ │ ├── IncludeServlet.java │ │ └── snippet.html │ │ ├── errorpage │ │ ├── ChildException.java │ │ ├── ErrorPageTestCase.java │ │ ├── ErrorServlet.java │ │ ├── ParentException.java │ │ ├── PathServlet.java │ │ ├── SecureServlet.java │ │ └── SecurityErrorPageTestCase.java │ │ ├── handlers │ │ ├── IsSecureFilter.java │ │ └── MarkSecureHandlerTestCase.java │ │ ├── lifecycle │ │ ├── EagerServletLifecycleTestCase.java │ │ ├── FirstServlet.java │ │ ├── InitializeInOrderTestCase.java │ │ ├── LifeCycleServlet.java │ │ ├── LifecycleFilter.java │ │ ├── SecondServlet.java │ │ ├── ServletLifecycleTestCase.java │ │ └── ThirdServlet.java │ │ ├── listener │ │ ├── ordering │ │ │ ├── FirstListener.java │ │ │ ├── SecondListener.java │ │ │ └── ServletSessionListenerOrderingTestCase.java │ │ ├── request │ │ │ └── async │ │ │ │ ├── AnotherAsyncServlet.java │ │ │ │ ├── AsyncListenerExceptionTest.java │ │ │ │ ├── AsyncServlet.java │ │ │ │ ├── CompleteAsyncServlet.java │ │ │ │ ├── RequestListenerAsyncRequestTestCase.java │ │ │ │ ├── onComplete │ │ │ │ ├── AsyncListenerOnCompleteTest.java │ │ │ │ └── OnCompleteServlet.java │ │ │ │ ├── onError │ │ │ │ ├── AsyncEventListener.java │ │ │ │ ├── AsyncListenerOnErrorTest.java │ │ │ │ ├── AsyncServlet1.java │ │ │ │ ├── AsyncServlet2.java │ │ │ │ ├── AsyncServlet3.java │ │ │ │ ├── AsyncTask.java │ │ │ │ ├── FaultyServlet.java │ │ │ │ └── SimpleAsyncListener.java │ │ │ │ └── onTimeout │ │ │ │ ├── AsyncServlet.java │ │ │ │ ├── NestedListenerInvocationTestCase.java │ │ │ │ ├── SimpleAsyncListener.java │ │ │ │ └── SimpleRequestListener.java │ │ ├── servletcontext │ │ │ ├── ServletContextListenerTestCase.java │ │ │ ├── ServletContextTestListener.java │ │ │ └── TestSci.java │ │ └── session │ │ │ ├── ServletSessionInvalidateWithListenerTestCase.java │ │ │ ├── SessionServlet.java │ │ │ └── SimpleSessionListener.java │ │ ├── metrics │ │ ├── MetricTestServlet.java │ │ ├── ServletMetricsHandlerTestCase.java │ │ └── TestMetricsCollector.java │ │ ├── mock │ │ └── MockRequestTestCase.java │ │ ├── multipart │ │ ├── AddMultipartServetListener.java │ │ ├── MultiPartServlet.java │ │ ├── MultiPartTestCase.java │ │ ├── forward │ │ │ ├── ForwardingServlet.java │ │ │ ├── MultiPartCapableServlet.java │ │ │ └── MultiPartForwardTestCase.java │ │ └── uploadfile.txt │ │ ├── path │ │ ├── FilterPathMappingTestCase.java │ │ ├── GetMappingServlet.java │ │ ├── MappingTestCase.java │ │ ├── PathFilter.java │ │ ├── PathMappingServlet.java │ │ ├── RealPathServlet.java │ │ ├── RealPathTestCase.java │ │ ├── ServletPathMappingTestCase.java │ │ └── file.txt │ │ ├── proprietry │ │ ├── BypassServletTestCase.java │ │ └── TransferTestCase.java │ │ ├── push │ │ ├── Http2ServerPushTestCase.java │ │ └── ServerPushServlet.java │ │ ├── request │ │ ├── ExecutorPerServletTestCase.java │ │ ├── RaceyAddServlet.java │ │ ├── RedirectServlet.java │ │ ├── RedirectTestCase.java │ │ ├── RequestPathServlet.java │ │ └── RequestPathTestCase.java │ │ ├── response │ │ ├── contenttype │ │ │ ├── ContentTypeCharsetTestCase.java │ │ │ ├── ContentTypeFilesTestCase.java │ │ │ ├── ContentTypeServlet.java │ │ │ └── webstart.jnlp │ │ └── writer │ │ │ ├── ExceptionWriterServlet.java │ │ │ ├── LargeResponseWriterServlet.java │ │ │ ├── ResponseWriterServlet.java │ │ │ └── ResponseWriterTestCase.java │ │ ├── security │ │ ├── SendAuthTypeServlet.java │ │ ├── SendSchemeServlet.java │ │ ├── SendUsernameServlet.java │ │ ├── basic │ │ │ ├── ServletBasicAuthTestCase.java │ │ │ └── ServletClientCertAuthTestCase.java │ │ ├── constraint │ │ │ ├── AuthenticationMessageServlet.java │ │ │ ├── EmptyRoleSemanticTestCase.java │ │ │ ├── SecurityConstraintUrlMappingTestCase.java │ │ │ └── ServletIdentityManager.java │ │ ├── custom │ │ │ ├── CustomAuthenticationMechanism.java │ │ │ └── ServletCustomAuthTestCase.java │ │ ├── digest │ │ │ └── DigestAuthTestCase.java │ │ ├── form │ │ │ ├── EchoServlet.java │ │ │ ├── FormLoginServlet.java │ │ │ ├── RequestParamEchoServlet.java │ │ │ ├── SaveOriginalPostRequestTestCase.java │ │ │ ├── ServletFormAuthTestCase.java │ │ │ ├── ServletFormAuthURLRewriteTestCase.java │ │ │ └── error.html │ │ ├── login │ │ │ ├── LoginFilter.java │ │ │ └── ServletLoginTestCase.java │ │ └── ssl │ │ │ ├── ConfidentialityConstraintUrlMappingTestCase.java │ │ │ ├── SSLAttributesServlet.java │ │ │ └── SSLMetaDataTestCase.java │ │ ├── servletcontext │ │ ├── 1#2.txt │ │ ├── GetResourceTestCase.java │ │ ├── ReadFileServlet.java │ │ └── file.txt │ │ ├── session │ │ ├── ChangeSessionIdListener.java │ │ ├── ChangeSessionIdServlet.java │ │ ├── ChangeSessionIdTestCase.java │ │ ├── CrossContextServletSessionTestCase.java │ │ ├── LastAccessTimeSessionServlet.java │ │ ├── RequestedSessionIdServlet.java │ │ ├── ServletSessionCrawlerTestCase.java │ │ ├── ServletSessionPersistenceTestCase.java │ │ ├── ServletSessionTestCase.java │ │ ├── ServletURLRewritingSessionTestCase.java │ │ ├── SessionCookieConfigListener.java │ │ ├── SessionIdHandlingTestCase.java │ │ ├── SessionServlet.java │ │ └── invalidate │ │ │ ├── ServletSessionInvalidateTestCase.java │ │ │ └── SessionServlet.java │ │ ├── spec │ │ ├── FilterMappingTestCase.java │ │ ├── GetCookiesTestCase.java │ │ ├── ParameterEchoTestCase.java │ │ ├── UnavailableServlet.java │ │ ├── UnavailableServletTestCase.java │ │ └── ValidCookieEchoServlet.java │ │ ├── streams │ │ ├── AbstractServletInputStreamTestCase.java │ │ ├── AsyncInputStreamServlet.java │ │ ├── AsyncOutputStreamServlet.java │ │ ├── BlockingInputStreamServlet.java │ │ ├── BlockingOutputStreamServlet.java │ │ ├── ConnectionTerminationServlet.java │ │ ├── ContentLengthCloseFlushServlet.java │ │ ├── EarlyCloseClientServlet.java │ │ ├── EarlyCloseServlet.java │ │ ├── ForceDrainServlet.java │ │ ├── Http2InputStreamTestCase.java │ │ ├── ResetBufferServlet.java │ │ ├── ServletInputStreamConnectionTerminationTestCase.java │ │ ├── ServletInputStreamDrainTestCase.java │ │ ├── ServletInputStreamEarlyCloseClientSideTestCase.java │ │ ├── ServletInputStreamEarlyCloseTestCase.java │ │ ├── ServletInputStreamRequestBufferingTestCase.java │ │ ├── ServletInputStreamSSLTestCase.java │ │ ├── ServletInputStreamTestCase.java │ │ ├── ServletOutputStreamSSLTestCase.java │ │ └── ServletOutputStreamTestCase.java │ │ ├── upgrade │ │ ├── AsyncUpgradeServlet.java │ │ ├── SimpleUpgradeTestCase.java │ │ ├── SslUpgradeTestCase.java │ │ └── UpgradeServlet.java │ │ ├── util │ │ ├── DeploymentUtils.java │ │ ├── EmptyServlet.java │ │ ├── MessageFilter.java │ │ ├── MessageServlet.java │ │ ├── ParameterEchoServlet.java │ │ ├── PathTestServlet.java │ │ ├── SetHeaderFilter.java │ │ ├── TXServlet.java │ │ ├── TestClassIntrospector.java │ │ ├── TestConfidentialPortManager.java │ │ ├── TestListener.java │ │ ├── TestResourceLoader.java │ │ └── Tracker.java │ │ └── wrapper │ │ ├── AbstractResponseWrapperTestCase.java │ │ ├── NonStandardRequestWrapper.java │ │ ├── NonStandardRequestWrappingFilter.java │ │ ├── NonStandardResponseWrapper.java │ │ ├── NonStandardResponseWrapperTestCase.java │ │ ├── StandardRequestWrapper.java │ │ ├── StandardRequestWrappingFilter.java │ │ ├── StandardResponseWrapper.java │ │ ├── StandardResponseWrapperTestCase.java │ │ └── WrapperServlet.java │ └── resources │ └── logging.properties ├── spotbugs-exclude.xml ├── vertx ├── pom.xml └── src │ └── main │ ├── java │ └── io │ │ └── undertow │ │ └── vertx │ │ ├── PushedHttpServerRequest.java │ │ ├── VertxBufferImpl.java │ │ ├── VertxHttpExchange.java │ │ └── VertxUndertowEngine.java │ └── resources │ └── META-INF │ └── services │ └── io.undertow.httpcore.UndertowEngine ├── websocket ├── core │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── io │ │ │ └── undertow │ │ │ └── websockets │ │ │ ├── BinaryOutputStream.java │ │ │ ├── ConfiguredClientEndpoint.java │ │ │ ├── ConfiguredServerEndpoint.java │ │ │ ├── DefaultContainerConfigurator.java │ │ │ ├── DefaultPongMessage.java │ │ │ ├── DefaultWebSocketClientSslProvider.java │ │ │ ├── Encoding.java │ │ │ ├── EncodingFactory.java │ │ │ ├── EndpointSessionHandler.java │ │ │ ├── ExtensionImpl.java │ │ │ ├── Extensions.java │ │ │ ├── FrameHandler.java │ │ │ ├── JsrWebSocketLogger.java │ │ │ ├── JsrWebSocketMessages.java │ │ │ ├── OrderedExecutor.java │ │ │ ├── SendHandlerAdapter.java │ │ │ ├── SendResultFuture.java │ │ │ ├── ServerEndpointConfigImpl.java │ │ │ ├── ServerWebSocketContainer.java │ │ │ ├── SessionContainer.java │ │ │ ├── UndertowContainerProvider.java │ │ │ ├── UndertowSession.java │ │ │ ├── WebSocketClientCompressionHandler.java │ │ │ ├── WebSocketClientNegotiation.java │ │ │ ├── WebSocketDeploymentInfo.java │ │ │ ├── WebSocketReconnectHandler.java │ │ │ ├── WebSocketSessionRemoteEndpoint.java │ │ │ ├── WebSocketWriter.java │ │ │ ├── WebsocketClientSslProvider.java │ │ │ ├── WebsocketConnectionBuilder.java │ │ │ ├── annotated │ │ │ ├── AnnotatedEndpoint.java │ │ │ ├── AnnotatedEndpointFactory.java │ │ │ ├── BoundMethod.java │ │ │ ├── BoundParameter.java │ │ │ ├── DecoderUtils.java │ │ │ └── EmptyEndpointConfig.java │ │ │ ├── handshake │ │ │ ├── Base64.java │ │ │ ├── ExchangeHandshakeRequest.java │ │ │ ├── ExchangeHandshakeResponse.java │ │ │ ├── Handshake.java │ │ │ ├── HandshakeUtil.java │ │ │ └── WebSocketHttpExchange.java │ │ │ └── util │ │ │ ├── ClassUtils.java │ │ │ ├── ConstructorObjectFactory.java │ │ │ ├── ContextSetupHandler.java │ │ │ ├── ImmediateObjectHandle.java │ │ │ ├── ObjectFactory.java │ │ │ ├── ObjectHandle.java │ │ │ ├── ObjectIntrospecter.java │ │ │ ├── PathTemplate.java │ │ │ ├── PathTemplateMatch.java │ │ │ ├── SecureRandomSessionIdGenerator.java │ │ │ └── WebsocketPathMatcher.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ ├── io.undertow.websockets.WebsocketClientSslProvider │ │ ├── jakarta.websocket.ContainerProvider │ │ └── jakarta.websocket.server.ServerEndpointConfig$Configurator ├── pom.xml ├── servlet │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── io │ │ │ │ └── undertow │ │ │ │ └── websockets │ │ │ │ └── servlet │ │ │ │ ├── Bootstrap.java │ │ │ │ ├── JsrWebSocketFilter.java │ │ │ │ ├── SecurityActions.java │ │ │ │ ├── ServletServerWebSocketContainer.java │ │ │ │ └── ServletWebSocketHttpExchange.java │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── io.undertow.servlet.ServletExtension │ │ └── test │ │ ├── java │ │ └── io │ │ │ └── undertow │ │ │ └── websockets │ │ │ ├── JsrWebSocketServerTest.java │ │ │ ├── TestClassIntrospector.java │ │ │ ├── autobahn │ │ │ ├── AnnotatedAutobahnServer.java │ │ │ ├── AutobahnAnnotatedEndpoint.java │ │ │ ├── ProgramaticAutobahnEndpoint.java │ │ │ └── ProgramaticAutobahnServer.java │ │ │ ├── extension │ │ │ └── JsrWebsocketExtensionTestCase.java │ │ │ ├── jsr │ │ │ └── test │ │ │ │ ├── AddEndpointServlet.java │ │ │ │ ├── BinaryEndpointServlet.java │ │ │ │ ├── BinaryEndpointTest.java │ │ │ │ ├── BinaryPartialEndpoint.java │ │ │ │ ├── ClassUtilsTest.java │ │ │ │ ├── FrameChecker.java │ │ │ │ ├── ProgramaticEndpoint.java │ │ │ │ ├── ProgramaticErrorEndpoint.java │ │ │ │ ├── ProgramaticLazyEndpointTest.java │ │ │ │ ├── TestMessagesReceivedInOrder.java │ │ │ │ ├── TestSslProvider.java │ │ │ │ ├── WebSocketTestClient.java │ │ │ │ ├── annotated │ │ │ │ ├── AnnotatedAddedProgrammaticallyEndpoint.java │ │ │ │ ├── AnnotatedClientEndpoint.java │ │ │ │ ├── AnnotatedClientEndpointWithConfigurator.java │ │ │ │ ├── AnnotatedEndpointTest.java │ │ │ │ ├── AnnotatedGenericClientEndpoint.java │ │ │ │ ├── ClientConfigurator.java │ │ │ │ ├── EncodableObject.java │ │ │ │ ├── EncodableObjectSubClass.java │ │ │ │ ├── EncodingEndpoint.java │ │ │ │ ├── EncodingGenericsEndpoint.java │ │ │ │ ├── ErrorEndpoint.java │ │ │ │ ├── GenericSuperclassDecoder.java │ │ │ │ ├── GenericWebSocketClientEndpoint.java │ │ │ │ ├── IncrementEndpoint.java │ │ │ │ ├── MessageEndpoint.java │ │ │ │ ├── MiddleClassDecoder.java │ │ │ │ ├── RequestUriEndpoint.java │ │ │ │ ├── RootContextEndpoint.java │ │ │ │ ├── SubclassDecoder.java │ │ │ │ ├── ThreadSafetyEndpoint.java │ │ │ │ └── TimeoutEndpoint.java │ │ │ │ └── dynamicupgrade │ │ │ │ ├── DoUpgradeServlet.java │ │ │ │ ├── DynamicEndpointTest.java │ │ │ │ ├── EchoEndpoint.java │ │ │ │ └── EchoProgramaticEndpoint.java │ │ │ ├── reconnect │ │ │ ├── AnnotatedClientReconnectEndpoint.java │ │ │ ├── ClientEndpointReconnectTestCase.java │ │ │ └── DisconnectServerEndpoint.java │ │ │ ├── security │ │ │ └── WebsocketBasicAuthTestCase.java │ │ │ ├── stress │ │ │ ├── StressEndpoint.java │ │ │ └── WebsocketStressTestCase.java │ │ │ └── suspendresume │ │ │ ├── SuspendResumeEndpoint.java │ │ │ └── SuspendResumeTestCase.java │ │ └── resources │ │ └── META-INF │ │ └── services │ │ └── io.undertow.websockets.WebsocketClientSslProvider └── vertx │ ├── pom.xml │ └── src │ └── main │ └── java │ └── io │ └── undertow │ └── websockets │ └── vertx │ ├── SecurityActions.java │ ├── VertxServerWebSocketContainer.java │ ├── VertxWebSocketHandler.java │ └── VertxWebSocketHttpExchange.java └── zanata.xml /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "maven" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.github/project.yml: -------------------------------------------------------------------------------- 1 | release: 2 | current-version: "5.3.5" 3 | next-version: "999-SNAPSHOT" 4 | 5 | -------------------------------------------------------------------------------- /.github/quarkus-github-bot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # The format of this file is documented here: 3 | # https://github.com/quarkusio/quarkus-bot#triage-issues 4 | features: [ANALYZE_WORKFLOW_RUN_RESULTS] 5 | workflowRunAnalysis: 6 | workflows: ["Build"] 7 | -------------------------------------------------------------------------------- /.github/workflows/pre-release.yml: -------------------------------------------------------------------------------- 1 | name: Quarkus Pre Release 2 | 3 | on: 4 | pull_request: 5 | paths: 6 | - '.github/project.yml' 7 | 8 | concurrency: 9 | group: ${{ github.workflow }}-${{ github.ref }} 10 | cancel-in-progress: true 11 | 12 | jobs: 13 | pre-release: 14 | name: Pre-Release 15 | uses: quarkusio/.github/.github/workflows/pre-release.yml@main 16 | secrets: inherit 17 | -------------------------------------------------------------------------------- /.github/workflows/release-perform.yml: -------------------------------------------------------------------------------- 1 | name: Quarkus Perform Release 2 | run-name: Perform ${{github.event.inputs.tag || github.ref_name}} Release 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | workflow_dispatch: 8 | inputs: 9 | tag: 10 | description: 'Tag to release' 11 | required: true 12 | 13 | permissions: 14 | attestations: write 15 | id-token: write 16 | contents: read 17 | 18 | concurrency: 19 | group: ${{ github.workflow }}-${{ github.ref }} 20 | cancel-in-progress: true 21 | 22 | jobs: 23 | perform-release: 24 | name: Perform Release 25 | uses: quarkusio/.github/.github/workflows/perform-release.yml@main 26 | secrets: inherit 27 | with: 28 | version: ${{github.event.inputs.tag || github.ref_name}} 29 | -------------------------------------------------------------------------------- /.github/workflows/release-prepare.yml: -------------------------------------------------------------------------------- 1 | name: Quarkus Prepare Release 2 | 3 | on: 4 | workflow_dispatch: 5 | pull_request: 6 | types: [ closed ] 7 | paths: 8 | - '.github/project.yml' 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | prepare-release: 16 | name: Prepare Release 17 | if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true}} 18 | uses: quarkusio/.github/.github/workflows/prepare-release.yml@main 19 | secrets: inherit 20 | with: 21 | skip_tests: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | *.iml 3 | .idea 4 | .settings 5 | .project 6 | .classpath 7 | *~ 8 | local-test 9 | out 10 | lib 11 | bin 12 | dependency-reduced-pom.xml 13 | hotspot.log 14 | .directory 15 | 16 | *.releaseBackup 17 | release.properties 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Quarkus HTTP 2 | ============ 3 | 4 | [![Version](https://img.shields.io/maven-central/v/io.quarkus.http/quarkus-http-core?logo=apache&style=for-the-badge)](https://search.maven.org/artifact/io.quarkus.http/quarkus-http-core) 5 | [![GitHub Actions Status]()](https://github.com/quarkusio/quarkus-http/actions?query=workflow%3A%22Build%22) 6 | 7 | A Vert.x based Servlet implementation. 8 | 9 | ## Release 10 | 11 | To release a new version, follow these steps: 12 | 13 | https://github.com/smallrye/smallrye/wiki/Release-Process#releasing 14 | 15 | The staging repository is automatically closed. The sync with Maven Central should take ~30 minutes. 16 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/attribute/ConstantExchangeAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.attribute; 20 | 21 | import io.undertow.server.HttpServerExchange; 22 | 23 | /** 24 | * Exchange attribute that represents a fixed value 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | public class ConstantExchangeAttribute implements ExchangeAttribute { 29 | 30 | private final String value; 31 | 32 | public ConstantExchangeAttribute(final String value) { 33 | this.value = value; 34 | } 35 | 36 | @Override 37 | public String readAttribute(final HttpServerExchange exchange) { 38 | return value; 39 | } 40 | 41 | @Override 42 | public void writeAttribute(final HttpServerExchange exchange, final String newValue) throws ReadOnlyAttributeException { 43 | throw new ReadOnlyAttributeException("constant", newValue); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/attribute/ExchangeAttributeWrapper.java: -------------------------------------------------------------------------------- 1 | package io.undertow.attribute; 2 | 3 | /** 4 | * Interface that can be used to wrap an exchange attribute. 5 | * 6 | * @author Stuart Douglas 7 | */ 8 | public interface ExchangeAttributeWrapper { 9 | 10 | ExchangeAttribute wrap(ExchangeAttribute attribute); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/attribute/ReadOnlyAttributeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.attribute; 20 | 21 | import io.undertow.UndertowMessages; 22 | 23 | /** 24 | * An exception that is thrown when an attribute is read only 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | public class ReadOnlyAttributeException extends Exception { 29 | 30 | public ReadOnlyAttributeException() { 31 | } 32 | 33 | public ReadOnlyAttributeException(final String attributeName, final String newValue) { 34 | super(UndertowMessages.MESSAGES.couldNotSetAttribute(attributeName, newValue)); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/attribute/SubstituteEmptyWrapper.java: -------------------------------------------------------------------------------- 1 | package io.undertow.attribute; 2 | 3 | import io.undertow.server.HttpServerExchange; 4 | 5 | /** 6 | * @author Stuart Douglas 7 | */ 8 | public class SubstituteEmptyWrapper implements ExchangeAttributeWrapper { 9 | 10 | private final String substitute; 11 | 12 | public SubstituteEmptyWrapper(String substitute) { 13 | this.substitute = substitute; 14 | } 15 | 16 | @Override 17 | public ExchangeAttribute wrap(final ExchangeAttribute attribute) { 18 | return new SubstituteEmptyAttribute(attribute, substitute); 19 | } 20 | 21 | public static class SubstituteEmptyAttribute implements ExchangeAttribute { 22 | private final ExchangeAttribute attribute; 23 | private final String substitute; 24 | 25 | public SubstituteEmptyAttribute(ExchangeAttribute attribute, String substitute) { 26 | this.attribute = attribute; 27 | this.substitute = substitute; 28 | } 29 | 30 | @Override 31 | public String readAttribute(HttpServerExchange exchange) { 32 | String val = attribute.readAttribute(exchange); 33 | if(val == null || val.isEmpty()) { 34 | return substitute; 35 | } 36 | return val; 37 | } 38 | 39 | @Override 40 | public void writeAttribute(HttpServerExchange exchange, String newValue) throws ReadOnlyAttributeException { 41 | attribute.writeAttribute(exchange, newValue); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/predicate/AndPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.predicate; 20 | 21 | import io.undertow.server.HttpServerExchange; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | class AndPredicate implements Predicate { 27 | 28 | private final Predicate[] predicates; 29 | 30 | AndPredicate(final Predicate ... predicates) { 31 | this.predicates = predicates; 32 | } 33 | 34 | @Override 35 | public boolean resolve(final HttpServerExchange value) { 36 | for(final Predicate predicate : predicates) { 37 | if(!predicate.resolve(value)) { 38 | return false; 39 | } 40 | } 41 | return true; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/predicate/FalsePredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.predicate; 20 | 21 | import io.undertow.server.HttpServerExchange; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public class FalsePredicate implements Predicate { 27 | 28 | public static final FalsePredicate INSTANCE = new FalsePredicate(); 29 | 30 | public static FalsePredicate instance() { 31 | return INSTANCE; 32 | } 33 | 34 | @Override 35 | public boolean resolve(final HttpServerExchange value) { 36 | return false; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/predicate/NotPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.predicate; 20 | 21 | import io.undertow.server.HttpServerExchange; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public class NotPredicate implements Predicate { 27 | 28 | private final Predicate predicate; 29 | 30 | NotPredicate(final Predicate predicate) { 31 | this.predicate = predicate; 32 | } 33 | 34 | @Override 35 | public boolean resolve(final HttpServerExchange value) { 36 | return !predicate.resolve(value); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/predicate/OrPredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.predicate; 20 | 21 | import io.undertow.server.HttpServerExchange; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | class OrPredicate implements Predicate { 27 | 28 | private final Predicate[] predicates; 29 | 30 | OrPredicate(final Predicate... predicates) { 31 | this.predicates = predicates; 32 | } 33 | 34 | @Override 35 | public boolean resolve(final HttpServerExchange value) { 36 | for (final Predicate predicate : predicates) { 37 | if (predicate.resolve(value)) { 38 | return true; 39 | } 40 | } 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/predicate/TruePredicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.predicate; 20 | 21 | import io.undertow.server.HttpServerExchange; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public class TruePredicate implements Predicate { 27 | 28 | public static final TruePredicate INSTANCE = new TruePredicate(); 29 | 30 | public static TruePredicate instance() { 31 | return INSTANCE; 32 | } 33 | 34 | @Override 35 | public boolean resolve(final HttpServerExchange value) { 36 | return true; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/security/api/AuthenticationMechanismContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2015 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.security.api; 19 | 20 | 21 | /** 22 | * An Undertow {@link SecurityContext} that uses Undertow {@link AuthenticationMechanism} 23 | * instances for authentication. 24 | * 25 | * @author Darran Lofthouse 26 | */ 27 | public interface AuthenticationMechanismContext extends SecurityContext { 28 | 29 | /** 30 | * Adds an authentication mechanism to this context. When {@link #authenticate()} is 31 | * called mechanisms will be iterated over in the order they are added, and given a chance to authenticate the user. 32 | * 33 | * @param mechanism The mechanism to add 34 | */ 35 | @Override 36 | void addAuthenticationMechanism(AuthenticationMechanism mechanism); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/security/idm/Credential.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.security.idm; 19 | 20 | /** 21 | * Representation of a users Credential. 22 | * 23 | * @author Darran Lofthouse 24 | */ 25 | public interface Credential { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/security/idm/ExternalCredential.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.security.idm; 20 | 21 | import java.io.Serializable; 22 | 23 | /** 24 | * Representation of an external credential. This basically represents a trusted 25 | * 3rd party, e.g. a front end server that has performed authentication. 26 | * 27 | * @author Stuart Douglas 28 | */ 29 | public class ExternalCredential implements Serializable, Credential { 30 | 31 | public static final ExternalCredential INSTANCE = new ExternalCredential(); 32 | 33 | private ExternalCredential() { 34 | 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/security/idm/GSSContextCredential.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.security.idm; 19 | 20 | import org.ietf.jgss.GSSContext; 21 | 22 | /** 23 | * A {@link Credential} to wrap an established GSSContext. 24 | * 25 | * @author Darran Lofthouse 26 | */ 27 | public class GSSContextCredential implements Credential { 28 | 29 | private final GSSContext gssContext; 30 | 31 | public GSSContextCredential(final GSSContext gssContext) { 32 | this.gssContext = gssContext; 33 | } 34 | 35 | public GSSContext getGssContext() { 36 | return gssContext; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/security/idm/PasswordCredential.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.security.idm; 19 | 20 | /** 21 | * A Credential representing the password of an Account. 22 | * 23 | * @author Darran Lofthouse 24 | */ 25 | public final class PasswordCredential implements Credential { 26 | 27 | private final char[] password; 28 | 29 | public PasswordCredential(final char[] password) { 30 | this.password = password; 31 | } 32 | 33 | public char[] getPassword() { 34 | return password; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/security/idm/X509CertificateCredential.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.security.idm; 19 | 20 | import java.security.cert.X509Certificate; 21 | 22 | /** 23 | * A {@link Credential} implementation which wraps an X.509 certificate. 24 | * 25 | * @author Darran Lofthouse 26 | */ 27 | public final class X509CertificateCredential implements Credential { 28 | 29 | private final X509Certificate certificate; 30 | 31 | public X509CertificateCredential(final X509Certificate certificate) { 32 | this.certificate = certificate; 33 | } 34 | 35 | public X509Certificate getCertificate() { 36 | return certificate; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/security/impl/SingleSignOnManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.security.impl; 20 | 21 | import io.undertow.security.idm.Account; 22 | 23 | /** 24 | * @author Paul Ferraro 25 | */ 26 | public interface SingleSignOnManager { 27 | SingleSignOn createSingleSignOn(Account account, String mechanism); 28 | 29 | SingleSignOn findSingleSignOn(String ssoId); 30 | 31 | void removeSingleSignOn(SingleSignOn sso); 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/DefaultExchangeHandler.java: -------------------------------------------------------------------------------- 1 | package io.undertow.server; 2 | 3 | import io.undertow.httpcore.ExchangeHandler; 4 | import io.undertow.httpcore.HttpExchange; 5 | 6 | public class DefaultExchangeHandler implements ExchangeHandler { 7 | 8 | private final HttpHandler handler; 9 | 10 | public DefaultExchangeHandler(HttpHandler handler) { 11 | this.handler = handler; 12 | } 13 | 14 | @Override 15 | public void handle(HttpExchange delegate) { 16 | HttpServerExchange exchange = new HttpServerExchange(delegate, -1); 17 | Connectors.setExchangeRequestPath(exchange, delegate.getRequestURI(), "UTF-8", true, false, new StringBuilder()); 18 | Connectors.executeRootHandler(handler, exchange); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/ExchangeCompletionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server; 20 | 21 | /** 22 | * Listener interface for events that are run at the completion of a request/response 23 | * cycle (i.e. when the request has been completely read, and the response has been fully written). 24 | *

25 | * At this point it is to late to modify the exchange further. 26 | *

27 | * Completion listeners are invoked in reverse order, 28 | * 29 | * @author Stuart Douglas 30 | */ 31 | public interface ExchangeCompletionListener { 32 | 33 | void exchangeEvent(final HttpServerExchange exchange); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/HandlerWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server; 20 | 21 | /** 22 | * Interface that can be used to wrap the handler chains, adding additional handlers. 23 | * 24 | * @author Stuart Douglas 25 | */ 26 | public interface HandlerWrapper { 27 | 28 | HttpHandler wrap(HttpHandler handler); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/HttpHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server; 20 | 21 | /** 22 | * A handler for an HTTP request. The request handler must eventually either call another handler or end the exchange. 23 | * 24 | * 25 | * @author David M. Lloyd 26 | */ 27 | public interface HttpHandler { 28 | 29 | /** 30 | * Handle the request. 31 | * 32 | * @param exchange the HTTP request/response exchange 33 | * 34 | */ 35 | void handleRequest(HttpServerExchange exchange) throws Exception; 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/ResponseCommitListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server; 20 | 21 | /** 22 | * Callback that is invoked just before the response is commit 23 | * 24 | * @author Stuart Douglas 25 | */ 26 | public interface ResponseCommitListener { 27 | 28 | /** 29 | * Invoked before the first bytes of the response are sent to the client 30 | * @param exchange The server exchange 31 | */ 32 | void beforeCommit(HttpServerExchange exchange); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/SecureCookieCommitListener.java: -------------------------------------------------------------------------------- 1 | package io.undertow.server; 2 | 3 | import java.util.Map; 4 | 5 | import io.undertow.server.handlers.Cookie; 6 | 7 | /** 8 | * Sets the

secure
attribute on all response cookies. 9 | */ 10 | public enum SecureCookieCommitListener implements ResponseCommitListener { 11 | INSTANCE; 12 | 13 | @Override 14 | public void beforeCommit(HttpServerExchange exchange) { 15 | Map cookies = exchange.getResponseCookiesInternal(); 16 | if (cookies != null) { 17 | for (Map.Entry cookie : exchange.getResponseCookies().entrySet()) { 18 | cookie.getValue().setSecure(true); 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/UndertowServerContainer.java: -------------------------------------------------------------------------------- 1 | package io.undertow.server; 2 | 3 | public class UndertowServerContainer { 4 | } 5 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/handlers/HttpContinueReadHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server.handlers; 20 | 21 | import io.undertow.server.HttpHandler; 22 | import io.undertow.server.HttpServerExchange; 23 | 24 | /** 25 | * This class is no longer required 26 | */ 27 | @Deprecated 28 | public class HttpContinueReadHandler implements HttpHandler { 29 | 30 | private final HttpHandler handler; 31 | 32 | public HttpContinueReadHandler(final HttpHandler handler) { 33 | this.handler = handler; 34 | } 35 | 36 | @Override 37 | public void handleRequest(final HttpServerExchange exchange) throws Exception { 38 | // if (HttpContinue.requiresContinueResponse(exchange)) { 39 | // exchange.addRequestWrapper(WRAPPER); 40 | // } 41 | handler.handleRequest(exchange); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/handlers/PredicateContextHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server.handlers; 20 | 21 | import java.util.TreeMap; 22 | 23 | import io.undertow.predicate.Predicate; 24 | import io.undertow.server.HttpHandler; 25 | import io.undertow.server.HttpServerExchange; 26 | 27 | /** 28 | * Handler that sets up the predicate context 29 | * 30 | * @author Stuart Douglas 31 | */ 32 | public class PredicateContextHandler implements HttpHandler { 33 | 34 | private final HttpHandler next; 35 | 36 | public PredicateContextHandler(HttpHandler next) { 37 | this.next = next; 38 | } 39 | 40 | @Override 41 | public void handleRequest(HttpServerExchange exchange) throws Exception { 42 | exchange.putAttachment(Predicate.PREDICATE_CONTEXT, new TreeMap()); 43 | next.handleRequest(exchange); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/handlers/accesslog/AccessLogReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server.handlers.accesslog; 20 | 21 | /** 22 | * Interface that is used by the access log handler to send data to the log file manager. 23 | * 24 | * Implementations of this interface must be thread safe. 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | public interface AccessLogReceiver { 29 | 30 | void logMessage(final String message); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/handlers/accesslog/LogFileHeaderGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server.handlers.accesslog; 20 | 21 | /** 22 | * Interface that generates the header for an access log. This is called 23 | * every time a new log file is started. 24 | * 25 | * @author Stuart Douglas 26 | */ 27 | public interface LogFileHeaderGenerator { 28 | 29 | String generateHeader(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/handlers/resource/DefaultResourceSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server.handlers.resource; 20 | 21 | import java.io.IOException; 22 | 23 | import io.undertow.server.HttpServerExchange; 24 | 25 | /** 26 | * A resource supplier that just delegates directly to a resource manager 27 | * 28 | * @author Stuart Douglas 29 | */ 30 | public class DefaultResourceSupplier implements ResourceSupplier { 31 | private final ResourceManager resourceManager; 32 | 33 | public DefaultResourceSupplier(ResourceManager resourceManager) { 34 | this.resourceManager = resourceManager; 35 | } 36 | 37 | @Override 38 | public Resource getResource(HttpServerExchange exchange, String path) throws IOException { 39 | return resourceManager.getResource(path); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/handlers/resource/FileResource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server.handlers.resource; 20 | 21 | import java.io.File; 22 | 23 | /** 24 | * A file resource 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | public class FileResource extends PathResource { 29 | 30 | public FileResource(final File file, final FileResourceManager manager, String path) { 31 | super(file.toPath(), manager, path); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/handlers/resource/ResourceSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server.handlers.resource; 20 | 21 | import java.io.IOException; 22 | 23 | import io.undertow.server.HttpServerExchange; 24 | 25 | /** 26 | * Interface that allows for more flexibility when resolving a resource than is currently provided 27 | * by {@link ResourceManager}. 28 | * 29 | * @author Stuart Douglas 30 | */ 31 | public interface ResourceSupplier { 32 | 33 | /** 34 | * 35 | * @param exchange The current exchange 36 | * @param path The path to resolve 37 | * @return A resource to serve 38 | * @throws IOException if an error ocured resolving the resource 39 | */ 40 | Resource getResource(HttpServerExchange exchange, String path) throws IOException; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/server/session/SessionIdGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.server.session; 20 | 21 | /** 22 | * 23 | * Strategy for generating session ID's. 24 | * 25 | * The session manager is not required to support pluggable session 26 | * id generation, it is an optional feature. 27 | * 28 | * @author Stuart Douglas 29 | */ 30 | public interface SessionIdGenerator { 31 | 32 | String createSessionId(); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/BadRequestException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2018 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 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 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package io.undertow.util; 17 | 18 | /** 19 | * Exception that is thrown when bad request is detected 20 | * 21 | * @author Stuart Douglas 22 | */ 23 | public class BadRequestException extends Exception { 24 | 25 | public BadRequestException() { 26 | } 27 | 28 | public BadRequestException(String message) { 29 | super(message); 30 | } 31 | 32 | public BadRequestException(Throwable cause) { 33 | super(cause); 34 | } 35 | 36 | public BadRequestException(String message, Throwable cause) { 37 | super(message, cause); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/ByteActivityCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2018 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 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 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package io.undertow.util; 17 | 18 | /** 19 | * Callback that allows the bytes read from or written to a stream to be tracked 20 | * 21 | * @author Stuart Douglas 22 | */ 23 | public interface ByteActivityCallback { 24 | 25 | void activity(long bytes); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/ChainedHandlerWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | import java.util.List; 22 | 23 | import io.undertow.server.HandlerWrapper; 24 | import io.undertow.server.HttpHandler; 25 | 26 | /** 27 | * Handler wrapper that chains several handler wrappers together. 28 | * 29 | * @author Stuart Douglas 30 | */ 31 | public class ChainedHandlerWrapper implements HandlerWrapper { 32 | 33 | private final List handlers; 34 | 35 | public ChainedHandlerWrapper(List handlers) { 36 | this.handlers = handlers; 37 | } 38 | 39 | @Override 40 | public HttpHandler wrap(HttpHandler handler) { 41 | HttpHandler cur = handler; 42 | for(HandlerWrapper h : handlers) { 43 | cur = h.wrap(cur); 44 | } 45 | return cur; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/HeaderToken.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.util; 19 | 20 | /** 21 | * Representation of a token allowed within a header. 22 | * 23 | * @author Darran Lofthouse 24 | */ 25 | public interface HeaderToken { 26 | 27 | /** 28 | * @return The name of the token as seen within the HTTP header. 29 | */ 30 | String getName(); 31 | 32 | /** 33 | * @return true if this header could be a quoted header. 34 | */ 35 | boolean isAllowQuoted(); 36 | 37 | /* 38 | * Additional items could be added and incorporated into the parsing checks: - 39 | * boolean isMandatory(); 40 | * boolean 41 | * isEnumeration(); 42 | * String[] getAllowedValues(); 43 | */ 44 | 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/MalformedMessageException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * Exception that is thrown when multipart parsing cannot parse a request 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | public class MalformedMessageException extends IOException { 29 | 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/ObjectPool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | /** 22 | * A pool of objects. 23 | * 24 | * @author ckozak 25 | * @author Stuart Douglas 26 | */ 27 | public interface ObjectPool { 28 | 29 | PooledObject allocate(); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/ParameterLimitException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2018 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 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 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package io.undertow.util; 17 | 18 | /** 19 | * Exception that is thrown if the max query or path parameter limit is exceeded 20 | * 21 | * @author Stuart Douglas 22 | */ 23 | public class ParameterLimitException extends Exception { 24 | 25 | public ParameterLimitException(String message) { 26 | super(message); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/PooledObject.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | import java.io.Closeable; 22 | 23 | /** 24 | * Represents a generic pooled object 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | public interface PooledObject extends Closeable, AutoCloseable { 29 | 30 | T getObject(); 31 | 32 | void close(); 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/RequestTooBigException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2018 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 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 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package io.undertow.util; 17 | 18 | import java.io.IOException; 19 | 20 | /** 21 | * @author Stuart Douglas 22 | */ 23 | public class RequestTooBigException extends IOException { 24 | 25 | public RequestTooBigException() { 26 | super(); 27 | } 28 | 29 | public RequestTooBigException(String message) { 30 | super(message); 31 | } 32 | 33 | public RequestTooBigException(String message, Throwable cause) { 34 | super(message, cause); 35 | } 36 | 37 | public RequestTooBigException(Throwable cause) { 38 | super(cause); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/io/undertow/util/SameThreadExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | import java.util.concurrent.Executor; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public class SameThreadExecutor implements Executor { 27 | 28 | public static final Executor INSTANCE = new SameThreadExecutor(); 29 | 30 | private SameThreadExecutor() { 31 | } 32 | 33 | @Override 34 | public void execute(final Runnable command) { 35 | command.run(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/resources/META-INF/services/io.undertow.predicate.PredicateBuilder: -------------------------------------------------------------------------------- 1 | io.undertow.predicate.PathMatchPredicate$Builder 2 | io.undertow.predicate.PathPrefixPredicate$Builder 3 | io.undertow.predicate.ContainsPredicate$Builder 4 | io.undertow.predicate.ExistsPredicate$Builder 5 | io.undertow.predicate.RegularExpressionPredicate$Builder 6 | io.undertow.predicate.PathSuffixPredicate$Builder 7 | io.undertow.predicate.EqualsPredicate$Builder 8 | io.undertow.predicate.PathTemplatePredicate$Builder 9 | io.undertow.predicate.MethodPredicate$Builder 10 | io.undertow.predicate.AuthenticationRequiredPredicate$Builder 11 | io.undertow.predicate.MaxContentSizePredicate$Builder 12 | io.undertow.predicate.MinContentSizePredicate$Builder 13 | io.undertow.predicate.SecurePredicate$Builder 14 | io.undertow.predicate.IdempotentPredicate$Builder 15 | -------------------------------------------------------------------------------- /core/src/main/resources/META-INF/services/io.undertow.xnio.client.ClientProvider: -------------------------------------------------------------------------------- 1 | io.undertow.xnio.client.http.HttpClientProvider 2 | io.undertow.xnio.client.ajp.AjpClientProvider 3 | io.undertow.xnio.client.http2.Http2ClientProvider 4 | io.undertow.xnio.client.http2.Http2ClearClientProvider 5 | io.undertow.xnio.client.http2.Http2PriorKnowledgeClientProvider 6 | -------------------------------------------------------------------------------- /core/src/main/resources/io/undertow/version.properties: -------------------------------------------------------------------------------- 1 | undertow.version=${project.version} -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/server/StopTestCase.java: -------------------------------------------------------------------------------- 1 | package io.undertow.server; 2 | 3 | import org.junit.Test; 4 | 5 | import io.undertow.Undertow; 6 | import io.undertow.httpcore.UndertowOptions; 7 | 8 | public class StopTestCase { 9 | 10 | @Test 11 | public void testStopUndertowNotStarted() { 12 | Undertow.builder().build().stop(); 13 | } 14 | 15 | @Test 16 | public void testStopUndertowAfterExceptionDuringStart() { 17 | // Making the NioXnioWorker constructor throw an exception, resulting in the Undertow.worker field not getting set. 18 | Undertow undertow = Undertow.builder().build(); 19 | try { 20 | undertow.start(); 21 | } 22 | catch (RuntimeException e) { 23 | } 24 | undertow.stop(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/server/handlers/file/page.html: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | Page 22 | 23 | 24 | A web page 25 | 26 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/server/handlers/file/subdir/a.txt: -------------------------------------------------------------------------------- 1 | a file 2 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/server/handlers/form/uploadfile.txt: -------------------------------------------------------------------------------- 1 | file contents 2 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/server/handlers/range.txt: -------------------------------------------------------------------------------- 1 | 0123456789 -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/testutils/AjpIgnore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.testutils; 20 | 21 | import java.lang.annotation.Inherited; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | 25 | /** 26 | * @author Stuart Douglas 27 | */ 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Inherited 30 | public @interface AjpIgnore { 31 | boolean apacheOnly() default false; 32 | 33 | String value() default ""; 34 | } 35 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/testutils/HttpOneOnly.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.testutils; 20 | 21 | import java.lang.annotation.Inherited; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | 25 | /** 26 | * Marks a test as only applicable to HTTP 1, so it will be ignored for other transports 27 | * 28 | * @author Stuart Douglas 29 | */ 30 | @Retention(RetentionPolicy.RUNTIME) 31 | @Inherited 32 | public @interface HttpOneOnly { 33 | 34 | String value() default ""; 35 | } 36 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/testutils/HttpsIgnore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.testutils; 20 | 21 | import java.lang.annotation.Inherited; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | 25 | /** 26 | * @author Stuart Douglas 27 | */ 28 | @Retention(RetentionPolicy.RUNTIME) 29 | @Inherited 30 | public @interface HttpsIgnore { 31 | 32 | String value() default ""; 33 | } 34 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/testutils/ProxyIgnore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.testutils; 20 | 21 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 22 | 23 | import java.lang.annotation.Inherited; 24 | import java.lang.annotation.Retention; 25 | 26 | /** 27 | * 28 | * @author Stuart Douglas 29 | */ 30 | @Retention(RUNTIME) 31 | @Inherited 32 | public @interface ProxyIgnore { 33 | 34 | String value() default ""; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/testutils/category/FunctionalTest.java: -------------------------------------------------------------------------------- 1 | package io.undertow.testutils.category; 2 | 3 | /** 4 | * Marker class used by JUnit categories representing unit tests 5 | */ 6 | public interface FunctionalTest { 7 | } 8 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/testutils/category/UnitTest.java: -------------------------------------------------------------------------------- 1 | package io.undertow.testutils.category; 2 | 3 | /** 4 | * Marker class used by JUnit categories representing unit tests 5 | */ 6 | public interface UnitTest { 7 | } 8 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/FlexBase64TestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | 22 | import org.junit.Assert; 23 | import org.junit.Test; 24 | import org.junit.experimental.categories.Category; 25 | 26 | import io.undertow.testutils.category.UnitTest; 27 | 28 | @Category(UnitTest.class) 29 | public class FlexBase64TestCase { 30 | 31 | @Test 32 | public void testReadStopsAtTerminator() throws Exception { 33 | String source = "ZWxsbw==="; 34 | byte[] target = new byte[1024]; 35 | final FlexBase64.Decoder decoder = FlexBase64.createDecoder(); 36 | int read = decoder.decode(source, 0, source.length(), target, 0, target.length); 37 | Assert.assertEquals(4, read); 38 | Assert.assertEquals("ello", new String(target, 0, read)); 39 | Assert.assertEquals(8, decoder.getLastInputPosition()); 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/HeaderTokenParserTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | import java.util.Collections; 22 | 23 | import org.junit.Assert; 24 | import org.junit.Test; 25 | import org.junit.experimental.categories.Category; 26 | 27 | import io.undertow.security.impl.DigestAuthorizationToken; 28 | import io.undertow.testutils.category.UnitTest; 29 | 30 | /** 31 | * @author Stuart Douglas 32 | */ 33 | @Category(UnitTest.class) 34 | public class HeaderTokenParserTestCase { 35 | 36 | @Test 37 | public void testHeaderTokenParser() { 38 | HeaderTokenParser h = new HeaderTokenParser(Collections.singletonMap("username", DigestAuthorizationToken.USERNAME)); 39 | Assert.assertEquals("a\"b", h.parseHeader("username=\"a\\\"b\"").get(DigestAuthorizationToken.USERNAME)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/HeadersUtilsTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | import org.junit.experimental.categories.Category; 24 | 25 | import io.undertow.httpcore.HttpHeaderNames; 26 | import io.undertow.testutils.category.UnitTest; 27 | 28 | /** 29 | * Tests param extraction of a header 30 | * 31 | * @author Tim Terlegård 32 | */ 33 | @Category(UnitTest.class) 34 | public class HeadersUtilsTestCase { 35 | 36 | @Test 37 | public void testTokenExtraction() { 38 | 39 | Assert.assertEquals("--xyz", HttpHeaderNames.extractTokenFromHeader("multipart/form-data; boundary=--xyz; param=abc", "boundary")); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/LocaleUtilsTestCase.java: -------------------------------------------------------------------------------- 1 | package io.undertow.util; 2 | 3 | import java.util.Locale; 4 | 5 | import org.junit.Assert; 6 | import org.junit.Test; 7 | import org.junit.experimental.categories.Category; 8 | 9 | import io.undertow.testutils.category.UnitTest; 10 | 11 | @Category(UnitTest.class) 12 | public class LocaleUtilsTestCase { 13 | 14 | @Test 15 | public void testGetLocaleFromInvalidString() throws Exception { 16 | Assert.assertEquals(LocaleUtils.getLocaleFromString("-"), new Locale("")); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/NodeStatusCodesTestCase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | import org.junit.experimental.categories.Category; 24 | 25 | import io.undertow.httpcore.StatusCodes; 26 | import io.undertow.testutils.category.UnitTest; 27 | 28 | /** 29 | * @author Stuart Douglas 30 | */ 31 | @Category(UnitTest.class) 32 | public class NodeStatusCodesTestCase { 33 | 34 | @Test 35 | public void testCodeLookup() { 36 | Assert.assertEquals("OK", StatusCodes.getReason(StatusCodes.OK)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/TestVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.util; 20 | 21 | import org.junit.Assert; 22 | import org.junit.Test; 23 | import org.junit.experimental.categories.Category; 24 | 25 | import io.undertow.Version; 26 | import io.undertow.testutils.category.UnitTest; 27 | 28 | /** 29 | * @author Tomaz Cerar (c) 2013 Red Hat Inc. 30 | */ 31 | @Category(UnitTest.class) 32 | public class TestVersion { 33 | 34 | @Test 35 | public void testVersionSet() { 36 | Assert.assertNotNull(Version.getVersionString()); 37 | String version = Version.getVersionString(); 38 | System.out.println("version = " + version); 39 | Assert.assertNotSame("Unknown", version); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/mime-multiline.txt: -------------------------------------------------------------------------------- 1 | --unique-boundary-1 2 | Content-type: text/plain; 3 | charset="ascii" 4 | 5 | Here is some text. 6 | --unique-boundary-1 7 | 8 | Here is some more text. 9 | --unique-boundary-1-- 10 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/mime-utf8.txt: -------------------------------------------------------------------------------- 1 | This is a preamble 2 | --unique-boundary-1 3 | Content-type: text/plain 4 | Content-Disposition: attachment; filename=个专为语文教学而设计的电脑软件.txt 5 | 6 | Just some chinese characters I copied from the internet, no idea what it says. 7 | --unique-boundary-1-- 8 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/mime1.txt: -------------------------------------------------------------------------------- 1 | This is a preamble 2 | --unique-boundary-1 3 | Content-type: text/plain 4 | 5 | Here is some text. 6 | --unique-boundary-1 7 | 8 | Here is some more text. 9 | --unique-boundary-1-- 10 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/mime2.txt: -------------------------------------------------------------------------------- 1 | --unique-boundary-1 2 | Content-type: text/plain 3 | 4 | Here is some text. 5 | --unique-boundary-1 6 | 7 | Here is some more text. 8 | --unique-boundary-1-- 9 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/mime3.txt: -------------------------------------------------------------------------------- 1 | --unique-boundary-1 2 | Content-type: text/plain 3 | Content-Transfer-encoding: base64 4 | 5 | VGhpcyBpcyBzb21lIGJhc2U2NCB0ZXh0Lg== 6 | --unique-boundary-1 7 | Content-Transfer-encoding: base64 8 | 9 | VGhpcyBpcyBzb21lIG1vcmUgYmFzZTY0IHRleHQu 10 | --unique-boundary-1-- 11 | -------------------------------------------------------------------------------- /core/src/test/java/io/undertow/util/mime4.txt: -------------------------------------------------------------------------------- 1 | --someboundarytext 2 | Content-type: text/plain 3 | Content-Transfer-encoding: quoted-printable 4 | 5 | time=3Dmoney. 6 | --someboundarytext-- 7 | -------------------------------------------------------------------------------- /core/src/test/resources/ajp-apache-site: -------------------------------------------------------------------------------- 1 | Listen 9080 2 | NameVirtualHost *:9080 3 | 4 | ProxyPass / ajp://localhost:8888/ 5 | ProxyPassReverse / ajp://localhost:8888/ 6 | 7 | Listen 9443 8 | NameVirtualHost *:9443 9 | 10 | SSLEngine on 11 | SSLCertificateFile /etc/apache2/ssl/server.pem 12 | SSLCACertificateFile /etc/apache2/ssl/ca.crt 13 | 14 | SSLVerifyClient optional 15 | SSLVerifyDepth 2 16 | SSLOptions +ExportCertData +StdEnvVars 17 | 18 | ProxyPass / ajp://localhost:8888/ 19 | ProxyPassReverse / ajp://localhost:8888/ 20 | 21 | -------------------------------------------------------------------------------- /core/src/test/resources/byteman-netwok.btm: -------------------------------------------------------------------------------- 1 | 2 | RULE handling NEED_WRAP 3 | CLASS org.xnio.ssl.JsseConnectedSslStreamChannel 4 | METHOD handleHandshake 5 | #AT INVOKE org.xnio.ssl.JsseConnectedSslStreamChannel.handleWrapResult 6 | AFTER INVOKE org.xnio.Pooled.getResource 1 7 | IF TRUE 8 | DO 9 | debug("Read is trying to wrap as a result of NEED_WRAP... wait for the channel to be closed"), 10 | signalWake("handleHandshake at invoke handleWrapResult", true), 11 | waitFor("channel closed"), 12 | debug("Proceeding with handleWrapResult") 13 | ENDRULE 14 | 15 | RULE before close channel 16 | CLASS org.xnio.ssl.JsseConnectedSslStreamChannel 17 | METHOD closeAction 18 | AT ENTRY 19 | IF TRUE 20 | DO 21 | debug("Channel is closing... waiting for handleHandshake first"), 22 | waitFor("handleHandshake at invoke handleWrapResult"), 23 | debug("Proceeding with closeAction") 24 | ENDRULE 25 | 26 | 27 | RULE after close channel 28 | CLASS org.xnio.ssl.JsseConnectedSslStreamChannel 29 | METHOD closeAction 30 | AT EXIT 31 | IF TRUE 32 | DO 33 | debug("Channel is closed... waking read"), 34 | signalWake("channel closed", true) 35 | ENDRULE 36 | -------------------------------------------------------------------------------- /core/src/test/resources/ca.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDNjCCAh6gAwIBAgIEUPqtwDANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJHQjEOMAwGA1UE 3 | CBMFU3RhdGUxDTALBgNVBAcTBENpdHkxDDAKBgNVBAoTA09yZzELMAkGA1UECxMCT1UxFDASBgNV 4 | BAMTC1Rlc3QgQ2xpZW50MB4XDTEzMDExOTE0MjkyMFoXDTIzMDExNzE0MjkyMFowXTELMAkGA1UE 5 | BhMCR0IxDjAMBgNVBAgTBVN0YXRlMQ0wCwYDVQQHEwRDaXR5MQwwCgYDVQQKEwNPcmcxCzAJBgNV 6 | BAsTAk9VMRQwEgYDVQQDEwtUZXN0IENsaWVudDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC 7 | ggEBAIFcxcn1M4hmgoH33g3pSu0kHyD345Xs3Jk23xA8YvxJxUeYReZo94Pcfi6nky2mhR4+wGo8 8 | +CZAMO3/kqxfBcBY/NIbLZtEKQ+sABZc/2Sqc1w1r2V4TsxibRLDpexbD9+S7aLAhTTpOwBFJIv3 9 | eQU2jz+X4RVXM73zPRA1aofqxl5eU/P8Fj+p0JUzNBQvxd+FizrzPYUkRJSMIZPCBax1uRgJ8u0L 10 | 5DQ6AxXe+OgTCJ/ghDys9ZwLhBHZNeav8/ih2twwd45RokAw1h511+KKKcJyBpEfHyrFelYDecUk 11 | C0YphlPV7zTWrnBxJEtrLKyeKO+oH+rvUTCexO07DM0CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEA 12 | XJEQri5VU0Ly/fTwhOG4OvQYtihwCVAwgev+GK6/ob/DWR3s0xYVpmAs+nzaFjqiHL8YDM2u4Gns 13 | 5u7eY0+eyfq+jSwvEjhfmWG3cYDTNvbOOuG4TrXOb6AUrqSLxm6A7K6PhjBoipNUFLOyiWNCfrRi 14 | FMBgJHvLZcyv0IZQXLzimfgo6rZRpmXR85dq50UYaFOLxw2kqkncU8UCo04M4rL1f2T4XHaXdttm 15 | df3EZ5pobrANKUMXV79ihF9LYH+yrc602pVLsBsRLWvVRagymP8w6hGgMnyTAgVmBIUC7FNiEKyI 16 | w9/tpVofINLO+Khr0kVDtGZe9xHWSS4DdNcdUA== 17 | -----END CERTIFICATE----- -------------------------------------------------------------------------------- /core/src/test/resources/client.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/core/src/test/resources/client.keystore -------------------------------------------------------------------------------- /core/src/test/resources/client.truststore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/core/src/test/resources/client.truststore -------------------------------------------------------------------------------- /core/src/test/resources/krb5.conf: -------------------------------------------------------------------------------- 1 | [libdefaults] 2 | default_realm = UNDERTOW.IO 3 | default_tgs_enctypes = aes128-cts-hmac-sha1-96,des-cbc-md5,des3-cbc-sha1-kd 4 | default_tkt_enctypes = aes128-cts-hmac-sha1-96,des-cbc-md5,des3-cbc-sha1-kd 5 | kdc_timeout = 5000 6 | dns_lookup_realm = false 7 | dns_lookup_kdc = false 8 | allow_weak_crypto = yes 9 | forwardable = true 10 | 11 | [realms] 12 | UNDERTOW.IO = { 13 | kdc = localhost:6088 14 | } 15 | 16 | [login] 17 | krb4_convert = true 18 | krb4_get_tickets = false 19 | -------------------------------------------------------------------------------- /core/src/test/resources/ldif/krbtgt.ldif: -------------------------------------------------------------------------------- 1 | dn: uid=krbtgt,ou=users,dc=undertow,dc=io 2 | objectClass: top 3 | objectClass: person 4 | objectClass: inetOrgPerson 5 | objectClass: krb5principal 6 | objectClass: krb5kdcentry 7 | cn: KDC Service 8 | sn: Service 9 | uid: krbtgt 10 | userPassword: secret 11 | krb5PrincipalName: krbtgt/UNDERTOW.IO@UNDERTOW.IO 12 | krb5KeyVersionNumber: 0 -------------------------------------------------------------------------------- /core/src/test/resources/ldif/partition.ldif: -------------------------------------------------------------------------------- 1 | dn: ou=users,dc=undertow,dc=io 2 | objectClass: organizationalUnit 3 | objectClass: top 4 | ou: users -------------------------------------------------------------------------------- /core/src/test/resources/ldif/server.ldif: -------------------------------------------------------------------------------- 1 | dn: uid=Server,ou=users,dc=undertow,dc=io 2 | objectClass: top 3 | objectClass: person 4 | objectClass: inetOrgPerson 5 | objectClass: krb5principal 6 | objectClass: krb5kdcentry 7 | cn: Server 8 | sn: Service 9 | uid: Server 10 | userPassword: servicepwd 11 | krb5PrincipalName: HTTP/${hostname}@UNDERTOW.IO 12 | krb5KeyVersionNumber: 0 -------------------------------------------------------------------------------- /core/src/test/resources/ldif/user.ldif: -------------------------------------------------------------------------------- 1 | dn: uid=jduke,ou=users,dc=undertow,dc=io 2 | objectClass: top 3 | objectClass: person 4 | objectClass: inetOrgPerson 5 | objectClass: krb5principal 6 | objectClass: krb5kdcentry 7 | cn: Java Duke 8 | sn: duke 9 | uid: jduke 10 | userPassword: theduke 11 | krb5PrincipalName: jduke@UNDERTOW.IO 12 | krb5KeyVersionNumber: 0 13 | -------------------------------------------------------------------------------- /core/src/test/resources/server.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/core/src/test/resources/server.keystore -------------------------------------------------------------------------------- /core/src/test/resources/server.truststore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/core/src/test/resources/server.truststore -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | Undertow Examples 2 | 3 | These provide some simple examples of how to run an embedded Undertow server. 4 | 5 | To run the examples simply run 6 | 7 | java -jar target/undertow-examples.jar 8 | 9 | or alternatively: 10 | 11 | mvn exec:exec 12 | 13 | And select the example you wish to run from the menu -------------------------------------------------------------------------------- /examples/conf/nodes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | localhost 5 | 8080 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/src/main/java/io/undertow/examples/UndertowExample.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.examples; 20 | 21 | import java.lang.annotation.ElementType; 22 | import java.lang.annotation.Retention; 23 | import java.lang.annotation.RetentionPolicy; 24 | import java.lang.annotation.Target; 25 | 26 | /** 27 | * @author Stuart Douglas 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target(ElementType.TYPE) 31 | public @interface UndertowExample { 32 | String value(); 33 | String location() default "http://localhost:8080"; 34 | } 35 | -------------------------------------------------------------------------------- /examples/src/main/java/io/undertow/examples/http2/client.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/examples/src/main/java/io/undertow/examples/http2/client.keystore -------------------------------------------------------------------------------- /examples/src/main/java/io/undertow/examples/http2/client.truststore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/examples/src/main/java/io/undertow/examples/http2/client.truststore -------------------------------------------------------------------------------- /examples/src/main/java/io/undertow/examples/http2/server.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/examples/src/main/java/io/undertow/examples/http2/server.keystore -------------------------------------------------------------------------------- /examples/src/main/java/io/undertow/examples/http2/server.truststore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/examples/src/main/java/io/undertow/examples/http2/server.truststore -------------------------------------------------------------------------------- /examples/src/main/java/io/undertow/examples/jsrwebsockets/JsrChatWebSocketEndpoint.java: -------------------------------------------------------------------------------- 1 | package io.undertow.examples.jsrwebsockets; 2 | 3 | import jakarta.websocket.OnMessage; 4 | import jakarta.websocket.Session; 5 | import jakarta.websocket.server.ServerEndpoint; 6 | 7 | /** 8 | * @author Stuart Douglas 9 | */ 10 | @ServerEndpoint("/myapp") 11 | public class JsrChatWebSocketEndpoint { 12 | 13 | @OnMessage 14 | public void message(String message, Session session) { 15 | for (Session s : session.getOpenSessions()) { 16 | s.getAsyncRemote().sendText(message); 17 | } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/BufferAllocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2018 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 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 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package io.undertow.httpcore; 17 | 18 | import io.netty.buffer.ByteBuf; 19 | 20 | public interface BufferAllocator { 21 | 22 | ByteBuf allocateBuffer(); 23 | 24 | ByteBuf allocateBuffer(boolean direct); 25 | 26 | ByteBuf allocateBuffer(int bufferSize); 27 | 28 | ByteBuf allocateBuffer(boolean direct, int bufferSize); 29 | 30 | int getBufferSize(); 31 | } 32 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/ClientAuth.java: -------------------------------------------------------------------------------- 1 | package io.undertow.httpcore; 2 | 3 | public enum ClientAuth { 4 | 5 | /** 6 | * No client authentication is requested or required. 7 | */ 8 | NONE, 9 | 10 | /** 11 | * Accept authentication if presented by client. If this option is set and the client chooses 12 | * not to provide authentication information about itself, the negotiations will continue. 13 | */ 14 | REQUEST, 15 | 16 | /** 17 | * Require client to present authentication, if not presented then negotiations will be declined. 18 | */ 19 | REQUIRED 20 | } 21 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/CompletedListener.java: -------------------------------------------------------------------------------- 1 | package io.undertow.httpcore; 2 | 3 | public interface CompletedListener { 4 | 5 | void completed(HttpExchange exchange); 6 | } 7 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/DefaultBlockingHttpExchange.java: -------------------------------------------------------------------------------- 1 | package io.undertow.httpcore; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | 7 | public class DefaultBlockingHttpExchange implements BlockingHttpExchange { 8 | 9 | private InputStream inputStream; 10 | private OutputStream outputStream; 11 | final HttpExchange exchange; 12 | 13 | public DefaultBlockingHttpExchange(HttpExchange exchange) { 14 | this.exchange = exchange; 15 | } 16 | 17 | @Override 18 | public InputStream getInputStream() { 19 | if (inputStream == null) { 20 | inputStream = new UndertowInputStream(exchange); 21 | } 22 | return inputStream; 23 | } 24 | 25 | @Override 26 | public OutputStream getOutputStream() { 27 | if (outputStream == null) { 28 | outputStream = new UndertowOutputStream(exchange); 29 | } 30 | return outputStream; 31 | } 32 | 33 | @Override 34 | public void close() throws IOException { 35 | if(outputStream != null) { 36 | outputStream.close(); 37 | } 38 | if(inputStream != null) { 39 | inputStream.close(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/ExchangeHandler.java: -------------------------------------------------------------------------------- 1 | package io.undertow.httpcore; 2 | 3 | public interface ExchangeHandler { 4 | 5 | void handle(HttpExchange exchange); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/HttpProtocolNames.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.httpcore; 20 | 21 | /** 22 | * Protocol version strings. 23 | * 24 | * @author David M. Lloyd 25 | */ 26 | public final class HttpProtocolNames { 27 | 28 | private HttpProtocolNames() { 29 | } 30 | 31 | /** 32 | * HTTP 0.9. 33 | */ 34 | public static final String HTTP_0_9 = "HTTP/0.9"; 35 | /** 36 | * HTTP 1.0. 37 | */ 38 | public static final String HTTP_1_0 = "HTTP/1.0"; 39 | /** 40 | * HTTP 1.1. 41 | */ 42 | public static final String HTTP_1_1 = "HTTP/1.1"; 43 | /** 44 | * HTTP 1.1. 45 | */ 46 | public static final String HTTP_2_0 = "HTTP/2.0"; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/PreCommitListener.java: -------------------------------------------------------------------------------- 1 | package io.undertow.httpcore; 2 | 3 | public interface PreCommitListener { 4 | 5 | void preCommit(HttpExchange exchange); 6 | } 7 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/UndertowEngine.java: -------------------------------------------------------------------------------- 1 | package io.undertow.httpcore; 2 | 3 | import java.io.Closeable; 4 | import java.util.concurrent.Executor; 5 | 6 | public interface UndertowEngine { 7 | 8 | EngineInstance start(int ioThreads, Executor blockingExecutor, BufferAllocator bufferAllocator); 9 | 10 | void bindHttp(EngineInstance instance, ExchangeHandler handler, int port, String host, Object options); 11 | 12 | void bindHttps(EngineInstance instance, ExchangeHandler handler, int port, String host, String keyStore, String keyStorePassword, String trustStore, String trustStorePassword, Object options); 13 | 14 | interface EngineInstance extends Closeable { 15 | void close(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/UndertowOption.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2018 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 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 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package io.undertow.httpcore; 17 | 18 | public class UndertowOption { 19 | 20 | private final String name; 21 | private final Class type; 22 | 23 | UndertowOption(String name, Class type) { 24 | this.name = name; 25 | this.type = type; 26 | } 27 | 28 | public String getName() { 29 | return name; 30 | } 31 | 32 | public Class getType() { 33 | return type; 34 | } 35 | 36 | public static UndertowOption create(String name, Class type) { 37 | return new UndertowOption<>(name, type); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /http-core/src/main/java/io/undertow/httpcore/WriteFunction.java: -------------------------------------------------------------------------------- 1 | package io.undertow.httpcore; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | 5 | /** 6 | * Function that is called before a write is performed. 7 | */ 8 | public interface WriteFunction { 9 | 10 | ByteBuf preWrite(ByteBuf data, boolean last); 11 | } 12 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/ExceptionLog.java: -------------------------------------------------------------------------------- 1 | package io.undertow.servlet; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Inherited; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | import org.jboss.logging.Logger; 10 | 11 | /** 12 | * Annotation that can be applied to exceptions to control how they are logged by Undertow. 13 | * 14 | * Note that this will only take effect if the deployments error handler has not been changed. 15 | * 16 | * @author Stuart Douglas 17 | */ 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Target(ElementType.TYPE) 20 | @Inherited 21 | public @interface ExceptionLog { 22 | /** 23 | * The default log level for this exception. 24 | */ 25 | Logger.Level value() default Logger.Level.ERROR; 26 | 27 | /** 28 | * The level at which to log stack traces. If this is a higher level 29 | * than the default then they will be logged by default at the default level. 30 | */ 31 | Logger.Level stackTraceLevel() default Logger.Level.FATAL; 32 | 33 | /** 34 | * The category to log this exception under 35 | */ 36 | String category(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/ClassIntrospecter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | /** 22 | * 23 | * Interface that is provided by the container to create a servlet / filter / listener 24 | * definition from a given class, based on the annotations present on the class. 25 | * 26 | * This is needed to allow for annotations to be taken into account when servlets etc are 27 | * added programatically. 28 | * 29 | * @author Stuart Douglas 30 | */ 31 | public interface ClassIntrospecter { 32 | 33 | InstanceFactory createInstanceFactory(final Class clazz) throws NoSuchMethodException; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/HttpMethodSecurityInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public class HttpMethodSecurityInfo extends SecurityInfo implements Cloneable { 25 | 26 | private volatile String method; 27 | 28 | public String getMethod() { 29 | return method; 30 | } 31 | 32 | public HttpMethodSecurityInfo setMethod(final String method) { 33 | this.method = method; 34 | return this; 35 | } 36 | 37 | @Override 38 | protected HttpMethodSecurityInfo createInstance() { 39 | return new HttpMethodSecurityInfo(); 40 | } 41 | 42 | @Override 43 | public HttpMethodSecurityInfo clone() { 44 | HttpMethodSecurityInfo info = super.clone(); 45 | info.method = method; 46 | return info; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/InstanceFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | /** 22 | * Factory that creates fully injected component instances. 23 | * 24 | * @author Stuart Douglas 25 | */ 26 | public interface InstanceFactory { 27 | 28 | /** 29 | * Factory that creates a fully injected instance. 30 | * 31 | * @return The fully injected instance 32 | */ 33 | InstanceHandle createInstance() throws InstantiationException; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/InstanceHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | /** 22 | * A handle for a container managed instance. When the servlet container is 23 | * done with it it should call the {@link #release()} method 24 | * 25 | * @author Stuart Douglas 26 | */ 27 | public interface InstanceHandle { 28 | 29 | /** 30 | * @return The managed instance 31 | * 32 | */ 33 | T getInstance(); 34 | 35 | /** 36 | * releases the instance, uninjecting and calling an pre-destroy methods as appropriate 37 | */ 38 | void release(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/LifecycleInterceptor.java: -------------------------------------------------------------------------------- 1 | package io.undertow.servlet.api; 2 | 3 | import jakarta.servlet.Filter; 4 | import jakarta.servlet.Servlet; 5 | import jakarta.servlet.ServletException; 6 | 7 | /** 8 | * Class that is run around invocations of servlet and filter lifecycle methods (init and destroy). 9 | * 10 | * Note that this only deals with lifecycle methods that are defined by the servlet spec. @POstConstruct, 11 | * PreDestroy and Inject methods are not handled. 12 | * 13 | * @author Stuart Douglas 14 | */ 15 | public interface LifecycleInterceptor { 16 | 17 | void init(ServletInfo servletInfo, Servlet servlet, LifecycleContext context) throws ServletException; 18 | 19 | void init(FilterInfo filterInfo, Filter filter, LifecycleContext context) throws ServletException; 20 | 21 | void destroy(ServletInfo servletInfo, Servlet servlet, LifecycleContext context) throws ServletException; 22 | 23 | void destroy(FilterInfo filterInfo, Filter filter, LifecycleContext context) throws ServletException; 24 | 25 | interface LifecycleContext { 26 | void proceed() throws ServletException; 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/MetricsCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | import io.undertow.server.handlers.MetricsHandler; 22 | 23 | /** 24 | * An interface that can be used to collect Servlet metrics 25 | * 26 | * @author Tomaz Cerar (c) 2014 Red Hat Inc. 27 | */ 28 | public interface MetricsCollector { 29 | 30 | void registerMetric(String servletName, MetricsHandler handler); 31 | } 32 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/MimeMapping.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public class MimeMapping { 25 | private final String extension; 26 | private final String mimeType; 27 | 28 | public MimeMapping(final String extension, final String mimeType) { 29 | this.extension = extension; 30 | this.mimeType = mimeType; 31 | } 32 | 33 | public String getExtension() { 34 | return extension; 35 | } 36 | 37 | public String getMimeType() { 38 | return mimeType; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/SecurityRoleRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | import io.undertow.servlet.UndertowServletMessages; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public class SecurityRoleRef { 27 | 28 | private final String role; 29 | private final String linkedRole; 30 | 31 | public SecurityRoleRef(final String role, final String linkedRole) { 32 | if(role == null) { 33 | throw UndertowServletMessages.MESSAGES.paramCannotBeNull("role"); 34 | } 35 | this.role = role; 36 | this.linkedRole = linkedRole; 37 | } 38 | 39 | public String getRole() { 40 | return role; 41 | } 42 | 43 | public String getLinkedRole() { 44 | return linkedRole; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/ServletStackTraces.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public enum ServletStackTraces { 25 | 26 | NONE("none"), 27 | LOCAL_ONLY("local-only"), 28 | ALL("all"); 29 | 30 | private final String value; 31 | 32 | ServletStackTraces(String value) { 33 | this.value = value; 34 | } 35 | 36 | @Override 37 | public String toString() { 38 | return value; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/SessionConfigWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | import io.undertow.server.session.SessionConfig; 22 | 23 | /** 24 | * A class that allows the SessionConfig to be wrapped. 25 | * 26 | * This is generally used to append JVM route information to the session ID in clustered environments. 27 | * 28 | * @author Stuart Douglas 29 | */ 30 | public interface SessionConfigWrapper { 31 | 32 | SessionConfig wrap(final SessionConfig sessionConfig, final Deployment deployment); 33 | } 34 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/SessionManagerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | import io.undertow.server.session.SessionManager; 22 | 23 | /** 24 | * Factory class used to create a session manager 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | public interface SessionManagerFactory { 29 | 30 | SessionManager createSessionManager(final Deployment deployment); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/ThreadSetupAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | import io.undertow.server.HttpServerExchange; 22 | 23 | /** 24 | * Interface that can be implemented by classes that need to setup 25 | * and thread local context before a request is processed. 26 | * 27 | * @author Stuart Douglas 28 | */ 29 | @Deprecated 30 | public interface ThreadSetupAction { 31 | 32 | /** 33 | * Setup any thread local context 34 | * 35 | * @param exchange The exchange, this may be null 36 | * @return A handle to tear down the request when the invocation is finished, or null 37 | */ 38 | Handle setup(final HttpServerExchange exchange); 39 | 40 | interface Handle { 41 | void tearDown(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/ThreadSetupHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | import io.undertow.server.HttpServerExchange; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public interface ThreadSetupHandler { 27 | 28 | Action create(Action action); 29 | 30 | interface Action { 31 | T call(HttpServerExchange exchange, C context) throws Exception; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/api/TransportGuaranteeType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.api; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public enum TransportGuaranteeType { 25 | NONE, 26 | INTEGRAL, 27 | CONFIDENTIAL, 28 | REJECTED; 29 | } 30 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/compat/rewrite/Resolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.compat.rewrite; 20 | 21 | /** 22 | * Resolver abstract class. 23 | * 24 | * @author Remy Maucherat 25 | */ 26 | public abstract class Resolver { 27 | 28 | public abstract String resolve(String key); 29 | 30 | public String resolveEnv(String key) { 31 | return System.getProperty(key); 32 | } 33 | 34 | public abstract String resolveSsl(String key); 35 | 36 | public abstract String resolveHttp(String key); 37 | 38 | public abstract boolean resolveResource(int type, String name); 39 | 40 | } -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/compat/rewrite/RewriteMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.compat.rewrite; 20 | 21 | /** 22 | * @author Remy Maucherat 23 | */ 24 | public interface RewriteMap { 25 | 26 | String setParameters(String params); 27 | 28 | String lookup(String key); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/core/Lifecycle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.core; 20 | 21 | import jakarta.servlet.ServletException; 22 | 23 | /** 24 | * 25 | * An object that can be started or stopped. 26 | * 27 | * @author Stuart Douglas 28 | */ 29 | public interface Lifecycle { 30 | 31 | void start() throws ServletException; 32 | 33 | void stop() throws ServletException; 34 | 35 | boolean isStarted(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/core/ServletExtensionHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.core; 20 | 21 | import java.util.List; 22 | import java.util.concurrent.CopyOnWriteArrayList; 23 | 24 | import io.undertow.servlet.ServletExtension; 25 | 26 | /** 27 | * Holder for global ServletExtension services. 28 | * This is particularly useful in an OSGi environment where classloader constraints 29 | * lead to the ServiceLoader not able to see ServletExtension implementations. 30 | */ 31 | public class ServletExtensionHolder { 32 | 33 | private static List extensions = new CopyOnWriteArrayList<>(); 34 | 35 | public static List getServletExtensions() { 36 | return extensions; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/handlers/ServletDispatchingHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.handlers; 20 | 21 | import io.undertow.server.HttpHandler; 22 | import io.undertow.server.HttpServerExchange; 23 | 24 | /** 25 | * Handler that dispatches to the resolved servlet. 26 | * 27 | * @author Stuart Douglas 28 | */ 29 | public class ServletDispatchingHandler implements HttpHandler { 30 | 31 | public static final ServletDispatchingHandler INSTANCE = new ServletDispatchingHandler(); 32 | 33 | @Override 34 | public void handleRequest(final HttpServerExchange exchange) throws Exception { 35 | ServletChain info = exchange.getAttachment(ServletRequestContext.ATTACHMENT_KEY).getCurrentServlet(); 36 | info.getHandler().handleRequest(exchange); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/handlers/security/ServletSingleSignOnAuthenticationMechainism.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.handlers.security; 20 | 21 | import io.undertow.security.impl.SingleSignOnManager; 22 | 23 | /** 24 | * This class name has a type, kept for backwards compatibility reasons 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | @Deprecated 29 | public class ServletSingleSignOnAuthenticationMechainism extends ServletSingleSignOnAuthenticationMechanism { 30 | public ServletSingleSignOnAuthenticationMechainism(SingleSignOnManager storage) { 31 | super(storage); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/spec/ContentTypeInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.spec; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | class ContentTypeInfo { 25 | private final String header; 26 | private final String charset; 27 | private final String contentType; 28 | 29 | ContentTypeInfo(String header, String charset, String contentType) { 30 | this.header = header; 31 | this.charset = charset; 32 | this.contentType = contentType; 33 | } 34 | 35 | public String getHeader() { 36 | return header; 37 | } 38 | 39 | public String getCharset() { 40 | return charset; 41 | } 42 | 43 | public String getContentType() { 44 | return contentType; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/util/DefaultClassIntrospector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.util; 20 | 21 | import io.undertow.servlet.api.ClassIntrospecter; 22 | import io.undertow.servlet.api.InstanceFactory; 23 | 24 | /** 25 | * @author Stuart Douglas 26 | */ 27 | public class DefaultClassIntrospector implements ClassIntrospecter { 28 | 29 | public static final DefaultClassIntrospector INSTANCE = new DefaultClassIntrospector(); 30 | 31 | private DefaultClassIntrospector() { 32 | } 33 | 34 | @Override 35 | public InstanceFactory createInstanceFactory(final Class clazz) throws NoSuchMethodException { 36 | return new ConstructorInstanceFactory<>(clazz.getDeclaredConstructor()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/util/EmptyEnumeration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.util; 20 | 21 | import java.util.Enumeration; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public class EmptyEnumeration implements Enumeration { 27 | 28 | private static final Enumeration INSTANCE = new EmptyEnumeration(); 29 | 30 | @SuppressWarnings("unchecked") 31 | public static Enumeration instance() { 32 | return (Enumeration) INSTANCE; 33 | } 34 | 35 | private EmptyEnumeration() { 36 | 37 | } 38 | 39 | @Override 40 | public boolean hasMoreElements() { 41 | return false; 42 | } 43 | 44 | @Override 45 | public Object nextElement() { 46 | return null; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/util/ImmediateInstanceFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.util; 20 | 21 | import io.undertow.servlet.api.InstanceFactory; 22 | import io.undertow.servlet.api.InstanceHandle; 23 | 24 | /** 25 | * @author Stuart Douglas 26 | */ 27 | public class ImmediateInstanceFactory implements InstanceFactory { 28 | 29 | private final T instance; 30 | 31 | public ImmediateInstanceFactory(final T instance) { 32 | this.instance = instance; 33 | } 34 | 35 | @Override 36 | public InstanceHandle createInstance() throws InstantiationException { 37 | return new ImmediateInstanceHandle<>(instance); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/util/ImmediateInstanceHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.util; 20 | 21 | import io.undertow.servlet.api.InstanceHandle; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public class ImmediateInstanceHandle implements InstanceHandle { 27 | 28 | private final T instance; 29 | 30 | public ImmediateInstanceHandle(final T instance) { 31 | this.instance = instance; 32 | } 33 | 34 | @Override 35 | public T getInstance() { 36 | return instance; 37 | } 38 | 39 | @Override 40 | public void release() { 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /servlet/src/main/java/io/undertow/servlet/util/IteratorEnumeration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.util; 20 | 21 | import java.util.Enumeration; 22 | import java.util.Iterator; 23 | 24 | /** 25 | * Wrapper to convert an iterator to an enumeration 26 | * 27 | * @author Stuart Douglas 28 | */ 29 | public class IteratorEnumeration implements Enumeration { 30 | 31 | private final Iterator iterator; 32 | 33 | public IteratorEnumeration(final Iterator iterator) { 34 | this.iterator = iterator; 35 | } 36 | 37 | @Override 38 | public boolean hasMoreElements() { 39 | return iterator.hasNext(); 40 | } 41 | 42 | @Override 43 | public T nextElement() { 44 | return iterator.next(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /servlet/src/main/resources/META-INF/services/io.undertow.attribute.ExchangeAttributeBuilder: -------------------------------------------------------------------------------- 1 | io.undertow.servlet.attribute.ServletRequestAttribute$Builder 2 | io.undertow.servlet.attribute.ServletSessionAttribute$Builder 3 | io.undertow.servlet.attribute.ServletSessionIdAttribute$Builder 4 | io.undertow.servlet.attribute.ServletRequestURLAttribute$Builder 5 | io.undertow.servlet.attribute.ServletRequestLineAttribute$Builder 6 | io.undertow.servlet.attribute.ServletRelativePathAttribute$Builder 7 | io.undertow.servlet.attribute.ServletRequestedSessionIdAttribute$Builder 8 | io.undertow.servlet.attribute.ServletRequestedSessionIdFromCookieAttribute$Builder 9 | io.undertow.servlet.attribute.ServletRequestedSessionIdValidAttribute$Builder 10 | io.undertow.servlet.attribute.ServletRequestLocaleAttribute$Builder 11 | io.undertow.servlet.attribute.ServletRequestCharacterEncodingAttribute$Builder 12 | io.undertow.servlet.attribute.ServletContextAttribute$Builder 13 | io.undertow.servlet.attribute.ServletRequestParameterAttribute$Builder 14 | io.undertow.servlet.attribute.ServletNameAttribute$Builder 15 | -------------------------------------------------------------------------------- /servlet/src/main/resources/META-INF/services/io.undertow.predicate.PredicateBuilder: -------------------------------------------------------------------------------- 1 | io.undertow.servlet.predicate.DispatcherTypePredicate$Builder 2 | io.undertow.servlet.predicate.DirectoryPredicate$Builder 3 | io.undertow.servlet.predicate.FilePredicate$Builder -------------------------------------------------------------------------------- /servlet/src/main/resources/META-INF/services/io.undertow.server.handlers.builder.HandlerBuilder: -------------------------------------------------------------------------------- 1 | io.undertow.servlet.handlers.MarkSecureHandler$Builder 2 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/async/AsyncErrorServlet.java: -------------------------------------------------------------------------------- 1 | package io.undertow.servlet.test.async; 2 | 3 | import java.io.IOException; 4 | 5 | import jakarta.servlet.ServletException; 6 | import jakarta.servlet.http.HttpServlet; 7 | import jakarta.servlet.http.HttpServletRequest; 8 | import jakarta.servlet.http.HttpServletResponse; 9 | 10 | import io.undertow.httpcore.StatusCodes; 11 | 12 | /** 13 | * @author Stuart Douglas 14 | */ 15 | public class AsyncErrorServlet extends HttpServlet { 16 | 17 | @Override 18 | protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { 19 | req.startAsync(); 20 | Thread t = new Thread(new Runnable() { 21 | @Override 22 | public void run() { 23 | try { 24 | Thread.sleep(100); 25 | resp.sendError(StatusCodes.INTERNAL_SERVER_ERROR); 26 | } catch (Exception e) { 27 | throw new RuntimeException(e); 28 | } 29 | } 30 | }); 31 | t.start(); 32 | } 33 | 34 | @Override 35 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 36 | doGet(req, resp); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/async/TestAsyncRespWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.async; 20 | 21 | import java.io.IOException; 22 | import java.io.PrintWriter; 23 | 24 | import jakarta.servlet.http.HttpServletResponse; 25 | import jakarta.servlet.http.HttpServletResponseWrapper; 26 | 27 | class TestAsyncRespWrapper extends HttpServletResponseWrapper { 28 | TestAsyncRespWrapper(HttpServletResponse resp) { 29 | super(resp); 30 | } 31 | 32 | @Override 33 | public PrintWriter getWriter() throws IOException { 34 | PrintWriter writer = super.getWriter(); 35 | writer.write("wrapped: "); 36 | return writer; 37 | } 38 | } -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/charset/DefaultCharsetFormParserServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.charset; 20 | 21 | import java.io.IOException; 22 | 23 | import jakarta.servlet.ServletException; 24 | import jakarta.servlet.http.HttpServlet; 25 | import jakarta.servlet.http.HttpServletRequest; 26 | import jakarta.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * @author Stuart Douglas 30 | */ 31 | public class DefaultCharsetFormParserServlet extends HttpServlet { 32 | 33 | @Override 34 | protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { 35 | String utf8Bytes = req.getParameter("\u0041\u00A9\u00E9\u0301\u0941\uD835\uDD0A"); 36 | resp.getOutputStream().write(utf8Bytes.getBytes("UTF-8")); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/defaultservlet/disallowed.sh: -------------------------------------------------------------------------------- 1 | This is not a real shell script, but the default servlet will not serve it by default. -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/defaultservlet/filterpath/filtered.txt: -------------------------------------------------------------------------------- 1 | Stuart -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/defaultservlet/foo/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/servlet/src/test/java/io/undertow/servlet/test/defaultservlet/foo/.gitkeep -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/defaultservlet/index.html: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | a page 21 | 22 | 23 | Redirected home page 24 | 25 | 26 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/defaultservlet/path/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quarkusio/quarkus-http/fd0182feaab2e711827610981a8713e659461c00/servlet/src/test/java/io/undertow/servlet/test/defaultservlet/path/.gitkeep -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/defaultservlet/range.txt: -------------------------------------------------------------------------------- 1 | 0123456789 -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/dispatcher/snippet.html: -------------------------------------------------------------------------------- 1 | SnippetText -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/errorpage/ChildException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.errorpage; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public class ChildException extends ParentException { 25 | } 26 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/errorpage/ParentException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.errorpage; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public class ParentException extends Exception { 25 | } 26 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/errorpage/PathServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.errorpage; 20 | 21 | import java.io.IOException; 22 | 23 | import jakarta.servlet.ServletException; 24 | import jakarta.servlet.http.HttpServlet; 25 | import jakarta.servlet.http.HttpServletRequest; 26 | import jakarta.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * @author Stuart Douglas 30 | */ 31 | public class PathServlet extends HttpServlet { 32 | @Override 33 | protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { 34 | resp.getWriter().write(req.getPathInfo()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/errorpage/SecureServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.errorpage; 20 | 21 | import jakarta.servlet.http.HttpServlet; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public class SecureServlet extends HttpServlet { 27 | } 28 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/listener/ordering/FirstListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.servlet.test.listener.ordering; 19 | 20 | import jakarta.servlet.ServletRequestEvent; 21 | import jakarta.servlet.ServletRequestListener; 22 | 23 | import io.undertow.servlet.test.util.Tracker; 24 | 25 | public class FirstListener implements ServletRequestListener { 26 | 27 | @Override 28 | public void requestInitialized(ServletRequestEvent sre) { 29 | Tracker.addAction(FirstListener.class.getSimpleName()); 30 | } 31 | 32 | @Override 33 | public void requestDestroyed(ServletRequestEvent sre) { 34 | Tracker.addAction(FirstListener.class.getSimpleName()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/listener/ordering/SecondListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.servlet.test.listener.ordering; 19 | 20 | import jakarta.servlet.ServletRequestEvent; 21 | import jakarta.servlet.ServletRequestListener; 22 | 23 | import io.undertow.servlet.test.util.Tracker; 24 | 25 | public class SecondListener implements ServletRequestListener { 26 | 27 | @Override 28 | public void requestInitialized(ServletRequestEvent sre) { 29 | Tracker.addAction(SecondListener.class.getSimpleName()); 30 | } 31 | 32 | @Override 33 | public void requestDestroyed(ServletRequestEvent sre) { 34 | Tracker.addAction(SecondListener.class.getSimpleName()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/listener/request/async/onError/AsyncTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.servlet.test.listener.request.async.onError; 19 | 20 | import jakarta.servlet.AsyncContext; 21 | 22 | public class AsyncTask implements Runnable { 23 | 24 | private final AsyncContext ctx; 25 | 26 | public AsyncTask(AsyncContext ctx) { 27 | this.ctx = ctx; 28 | } 29 | 30 | @Override 31 | public void run() { 32 | ctx.dispatch("/faulty"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/listener/request/async/onError/FaultyServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.servlet.test.listener.request.async.onError; 19 | 20 | import java.io.IOException; 21 | 22 | import jakarta.servlet.ServletException; 23 | import jakarta.servlet.http.HttpServlet; 24 | import jakarta.servlet.http.HttpServletRequest; 25 | import jakarta.servlet.http.HttpServletResponse; 26 | 27 | public class FaultyServlet extends HttpServlet { 28 | 29 | @Override 30 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 31 | throw new IllegalStateException(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/listener/session/SessionServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.servlet.test.listener.session; 19 | 20 | import java.io.IOException; 21 | 22 | import jakarta.servlet.ServletException; 23 | import jakarta.servlet.http.HttpServlet; 24 | import jakarta.servlet.http.HttpServletRequest; 25 | import jakarta.servlet.http.HttpServletResponse; 26 | import jakarta.servlet.http.HttpSession; 27 | 28 | public class SessionServlet extends HttpServlet { 29 | 30 | @Override 31 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 32 | HttpSession session = req.getSession(true); 33 | session.setAttribute("FOO", "BAR"); 34 | session.invalidate(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/listener/session/SimpleSessionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.servlet.test.listener.session; 19 | 20 | import jakarta.servlet.http.HttpSessionEvent; 21 | import jakarta.servlet.http.HttpSessionListener; 22 | 23 | import org.junit.Assert; 24 | 25 | 26 | public class SimpleSessionListener implements HttpSessionListener { 27 | 28 | @Override 29 | public void sessionCreated(HttpSessionEvent arg0) { 30 | } 31 | 32 | @Override 33 | public void sessionDestroyed(HttpSessionEvent event) { 34 | Assert.assertEquals("BAR", event.getSession().getAttribute("FOO")); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/metrics/MetricTestServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.metrics; 20 | 21 | import java.io.IOException; 22 | import java.io.PrintWriter; 23 | 24 | import jakarta.servlet.ServletException; 25 | import jakarta.servlet.http.HttpServlet; 26 | import jakarta.servlet.http.HttpServletRequest; 27 | import jakarta.servlet.http.HttpServletResponse; 28 | 29 | /** 30 | * @author Tomaz Cerar 31 | */ 32 | public class MetricTestServlet extends HttpServlet { 33 | 34 | @Override 35 | protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { 36 | PrintWriter out = resp.getWriter(); 37 | out.print("metric"); 38 | try { 39 | Thread.sleep(5); 40 | } catch (InterruptedException e) { 41 | //we dont care 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/metrics/TestMetricsCollector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.metrics; 20 | 21 | import java.util.concurrent.ConcurrentHashMap; 22 | import java.util.concurrent.ConcurrentMap; 23 | 24 | import io.undertow.server.handlers.MetricsHandler; 25 | import io.undertow.servlet.api.MetricsCollector; 26 | 27 | /** 28 | * @author Tomaz Cerar (c) 2014 Red Hat Inc. 29 | */ 30 | public class TestMetricsCollector implements MetricsCollector { 31 | 32 | private final ConcurrentMap metrics = new ConcurrentHashMap<>(); 33 | 34 | @Override 35 | public void registerMetric(String name, MetricsHandler handler) { 36 | metrics.putIfAbsent(name,handler); 37 | } 38 | 39 | public MetricsHandler.MetricResult getMetrics(String name) { 40 | return metrics.get(name).getMetrics(); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/multipart/AddMultipartServetListener.java: -------------------------------------------------------------------------------- 1 | package io.undertow.servlet.test.multipart; 2 | 3 | import jakarta.servlet.MultipartConfigElement; 4 | import jakarta.servlet.ServletContextEvent; 5 | import jakarta.servlet.ServletContextListener; 6 | import jakarta.servlet.ServletRegistration; 7 | 8 | /** 9 | * @author Stuart Douglas 10 | */ 11 | public class AddMultipartServetListener implements ServletContextListener { 12 | @Override 13 | public void contextInitialized(ServletContextEvent sce) { 14 | ServletRegistration.Dynamic reg = sce.getServletContext().addServlet("added", new MultiPartServlet()); 15 | reg.addMapping("/added"); 16 | reg.setMultipartConfig(new MultipartConfigElement(System.getProperty("java.io.tmpdir"))); 17 | } 18 | 19 | @Override 20 | public void contextDestroyed(ServletContextEvent sce) { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/multipart/uploadfile.txt: -------------------------------------------------------------------------------- 1 | file contents -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/path/PathMappingServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.path; 20 | 21 | import java.io.IOException; 22 | import java.io.PrintWriter; 23 | 24 | import jakarta.servlet.ServletException; 25 | import jakarta.servlet.http.HttpServlet; 26 | import jakarta.servlet.http.HttpServletRequest; 27 | import jakarta.servlet.http.HttpServletResponse; 28 | 29 | /** 30 | * @author Stuart Douglas 31 | */ 32 | public class PathMappingServlet extends HttpServlet { 33 | 34 | @Override 35 | protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { 36 | PrintWriter writer = resp.getWriter(); 37 | writer.write(getServletName() + " - " + req.getServletPath() + " - " + req.getPathInfo()); 38 | writer.close(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/path/file.txt: -------------------------------------------------------------------------------- 1 | some file content -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/push/ServerPushServlet.java: -------------------------------------------------------------------------------- 1 | package io.undertow.servlet.test.push; 2 | 3 | import jakarta.servlet.ServletException; 4 | import jakarta.servlet.http.HttpServlet; 5 | import jakarta.servlet.http.HttpServletRequest; 6 | import jakarta.servlet.http.HttpServletResponse; 7 | import java.io.IOException; 8 | 9 | public class ServerPushServlet extends HttpServlet { 10 | 11 | @Override 12 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 13 | req.newPushBuilder() 14 | .path("pushed") 15 | .push(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/request/RaceyAddServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.request; 20 | 21 | import java.io.IOException; 22 | 23 | import jakarta.servlet.ServletException; 24 | import jakarta.servlet.http.HttpServlet; 25 | import jakarta.servlet.http.HttpServletRequest; 26 | import jakarta.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * @author Stuart Douglas 30 | */ 31 | public class RaceyAddServlet extends HttpServlet { 32 | 33 | volatile int value; 34 | 35 | @Override 36 | protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { 37 | resp.getWriter().write("" + (value++)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/request/RedirectServlet.java: -------------------------------------------------------------------------------- 1 | package io.undertow.servlet.test.request; 2 | 3 | import java.io.IOException; 4 | 5 | import jakarta.servlet.ServletException; 6 | import jakarta.servlet.http.HttpServlet; 7 | import jakarta.servlet.http.HttpServletRequest; 8 | import jakarta.servlet.http.HttpServletResponse; 9 | 10 | /** 11 | * @author Stuart Douglas 12 | */ 13 | public class RedirectServlet extends HttpServlet { 14 | 15 | @Override 16 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 17 | resp.sendRedirect(req.getParameter("redirect")); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/response/contenttype/webstart.jnlp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Launch applet with Web Start 5 | Foo Bar Inc. 6 | 7 | 8 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/security/form/EchoServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.security.form; 20 | 21 | import java.io.IOException; 22 | 23 | import jakarta.servlet.ServletException; 24 | import jakarta.servlet.http.HttpServlet; 25 | import jakarta.servlet.http.HttpServletRequest; 26 | import jakarta.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * @author Stuart Douglas 30 | */ 31 | public class EchoServlet extends HttpServlet { 32 | 33 | @Override 34 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { 35 | 36 | byte[] buf = new byte[100]; 37 | int res; 38 | while ((res = req.getInputStream().read(buf)) > 0) { 39 | resp.getOutputStream().write(buf, 0, res); 40 | } 41 | 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/security/form/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | error page 4 | 5 | 6 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/servletcontext/1#2.txt: -------------------------------------------------------------------------------- 1 | Hello! -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/servletcontext/file.txt: -------------------------------------------------------------------------------- 1 | File Contents -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/session/ChangeSessionIdListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.session; 20 | 21 | import jakarta.servlet.http.HttpSessionEvent; 22 | import jakarta.servlet.http.HttpSessionIdListener; 23 | 24 | /** 25 | * @author Stuart Douglas 26 | */ 27 | public class ChangeSessionIdListener implements HttpSessionIdListener { 28 | 29 | public static volatile String oldId; 30 | public static volatile String newId; 31 | 32 | @Override 33 | public void sessionIdChanged(final HttpSessionEvent event, final String oldSessionId) { 34 | this.oldId = oldSessionId; 35 | this.newId = event.getSession().getId(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/spec/UnavailableServlet.java: -------------------------------------------------------------------------------- 1 | package io.undertow.servlet.test.spec; 2 | 3 | import java.io.IOException; 4 | 5 | import jakarta.servlet.Servlet; 6 | import jakarta.servlet.ServletConfig; 7 | import jakarta.servlet.ServletException; 8 | import jakarta.servlet.ServletRequest; 9 | import jakarta.servlet.ServletResponse; 10 | import jakarta.servlet.UnavailableException; 11 | 12 | /** 13 | * @author Stuart Douglas 14 | */ 15 | public class UnavailableServlet implements Servlet { 16 | 17 | static final String PERMANENT = "permanent"; 18 | static boolean first = true; 19 | 20 | @Override 21 | public void init(ServletConfig config) throws ServletException { 22 | if(config.getInitParameter(PERMANENT) != null) { 23 | throw new UnavailableException("msg"); 24 | } else if(first){ 25 | first = false; 26 | throw new UnavailableException("msg", 1); 27 | } 28 | } 29 | 30 | @Override 31 | public ServletConfig getServletConfig() { 32 | return null; 33 | } 34 | 35 | @Override 36 | public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException { 37 | 38 | } 39 | 40 | @Override 41 | public String getServletInfo() { 42 | return null; 43 | } 44 | 45 | @Override 46 | public void destroy() { 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/spec/ValidCookieEchoServlet.java: -------------------------------------------------------------------------------- 1 | package io.undertow.servlet.test.spec; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | 6 | import jakarta.servlet.ServletException; 7 | import jakarta.servlet.http.Cookie; 8 | import jakarta.servlet.http.HttpServlet; 9 | import jakarta.servlet.http.HttpServletRequest; 10 | import jakarta.servlet.http.HttpServletResponse; 11 | 12 | /** 13 | * A servlet that echoes name and value pairs for received valid cookies only. 14 | * 15 | * @author Gael Marziou 16 | */ 17 | public class ValidCookieEchoServlet extends HttpServlet { 18 | 19 | @Override 20 | protected void doGet(final HttpServletRequest req, 21 | final HttpServletResponse resp) throws ServletException, IOException { 22 | 23 | Cookie[] cookies = req.getCookies(); 24 | 25 | PrintWriter out = resp.getWriter(); 26 | for (Cookie cookie : cookies) { 27 | out.print("name='" + cookie.getName() + "'"); 28 | out.print("value='" + cookie.getValue() + "'"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/streams/ForceDrainServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.streams; 20 | 21 | import java.io.IOException; 22 | 23 | import jakarta.servlet.ServletException; 24 | import jakarta.servlet.http.HttpServlet; 25 | import jakarta.servlet.http.HttpServletRequest; 26 | import jakarta.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * @author Stuart Douglas 30 | */ 31 | public class ForceDrainServlet extends HttpServlet { 32 | 33 | @Override 34 | protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { 35 | resp.getOutputStream().write("close".getBytes("UTF-8")); 36 | resp.getOutputStream().close(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/util/TestClassIntrospector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.util; 20 | 21 | import io.undertow.servlet.api.ClassIntrospecter; 22 | import io.undertow.servlet.api.InstanceFactory; 23 | import io.undertow.servlet.util.ConstructorInstanceFactory; 24 | 25 | /** 26 | * @author Stuart Douglas 27 | */ 28 | public class TestClassIntrospector implements ClassIntrospecter { 29 | 30 | public static final TestClassIntrospector INSTANCE = new TestClassIntrospector(); 31 | 32 | @Override 33 | public InstanceFactory createInstanceFactory(final Class clazz) throws NoSuchMethodException { 34 | return new ConstructorInstanceFactory<>(clazz.getDeclaredConstructor()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/util/Tracker.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package io.undertow.servlet.test.util; 19 | 20 | import java.util.ArrayList; 21 | import java.util.Collections; 22 | import java.util.List; 23 | 24 | /** 25 | * Utility class for tracking invocation order. 26 | * 27 | * @author Jozef Hartinger 28 | * 29 | */ 30 | public class Tracker { 31 | 32 | private static final List actions = Collections.synchronizedList(new ArrayList()); 33 | 34 | public static void addAction(String action) { 35 | actions.add(action); 36 | } 37 | 38 | public static List getActions() { 39 | return actions; 40 | } 41 | 42 | public static void reset() { 43 | actions.clear(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/wrapper/StandardRequestWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.wrapper; 20 | 21 | import jakarta.servlet.http.HttpServletRequest; 22 | import jakarta.servlet.http.HttpServletRequestWrapper; 23 | 24 | /** 25 | * @author Stuart Douglas 26 | */ 27 | public class StandardRequestWrapper extends HttpServletRequestWrapper { 28 | /** 29 | * Constructs a request object wrapping the given request. 30 | * 31 | * @throws IllegalArgumentException 32 | * if the request is null 33 | */ 34 | public StandardRequestWrapper(final HttpServletRequest request) { 35 | super(request); 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/wrapper/StandardResponseWrapper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.wrapper; 20 | 21 | import jakarta.servlet.http.HttpServletResponse; 22 | import jakarta.servlet.http.HttpServletResponseWrapper; 23 | 24 | /** 25 | * @author Stuart Douglas 26 | */ 27 | public class StandardResponseWrapper extends HttpServletResponseWrapper { 28 | 29 | /** 30 | * Constructs a response adaptor wrapping the given response. 31 | * 32 | * @throws IllegalArgumentException if the response is null 33 | */ 34 | public StandardResponseWrapper(final HttpServletResponse response) { 35 | super(response); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /servlet/src/test/java/io/undertow/servlet/test/wrapper/WrapperServlet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.servlet.test.wrapper; 20 | 21 | import java.io.IOException; 22 | 23 | import jakarta.servlet.ServletException; 24 | import jakarta.servlet.http.HttpServlet; 25 | import jakarta.servlet.http.HttpServletRequest; 26 | import jakarta.servlet.http.HttpServletResponse; 27 | 28 | /** 29 | * @author Stuart Douglas 30 | */ 31 | public class WrapperServlet extends HttpServlet{ 32 | 33 | @Override 34 | protected void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { 35 | resp.getWriter().write(req.getClass().getName()); 36 | resp.getWriter().write("\n"); 37 | resp.getWriter().write(resp.getClass().getName()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /vertx/src/main/resources/META-INF/services/io.undertow.httpcore.UndertowEngine: -------------------------------------------------------------------------------- 1 | io.undertow.vertx.VertxUndertowEngine -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/Extensions.java: -------------------------------------------------------------------------------- 1 | package io.undertow.websockets; 2 | 3 | import io.netty.handler.codec.http.websocketx.extensions.WebSocketExtensionData; 4 | 5 | import jakarta.websocket.Extension; 6 | import java.util.Arrays; 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | public class Extensions { 11 | 12 | public static final Extension PERMESSAGE_DEFLATE = new ExtensionImpl(new WebSocketExtensionData("permessage-deflate", Collections.emptyMap())); 13 | public static final Extension DEFLATE_FRAME = new ExtensionImpl(new WebSocketExtensionData("deflate-frame", Collections.emptyMap())); 14 | 15 | public static final List EXTENSIONS = Collections.unmodifiableList(Arrays.asList(PERMESSAGE_DEFLATE, DEFLATE_FRAME)); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/WebSocketClientCompressionHandler.java: -------------------------------------------------------------------------------- 1 | package io.undertow.websockets; 2 | 3 | import io.netty.channel.ChannelHandler; 4 | import io.netty.channel.ChannelHandlerContext; 5 | import io.netty.channel.ChannelPromise; 6 | import io.netty.handler.codec.http.websocketx.extensions.WebSocketClientExtensionHandler; 7 | import io.netty.handler.codec.http.websocketx.extensions.compression.DeflateFrameClientExtensionHandshaker; 8 | import io.netty.handler.codec.http.websocketx.extensions.compression.PerMessageDeflateClientExtensionHandshaker; 9 | 10 | @ChannelHandler.Sharable 11 | public final class WebSocketClientCompressionHandler extends WebSocketClientExtensionHandler { 12 | 13 | public static final WebSocketClientCompressionHandler INSTANCE = new WebSocketClientCompressionHandler(); 14 | 15 | WebSocketClientCompressionHandler() { 16 | super(new PerMessageDeflateClientExtensionHandshaker(), 17 | new DeflateFrameClientExtensionHandshaker(false), 18 | new DeflateFrameClientExtensionHandshaker(true)); 19 | } 20 | 21 | @Override 22 | public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { 23 | //we set the headers ourself 24 | ctx.write(msg, promise); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/WebsocketClientSslProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2018 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 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 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | package io.undertow.websockets; 17 | 18 | import java.net.URI; 19 | 20 | import javax.net.ssl.SSLContext; 21 | import jakarta.websocket.ClientEndpointConfig; 22 | import jakarta.websocket.Endpoint; 23 | 24 | import io.netty.channel.EventLoopGroup; 25 | 26 | /** 27 | * Interface that is loaded from a service loader, that allows 28 | * you to configure SSL for web socket client connections. 29 | * 30 | * @author Stuart Douglas 31 | */ 32 | public interface WebsocketClientSslProvider { 33 | 34 | SSLContext getSsl(EventLoopGroup worker, final Class annotatedEndpoint, URI uri); 35 | 36 | SSLContext getSsl(EventLoopGroup worker, final Object annotatedEndpointInstance, URI uri); 37 | 38 | SSLContext getSsl(EventLoopGroup worker, final Endpoint endpoint, final ClientEndpointConfig cec, URI uri); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/annotated/BoundParameter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.annotated; 20 | 21 | import java.util.Map; 22 | import java.util.Set; 23 | 24 | import jakarta.websocket.DecodeException; 25 | 26 | /** 27 | * @author Stuart Douglas 28 | */ 29 | public interface BoundParameter { 30 | Set positions(); 31 | 32 | void populate(final Object[] params, final Map, Object> value) throws DecodeException; 33 | 34 | Class getType(); 35 | } 36 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/util/ContextSetupHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.util; 20 | 21 | import io.undertow.websockets.UndertowSession; 22 | 23 | /** 24 | * @author Stuart Douglas 25 | */ 26 | public interface ContextSetupHandler { 27 | 28 | Action create(Action action); 29 | 30 | interface Action { 31 | T call(C context, UndertowSession session) throws Exception; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/util/ImmediateObjectHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.util; 20 | 21 | 22 | /** 23 | * @author Stuart Douglas 24 | */ 25 | public class ImmediateObjectHandle implements ObjectHandle { 26 | 27 | private final T instance; 28 | 29 | public ImmediateObjectHandle(final T instance) { 30 | this.instance = instance; 31 | } 32 | 33 | @Override 34 | public T getInstance() { 35 | return instance; 36 | } 37 | 38 | @Override 39 | public void release() { 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/util/ObjectFactory.java: -------------------------------------------------------------------------------- 1 | package io.undertow.websockets.util; 2 | 3 | public interface ObjectFactory { 4 | 5 | ObjectHandle createInstance(); 6 | 7 | } 8 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/util/ObjectHandle.java: -------------------------------------------------------------------------------- 1 | package io.undertow.websockets.util; 2 | 3 | public interface ObjectHandle { 4 | 5 | T getInstance(); 6 | 7 | void release(); 8 | } 9 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/util/ObjectIntrospecter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.util; 20 | 21 | /** 22 | * 23 | * Interface that is provided by the container to create a servlet / filter / listener 24 | * definition from a given class, based on the annotations present on the class. 25 | * 26 | * This is needed to allow for annotations to be taken into account when servlets etc are 27 | * added programatically. 28 | * 29 | * @author Stuart Douglas 30 | */ 31 | public interface ObjectIntrospecter { 32 | 33 | ObjectFactory createInstanceFactory(final Class clazz); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /websocket/core/src/main/java/io/undertow/websockets/util/PathTemplateMatch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.util; 20 | 21 | import java.util.Map; 22 | 23 | /** 24 | * The result of a path template match. 25 | * 26 | * @author Stuart Douglas 27 | */ 28 | public class PathTemplateMatch { 29 | 30 | private final String matchedTemplate; 31 | private final Map parameters; 32 | 33 | public PathTemplateMatch(String matchedTemplate, Map parameters) { 34 | this.matchedTemplate = matchedTemplate; 35 | this.parameters = parameters; 36 | } 37 | 38 | public String getMatchedTemplate() { 39 | return matchedTemplate; 40 | } 41 | 42 | public Map getParameters() { 43 | return parameters; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /websocket/core/src/main/resources/META-INF/services/io.undertow.websockets.WebsocketClientSslProvider: -------------------------------------------------------------------------------- 1 | io.undertow.websockets.DefaultWebSocketClientSslProvider -------------------------------------------------------------------------------- /websocket/core/src/main/resources/META-INF/services/jakarta.websocket.ContainerProvider: -------------------------------------------------------------------------------- 1 | io.undertow.websockets.UndertowContainerProvider 2 | -------------------------------------------------------------------------------- /websocket/core/src/main/resources/META-INF/services/jakarta.websocket.server.ServerEndpointConfig$Configurator: -------------------------------------------------------------------------------- 1 | io.undertow.websockets.DefaultContainerConfigurator 2 | -------------------------------------------------------------------------------- /websocket/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 21 | 4.0.0 22 | 23 | 24 | io.quarkus.http 25 | quarkus-http-parent 26 | 999-SNAPSHOT 27 | 28 | 29 | quarkus-http-websocket-parent 30 | 31 | WebSocket Parent 32 | WebSocket Parent 33 | 34 | pom 35 | 36 | 37 | core 38 | servlet 39 | vertx 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /websocket/servlet/src/main/resources/META-INF/services/io.undertow.servlet.ServletExtension: -------------------------------------------------------------------------------- 1 | io.undertow.websockets.servlet.Bootstrap 2 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/TestClassIntrospector.java: -------------------------------------------------------------------------------- 1 | package io.undertow.websockets; 2 | 3 | import io.undertow.websockets.util.ConstructorObjectFactory; 4 | import io.undertow.websockets.util.ObjectFactory; 5 | import io.undertow.websockets.util.ObjectIntrospecter; 6 | 7 | /** 8 | * @author Stuart Douglas 9 | */ 10 | public class TestClassIntrospector implements ObjectIntrospecter { 11 | 12 | public static final TestClassIntrospector INSTANCE = new TestClassIntrospector(); 13 | 14 | @Override 15 | public ObjectFactory createInstanceFactory(final Class clazz) { 16 | try { 17 | return new ConstructorObjectFactory<>(clazz.getDeclaredConstructor()); 18 | } catch (NoSuchMethodException e) { 19 | throw new RuntimeException(e); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/ProgramaticEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test; 20 | 21 | import jakarta.websocket.Endpoint; 22 | import jakarta.websocket.EndpointConfig; 23 | import jakarta.websocket.MessageHandler; 24 | import jakarta.websocket.Session; 25 | 26 | /** 27 | * @author Stuart Douglas 28 | */ 29 | public class ProgramaticEndpoint extends Endpoint { 30 | @Override 31 | public void onOpen(final Session session, EndpointConfig config) { 32 | session.addMessageHandler(new MessageHandler.Whole() { 33 | @Override 34 | public void onMessage(String message) { 35 | session.getAsyncRemote().sendText("Hello " + message); 36 | } 37 | }); 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/AnnotatedAddedProgrammaticallyEndpoint.java: -------------------------------------------------------------------------------- 1 | package io.undertow.websockets.jsr.test.annotated; 2 | 3 | 4 | import jakarta.websocket.OnMessage; 5 | import jakarta.websocket.Session; 6 | import jakarta.websocket.server.ServerEndpoint; 7 | 8 | @ServerEndpoint(AnnotatedAddedProgrammaticallyEndpoint.PATH) 9 | public class AnnotatedAddedProgrammaticallyEndpoint { 10 | 11 | static final String PATH = "/programmatic"; 12 | 13 | @OnMessage 14 | public String handleMessage(String message, Session session) { 15 | StringBuilder reversed = new StringBuilder(message); 16 | reversed.reverse(); 17 | return reversed.toString(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/EncodableObjectSubClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test.annotated; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public class EncodableObjectSubClass extends EncodableObject { 25 | public EncodableObjectSubClass(String value) { 26 | super(value); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/EncodingEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test.annotated; 20 | 21 | import jakarta.websocket.OnMessage; 22 | import jakarta.websocket.server.PathParam; 23 | import jakarta.websocket.server.ServerEndpoint; 24 | 25 | /** 26 | * @author Stuart Douglas 27 | */ 28 | @ServerEndpoint(value = "/encoding/{user}", encoders = {EncodableObject.TextEncoder.class}, decoders = {EncodableObject.TextDecoder.class, EncodableObject.BinaryDecoder.class}) 29 | public class EncodingEndpoint { 30 | 31 | @OnMessage 32 | public EncodableObject handleMessage(final EncodableObject message, @PathParam("user") String user) { 33 | return new EncodableObjectSubClass(message.getValue() + " " + user); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/EncodingGenericsEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test.annotated; 20 | 21 | import jakarta.websocket.OnMessage; 22 | import jakarta.websocket.server.PathParam; 23 | import jakarta.websocket.server.ServerEndpoint; 24 | 25 | /** 26 | * UNDERTOW-287 27 | * 28 | * 29 | * 30 | * @author Stuart Douglas 31 | */ 32 | @ServerEndpoint(value = "/encodingGenerics/{user}", decoders = SubclassDecoder.class) 33 | public class EncodingGenericsEndpoint { 34 | 35 | @OnMessage 36 | public String handleMessage(final EncodableObject message, @PathParam("user") String user) { 37 | return message.getValue() + " " + user; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/GenericSuperclassDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test.annotated; 20 | 21 | import jakarta.websocket.DecodeException; 22 | import jakarta.websocket.Decoder; 23 | import jakarta.websocket.EndpointConfig; 24 | 25 | /** 26 | * @author Stuart Douglas 27 | */ 28 | public abstract class GenericSuperclassDecoder implements Decoder.Text { 29 | @Override 30 | public T decode(String s) throws DecodeException { 31 | return doRealDecode(s); 32 | } 33 | 34 | protected abstract T doRealDecode(String s); 35 | 36 | @Override 37 | public boolean willDecode(String s) { 38 | return true; 39 | } 40 | 41 | @Override 42 | public void init(EndpointConfig config) { 43 | 44 | } 45 | 46 | @Override 47 | public void destroy() { 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/GenericWebSocketClientEndpoint.java: -------------------------------------------------------------------------------- 1 | package io.undertow.websockets.jsr.test.annotated; 2 | 3 | public interface GenericWebSocketClientEndpoint { 4 | 5 | void onMessage(final M message); 6 | } 7 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/MiddleClassDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test.annotated; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public abstract class MiddleClassDecoder extends GenericSuperclassDecoder { 25 | } 26 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/RequestUriEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test.annotated; 20 | 21 | import jakarta.websocket.OnMessage; 22 | import jakarta.websocket.Session; 23 | import jakarta.websocket.server.ServerEndpoint; 24 | 25 | /** 26 | * @author Stuart Douglas 27 | */ 28 | @ServerEndpoint("/request") 29 | public class RequestUriEndpoint { 30 | 31 | @OnMessage 32 | public String handleMessage(String message, Session session) { 33 | return session.getRequestURI().toString(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/annotated/SubclassDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test.annotated; 20 | 21 | /** 22 | * @author Stuart Douglas 23 | */ 24 | public class SubclassDecoder extends MiddleClassDecoder { 25 | @Override 26 | protected EncodableObject doRealDecode(String s) { 27 | return new EncodableObject(s); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/jsr/test/dynamicupgrade/EchoEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.jsr.test.dynamicupgrade; 20 | 21 | import jakarta.websocket.OnMessage; 22 | import jakarta.websocket.OnOpen; 23 | import jakarta.websocket.Session; 24 | import jakarta.websocket.server.PathParam; 25 | 26 | /** 27 | * @author Stuart Douglas 28 | */ 29 | public class EchoEndpoint { 30 | 31 | private boolean opened = false; 32 | 33 | @OnOpen 34 | public void open(Session session) { 35 | opened = true; 36 | } 37 | 38 | @OnMessage 39 | public String echo(@PathParam("foo") String foo, String message) { 40 | return "opened:" + opened + " " + foo + " " + message; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/reconnect/DisconnectServerEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.reconnect; 20 | 21 | import java.io.IOException; 22 | 23 | import jakarta.websocket.OnMessage; 24 | import jakarta.websocket.Session; 25 | import jakarta.websocket.server.ServerEndpoint; 26 | 27 | /** 28 | * @author Stuart Douglas 29 | */ 30 | @ServerEndpoint("/") 31 | public class DisconnectServerEndpoint { 32 | 33 | @OnMessage 34 | public String text(String message, Session session) throws IOException { 35 | if(message.equals("close")) { 36 | session.close(); 37 | return null; 38 | } 39 | return "ECHO-" + message; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/java/io/undertow/websockets/suspendresume/SuspendResumeEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2014 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package io.undertow.websockets.suspendresume; 20 | 21 | import jakarta.websocket.OnMessage; 22 | import jakarta.websocket.server.ServerEndpoint; 23 | 24 | /** 25 | * @author Stuart Douglas 26 | */ 27 | @ServerEndpoint(value = "/") 28 | public class SuspendResumeEndpoint { 29 | 30 | @OnMessage 31 | public String handleMessage(final String message) throws InterruptedException { 32 | Thread.sleep(2000); 33 | return message; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /websocket/servlet/src/test/resources/META-INF/services/io.undertow.websockets.WebsocketClientSslProvider: -------------------------------------------------------------------------------- 1 | # 2 | # JBoss, Home of Professional Open Source. 3 | # Copyright 2018 Red Hat, Inc., and individual contributors 4 | # as indicated by the @author tags. 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 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | io.undertow.websockets.jsr.test.TestSslProvider -------------------------------------------------------------------------------- /zanata.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | https://translate.jboss.org/ 23 | undertow 24 | 2.0 25 | properties 26 | 27 | 28 | --------------------------------------------------------------------------------