From 1b1302ea2f7b2dcf4a3a6fd12595abb41423687a Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sat, 21 Jun 2025 14:44:31 +0200 Subject: [PATCH 01/22] Bumped version 2.7-SNAPSHOT --- changes.md | 58 +------------------ .../org.restlet.gwt.ext.json/pom.xml | 2 +- .../org.restlet.gwt.ext.xml/pom.xml | 2 +- org.restlet.gwt/org.restlet.gwt/pom.xml | 2 +- .../org/restlet/client/engine/Engine.java | 2 +- org.restlet.gwt/pom.xml | 2 +- org.restlet.java/org.restlet.ext.atom/pom.xml | 2 +- .../org.restlet.ext.crypto/pom.xml | 2 +- .../org.restlet.ext.freemarker/pom.xml | 2 +- org.restlet.java/org.restlet.ext.gson/pom.xml | 2 +- .../org.restlet.ext.guice/pom.xml | 2 +- org.restlet.java/org.restlet.ext.gwt/pom.xml | 2 +- org.restlet.java/org.restlet.ext.jaas/pom.xml | 2 +- .../org.restlet.ext.jackson/pom.xml | 2 +- org.restlet.java/org.restlet.ext.jaxb/pom.xml | 2 +- .../org.restlet.ext.jetty/pom.xml | 2 +- org.restlet.java/org.restlet.ext.json/pom.xml | 2 +- .../org.restlet.ext.odata/pom.xml | 2 +- .../org.restlet.ext.servlet/pom.xml | 2 +- .../org.restlet.ext.slf4j/pom.xml | 2 +- .../org.restlet.ext.spring/pom.xml | 2 +- .../org.restlet.ext.thymeleaf/pom.xml | 2 +- .../org.restlet.ext.velocity/pom.xml | 2 +- org.restlet.java/org.restlet.ext.xml/pom.xml | 2 +- org.restlet.java/org.restlet/pom.xml | 2 +- .../main/java/org/restlet/engine/Engine.java | 2 +- org.restlet.java/pom.xml | 2 +- pom.xml | 2 +- 28 files changed, 29 insertions(+), 83 deletions(-) diff --git a/changes.md b/changes.md index eac8cec2f2..7f8b86a00a 100644 --- a/changes.md +++ b/changes.md @@ -1,60 +1,6 @@ Changes log =========== -- 2.6.0 (??-07-2025) - -- 2.6 Release Candidate 2 (21-06-2025) - - Misc - - Upgraded to Jakarta EE 10 - - JaxB to 4.0.0 - - Servlet API to 6.0.0 - - Upgraded Gson library to 2.13.1. - - Upgraded Jackson library to 2.19.1. - - Upgraded Jetty library to version 2.0.17. - - Upgraded Joda-time library to 2.14.0. - - Upgraded Json library to 20250517. - - Upgraded OSGi library to 4.3.0. - - Upgraded Spring library to 6.2.8. - -- 2.6 Release Candidate 1 (28-04-2025) - - Enhancements - - Added MultiPartRepresentation to the Jetty extension to support generation and parsing. - - Added support for the "charset" parameter in HTTP BASIC challenges. Reported by Marc Lafon. - - Added MediaType constructors to help with cloning and customization needs. - - Added support for HTTP2 and HTTP3 protocols by the Jetty HTTP server connector. - - Added support for HTTP2 and HTTP3 protocols by the Jetty HTTP client connector. - - Misc - - Upgraded Thymeleaf library to 3.1.3.RELEASE. - - Upgraded Slf4j library to 5.12.0. - - Upgraded GWT libraries to version 2.12.2. - - Upgraded Jetty library to version 2.0.17. - -- 2.6 Milestone 2 (02-03-2025) - - Enhancements - - Added support for graceful shutdown to the Jetty server. - - Updated default configuration of Jetty connector and fixed unit tests. - - Misc - - Deprecated internal HTTP connector that will be removed in favor of Jetty in 2.7/3.0 version. - - Deprecated the GWT edition that will be removed in 2.7/3.0 version. - - Refactored unit tests to follow standard Maven location and removed "org.restlet.test" module. - - Moved "org.restlet.examples" module - into [separate repository]([url](https://github.com/restlet/restlet-examples/tree/2.6)) - - Updated FreeMarker library to version 2.3.34. - - Updated GSON library to version 2.12.1. - - Updated Jackson library to version 2.17.3. - - Updated JODA Time library to version 2.13.1. - - Updated JSON library to version 20250107. - - Updated JUnit library to version 5.11.4. - - Updated Spring Framework dependency to version 6.2.3. - -- 2.6 Milestone 1 (26-01-2025) - - Enhancements - - Java 17 is the minimum requirement. +- 2.7 Milestone 1 (??-06-2025) - Misc - - Upgraded GWT (org.gwtproject:gwt-dev/gwt-user) to 2.12.1. - - Upgraded Guice to 7.0.0. - - Upgraded Jetty to 12.0.16. - - Upgraded Spring to 6.2.0. - - Removed deprecated extensions FileUpload, GAE, OSGi, RDF. - - Removed deprecated code related to WebDAV, NIO, POP, POPS, SDC, SIP, SIPS, SMTP, SMTPS. - - Deprecated the Atom, JAXB, Guice, GWT, OData and Servlet extensions. + \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt.ext.json/pom.xml b/org.restlet.gwt/org.restlet.gwt.ext.json/pom.xml index 88115517ee..47ff19f715 100644 --- a/org.restlet.gwt/org.restlet.gwt.ext.json/pom.xml +++ b/org.restlet.gwt/org.restlet.gwt.ext.json/pom.xml @@ -5,7 +5,7 @@ org.restlet.gwt org.restlet.gwt.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.gwt/org.restlet.gwt.ext.xml/pom.xml b/org.restlet.gwt/org.restlet.gwt.ext.xml/pom.xml index fd829605e3..5346953bcd 100644 --- a/org.restlet.gwt/org.restlet.gwt.ext.xml/pom.xml +++ b/org.restlet.gwt/org.restlet.gwt.ext.xml/pom.xml @@ -5,7 +5,7 @@ org.restlet.gwt org.restlet.gwt.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.gwt/org.restlet.gwt/pom.xml b/org.restlet.gwt/org.restlet.gwt/pom.xml index 35b93d7685..ebdd270862 100644 --- a/org.restlet.gwt/org.restlet.gwt/pom.xml +++ b/org.restlet.gwt/org.restlet.gwt/pom.xml @@ -5,7 +5,7 @@ org.restlet.gwt org.restlet.gwt.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Engine.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Engine.java index 6d7430a446..ea99a51ed0 100644 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Engine.java +++ b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Engine.java @@ -69,7 +69,7 @@ public class Engine { public static final String MAJOR_NUMBER = "2"; /** Minor version number. */ - public static final String MINOR_NUMBER = "6"; + public static final String MINOR_NUMBER = "7"; /** Release number. */ public static final String RELEASE_NUMBER = "-SNAPSHOT"; diff --git a/org.restlet.gwt/pom.xml b/org.restlet.gwt/pom.xml index 84cc0a5880..51737e28dd 100644 --- a/org.restlet.gwt/pom.xml +++ b/org.restlet.gwt/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.java/org.restlet.ext.atom/pom.xml b/org.restlet.java/org.restlet.ext.atom/pom.xml index 28cf143309..a1d8ca59a2 100644 --- a/org.restlet.java/org.restlet.ext.atom/pom.xml +++ b/org.restlet.java/org.restlet.ext.atom/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.crypto/pom.xml b/org.restlet.java/org.restlet.ext.crypto/pom.xml index 5b951ff5a7..b17aafa1dd 100644 --- a/org.restlet.java/org.restlet.ext.crypto/pom.xml +++ b/org.restlet.java/org.restlet.ext.crypto/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.freemarker/pom.xml b/org.restlet.java/org.restlet.ext.freemarker/pom.xml index ace57350e3..8072e07044 100644 --- a/org.restlet.java/org.restlet.ext.freemarker/pom.xml +++ b/org.restlet.java/org.restlet.ext.freemarker/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.gson/pom.xml b/org.restlet.java/org.restlet.ext.gson/pom.xml index eb3aaa92f8..e75fe9297c 100644 --- a/org.restlet.java/org.restlet.ext.gson/pom.xml +++ b/org.restlet.java/org.restlet.ext.gson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.guice/pom.xml b/org.restlet.java/org.restlet.ext.guice/pom.xml index f30b98676e..18211cab99 100644 --- a/org.restlet.java/org.restlet.ext.guice/pom.xml +++ b/org.restlet.java/org.restlet.ext.guice/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.gwt/pom.xml b/org.restlet.java/org.restlet.ext.gwt/pom.xml index 33fb1a931b..6d9200cd03 100644 --- a/org.restlet.java/org.restlet.ext.gwt/pom.xml +++ b/org.restlet.java/org.restlet.ext.gwt/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.jaas/pom.xml b/org.restlet.java/org.restlet.ext.jaas/pom.xml index 29e27d8ec6..d67151a51c 100644 --- a/org.restlet.java/org.restlet.ext.jaas/pom.xml +++ b/org.restlet.java/org.restlet.ext.jaas/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.jackson/pom.xml b/org.restlet.java/org.restlet.ext.jackson/pom.xml index 47bb2806a6..ef375c6c53 100644 --- a/org.restlet.java/org.restlet.ext.jackson/pom.xml +++ b/org.restlet.java/org.restlet.ext.jackson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.jaxb/pom.xml b/org.restlet.java/org.restlet.ext.jaxb/pom.xml index 27fe54053d..53da22739c 100644 --- a/org.restlet.java/org.restlet.ext.jaxb/pom.xml +++ b/org.restlet.java/org.restlet.ext.jaxb/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.jetty/pom.xml b/org.restlet.java/org.restlet.ext.jetty/pom.xml index fdfa6280d3..e05e721826 100644 --- a/org.restlet.java/org.restlet.ext.jetty/pom.xml +++ b/org.restlet.java/org.restlet.ext.jetty/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.json/pom.xml b/org.restlet.java/org.restlet.ext.json/pom.xml index adbbeb1a3c..6f8027ff63 100644 --- a/org.restlet.java/org.restlet.ext.json/pom.xml +++ b/org.restlet.java/org.restlet.ext.json/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.odata/pom.xml b/org.restlet.java/org.restlet.ext.odata/pom.xml index 2cffd3c829..45de52f382 100644 --- a/org.restlet.java/org.restlet.ext.odata/pom.xml +++ b/org.restlet.java/org.restlet.ext.odata/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.servlet/pom.xml b/org.restlet.java/org.restlet.ext.servlet/pom.xml index 59d6a92bdc..e0e1ccdc50 100644 --- a/org.restlet.java/org.restlet.ext.servlet/pom.xml +++ b/org.restlet.java/org.restlet.ext.servlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.slf4j/pom.xml b/org.restlet.java/org.restlet.ext.slf4j/pom.xml index 6faa348693..e673a0cbc4 100644 --- a/org.restlet.java/org.restlet.ext.slf4j/pom.xml +++ b/org.restlet.java/org.restlet.ext.slf4j/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.spring/pom.xml b/org.restlet.java/org.restlet.ext.spring/pom.xml index 6e96a82a89..c16297791b 100644 --- a/org.restlet.java/org.restlet.ext.spring/pom.xml +++ b/org.restlet.java/org.restlet.ext.spring/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/pom.xml b/org.restlet.java/org.restlet.ext.thymeleaf/pom.xml index 034ce898e2..927997c5cd 100644 --- a/org.restlet.java/org.restlet.ext.thymeleaf/pom.xml +++ b/org.restlet.java/org.restlet.ext.thymeleaf/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.velocity/pom.xml b/org.restlet.java/org.restlet.ext.velocity/pom.xml index c4bb4b68d4..61d13dcb8b 100644 --- a/org.restlet.java/org.restlet.ext.velocity/pom.xml +++ b/org.restlet.java/org.restlet.ext.velocity/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet.ext.xml/pom.xml b/org.restlet.java/org.restlet.ext.xml/pom.xml index 1a6fc87299..e554e97af9 100644 --- a/org.restlet.java/org.restlet.ext.xml/pom.xml +++ b/org.restlet.java/org.restlet.ext.xml/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet/pom.xml b/org.restlet.java/org.restlet/pom.xml index f87f6e05b3..e6553c9ef5 100644 --- a/org.restlet.java/org.restlet/pom.xml +++ b/org.restlet.java/org.restlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../../pom.xml diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Engine.java index cc640c8b0c..e6b5bdc7ed 100644 --- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -87,7 +87,7 @@ public class Engine { public static final String MAJOR_NUMBER = "2"; /** Minor version number. */ - public static final String MINOR_NUMBER = "6"; + public static final String MINOR_NUMBER = "7"; /** Release number. */ public static final String RELEASE_NUMBER = "-SNAPSHOT"; diff --git a/org.restlet.java/pom.xml b/org.restlet.java/pom.xml index 96e0cb557d..f5cb65f3fc 100644 --- a/org.restlet.java/pom.xml +++ b/org.restlet.java/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index b5c81af6f4..630c2df64e 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.6-SNAPSHOT + 2.7-SNAPSHOT pom Restlet Framework - Parent From 29692723482654e5701cec6a4562883445cafdd2 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sat, 21 Jun 2025 15:08:36 +0200 Subject: [PATCH 02/22] Drop deprecated extensions Atom, Guice, GWT, JAXB, OData and edition GWT --- .github/workflows/build.yaml | 2 +- changes.md | 3 +- .../pom.xml | 2 +- .../restlet/ext/crypto/AwsAuthenticator.java | 0 .../ext/crypto/CookieAuthenticator.java | 0 .../ext/crypto/DigestAuthenticator.java | 0 .../org/restlet/ext/crypto/DigestUtils.java | 0 .../restlet/ext/crypto/DigestVerifier.java | 0 .../restlet/ext/crypto/internal/AwsUtils.java | 0 .../ext/crypto/internal/AwsVerifier.java | 0 .../ext/crypto/internal/CryptoUtils.java | 0 .../crypto/internal/HttpAwsQueryHelper.java | 0 .../ext/crypto/internal/HttpAwsS3Helper.java | 0 .../internal/HttpAzureSharedKeyHelper.java | 0 .../HttpAzureSharedKeyLiteHelper.java | 0 .../ext/crypto/internal/HttpDigestHelper.java | 0 .../crypto/internal/HttpDigestVerifier.java | 0 .../java/org/restlet/ext/crypto/package.html | 0 ...estlet.engine.security.AuthenticatorHelper | 0 .../crypto/CookieAuthenticatorTestCase.java | 0 .../ext/crypto/DigestVerifierTestCase.java | 0 .../ext/crypto/HttpDigestTestCase.java | 0 .../internal/HttpAwsS3HelperTestCase.java | 0 .../internal/HttpAwsS3HostNameTestCase.java | 0 .../internal/HttpAwsS3SigningTestCase.java | 0 .../internal/HttpAwsS3VerifierTestCase.java | 0 .../internal/HttpDigestHelperTestCase.java | 0 .../pom.xml | 2 +- .../ext/freemarker/ContextTemplateLoader.java | 0 .../ext/freemarker/FreemarkerConverter.java | 0 .../ext/freemarker/TemplateFilter.java | 0 .../freemarker/TemplateRepresentation.java | 0 .../internal/ResolverHashModel.java | 0 .../ext/freemarker/internal/ScalarModel.java | 0 .../org/restlet/ext/freemarker/package.html | 0 ...g.restlet.engine.converter.ConverterHelper | 0 .../ext/freemarker/FreeMarkerTestCase.java | 0 .../freemarker/TemplateFilterTestCase.java | 0 .../restlet/ext/freemarker/notATemplate.txt | 0 .../restlet/ext/freemarker/template.txt.fmt | 0 .../pom.xml | 2 +- .../org/restlet/ext/gson/GsonConverter.java | 0 .../restlet/ext/gson/GsonRepresentation.java | 0 .../java/org/restlet/ext/gson/package.html | 0 ...g.restlet.engine.converter.ConverterHelper | 0 .../org/restlet/ext/gson/GsonTestCase.java | 0 .../pom.xml | 2 +- .../ext/jaas/ChallengeCallbackHandler.java | 0 .../java/org/restlet/ext/jaas/JaasUtils.java | 0 .../org/restlet/ext/jaas/JaasVerifier.java | 0 .../java/org/restlet/ext/jaas/package.html | 0 .../pom.xml | 2 +- .../restlet/ext/jackson/JacksonConverter.java | 0 .../ext/jackson/JacksonRepresentation.java | 0 .../jackson/internal/XmlFactoryProvider.java | 0 .../java/org/restlet/ext/jackson/package.html | 0 ...g.restlet.engine.converter.ConverterHelper | 0 .../org/restlet/ext/jackson/Customer.java | 0 .../java/org/restlet/ext/jackson/Invoice.java | 0 .../restlet/ext/jackson/JacksonTestCase.java | 0 .../org/restlet/ext/jackson/MyException.java | 0 .../org/restlet/ext/jackson/jacksonBomb.xml | 0 .../README.md | 0 .../pom.xml | 2 +- .../restlet/ext/jetty/HttpClientHelper.java | 0 .../restlet/ext/jetty/HttpServerHelper.java | 0 .../restlet/ext/jetty/HttpsServerHelper.java | 0 .../restlet/ext/jetty/JettyServerHelper.java | 0 .../ext/jetty/MultiPartRepresentation.java | 0 .../ext/jetty/internal/JettyClientCall.java | 0 .../ext/jetty/internal/JettyHandler.java | 0 .../ext/jetty/internal/JettyServerCall.java | 0 .../RestletSslContextFactoryClient.java | 0 .../RestletSslContextFactoryServer.java | 0 .../java/org/restlet/ext/jetty/package.html | 0 .../services/org.restlet.engine.ClientHelper | 0 .../services/org.restlet.engine.ServerHelper | 0 .../org/restlet/ext/jetty/AsyncTestCase.java | 0 .../ext/jetty/FormDataSetTestCase.java | 0 .../test/java/org/restlet/ext/jetty/Lock.java | 0 .../MultiPartRepresentationTestCase.java | 0 .../ext/jetty/ShutdownHookTestCase.java | 0 .../connectors/BaseConnectorsTestCase.java | 0 .../ChunkedEncodingPutTestCase.java | 0 .../connectors/ChunkedEncodingTestCase.java | 0 .../jetty/connectors/ConnectorTestCase.java | 0 .../jetty/connectors/GetChunkedTestCase.java | 0 .../connectors/GetQueryParamTestCase.java | 0 .../ext/jetty/connectors/GetTestCase.java | 0 .../HttpTransportProtocolsTestCase.java | 0 .../ext/jetty/connectors/PostPutTestCase.java | 0 .../RemoteClientAddressTestCase.java | 0 .../ServerMaxConnectionsTestCase.java | 0 .../connectors/SslBaseConnectorsTestCase.java | 0 .../SslClientContextGetTestCase.java | 0 .../ext/jetty/connectors/SslGetTestCase.java | 0 .../AbstractAnnotatedServerResource03.java | 0 .../jetty/resource/AnnotatedInterface03.java | 0 .../resource/AnnotatedInterface03_01.java | 0 .../resource/AnnotatedInterface03_02.java | 0 .../resource/AnnotatedResource09TestCase.java | 0 .../resource/AnnotatedResource10TestCase.java | 0 .../resource/AnnotatedResource11TestCase.java | 0 .../resource/JettyConnectorTestCase.java | 0 .../ext/jetty/resource/MyResource09.java | 0 .../ext/jetty/resource/MyResource10.java | 0 .../ext/jetty/resource/MyResource11.java | 0 .../restlet/ext/jetty/resource/SIMethod.java | 0 .../restlet/ext/jetty/resource/SNIMethod.java | 0 .../restlet/ext/jetty/resource/USIMethod.java | 0 .../ext/jetty/resource/USNIMethod.java | 0 .../restlet/ext/jetty/connectors/dummy.jks | Bin .../restlet/ext/jetty/connectors/dummy.p12 | Bin .../pom.xml | 2 +- .../src/main/java}/org/restlet/JSON.gwt.xml | 0 .../org/restlet/ext/json/JsonConverter.java | 0 .../restlet/ext/json/JsonRepresentation.java | 0 .../org/restlet/ext/json/JsonpFilter.java | 0 .../restlet/ext/json/JsonpRepresentation.java | 0 .../java/org/restlet/ext/json/package.html | 0 ...g.restlet.engine.converter.ConverterHelper | 0 .../restlet/ext/json/JsonpFilterTestCase.java | 0 .../ext/json/JsonpRepresentationTestCase.java | 0 .../pom.xml | 2 +- .../restlet/ext/servlet/ServerServlet.java | 0 .../restlet/ext/servlet/ServletAdapter.java | 0 .../org/restlet/ext/servlet/ServletUtils.java | 0 .../ext/servlet/internal/ServletCall.java | 0 .../ext/servlet/internal/ServletLogger.java | 0 .../servlet/internal/ServletLoggerFacade.java | 0 .../internal/ServletServerAdapter.java | 0 .../servlet/internal/ServletWarClient.java | 0 .../internal/ServletWarClientHelper.java | 0 .../servlet/internal/ServletWarEntity.java | 0 .../java/org/restlet/ext/servlet/package.html | 0 .../src/main/resources/META-INF/MANIFEST.MF | 0 .../src/main/resources/OSGI-INF/restlet.xml | 0 .../pom.xml | 2 +- .../org/restlet/ext/slf4j/Slf4jLogger.java | 0 .../restlet/ext/slf4j/Slf4jLoggerFacade.java | 0 .../java/org/restlet/ext/slf4j/package.html | 0 .../pom.xml | 2 +- .../ext/spring/RestletFrameworkServlet.java | 0 .../restlet/ext/spring/SpringBeanFinder.java | 0 .../restlet/ext/spring/SpringBeanRouter.java | 0 .../restlet/ext/spring/SpringComponent.java | 0 .../org/restlet/ext/spring/SpringContext.java | 0 .../org/restlet/ext/spring/SpringFinder.java | 0 .../org/restlet/ext/spring/SpringHost.java | 0 .../restlet/ext/spring/SpringResource.java | 0 .../org/restlet/ext/spring/SpringRouter.java | 0 .../org/restlet/ext/spring/SpringServer.java | 0 .../ext/spring/SpringServerServlet.java | 0 .../java/org/restlet/ext/spring/package.html | 0 .../ext/spring/SpringBeanFinderTestCase.java | 0 .../ext/spring/SpringBeanRouterTestCase.java | 0 .../restlet/ext/spring/SpringTestCase.java | 0 .../ext/spring/resources/OrderResource.java | 0 .../ext/spring/resources/OrdersResource.java | 0 .../ext/spring/resources/UserResource.java | 0 .../org/restlet/ext/spring/SpringTestCase.xml | 0 .../pom.xml | 2 +- .../restlet/ext/thymeleaf/TemplateFilter.java | 0 .../ext/thymeleaf/TemplateRepresentation.java | 0 .../ext/thymeleaf/ThymeleafConverter.java | 0 .../org/restlet/ext/thymeleaf/package.html | 0 ...g.restlet.engine.converter.ConverterHelper | 0 .../ext/thymeleaf/ThymeleafTestCase.java | 0 .../org/restlet/ext/thymeleaf/test.html | 0 .../pom.xml | 2 +- .../RepresentationResourceLoader.java | 0 .../restlet/ext/velocity/TemplateFilter.java | 0 .../ext/velocity/TemplateRepresentation.java | 0 .../ext/velocity/VelocityConverter.java | 0 .../org/restlet/ext/velocity/package.html | 0 ...g.restlet.engine.converter.ConverterHelper | 0 .../ext/velocity/TemplateFilterTestCase.java | 0 .../ext/velocity/VelocityTestCase.java | 0 .../org/restlet/ext/velocity/notATemplate.txt | 0 .../org/restlet/ext/velocity/template.txt.vm | 0 .../pom.xml | 2 +- .../restlet/ext/xml/DomRepresentation.java | 0 .../java/org/restlet/ext/xml/NodeList.java | 0 .../restlet/ext/xml/SaxRepresentation.java | 0 .../ext/xml/TransformRepresentation.java | 0 .../java/org/restlet/ext/xml/Transformer.java | 0 .../org/restlet/ext/xml/XmlConverter.java | 0 .../restlet/ext/xml/XmlRepresentation.java | 0 .../java/org/restlet/ext/xml/XmlWriter.java | 0 .../ext/xml/internal/AbstractXmlReader.java | 0 .../ext/xml/internal/ContextResolver.java | 0 .../java/org/restlet/ext/xml/package.html | 0 ...g.restlet.engine.converter.ConverterHelper | 0 .../ext/xml/ResolvingTransformerTestCase.java | 0 .../xml/TransformRepresentationTestCase.java | 0 .../restlet/ext/xml/TransformerTestCase.java | 0 .../org/restlet/ext/xml/xslt/one/1st.xml | 0 .../org/restlet/ext/xml/xslt/one/1st.xsl | 0 .../org/restlet/ext/xml/xslt/two/2nd.xml | 0 .../org/restlet/ext/xml/xslt/two/2nd.xsl | 0 .../org.restlet.gwt.ext.json/pom.xml | 36 - .../client/ext/json/JsonRepresentation.java | 238 -- .../org/restlet/client/ext/json/package.html | 15 - .../org.restlet.gwt.ext.xml/pom.xml | 36 - .../client/ext/xml/DomRepresentation.java | 135 - .../org/restlet/client/ext/xml/package.html | 9 - .../main/resources/org/restlet/XML.gwt.xml | 4 - org.restlet.gwt/org.restlet.gwt/pom.xml | 53 - .../src/main/java/org/restlet/Restlet.gwt.xml | 7 - .../main/java/org/restlet/client/Client.java | 184 -- .../java/org/restlet/client/Connector.java | 111 - .../main/java/org/restlet/client/Context.java | 260 -- .../main/java/org/restlet/client/Message.java | 442 --- .../main/java/org/restlet/client/Request.java | 916 ------ .../java/org/restlet/client/Response.java | 1049 ------ .../main/java/org/restlet/client/Restlet.java | 332 -- .../main/java/org/restlet/client/Uniform.java | 40 - .../client/data/AuthenticationInfo.java | 246 -- .../restlet/client/data/CacheDirective.java | 464 --- .../restlet/client/data/ChallengeMessage.java | 302 -- .../restlet/client/data/ChallengeRequest.java | 194 -- .../client/data/ChallengeResponse.java | 421 --- .../restlet/client/data/ChallengeScheme.java | 268 -- .../org/restlet/client/data/CharacterSet.java | 294 -- .../org/restlet/client/data/ClientInfo.java | 542 --- .../org/restlet/client/data/Conditions.java | 474 --- .../java/org/restlet/client/data/Cookie.java | 235 -- .../restlet/client/data/CookieSetting.java | 293 -- .../java/org/restlet/client/data/Digest.java | 130 - .../org/restlet/client/data/Dimension.java | 26 - .../org/restlet/client/data/Disposition.java | 228 -- .../org/restlet/client/data/Encoding.java | 153 - .../java/org/restlet/client/data/Form.java | 340 -- .../java/org/restlet/client/data/Header.java | 116 - .../org/restlet/client/data/Language.java | 215 -- .../org/restlet/client/data/MediaType.java | 741 ----- .../org/restlet/client/data/Metadata.java | 145 - .../java/org/restlet/client/data/Method.java | 519 --- .../org/restlet/client/data/Parameter.java | 178 - .../org/restlet/client/data/Preference.java | 150 - .../java/org/restlet/client/data/Product.java | 109 - .../org/restlet/client/data/Protocol.java | 369 --- .../java/org/restlet/client/data/Range.java | 257 -- .../restlet/client/data/RecipientInfo.java | 113 - .../org/restlet/client/data/Reference.java | 2928 ----------------- .../org/restlet/client/data/ServerInfo.java | 125 - .../java/org/restlet/client/data/Status.java | 1636 --------- .../java/org/restlet/client/data/Tag.java | 196 -- .../java/org/restlet/client/data/Warning.java | 126 - .../java/org/restlet/client/data/package.html | 13 - .../org/restlet/client/engine/Engine.java | 428 --- .../org/restlet/client/engine/Helper.java | 19 - .../restlet/client/engine/RestletHelper.java | 160 - .../client/engine/adapter/Adapter.java | 58 - .../restlet/client/engine/adapter/Call.java | 478 --- .../client/engine/adapter/ClientAdapter.java | 198 -- .../client/engine/adapter/ClientCall.java | 226 -- .../client/engine/adapter/GwtClientCall.java | 265 -- .../engine/adapter/GwtHttpClientHelper.java | 102 - .../engine/adapter/HttpClientHelper.java | 119 - .../client/engine/adapter/package.html | 8 - .../engine/application/MetadataExtension.java | 99 - .../client/engine/application/StatusInfo.java | 220 -- .../client/engine/connector/ClientHelper.java | 41 - .../engine/connector/ConnectorHelper.java | 71 - .../engine/connector/HttpProtocolHelper.java | 36 - .../client/engine/connector/Method.java | 44 - .../engine/connector/ProtocolHelper.java | 36 - .../connector/WebDavProtocolHelper.java | 34 - .../client/engine/connector/package.html | 10 - .../engine/header/CacheDirectiveReader.java | 53 - .../engine/header/CacheDirectiveWriter.java | 40 - .../engine/header/ChallengeRequestReader.java | 88 - .../client/engine/header/ChallengeWriter.java | 161 - .../client/engine/header/ContentType.java | 158 - .../engine/header/ContentTypeReader.java | 233 -- .../client/engine/header/CookieReader.java | 182 - .../engine/header/CookieSettingReader.java | 240 -- .../engine/header/CookieSettingWriter.java | 163 - .../client/engine/header/CookieWriter.java | 159 - .../client/engine/header/DateWriter.java | 51 - .../client/engine/header/DimensionReader.java | 80 - .../client/engine/header/DimensionWriter.java | 88 - .../engine/header/DispositionReader.java | 61 - .../engine/header/DispositionWriter.java | 57 - .../client/engine/header/EncodingReader.java | 44 - .../client/engine/header/EncodingWriter.java | 38 - .../client/engine/header/HeaderConstants.java | 202 -- .../client/engine/header/HeaderReader.java | 757 ----- .../client/engine/header/HeaderUtils.java | 1026 ------ .../client/engine/header/HeaderWriter.java | 312 -- .../client/engine/header/LanguageReader.java | 38 - .../client/engine/header/LanguageWriter.java | 34 - .../client/engine/header/MetadataWriter.java | 26 - .../client/engine/header/MethodReader.java | 52 - .../client/engine/header/MethodWriter.java | 39 - .../engine/header/PreferenceReader.java | 473 --- .../engine/header/PreferenceWriter.java | 97 - .../client/engine/header/ProductReader.java | 128 - .../client/engine/header/ProductWriter.java | 62 - .../client/engine/header/RangeReader.java | 104 - .../client/engine/header/RangeWriter.java | 140 - .../engine/header/RecipientInfoReader.java | 79 - .../engine/header/RecipientInfoWriter.java | 61 - .../client/engine/header/StringReader.java | 51 - .../client/engine/header/StringWriter.java | 37 - .../client/engine/header/TagReader.java | 52 - .../client/engine/header/TagWriter.java | 50 - .../client/engine/header/TokenReader.java | 36 - .../client/engine/header/WarningReader.java | 79 - .../client/engine/header/WarningWriter.java | 68 - .../org/restlet/client/engine/io/IoUtils.java | 173 - .../client/engine/io/StringInputStream.java | 110 - .../client/engine/log/LoggerFacade.java | 105 - .../org/restlet/client/engine/package.html | 8 - .../engine/resource/GwtClientProxy.java | 116 - .../restlet/client/engine/util/Base64.java | 244 -- .../engine/util/CacheDirectiveSeries.java | 51 - .../engine/util/CaseInsensitiveHashSet.java | 48 - .../client/engine/util/CookieSeries.java | 51 - .../engine/util/CookieSettingSeries.java | 50 - .../restlet/client/engine/util/DateUtils.java | 257 -- .../client/engine/util/FormReader.java | 400 --- .../restlet/client/engine/util/FormUtils.java | 298 -- .../client/engine/util/HeaderSeries.java | 51 - .../client/engine/util/ImmutableDate.java | 108 - .../restlet/client/engine/util/ListUtils.java | 54 - .../client/engine/util/ParameterSeries.java | 66 - .../restlet/client/engine/util/SetUtils.java | 22 - .../client/engine/util/StringUtils.java | 667 ---- .../client/engine/util/SystemUtils.java | 51 - .../util/emul/CopyOnWriteArrayList.java | 137 - .../engine/util/emul/CopyOnWriteArraySet.java | 83 - .../client/engine/util/emul/StringWriter.java | 48 - .../util/emul/UnknownHostException.java | 31 - .../emul/UnsupportedEncodingException.java | 31 - .../main/java/org/restlet/client/package.html | 11 - .../CharacterRepresentation.java | 38 - .../representation/EmptyRepresentation.java | 56 - .../representation/InputRepresentation.java | 117 - .../representation/ObjectRepresentation.java | 245 -- .../client/representation/Representation.java | 468 --- .../representation/RepresentationInfo.java | 193 -- .../representation/StreamRepresentation.java | 45 - .../representation/StringRepresentation.java | 196 -- .../client/representation/Variant.java | 519 --- .../client/representation/package.html | 9 - .../restlet/client/resource/ClientProxy.java | 32 - .../client/resource/ClientResource.java | 1536 --------- .../org/restlet/client/resource/Delete.java | 69 - .../client/resource/ExceptionHandler.java | 19 - .../java/org/restlet/client/resource/Get.java | 72 - .../org/restlet/client/resource/Options.java | 69 - .../org/restlet/client/resource/Patch.java | 79 - .../org/restlet/client/resource/Post.java | 79 - .../java/org/restlet/client/resource/Put.java | 78 - .../org/restlet/client/resource/Resource.java | 830 ----- .../client/resource/ResourceException.java | 301 -- .../org/restlet/client/resource/Result.java | 45 - .../org/restlet/client/resource/Status.java | 74 - .../org/restlet/client/resource/package.html | 9 - .../client/service/MetadataService.java | 698 ---- .../org/restlet/client/service/Service.java | 127 - .../org/restlet/client/service/package.html | 9 - .../org/restlet/client/util/ClientList.java | 83 - .../org/restlet/client/util/NamedValue.java | 43 - .../java/org/restlet/client/util/Series.java | 621 ---- .../org/restlet/client/util/WrapperList.java | 357 -- .../org/restlet/client/util/WrapperMap.java | 208 -- .../client/util/WrapperRepresentation.java | 224 -- .../restlet/client/util/WrapperRequest.java | 501 --- .../restlet/client/util/WrapperResponse.java | 522 --- .../restlet/client/util/WrapperRestlet.java | 126 - .../java/org/restlet/client/util/package.html | 9 - .../org/restlet/rebind/AnnotationInfo.java | 142 - .../org/restlet/rebind/AnnotationUtils.java | 212 -- .../restlet/rebind/ClientProxyGenerator.java | 1071 ------ .../main/java/org/restlet/rebind/package.html | 8 - .../resources/org/restlet/Restlet.gwt.xml | 7 - .../org/restlet/client/engine/EngineTest.java | 36 - org.restlet.gwt/pom.xml | 86 - org.restlet.java/org.restlet.ext.atom/pom.xml | 38 - .../org/restlet/ext/atom/AtomConverter.java | 157 - .../java/org/restlet/ext/atom/Categories.java | 233 -- .../java/org/restlet/ext/atom/Category.java | 141 - .../java/org/restlet/ext/atom/Collection.java | 296 -- .../java/org/restlet/ext/atom/Content.java | 215 -- .../main/java/org/restlet/ext/atom/Entry.java | 547 --- .../org/restlet/ext/atom/EntryReader.java | 277 -- .../main/java/org/restlet/ext/atom/Feed.java | 602 ---- .../java/org/restlet/ext/atom/FeedReader.java | 304 -- .../java/org/restlet/ext/atom/Generator.java | 145 - .../main/java/org/restlet/ext/atom/Link.java | 261 -- .../java/org/restlet/ext/atom/Person.java | 149 - .../java/org/restlet/ext/atom/Relation.java | 329 -- .../java/org/restlet/ext/atom/Service.java | 307 -- .../java/org/restlet/ext/atom/Source.java | 384 --- .../main/java/org/restlet/ext/atom/Text.java | 177 - .../java/org/restlet/ext/atom/Workspace.java | 170 - .../internal/CategoriesContentReader.java | 78 - .../ext/atom/internal/EntryContentReader.java | 482 --- .../ext/atom/internal/FeedContentReader.java | 553 ---- .../atom/internal/ServiceContentReader.java | 196 -- .../java/org/restlet/ext/atom/package.html | 10 - ...g.restlet.engine.converter.ConverterHelper | 1 - .../org.restlet.ext.guice/README.md | 7 - .../org.restlet.ext.guice/pom.xml | 44 - .../org/restlet/ext/guice/FinderFactory.java | 57 - .../guice/ResourceInjectingApplication.java | 84 - .../org/restlet/ext/guice/RestletGuice.java | 317 -- .../guice/SelfInjectingServerResource.java | 64 - .../SelfInjectingServerResourceModule.java | 39 - .../org/restlet/ext/guice/package-info.java | 193 -- ...InjectingServerResourceModuleTestCase.java | 119 - .../ext/guice/GuiceWrappedFinderTestCase.java | 172 - org.restlet.java/org.restlet.ext.gwt/pom.xml | 49 - .../org/restlet/ext/gwt/GwtConverter.java | 155 - .../restlet/ext/gwt/ObjectRepresentation.java | 182 - .../ext/gwt/SimpleSerializationPolicy.java | 57 - .../SimpleSerializationPolicyProvider.java | 35 - .../java/org/restlet/ext/gwt/package.html | 9 - ...g.restlet.engine.converter.ConverterHelper | 1 - org.restlet.java/org.restlet.ext.jaxb/pom.xml | 49 - .../org/restlet/ext/jaxb/JaxbConverter.java | 205 -- .../restlet/ext/jaxb/JaxbRepresentation.java | 669 ---- .../restlet/ext/jaxb/internal/Marshaller.java | 187 -- .../ext/jaxb/internal/Unmarshaller.java | 201 -- .../java/org/restlet/ext/jaxb/package.html | 12 - ...g.restlet.engine.converter.ConverterHelper | 1 - .../ext/jaxb/JaxbBasicConverterTestCase.java | 42 - .../JaxbIntegrationConverterTestCase.java | 147 - .../org/restlet/ext/jaxb/ObjectFactory.java | 19 - .../java/org/restlet/ext/jaxb/Sample.java | 42 - .../src/main/java/org/restlet/JSON.gwt.xml | 4 - .../org.restlet.ext.odata/pom.xml | 53 - .../java/org/restlet/ext/odata/Generator.java | 353 -- .../java/org/restlet/ext/odata/Query.java | 764 ----- .../java/org/restlet/ext/odata/Service.java | 1254 ------- .../odata/internal/EntryContentHandler.java | 818 ----- .../ext/odata/internal/EntryIterator.java | 102 - .../odata/internal/FeedContentHandler.java | 305 -- .../ext/odata/internal/edm/Association.java | 83 - .../odata/internal/edm/AssociationEnd.java | 101 - .../odata/internal/edm/AssociationSet.java | 84 - .../odata/internal/edm/AssociationSetEnd.java | 65 - .../odata/internal/edm/ComplexProperty.java | 55 - .../ext/odata/internal/edm/ComplexType.java | 71 - .../odata/internal/edm/EntityContainer.java | 177 - .../ext/odata/internal/edm/EntitySet.java | 56 - .../ext/odata/internal/edm/EntityType.java | 206 -- .../odata/internal/edm/FunctionImport.java | 279 -- .../ext/odata/internal/edm/Mapping.java | 177 - .../ext/odata/internal/edm/Metadata.java | 437 --- .../odata/internal/edm/MetadataReader.java | 714 ---- .../ext/odata/internal/edm/NamedObject.java | 83 - .../ext/odata/internal/edm/Namespace.java | 53 - .../internal/edm/NavigationProperty.java | 99 - .../ext/odata/internal/edm/ODataType.java | 235 -- .../ext/odata/internal/edm/Parameter.java | 144 - .../ext/odata/internal/edm/Property.java | 212 -- .../ext/odata/internal/edm/Schema.java | 148 - .../restlet/ext/odata/internal/edm/Type.java | 88 - .../ext/odata/internal/edm/TypeUtils.java | 631 ---- .../odata/internal/reflect/ReflectUtils.java | 509 --- .../odata/internal/templates/complexType.ftl | 126 - .../odata/internal/templates/entityType.ftl | 223 -- .../ext/odata/internal/templates/service.ftl | 178 - .../java/org/restlet/ext/odata/package.html | 13 - .../restlet/engine/application/package.html | 7 - .../org/restlet/engine/header/package.html | 7 - .../java/org/restlet/engine/io/package.html | 6 - .../java/org/restlet/engine/log/package.html | 7 - .../org/restlet/engine/resource/package.html | 7 - .../java/org/restlet/engine/util/package.html | 7 - .../test/resources/maven-version.properties | 1 - org.restlet.java/pom.xml | 40 - .../org.restlet => org.restlet}/pom.xml | 2 +- .../main/java/org/restlet/Application.java | 0 .../src/main/java/org/restlet/Client.java | 0 .../src/main/java/org/restlet/Component.java | 0 .../src/main/java/org/restlet/Connector.java | 0 .../src/main/java/org/restlet/Context.java | 0 .../src/main/java/org/restlet/Message.java | 0 .../src/main/java/org/restlet/Request.java | 0 .../src/main/java/org/restlet/Response.java | 0 .../src/main/java/org/restlet/Restlet.java | 0 .../src/main/java/org/restlet/Server.java | 0 .../src/main/java/org/restlet/Uniform.java | 0 .../org/restlet/data/AuthenticationInfo.java | 0 .../java/org/restlet/data/CacheDirective.java | 0 .../org/restlet/data/ChallengeMessage.java | 0 .../org/restlet/data/ChallengeRequest.java | 0 .../org/restlet/data/ChallengeResponse.java | 0 .../org/restlet/data/ChallengeScheme.java | 0 .../java/org/restlet/data/CharacterSet.java | 0 .../java/org/restlet/data/ClientInfo.java | 0 .../java/org/restlet/data/Conditions.java | 0 .../main/java/org/restlet/data/Cookie.java | 0 .../java/org/restlet/data/CookieSetting.java | 0 .../main/java/org/restlet/data/Digest.java | 0 .../main/java/org/restlet/data/Dimension.java | 0 .../java/org/restlet/data/Disposition.java | 0 .../main/java/org/restlet/data/Encoding.java | 0 .../java/org/restlet/data/Expectation.java | 0 .../src/main/java/org/restlet/data/Form.java | 0 .../main/java/org/restlet/data/Header.java | 0 .../main/java/org/restlet/data/Language.java | 0 .../java/org/restlet/data/LocalReference.java | 0 .../main/java/org/restlet/data/MediaType.java | 0 .../main/java/org/restlet/data/Metadata.java | 0 .../main/java/org/restlet/data/Method.java | 0 .../main/java/org/restlet/data/Parameter.java | 0 .../java/org/restlet/data/Preference.java | 0 .../main/java/org/restlet/data/Product.java | 0 .../main/java/org/restlet/data/Protocol.java | 0 .../src/main/java/org/restlet/data/Range.java | 0 .../java/org/restlet/data/RecipientInfo.java | 0 .../main/java/org/restlet/data/Reference.java | 0 .../java/org/restlet/data/ReferenceList.java | 0 .../java/org/restlet/data/ServerInfo.java | 0 .../main/java/org/restlet/data/Status.java | 0 .../src/main/java/org/restlet/data/Tag.java | 0 .../main/java/org/restlet/data/Warning.java | 0 .../java/org/restlet/data/agent.properties | 0 .../main/java/org/restlet/data/package.html | 0 .../org/restlet/engine/CompositeHelper.java | 0 .../main/java/org/restlet/engine/Edition.java | 0 .../main/java/org/restlet/engine/Engine.java | 0 .../main/java/org/restlet/engine/Helper.java | 0 .../org/restlet/engine/RestletHelper.java | 0 .../org/restlet/engine/adapter/Adapter.java | 0 .../java/org/restlet/engine/adapter/Call.java | 0 .../restlet/engine/adapter/ClientAdapter.java | 0 .../restlet/engine/adapter/ClientCall.java | 0 .../engine/adapter/HttpClientHelper.java | 0 .../restlet/engine/adapter/HttpRequest.java | 0 .../restlet/engine/adapter/HttpResponse.java | 0 .../engine/adapter/HttpServerHelper.java | 0 .../restlet/engine/adapter/ServerAdapter.java | 0 .../restlet/engine/adapter/ServerCall.java | 0 .../org/restlet/engine/adapter/package.html | 0 .../engine/application/ApplicationHelper.java | 0 .../restlet/engine/application/Conneg.java | 0 .../engine/application/CorsFilter.java | 0 .../application/CorsResponseHelper.java | 0 .../application/DecodeRepresentation.java | 0 .../restlet/engine/application/Decoder.java | 0 .../application/EncodeRepresentation.java | 0 .../restlet/engine/application/Encoder.java | 0 .../engine/application/FlexibleConneg.java | 0 .../engine/application/MetadataExtension.java | 0 .../engine/application/RangeFilter.java | 0 .../application/RangeRepresentation.java | 0 .../engine/application/StatusFilter.java | 0 .../engine/application/StatusInfo.java | 0 .../engine/application/StrictConneg.java | 0 .../engine/application/TunnelFilter.java | 0 .../restlet}/engine/application/package.html | 0 .../restlet/engine/component/ClientRoute.java | 0 .../engine/component/ClientRouter.java | 0 .../component/ComponentClientDispatcher.java | 0 .../engine/component/ComponentContext.java | 0 .../engine/component/ComponentHelper.java | 0 .../component/ComponentServerDispatcher.java | 0 .../restlet/engine/component/HostRoute.java | 0 .../engine/component/InternalRouter.java | 0 .../engine/component/ServerRouter.java | 0 .../org/restlet/engine/component/package.html | 0 .../engine/connector/ClientHelper.java | 0 .../ConnectionClosingRepresentation.java | 0 .../engine/connector/ConnectorHelper.java | 0 .../engine/connector/FtpClientHelper.java | 0 .../engine/connector/HttpClientHelper.java | 0 .../engine/connector/HttpExchangeCall.java | 0 .../engine/connector/HttpProtocolHelper.java | 0 .../engine/connector/HttpServerHelper.java | 0 .../connector/HttpUrlConnectionCall.java | 0 .../engine/connector/HttpsServerHelper.java | 0 .../org/restlet/engine/connector/Method.java | 0 .../engine/connector/NetServerHelper.java | 0 .../engine/connector/ProtocolHelper.java | 0 .../engine/connector/ServerHelper.java | 0 .../org/restlet/engine/connector/package.html | 0 .../engine/converter/ConverterHelper.java | 0 .../engine/converter/ConverterUtils.java | 0 .../engine/converter/DefaultConverter.java | 0 .../converter/StatusInfoHtmlConverter.java | 0 .../org/restlet/engine/converter/package.html | 0 .../engine/header/CacheDirectiveReader.java | 0 .../engine/header/CacheDirectiveWriter.java | 0 .../engine/header/ChallengeRequestReader.java | 0 .../engine/header/ChallengeWriter.java | 0 .../restlet/engine/header/ContentType.java | 0 .../engine/header/ContentTypeReader.java | 0 .../restlet/engine/header/CookieReader.java | 0 .../engine/header/CookieSettingReader.java | 0 .../engine/header/CookieSettingWriter.java | 0 .../restlet/engine/header/CookieWriter.java | 0 .../org/restlet/engine/header/DateWriter.java | 0 .../engine/header/DimensionReader.java | 0 .../engine/header/DimensionWriter.java | 0 .../engine/header/DispositionReader.java | 0 .../engine/header/DispositionWriter.java | 0 .../restlet/engine/header/EncodingReader.java | 0 .../restlet/engine/header/EncodingWriter.java | 0 .../engine/header/ExpectationReader.java | 0 .../engine/header/ExpectationWriter.java | 0 .../engine/header/HeaderConstants.java | 0 .../restlet/engine/header/HeaderReader.java | 0 .../restlet/engine/header/HeaderUtils.java | 0 .../restlet/engine/header/HeaderWriter.java | 0 .../restlet/engine/header/LanguageReader.java | 0 .../restlet/engine/header/LanguageWriter.java | 0 .../restlet/engine/header/MetadataWriter.java | 0 .../restlet/engine/header/MethodReader.java | 0 .../restlet/engine/header/MethodWriter.java | 0 .../engine/header/PreferenceReader.java | 0 .../engine/header/PreferenceWriter.java | 0 .../restlet/engine/header/ProductReader.java | 0 .../restlet/engine/header/ProductWriter.java | 0 .../restlet/engine/header/RangeReader.java | 0 .../restlet/engine/header/RangeWriter.java | 0 .../engine/header/RecipientInfoReader.java | 0 .../engine/header/RecipientInfoWriter.java | 0 .../restlet/engine/header/StringReader.java | 0 .../restlet/engine/header/StringWriter.java | 0 .../org/restlet/engine/header/TagReader.java | 0 .../org/restlet/engine/header/TagWriter.java | 0 .../restlet/engine/header/TokenReader.java | 0 .../restlet/engine/header/WarningReader.java | 0 .../restlet/engine/header/WarningWriter.java | 0 .../org/restlet}/engine/header/package.html | 0 .../restlet/engine/internal/Activator.java | 0 .../java/org/restlet/engine/io/IoUtils.java | 0 .../org/restlet/engine/io/PipeStream.java | 0 .../restlet/engine/io/RangeInputStream.java | 0 .../restlet/engine/io/ReaderInputStream.java | 0 .../engine/io/UnclosableInputStream.java | 0 .../engine/io/UnclosableOutputStream.java | 0 .../restlet/engine/io/WriterOutputStream.java | 0 .../java/org/restlet}/engine/io/package.html | 0 .../engine/local/ClapClientHelper.java | 0 .../engine/local/DirectoryServerResource.java | 0 .../java/org/restlet/engine/local/Entity.java | 0 .../engine/local/EntityClientHelper.java | 0 .../engine/local/FileClientHelper.java | 0 .../org/restlet/engine/local/FileEntity.java | 0 .../engine/local/LocalClientHelper.java | 0 .../engine/local/RiapClientHelper.java | 0 .../engine/local/RiapServerHelper.java | 0 .../restlet/engine/local/ZipClientHelper.java | 0 .../restlet/engine/local/ZipEntryEntity.java | 0 .../engine/local/ZipEntryRepresentation.java | 0 .../org/restlet/engine/local/package.html | 0 .../engine/log/AccessLogFileHandler.java | 0 .../engine/log/AccessLogFormatter.java | 0 .../engine/log/DefaultAccessLogFormatter.java | 0 .../org/restlet/engine/log/IdentClient.java | 0 .../org/restlet/engine/log/LogFilter.java | 0 .../java/org/restlet/engine/log/LogUtils.java | 0 .../org/restlet/engine/log/LoggerFacade.java | 0 .../engine/log/LoggingThreadFactory.java | 0 .../restlet/engine/log/SimplerFormatter.java | 0 .../restlet/engine/log/SimplestFormatter.java | 0 .../java/org/restlet}/engine/log/package.html | 0 .../main/java/org/restlet/engine/package.html | 0 .../engine/resource/AnnotationInfo.java | 0 .../engine/resource/AnnotationUtils.java | 0 .../resource/ClientInvocationHandler.java | 0 .../engine/resource/MethodAnnotationInfo.java | 0 .../resource/ThrowableAnnotationInfo.java | 0 .../restlet/engine/resource/VariantInfo.java | 0 .../org/restlet}/engine/resource/package.html | 0 .../engine/security/AuthenticatorHelper.java | 0 .../engine/security/AuthenticatorUtils.java | 0 .../engine/security/HttpBasicHelper.java | 0 .../restlet/engine/security/RoleMapping.java | 0 .../org/restlet/engine/security/package.html | 0 .../restlet/engine/ssl/DefaultSslContext.java | 0 .../engine/ssl/DefaultSslContextFactory.java | 0 .../restlet/engine/ssl/SslContextFactory.java | 0 .../java/org/restlet/engine/ssl/SslUtils.java | 0 .../engine/ssl/WrapperSslContextSpi.java | 0 .../ssl/WrapperSslServerSocketFactory.java | 0 .../engine/ssl/WrapperSslSocketFactory.java | 0 .../java/org/restlet/engine/ssl/package.html | 0 .../engine/util/AlphaNumericComparator.java | 0 .../engine/util/AlphabeticalComparator.java | 0 .../restlet/engine/util/BeanInfoUtils.java | 0 .../org/restlet/engine/util/CallResolver.java | 0 .../engine/util/CaseInsensitiveHashSet.java | 0 .../engine/util/ChildClientDispatcher.java | 0 .../org/restlet/engine/util/ChildContext.java | 0 .../engine/util/ContextualRunnable.java | 0 .../org/restlet/engine/util/DateUtils.java | 0 .../engine/util/DefaultSaxHandler.java | 0 .../engine/util/EngineClassLoader.java | 0 .../org/restlet/engine/util/FormReader.java | 0 .../org/restlet/engine/util/FormUtils.java | 0 .../restlet/engine/util/ImmutableDate.java | 0 .../engine/util/InternetDateFormat.java | 0 .../org/restlet/engine/util/ListUtils.java | 0 .../org/restlet/engine/util/MapResolver.java | 0 .../java/org/restlet/engine/util/Pool.java | 0 .../restlet/engine/util/ReferenceUtils.java | 0 .../org/restlet/engine/util/SetUtils.java | 0 .../org/restlet/engine/util/StringUtils.java | 0 .../org/restlet/engine/util/SystemUtils.java | 0 .../engine/util/TemplateDispatcher.java | 0 .../util/WrapperScheduledExecutorService.java | 0 .../org/restlet}/engine/util/package.html | 0 .../src/main/java/org/restlet/package.html | 0 .../AppendableRepresentation.java | 0 .../BufferingRepresentation.java | 0 .../ByteArrayRepresentation.java | 0 .../CharacterRepresentation.java | 0 .../DigesterRepresentation.java | 0 .../representation/EmptyRepresentation.java | 0 .../representation/FileRepresentation.java | 0 .../representation/InputRepresentation.java | 0 .../representation/ObjectRepresentation.java | 0 .../representation/OutputRepresentation.java | 0 .../representation/ReaderRepresentation.java | 0 .../representation/Representation.java | 0 .../representation/RepresentationInfo.java | 0 .../representation/StreamRepresentation.java | 0 .../representation/StringRepresentation.java | 0 .../org/restlet/representation/Variant.java | 0 .../representation/WriterRepresentation.java | 0 .../org/restlet/representation/package.html | 0 .../org/restlet/resource/ClientProxy.java | 0 .../org/restlet/resource/ClientResource.java | 0 .../java/org/restlet/resource/Delete.java | 0 .../java/org/restlet/resource/Directory.java | 0 .../java/org/restlet/resource/Finder.java | 0 .../main/java/org/restlet/resource/Get.java | 0 .../java/org/restlet/resource/Options.java | 0 .../main/java/org/restlet/resource/Patch.java | 0 .../main/java/org/restlet/resource/Post.java | 0 .../main/java/org/restlet/resource/Put.java | 0 .../java/org/restlet/resource/Resource.java | 0 .../restlet/resource/ResourceException.java | 0 .../java/org/restlet/resource/Result.java | 0 .../org/restlet/resource/ServerResource.java | 0 .../java/org/restlet/resource/Status.java | 0 .../java/org/restlet/resource/package.html | 0 .../java/org/restlet/routing/Extractor.java | 0 .../main/java/org/restlet/routing/Filter.java | 0 .../java/org/restlet/routing/Redirector.java | 0 .../main/java/org/restlet/routing/Route.java | 0 .../main/java/org/restlet/routing/Router.java | 0 .../java/org/restlet/routing/Template.java | 0 .../org/restlet/routing/TemplateRoute.java | 0 .../java/org/restlet/routing/Validator.java | 0 .../java/org/restlet/routing/Variable.java | 0 .../java/org/restlet/routing/VirtualHost.java | 0 .../java/org/restlet/routing/package.html | 0 .../org/restlet/security/Authenticator.java | 0 .../java/org/restlet/security/Authorizer.java | 0 .../security/CertificateAuthenticator.java | 0 .../security/ChallengeAuthenticator.java | 0 .../security/ConfidentialAuthorizer.java | 0 .../java/org/restlet/security/Enroler.java | 0 .../main/java/org/restlet/security/Group.java | 0 .../org/restlet/security/LocalVerifier.java | 0 .../org/restlet/security/MapVerifier.java | 0 .../org/restlet/security/MemoryRealm.java | 0 .../restlet/security/MethodAuthorizer.java | 0 .../main/java/org/restlet/security/Realm.java | 0 .../main/java/org/restlet/security/Role.java | 0 .../org/restlet/security/RoleAuthorizer.java | 0 .../org/restlet/security/SecretVerifier.java | 0 .../main/java/org/restlet/security/User.java | 0 .../java/org/restlet/security/Verifier.java | 0 .../java/org/restlet/security/package.html | 0 .../org/restlet/service/ConnectorService.java | 0 .../org/restlet/service/ConnegService.java | 0 .../org/restlet/service/ConverterService.java | 0 .../java/org/restlet/service/CorsService.java | 0 .../org/restlet/service/DecoderService.java | 0 .../org/restlet/service/EncoderService.java | 0 .../java/org/restlet/service/LogService.java | 0 .../org/restlet/service/MetadataService.java | 0 .../org/restlet/service/RangeService.java | 0 .../java/org/restlet/service/Service.java | 0 .../org/restlet/service/StatusService.java | 0 .../java/org/restlet/service/TaskService.java | 0 .../org/restlet/service/TunnelService.java | 0 .../service/accept-encoding.properties | 0 .../org/restlet/service/accept.properties | 0 .../java/org/restlet/service/package.html | 0 .../java/org/restlet/util/ClientList.java | 0 .../java/org/restlet/util/NamedValue.java | 0 .../main/java/org/restlet/util/Resolver.java | 0 .../main/java/org/restlet/util/RouteList.java | 0 .../main/java/org/restlet/util/Series.java | 0 .../java/org/restlet/util/ServerList.java | 0 .../java/org/restlet/util/ServiceList.java | 0 .../java/org/restlet/util/WrapperList.java | 0 .../java/org/restlet/util/WrapperMap.java | 0 .../restlet/util/WrapperRepresentation.java | 0 .../java/org/restlet/util/WrapperRequest.java | 0 .../org/restlet/util/WrapperResponse.java | 0 .../java/org/restlet/util/WrapperRestlet.java | 0 .../main/java/org/restlet/util/package.html | 0 .../src/main/resources/META-INF/MANIFEST.MF | 0 .../restlet/ApplicationContextTestCase.java | 0 .../java/org/restlet/Bug1145TestCase.java | 0 .../test/java/org/restlet/CallTestCase.java | 0 .../java/org/restlet/RestartTestCase.java | 0 .../data/AuthenticationInfoTestCase.java | 0 .../org/restlet/data/ClientInfoTestCase.java | 0 .../java/org/restlet/data/CookieTestCase.java | 0 .../org/restlet/data/FileClientTestCase.java | 0 .../restlet/data/FileReferenceTestCase.java | 0 .../java/org/restlet/data/FormTestCase.java | 0 .../org/restlet/data/LanguageTestCase.java | 0 .../org/restlet/data/MediaTypeTestCase.java | 0 .../java/org/restlet/data/MethodTestCase.java | 0 .../restlet/data/ProductTokenTestCase.java | 0 .../java/org/restlet/data/RangeTestCase.java | 0 .../restlet/data/RecipientInfoTestCase.java | 0 .../org/restlet/data/ReferenceTestCase.java | 0 .../restlet/data/RiapConnectorsTestCase.java | 0 .../java/org/restlet/data/RiapTestCase.java | 0 .../java/org/restlet/data/StatusTestCase.java | 0 .../java/org/restlet/data/TagTestCase.java | 0 .../org/restlet/data/ZipClientTestCase.java | 0 .../java/org/restlet/engine/EngineTest.java | 0 .../CorsResponseFilterTestCase.java | 0 .../RangeRepresentationTestCase.java | 0 .../application/TunnelFilterTestCase.java | 0 .../engine/header/ContentTypeTestCase.java | 0 .../engine/header/CookieReaderTestCase.java | 0 .../header/DispositionReaderTestCase.java | 0 .../header/DispositionWriterTestCase.java | 0 .../restlet/engine/header/HeaderTestCase.java | 0 .../engine/header/HeaderUtilsTestCase.java | 0 .../header/PreferenceReaderTestCase.java | 0 .../engine/header/RangeReaderTestCase.java | 0 .../restlet/engine/io/IoUtilsTestCase.java | 0 .../engine/io/ReaderInputStreamTestCase.java | 0 .../io/UnclosableInputStreamTestCase.java | 0 .../io/UnclosableOutputStreamTestCase.java | 0 .../resource/AnnotationUtilsTestCase.java | 0 .../util/AlphaNumericComparatorTestCase.java | 0 .../engine/util/DateUtilsTestCase.java | 0 .../engine/util/HtmlEncodingTestCase.java | 0 .../AppendableRepresentationTestCase.java | 0 .../DigesterRepresentationTestCase.java | 0 .../FileRepresentationTestCase.java | 0 .../AbstractAnnotatedResourceTestCase.java | 0 ...ctAnnotatedResourceWithFinderTestCase.java | 0 ...bstractGenericAnnotatedServerResource.java | 0 .../resource/AnnotatedResource01TestCase.java | 0 .../resource/AnnotatedResource02TestCase.java | 0 .../resource/AnnotatedResource03TestCase.java | 0 .../resource/AnnotatedResource04TestCase.java | 0 .../resource/AnnotatedResource05TestCase.java | 0 .../resource/AnnotatedResource06TestCase.java | 0 .../resource/AnnotatedResource07TestCase.java | 0 .../resource/AnnotatedResource08TestCase.java | 0 .../resource/AnnotatedResource12TestCase.java | 0 .../resource/AnnotatedResource13TestCase.java | 0 .../resource/AnnotatedResource14TestCase.java | 0 .../AnnotatedResource15OkTestCase.java | 0 .../resource/AnnotatedResource15TestCase.java | 0 .../resource/AnnotatedResource16TestCase.java | 0 .../resource/AnnotatedResource17TestCase.java | 0 .../resource/AnnotatedResource18TestCase.java | 0 .../resource/AnnotatedResource20TestCase.java | 0 .../restlet/resource/DirectoryTestCase.java | 0 .../GenericAnnotatedServerResource.java | 0 .../resource/GenericServerResource16.java | 0 .../resource/GenericServerResource17.java | 0 .../java/org/restlet/resource/MyBean.java | 0 .../org/restlet/resource/MyException01.java | 0 .../org/restlet/resource/MyException02.java | 0 .../org/restlet/resource/MyResource01.java | 0 .../org/restlet/resource/MyResource02.java | 0 .../org/restlet/resource/MyResource03.java | 0 .../org/restlet/resource/MyResource04.java | 0 .../org/restlet/resource/MyResource05.java | 0 .../org/restlet/resource/MyResource06.java | 0 .../org/restlet/resource/MyResource07.java | 0 .../org/restlet/resource/MyResource08.java | 0 .../org/restlet/resource/MyResource12.java | 0 .../org/restlet/resource/MyResource17.java | 0 .../org/restlet/resource/MyResource20.java | 0 .../restlet/resource/MyServerResource01.java | 0 .../restlet/resource/MyServerResource12.java | 0 .../restlet/resource/MyServerResource15.java | 0 .../resource/MyServerResource15Ok.java | 0 .../restlet/resource/MyServerResource16.java | 0 .../restlet/resource/MyServerResource17.java | 0 .../restlet/resource/MyServerResource18.java | 0 .../restlet/resource/MyServerResource20.java | 0 .../routing/AbstractFilterTestCase.java | 0 .../org/restlet/routing/FilterTestCase.java | 0 .../java/org/restlet/routing/MockFilter.java | 0 .../java/org/restlet/routing/MockRestlet.java | 0 .../org/restlet/routing/RedirectTestCase.java | 0 .../restlet/routing/RouteListTestCase.java | 0 .../org/restlet/routing/TemplateTestCase.java | 0 .../org/restlet/routing/TraceRestlet.java | 0 .../restlet/routing/ValidatorTestCase.java | 0 .../restlet/security/HelloWorldRestlet.java | 0 .../restlet/security/HttpBasicTestCase.java | 0 .../org/restlet/security/MemoryRealmTest.java | 0 .../org/restlet/security/RoleTestCase.java | 0 .../org/restlet/security/SaasApplication.java | 0 .../org/restlet/security/SaasComponent.java | 0 .../restlet/security/SecurityTestCase.java | 0 .../java/org/restlet/security/package.html | 0 .../service/ConnegServiceTestCase.java | 0 .../service/MetadataServiceTestCase.java | 0 .../service/StatusServiceTestCase.java | 0 .../service/UserAgentTestResource.java | 0 .../UserAgentTunnelFilterTestCase.java | 0 .../test/resources/maven-version.properties | 0 pom.xml | 30 +- readme.md | 8 +- 922 files changed, 39 insertions(+), 56727 deletions(-) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/pom.xml (96%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/AwsAuthenticator.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/CookieAuthenticator.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/DigestAuthenticator.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/DigestUtils.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/DigestVerifier.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/AwsUtils.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/AwsVerifier.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/CryptoUtils.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/HttpAwsQueryHelper.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/HttpAwsS3Helper.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyHelper.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyLiteHelper.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/HttpDigestHelper.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/internal/HttpDigestVerifier.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/java/org/restlet/ext/crypto/package.html (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/main/resources/META-INF/services/org.restlet.engine.security.AuthenticatorHelper (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/test/java/org/restlet/ext/crypto/CookieAuthenticatorTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/test/java/org/restlet/ext/crypto/DigestVerifierTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/test/java/org/restlet/ext/crypto/HttpDigestTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HelperTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HostNameTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3SigningTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3VerifierTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.crypto => org.restlet.ext.crypto}/src/test/java/org/restlet/ext/crypto/internal/HttpDigestHelperTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/pom.xml (96%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/main/java/org/restlet/ext/freemarker/ContextTemplateLoader.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/main/java/org/restlet/ext/freemarker/FreemarkerConverter.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/main/java/org/restlet/ext/freemarker/TemplateFilter.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/main/java/org/restlet/ext/freemarker/TemplateRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/main/java/org/restlet/ext/freemarker/internal/ResolverHashModel.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/main/java/org/restlet/ext/freemarker/internal/ScalarModel.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/main/java/org/restlet/ext/freemarker/package.html (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/test/java/org/restlet/ext/freemarker/FreeMarkerTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/test/java/org/restlet/ext/freemarker/TemplateFilterTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/test/resources/org/restlet/ext/freemarker/notATemplate.txt (100%) rename {org.restlet.java/org.restlet.ext.freemarker => org.restlet.ext.freemarker}/src/test/resources/org/restlet/ext/freemarker/template.txt.fmt (100%) rename {org.restlet.java/org.restlet.ext.gson => org.restlet.ext.gson}/pom.xml (97%) rename {org.restlet.java/org.restlet.ext.gson => org.restlet.ext.gson}/src/main/java/org/restlet/ext/gson/GsonConverter.java (100%) rename {org.restlet.java/org.restlet.ext.gson => org.restlet.ext.gson}/src/main/java/org/restlet/ext/gson/GsonRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.gson => org.restlet.ext.gson}/src/main/java/org/restlet/ext/gson/package.html (100%) rename {org.restlet.java/org.restlet.ext.gson => org.restlet.ext.gson}/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper (100%) rename {org.restlet.java/org.restlet.ext.gson => org.restlet.ext.gson}/src/test/java/org/restlet/ext/gson/GsonTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jaas => org.restlet.ext.jaas}/pom.xml (95%) rename {org.restlet.java/org.restlet.ext.jaas => org.restlet.ext.jaas}/src/main/java/org/restlet/ext/jaas/ChallengeCallbackHandler.java (100%) rename {org.restlet.java/org.restlet.ext.jaas => org.restlet.ext.jaas}/src/main/java/org/restlet/ext/jaas/JaasUtils.java (100%) rename {org.restlet.java/org.restlet.ext.jaas => org.restlet.ext.jaas}/src/main/java/org/restlet/ext/jaas/JaasVerifier.java (100%) rename {org.restlet.java/org.restlet.ext.jaas => org.restlet.ext.jaas}/src/main/java/org/restlet/ext/jaas/package.html (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/pom.xml (98%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/main/java/org/restlet/ext/jackson/JacksonConverter.java (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/main/java/org/restlet/ext/jackson/JacksonRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/main/java/org/restlet/ext/jackson/internal/XmlFactoryProvider.java (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/main/java/org/restlet/ext/jackson/package.html (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/test/java/org/restlet/ext/jackson/Customer.java (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/test/java/org/restlet/ext/jackson/Invoice.java (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/test/java/org/restlet/ext/jackson/JacksonTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/test/java/org/restlet/ext/jackson/MyException.java (100%) rename {org.restlet.java/org.restlet.ext.jackson => org.restlet.ext.jackson}/src/test/resources/org/restlet/ext/jackson/jacksonBomb.xml (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/README.md (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/pom.xml (98%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/HttpClientHelper.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/HttpServerHelper.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/HttpsServerHelper.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/MultiPartRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/internal/JettyHandler.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/internal/JettyServerCall.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryClient.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryServer.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/java/org/restlet/ext/jetty/package.html (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/AsyncTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/FormDataSetTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/Lock.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/MultiPartRepresentationTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/ShutdownHookTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingPutTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/ConnectorTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/GetChunkedTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/GetQueryParamTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/GetTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/HttpTransportProtocolsTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/PostPutTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/RemoteClientAddressTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/SslClientContextGetTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/connectors/SslGetTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/AbstractAnnotatedServerResource03.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_01.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_02.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource09TestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource10TestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource11TestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/JettyConnectorTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/MyResource09.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/MyResource10.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/MyResource11.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/SIMethod.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/SNIMethod.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/USIMethod.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/java/org/restlet/ext/jetty/resource/USNIMethod.java (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks (100%) rename {org.restlet.java/org.restlet.ext.jetty => org.restlet.ext.jetty}/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/pom.xml (96%) rename {org.restlet.gwt/org.restlet.gwt.ext.json/src/main/resources => org.restlet.ext.json/src/main/java}/org/restlet/JSON.gwt.xml (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/src/main/java/org/restlet/ext/json/JsonConverter.java (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/src/main/java/org/restlet/ext/json/JsonRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/src/main/java/org/restlet/ext/json/JsonpFilter.java (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/src/main/java/org/restlet/ext/json/JsonpRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/src/main/java/org/restlet/ext/json/package.html (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/src/test/java/org/restlet/ext/json/JsonpFilterTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.json => org.restlet.ext.json}/src/test/java/org/restlet/ext/json/JsonpRepresentationTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/pom.xml (96%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/ServerServlet.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/ServletAdapter.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/ServletUtils.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/java/org/restlet/ext/servlet/package.html (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/resources/META-INF/MANIFEST.MF (100%) rename {org.restlet.java/org.restlet.ext.servlet => org.restlet.ext.servlet}/src/main/resources/OSGI-INF/restlet.xml (100%) rename {org.restlet.java/org.restlet.ext.slf4j => org.restlet.ext.slf4j}/pom.xml (96%) rename {org.restlet.java/org.restlet.ext.slf4j => org.restlet.ext.slf4j}/src/main/java/org/restlet/ext/slf4j/Slf4jLogger.java (100%) rename {org.restlet.java/org.restlet.ext.slf4j => org.restlet.ext.slf4j}/src/main/java/org/restlet/ext/slf4j/Slf4jLoggerFacade.java (100%) rename {org.restlet.java/org.restlet.ext.slf4j => org.restlet.ext.slf4j}/src/main/java/org/restlet/ext/slf4j/package.html (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/pom.xml (98%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringBeanFinder.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringBeanRouter.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringComponent.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringContext.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringFinder.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringHost.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringResource.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringRouter.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringServer.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/SpringServerServlet.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/main/java/org/restlet/ext/spring/package.html (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/test/java/org/restlet/ext/spring/SpringBeanFinderTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/test/java/org/restlet/ext/spring/SpringBeanRouterTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/test/java/org/restlet/ext/spring/SpringTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/test/java/org/restlet/ext/spring/resources/OrderResource.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/test/java/org/restlet/ext/spring/resources/OrdersResource.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/test/java/org/restlet/ext/spring/resources/UserResource.java (100%) rename {org.restlet.java/org.restlet.ext.spring => org.restlet.ext.spring}/src/test/resources/org/restlet/ext/spring/SpringTestCase.xml (100%) rename {org.restlet.java/org.restlet.ext.thymeleaf => org.restlet.ext.thymeleaf}/pom.xml (96%) rename {org.restlet.java/org.restlet.ext.thymeleaf => org.restlet.ext.thymeleaf}/src/main/java/org/restlet/ext/thymeleaf/TemplateFilter.java (100%) rename {org.restlet.java/org.restlet.ext.thymeleaf => org.restlet.ext.thymeleaf}/src/main/java/org/restlet/ext/thymeleaf/TemplateRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.thymeleaf => org.restlet.ext.thymeleaf}/src/main/java/org/restlet/ext/thymeleaf/ThymeleafConverter.java (100%) rename {org.restlet.java/org.restlet.ext.thymeleaf => org.restlet.ext.thymeleaf}/src/main/java/org/restlet/ext/thymeleaf/package.html (100%) rename {org.restlet.java/org.restlet.ext.thymeleaf => org.restlet.ext.thymeleaf}/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper (100%) rename {org.restlet.java/org.restlet.ext.thymeleaf => org.restlet.ext.thymeleaf}/src/test/java/org/restlet/ext/thymeleaf/ThymeleafTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.thymeleaf => org.restlet.ext.thymeleaf}/src/test/resources/org/restlet/ext/thymeleaf/test.html (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/pom.xml (96%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/main/java/org/restlet/ext/velocity/RepresentationResourceLoader.java (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/main/java/org/restlet/ext/velocity/TemplateFilter.java (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/main/java/org/restlet/ext/velocity/TemplateRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/main/java/org/restlet/ext/velocity/VelocityConverter.java (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/main/java/org/restlet/ext/velocity/package.html (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/test/java/org/restlet/ext/velocity/TemplateFilterTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/test/java/org/restlet/ext/velocity/VelocityTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/test/resources/org/restlet/ext/velocity/notATemplate.txt (100%) rename {org.restlet.java/org.restlet.ext.velocity => org.restlet.ext.velocity}/src/test/resources/org/restlet/ext/velocity/template.txt.vm (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/pom.xml (96%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/DomRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/NodeList.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/SaxRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/TransformRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/Transformer.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/XmlConverter.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/XmlRepresentation.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/XmlWriter.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/internal/AbstractXmlReader.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/internal/ContextResolver.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/java/org/restlet/ext/xml/package.html (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/test/java/org/restlet/ext/xml/ResolvingTransformerTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/test/java/org/restlet/ext/xml/TransformRepresentationTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/test/java/org/restlet/ext/xml/TransformerTestCase.java (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xml (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xsl (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xml (100%) rename {org.restlet.java/org.restlet.ext.xml => org.restlet.ext.xml}/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xsl (100%) delete mode 100644 org.restlet.gwt/org.restlet.gwt.ext.json/pom.xml delete mode 100644 org.restlet.gwt/org.restlet.gwt.ext.json/src/main/java/org/restlet/client/ext/json/JsonRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt.ext.json/src/main/java/org/restlet/client/ext/json/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt.ext.xml/pom.xml delete mode 100644 org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/java/org/restlet/client/ext/xml/DomRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/java/org/restlet/client/ext/xml/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/resources/org/restlet/XML.gwt.xml delete mode 100644 org.restlet.gwt/org.restlet.gwt/pom.xml delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/Restlet.gwt.xml delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Client.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Connector.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Context.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Message.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Request.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Response.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Restlet.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Uniform.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/AuthenticationInfo.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CacheDirective.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeMessage.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeRequest.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeResponse.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeScheme.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CharacterSet.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ClientInfo.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Conditions.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Cookie.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CookieSetting.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Digest.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Dimension.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Disposition.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Encoding.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Form.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Header.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Language.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/MediaType.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Metadata.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Method.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Parameter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Preference.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Product.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Protocol.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Range.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/RecipientInfo.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Reference.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ServerInfo.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Status.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Tag.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Warning.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Engine.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Helper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/RestletHelper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/Adapter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/Call.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/ClientAdapter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/ClientCall.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/GwtClientCall.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/GwtHttpClientHelper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/HttpClientHelper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/MetadataExtension.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/StatusInfo.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ClientHelper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ConnectorHelper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/HttpProtocolHelper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/Method.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ProtocolHelper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/WebDavProtocolHelper.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CacheDirectiveReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CacheDirectiveWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ChallengeRequestReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ChallengeWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ContentType.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ContentTypeReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieSettingReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieSettingWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DateWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DimensionReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DimensionWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DispositionReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DispositionWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/EncodingReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/EncodingWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderConstants.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/LanguageReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/LanguageWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MetadataWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MethodReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MethodWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/PreferenceReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/PreferenceWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ProductReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ProductWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RangeReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RangeWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RecipientInfoReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RecipientInfoWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/StringReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/StringWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TagReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TagWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TokenReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/WarningReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/WarningWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/IoUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/StringInputStream.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/log/LoggerFacade.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/resource/GwtClientProxy.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/Base64.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CacheDirectiveSeries.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CaseInsensitiveHashSet.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CookieSeries.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CookieSettingSeries.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/DateUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/FormReader.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/FormUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/HeaderSeries.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ImmutableDate.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ListUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ParameterSeries.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/SetUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/StringUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/SystemUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/CopyOnWriteArrayList.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/CopyOnWriteArraySet.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/StringWriter.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/UnknownHostException.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/UnsupportedEncodingException.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/CharacterRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/EmptyRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/InputRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/ObjectRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/Representation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/RepresentationInfo.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/StreamRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/StringRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/Variant.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ClientProxy.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ClientResource.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Delete.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ExceptionHandler.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Get.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Options.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Patch.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Post.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Put.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Resource.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ResourceException.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Result.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Status.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/MetadataService.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/Service.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/ClientList.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/NamedValue.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/Series.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperList.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperMap.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRepresentation.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRequest.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperResponse.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRestlet.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/AnnotationInfo.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/AnnotationUtils.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/ClientProxyGenerator.java delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/package.html delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/main/resources/org/restlet/Restlet.gwt.xml delete mode 100644 org.restlet.gwt/org.restlet.gwt/src/test/java/org/restlet/client/engine/EngineTest.java delete mode 100644 org.restlet.gwt/pom.xml delete mode 100644 org.restlet.java/org.restlet.ext.atom/pom.xml delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/AtomConverter.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Categories.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Category.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Collection.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Content.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Entry.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/EntryReader.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Feed.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/FeedReader.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Generator.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Link.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Person.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Relation.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Service.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Source.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Text.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Workspace.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/CategoriesContentReader.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/EntryContentReader.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/FeedContentReader.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/ServiceContentReader.java delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/package.html delete mode 100644 org.restlet.java/org.restlet.ext.atom/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper delete mode 100644 org.restlet.java/org.restlet.ext.guice/README.md delete mode 100644 org.restlet.java/org.restlet.ext.guice/pom.xml delete mode 100644 org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/FinderFactory.java delete mode 100644 org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/ResourceInjectingApplication.java delete mode 100644 org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/RestletGuice.java delete mode 100644 org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/SelfInjectingServerResource.java delete mode 100644 org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/SelfInjectingServerResourceModule.java delete mode 100644 org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/package-info.java delete mode 100644 org.restlet.java/org.restlet.ext.guice/src/test/java/org/restlet/ext/guice/GuiceSelfInjectingServerResourceModuleTestCase.java delete mode 100644 org.restlet.java/org.restlet.ext.guice/src/test/java/org/restlet/ext/guice/GuiceWrappedFinderTestCase.java delete mode 100644 org.restlet.java/org.restlet.ext.gwt/pom.xml delete mode 100644 org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/GwtConverter.java delete mode 100644 org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/ObjectRepresentation.java delete mode 100644 org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/SimpleSerializationPolicy.java delete mode 100644 org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/SimpleSerializationPolicyProvider.java delete mode 100644 org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/package.html delete mode 100644 org.restlet.java/org.restlet.ext.gwt/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/pom.xml delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/package.html delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/JaxbBasicConverterTestCase.java delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/JaxbIntegrationConverterTestCase.java delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java delete mode 100644 org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java delete mode 100644 org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/JSON.gwt.xml delete mode 100644 org.restlet.java/org.restlet.ext.odata/pom.xml delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Generator.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Query.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Service.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/EntryContentHandler.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/EntryIterator.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/FeedContentHandler.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Association.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationEnd.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationSet.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationSetEnd.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ComplexProperty.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ComplexType.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntityContainer.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntitySet.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntityType.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/FunctionImport.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Mapping.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Metadata.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/MetadataReader.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/NamedObject.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Namespace.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/NavigationProperty.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ODataType.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Parameter.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Property.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Schema.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Type.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/TypeUtils.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/reflect/ReflectUtils.java delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/complexType.ftl delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/entityType.ftl delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/service.ftl delete mode 100644 org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/package.html delete mode 100644 org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/package.html delete mode 100644 org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/package.html delete mode 100644 org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/package.html delete mode 100644 org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/package.html delete mode 100644 org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/package.html delete mode 100644 org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/package.html delete mode 100644 org.restlet.java/org.restlet/src/test/resources/maven-version.properties delete mode 100644 org.restlet.java/pom.xml rename {org.restlet.java/org.restlet => org.restlet}/pom.xml (98%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Application.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Client.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Component.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Connector.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Context.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Message.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Request.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Response.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Restlet.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Server.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/Uniform.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/AuthenticationInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/CacheDirective.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/ChallengeMessage.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/ChallengeRequest.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/ChallengeResponse.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/ChallengeScheme.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/CharacterSet.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/ClientInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Conditions.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Cookie.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/CookieSetting.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Digest.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Dimension.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Disposition.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Encoding.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Expectation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Form.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Header.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Language.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/LocalReference.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/MediaType.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Metadata.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Method.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Parameter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Preference.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Product.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Protocol.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Range.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/RecipientInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Reference.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/ReferenceList.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/ServerInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Status.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Tag.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/Warning.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/agent.properties (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/data/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/CompositeHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/Edition.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/Engine.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/Helper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/RestletHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/Adapter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/Call.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/ClientAdapter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/ClientCall.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/HttpClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/HttpRequest.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/HttpResponse.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/ServerAdapter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/ServerCall.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/adapter/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/ApplicationHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/Conneg.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/CorsFilter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/CorsResponseHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/DecodeRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/Decoder.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/EncodeRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/Encoder.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/FlexibleConneg.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/MetadataExtension.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/RangeFilter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/RangeRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/StatusFilter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/StatusInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/StrictConneg.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/application/TunnelFilter.java (100%) rename {org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client => org.restlet/src/main/java/org/restlet}/engine/application/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/ClientRoute.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/ClientRouter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/ComponentClientDispatcher.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/ComponentContext.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/ComponentHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/HostRoute.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/InternalRouter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/ServerRouter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/component/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/ClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/ConnectorHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/FtpClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/HttpClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/HttpProtocolHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/HttpServerHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/Method.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/NetServerHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/ProtocolHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/ServerHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/connector/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/converter/ConverterHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/converter/ConverterUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/converter/DefaultConverter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/converter/StatusInfoHtmlConverter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/converter/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/CacheDirectiveReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/CacheDirectiveWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/ChallengeWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/ContentType.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/ContentTypeReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/CookieReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/CookieSettingReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/CookieSettingWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/CookieWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/DateWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/DimensionReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/DimensionWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/DispositionReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/DispositionWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/EncodingReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/EncodingWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/ExpectationReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/ExpectationWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/HeaderConstants.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/HeaderReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/HeaderUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/HeaderWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/LanguageReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/LanguageWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/MetadataWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/MethodReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/MethodWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/PreferenceReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/PreferenceWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/ProductReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/ProductWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/RangeReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/RangeWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/RecipientInfoReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/RecipientInfoWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/StringReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/StringWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/TagReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/TagWriter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/TokenReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/WarningReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/header/WarningWriter.java (100%) rename {org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client => org.restlet/src/main/java/org/restlet}/engine/header/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/internal/Activator.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/io/IoUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/io/PipeStream.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/io/RangeInputStream.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/io/ReaderInputStream.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/io/UnclosableInputStream.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/io/UnclosableOutputStream.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/io/WriterOutputStream.java (100%) rename {org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client => org.restlet/src/main/java/org/restlet}/engine/io/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/ClapClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/DirectoryServerResource.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/Entity.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/EntityClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/FileClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/FileEntity.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/LocalClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/RiapClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/RiapServerHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/ZipClientHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/ZipEntryEntity.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/ZipEntryRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/local/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/AccessLogFileHandler.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/AccessLogFormatter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/DefaultAccessLogFormatter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/IdentClient.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/LogFilter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/LogUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/LoggerFacade.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/LoggingThreadFactory.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/SimplerFormatter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/log/SimplestFormatter.java (100%) rename {org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client => org.restlet/src/main/java/org/restlet}/engine/log/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/resource/AnnotationInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/resource/AnnotationUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/resource/ClientInvocationHandler.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/resource/ThrowableAnnotationInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/resource/VariantInfo.java (100%) rename {org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client => org.restlet/src/main/java/org/restlet}/engine/resource/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/security/AuthenticatorHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/security/AuthenticatorUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/security/HttpBasicHelper.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/security/RoleMapping.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/security/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/ssl/DefaultSslContext.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/ssl/DefaultSslContextFactory.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/ssl/SslContextFactory.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/ssl/SslUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/ssl/WrapperSslContextSpi.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/ssl/WrapperSslServerSocketFactory.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/ssl/WrapperSslSocketFactory.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/ssl/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/AlphaNumericComparator.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/AlphabeticalComparator.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/BeanInfoUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/CallResolver.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/CaseInsensitiveHashSet.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/ChildContext.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/ContextualRunnable.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/DateUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/DefaultSaxHandler.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/EngineClassLoader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/FormReader.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/FormUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/ImmutableDate.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/InternetDateFormat.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/ListUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/MapResolver.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/Pool.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/ReferenceUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/SetUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/StringUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/SystemUtils.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/TemplateDispatcher.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/engine/util/WrapperScheduledExecutorService.java (100%) rename {org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client => org.restlet/src/main/java/org/restlet}/engine/util/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/AppendableRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/BufferingRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/ByteArrayRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/CharacterRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/DigesterRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/EmptyRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/FileRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/InputRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/ObjectRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/OutputRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/ReaderRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/Representation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/RepresentationInfo.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/StreamRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/StringRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/Variant.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/WriterRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/representation/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/ClientProxy.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/ClientResource.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Delete.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Directory.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Finder.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Get.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Options.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Patch.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Post.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Put.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Resource.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/ResourceException.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Result.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/ServerResource.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/Status.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/resource/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/Extractor.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/Filter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/Redirector.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/Route.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/Router.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/Template.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/TemplateRoute.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/Validator.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/Variable.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/VirtualHost.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/routing/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/Authenticator.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/Authorizer.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/CertificateAuthenticator.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/ChallengeAuthenticator.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/ConfidentialAuthorizer.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/Enroler.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/Group.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/LocalVerifier.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/MapVerifier.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/MemoryRealm.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/MethodAuthorizer.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/Realm.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/Role.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/RoleAuthorizer.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/SecretVerifier.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/User.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/Verifier.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/security/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/ConnectorService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/ConnegService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/ConverterService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/CorsService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/DecoderService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/EncoderService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/LogService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/MetadataService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/RangeService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/Service.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/StatusService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/TaskService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/TunnelService.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/accept-encoding.properties (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/accept.properties (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/service/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/ClientList.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/NamedValue.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/Resolver.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/RouteList.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/Series.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/ServerList.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/ServiceList.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/WrapperList.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/WrapperMap.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/WrapperRepresentation.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/WrapperRequest.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/WrapperResponse.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/WrapperRestlet.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/java/org/restlet/util/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/main/resources/META-INF/MANIFEST.MF (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/ApplicationContextTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/Bug1145TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/CallTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/RestartTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/AuthenticationInfoTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/ClientInfoTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/CookieTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/FileClientTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/FileReferenceTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/FormTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/LanguageTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/MediaTypeTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/MethodTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/ProductTokenTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/RangeTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/RecipientInfoTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/ReferenceTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/RiapConnectorsTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/RiapTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/StatusTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/TagTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/data/ZipClientTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/EngineTest.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/application/CorsResponseFilterTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/application/RangeRepresentationTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/application/TunnelFilterTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/header/ContentTypeTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/header/CookieReaderTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/header/DispositionReaderTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/header/DispositionWriterTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/header/HeaderTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/header/HeaderUtilsTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/header/PreferenceReaderTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/header/RangeReaderTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/io/IoUtilsTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/io/ReaderInputStreamTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/io/UnclosableInputStreamTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/io/UnclosableOutputStreamTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/resource/AnnotationUtilsTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/util/AlphaNumericComparatorTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/util/DateUtilsTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/engine/util/HtmlEncodingTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/representation/AppendableRepresentationTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/representation/FileRepresentationTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AbstractAnnotatedResourceTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AbstractAnnotatedResourceWithFinderTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AbstractGenericAnnotatedServerResource.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource01TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource02TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource03TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource04TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource05TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource06TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource07TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource08TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource12TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource13TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource14TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource15OkTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource15TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource16TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource17TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource18TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/AnnotatedResource20TestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/DirectoryTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/GenericAnnotatedServerResource.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/GenericServerResource16.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/GenericServerResource17.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyBean.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyException01.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyException02.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource01.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource02.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource03.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource04.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource05.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource06.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource07.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource08.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource12.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource17.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyResource20.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyServerResource01.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyServerResource12.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyServerResource15.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyServerResource15Ok.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyServerResource16.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyServerResource17.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyServerResource18.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/resource/MyServerResource20.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/AbstractFilterTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/FilterTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/MockFilter.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/MockRestlet.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/RedirectTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/RouteListTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/TemplateTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/TraceRestlet.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/routing/ValidatorTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/security/HelloWorldRestlet.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/security/HttpBasicTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/security/MemoryRealmTest.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/security/RoleTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/security/SaasApplication.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/security/SaasComponent.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/security/SecurityTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/security/package.html (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/service/ConnegServiceTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/service/MetadataServiceTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/service/StatusServiceTestCase.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/service/UserAgentTestResource.java (100%) rename {org.restlet.java/org.restlet => org.restlet}/src/test/java/org/restlet/service/UserAgentTunnelFilterTestCase.java (100%) rename {org.restlet.gwt/org.restlet.gwt => org.restlet}/src/test/resources/maven-version.properties (100%) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9d3be3d827..28e3cd8f00 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,7 +3,7 @@ name: CI on: push: branches: - - "2.6" + - "2.7" pull_request: workflow_dispatch: concurrency: diff --git a/changes.md b/changes.md index 7f8b86a00a..b41f39daa4 100644 --- a/changes.md +++ b/changes.md @@ -3,4 +3,5 @@ Changes log - 2.7 Milestone 1 (??-06-2025) - Misc - \ No newline at end of file + - Remove deprecated extension Atom, Guice, GWT, JAXB, OData + - Remove edition GWT \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.crypto/pom.xml b/org.restlet.ext.crypto/pom.xml similarity index 96% rename from org.restlet.java/org.restlet.ext.crypto/pom.xml rename to org.restlet.ext.crypto/pom.xml index b17aafa1dd..36b0448377 100644 --- a/org.restlet.java/org.restlet.ext.crypto/pom.xml +++ b/org.restlet.ext.crypto/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.crypto diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/AwsAuthenticator.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/AwsAuthenticator.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/AwsAuthenticator.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/AwsAuthenticator.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/CookieAuthenticator.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/CookieAuthenticator.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/CookieAuthenticator.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/CookieAuthenticator.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestAuthenticator.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestAuthenticator.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestAuthenticator.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestAuthenticator.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestUtils.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestUtils.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestUtils.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestUtils.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestVerifier.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestVerifier.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestVerifier.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/DigestVerifier.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/AwsUtils.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/AwsUtils.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/AwsUtils.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/AwsUtils.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/AwsVerifier.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/AwsVerifier.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/AwsVerifier.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/AwsVerifier.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/CryptoUtils.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/CryptoUtils.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/CryptoUtils.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/CryptoUtils.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAwsQueryHelper.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAwsQueryHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAwsQueryHelper.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAwsQueryHelper.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAwsS3Helper.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAwsS3Helper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAwsS3Helper.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAwsS3Helper.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyHelper.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyHelper.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyHelper.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyLiteHelper.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyLiteHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyLiteHelper.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpAzureSharedKeyLiteHelper.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpDigestHelper.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpDigestHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpDigestHelper.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpDigestHelper.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpDigestVerifier.java b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpDigestVerifier.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpDigestVerifier.java rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/internal/HttpDigestVerifier.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/package.html b/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/package.html rename to org.restlet.ext.crypto/src/main/java/org/restlet/ext/crypto/package.html diff --git a/org.restlet.java/org.restlet.ext.crypto/src/main/resources/META-INF/services/org.restlet.engine.security.AuthenticatorHelper b/org.restlet.ext.crypto/src/main/resources/META-INF/services/org.restlet.engine.security.AuthenticatorHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/main/resources/META-INF/services/org.restlet.engine.security.AuthenticatorHelper rename to org.restlet.ext.crypto/src/main/resources/META-INF/services/org.restlet.engine.security.AuthenticatorHelper diff --git a/org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/CookieAuthenticatorTestCase.java b/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/CookieAuthenticatorTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/CookieAuthenticatorTestCase.java rename to org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/CookieAuthenticatorTestCase.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/DigestVerifierTestCase.java b/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/DigestVerifierTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/DigestVerifierTestCase.java rename to org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/DigestVerifierTestCase.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/HttpDigestTestCase.java b/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/HttpDigestTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/HttpDigestTestCase.java rename to org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/HttpDigestTestCase.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HelperTestCase.java b/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HelperTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HelperTestCase.java rename to org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HelperTestCase.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HostNameTestCase.java b/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HostNameTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HostNameTestCase.java rename to org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3HostNameTestCase.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3SigningTestCase.java b/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3SigningTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3SigningTestCase.java rename to org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3SigningTestCase.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3VerifierTestCase.java b/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3VerifierTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3VerifierTestCase.java rename to org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpAwsS3VerifierTestCase.java diff --git a/org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpDigestHelperTestCase.java b/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpDigestHelperTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpDigestHelperTestCase.java rename to org.restlet.ext.crypto/src/test/java/org/restlet/ext/crypto/internal/HttpDigestHelperTestCase.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/pom.xml b/org.restlet.ext.freemarker/pom.xml similarity index 96% rename from org.restlet.java/org.restlet.ext.freemarker/pom.xml rename to org.restlet.ext.freemarker/pom.xml index 8072e07044..2a9f036de3 100644 --- a/org.restlet.java/org.restlet.ext.freemarker/pom.xml +++ b/org.restlet.ext.freemarker/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.freemarker diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/ContextTemplateLoader.java b/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/ContextTemplateLoader.java similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/ContextTemplateLoader.java rename to org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/ContextTemplateLoader.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/FreemarkerConverter.java b/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/FreemarkerConverter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/FreemarkerConverter.java rename to org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/FreemarkerConverter.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/TemplateFilter.java b/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/TemplateFilter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/TemplateFilter.java rename to org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/TemplateFilter.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/TemplateRepresentation.java b/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/TemplateRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/TemplateRepresentation.java rename to org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/TemplateRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/internal/ResolverHashModel.java b/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/internal/ResolverHashModel.java similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/internal/ResolverHashModel.java rename to org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/internal/ResolverHashModel.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/internal/ScalarModel.java b/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/internal/ScalarModel.java similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/internal/ScalarModel.java rename to org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/internal/ScalarModel.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/package.html b/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/package.html rename to org.restlet.ext.freemarker/src/main/java/org/restlet/ext/freemarker/package.html diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.ext.freemarker/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper rename to org.restlet.ext.freemarker/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/test/java/org/restlet/ext/freemarker/FreeMarkerTestCase.java b/org.restlet.ext.freemarker/src/test/java/org/restlet/ext/freemarker/FreeMarkerTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/test/java/org/restlet/ext/freemarker/FreeMarkerTestCase.java rename to org.restlet.ext.freemarker/src/test/java/org/restlet/ext/freemarker/FreeMarkerTestCase.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/test/java/org/restlet/ext/freemarker/TemplateFilterTestCase.java b/org.restlet.ext.freemarker/src/test/java/org/restlet/ext/freemarker/TemplateFilterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/test/java/org/restlet/ext/freemarker/TemplateFilterTestCase.java rename to org.restlet.ext.freemarker/src/test/java/org/restlet/ext/freemarker/TemplateFilterTestCase.java diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/test/resources/org/restlet/ext/freemarker/notATemplate.txt b/org.restlet.ext.freemarker/src/test/resources/org/restlet/ext/freemarker/notATemplate.txt similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/test/resources/org/restlet/ext/freemarker/notATemplate.txt rename to org.restlet.ext.freemarker/src/test/resources/org/restlet/ext/freemarker/notATemplate.txt diff --git a/org.restlet.java/org.restlet.ext.freemarker/src/test/resources/org/restlet/ext/freemarker/template.txt.fmt b/org.restlet.ext.freemarker/src/test/resources/org/restlet/ext/freemarker/template.txt.fmt similarity index 100% rename from org.restlet.java/org.restlet.ext.freemarker/src/test/resources/org/restlet/ext/freemarker/template.txt.fmt rename to org.restlet.ext.freemarker/src/test/resources/org/restlet/ext/freemarker/template.txt.fmt diff --git a/org.restlet.java/org.restlet.ext.gson/pom.xml b/org.restlet.ext.gson/pom.xml similarity index 97% rename from org.restlet.java/org.restlet.ext.gson/pom.xml rename to org.restlet.ext.gson/pom.xml index e75fe9297c..a63298ec40 100644 --- a/org.restlet.java/org.restlet.ext.gson/pom.xml +++ b/org.restlet.ext.gson/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.gson diff --git a/org.restlet.java/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/GsonConverter.java b/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/GsonConverter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/GsonConverter.java rename to org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/GsonConverter.java diff --git a/org.restlet.java/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/GsonRepresentation.java b/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/GsonRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/GsonRepresentation.java rename to org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/GsonRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/package.html b/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/package.html rename to org.restlet.ext.gson/src/main/java/org/restlet/ext/gson/package.html diff --git a/org.restlet.java/org.restlet.ext.gson/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.ext.gson/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.gson/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper rename to org.restlet.ext.gson/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper diff --git a/org.restlet.java/org.restlet.ext.gson/src/test/java/org/restlet/ext/gson/GsonTestCase.java b/org.restlet.ext.gson/src/test/java/org/restlet/ext/gson/GsonTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.gson/src/test/java/org/restlet/ext/gson/GsonTestCase.java rename to org.restlet.ext.gson/src/test/java/org/restlet/ext/gson/GsonTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jaas/pom.xml b/org.restlet.ext.jaas/pom.xml similarity index 95% rename from org.restlet.java/org.restlet.ext.jaas/pom.xml rename to org.restlet.ext.jaas/pom.xml index d67151a51c..02cbc42dc9 100644 --- a/org.restlet.java/org.restlet.ext.jaas/pom.xml +++ b/org.restlet.ext.jaas/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.jaas diff --git a/org.restlet.java/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/ChallengeCallbackHandler.java b/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/ChallengeCallbackHandler.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/ChallengeCallbackHandler.java rename to org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/ChallengeCallbackHandler.java diff --git a/org.restlet.java/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/JaasUtils.java b/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/JaasUtils.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/JaasUtils.java rename to org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/JaasUtils.java diff --git a/org.restlet.java/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/JaasVerifier.java b/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/JaasVerifier.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/JaasVerifier.java rename to org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/JaasVerifier.java diff --git a/org.restlet.java/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/package.html b/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/package.html rename to org.restlet.ext.jaas/src/main/java/org/restlet/ext/jaas/package.html diff --git a/org.restlet.java/org.restlet.ext.jackson/pom.xml b/org.restlet.ext.jackson/pom.xml similarity index 98% rename from org.restlet.java/org.restlet.ext.jackson/pom.xml rename to org.restlet.ext.jackson/pom.xml index ef375c6c53..8bb4505f79 100644 --- a/org.restlet.java/org.restlet.ext.jackson/pom.xml +++ b/org.restlet.ext.jackson/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.jackson diff --git a/org.restlet.java/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/JacksonConverter.java b/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/JacksonConverter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/JacksonConverter.java rename to org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/JacksonConverter.java diff --git a/org.restlet.java/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/JacksonRepresentation.java b/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/JacksonRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/JacksonRepresentation.java rename to org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/JacksonRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/internal/XmlFactoryProvider.java b/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/internal/XmlFactoryProvider.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/internal/XmlFactoryProvider.java rename to org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/internal/XmlFactoryProvider.java diff --git a/org.restlet.java/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/package.html b/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/package.html rename to org.restlet.ext.jackson/src/main/java/org/restlet/ext/jackson/package.html diff --git a/org.restlet.java/org.restlet.ext.jackson/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.ext.jackson/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper rename to org.restlet.ext.jackson/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper diff --git a/org.restlet.java/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/Customer.java b/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/Customer.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/Customer.java rename to org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/Customer.java diff --git a/org.restlet.java/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/Invoice.java b/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/Invoice.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/Invoice.java rename to org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/Invoice.java diff --git a/org.restlet.java/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/JacksonTestCase.java b/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/JacksonTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/JacksonTestCase.java rename to org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/JacksonTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/MyException.java b/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/MyException.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/MyException.java rename to org.restlet.ext.jackson/src/test/java/org/restlet/ext/jackson/MyException.java diff --git a/org.restlet.java/org.restlet.ext.jackson/src/test/resources/org/restlet/ext/jackson/jacksonBomb.xml b/org.restlet.ext.jackson/src/test/resources/org/restlet/ext/jackson/jacksonBomb.xml similarity index 100% rename from org.restlet.java/org.restlet.ext.jackson/src/test/resources/org/restlet/ext/jackson/jacksonBomb.xml rename to org.restlet.ext.jackson/src/test/resources/org/restlet/ext/jackson/jacksonBomb.xml diff --git a/org.restlet.java/org.restlet.ext.jetty/README.md b/org.restlet.ext.jetty/README.md similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/README.md rename to org.restlet.ext.jetty/README.md diff --git a/org.restlet.java/org.restlet.ext.jetty/pom.xml b/org.restlet.ext.jetty/pom.xml similarity index 98% rename from org.restlet.java/org.restlet.ext.jetty/pom.xml rename to org.restlet.ext.jetty/pom.xml index e05e721826..bcc9a40ba2 100644 --- a/org.restlet.java/org.restlet.ext.jetty/pom.xml +++ b/org.restlet.ext.jetty/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.jetty diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpClientHelper.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpClientHelper.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpClientHelper.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpServerHelper.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpServerHelper.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpServerHelper.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpsServerHelper.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpsServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpsServerHelper.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpsServerHelper.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/MultiPartRepresentation.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/MultiPartRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/MultiPartRepresentation.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/MultiPartRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyHandler.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyHandler.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyHandler.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyHandler.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyServerCall.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyServerCall.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyServerCall.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyServerCall.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryClient.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryClient.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryClient.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryClient.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryServer.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryServer.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryServer.java rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryServer.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/package.html b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/package.html rename to org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/package.html diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper b/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper rename to org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper diff --git a/org.restlet.java/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper b/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper rename to org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/AsyncTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/AsyncTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/AsyncTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/AsyncTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/FormDataSetTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/FormDataSetTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/FormDataSetTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/FormDataSetTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/Lock.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/Lock.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/Lock.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/Lock.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/MultiPartRepresentationTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/MultiPartRepresentationTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/MultiPartRepresentationTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/MultiPartRepresentationTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/ShutdownHookTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/ShutdownHookTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/ShutdownHookTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/ShutdownHookTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingPutTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingPutTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingPutTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingPutTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ConnectorTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ConnectorTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ConnectorTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ConnectorTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetChunkedTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetChunkedTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetChunkedTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetChunkedTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetQueryParamTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetQueryParamTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetQueryParamTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetQueryParamTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/HttpTransportProtocolsTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/HttpTransportProtocolsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/HttpTransportProtocolsTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/HttpTransportProtocolsTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/PostPutTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/PostPutTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/PostPutTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/PostPutTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/RemoteClientAddressTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/RemoteClientAddressTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/RemoteClientAddressTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/RemoteClientAddressTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslClientContextGetTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslClientContextGetTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslClientContextGetTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslClientContextGetTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslGetTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslGetTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslGetTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslGetTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AbstractAnnotatedServerResource03.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AbstractAnnotatedServerResource03.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AbstractAnnotatedServerResource03.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AbstractAnnotatedServerResource03.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_01.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_01.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_01.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_01.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_02.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_02.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_02.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_02.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource09TestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource09TestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource09TestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource09TestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource10TestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource10TestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource10TestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource10TestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource11TestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource11TestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource11TestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource11TestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/JettyConnectorTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/JettyConnectorTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/JettyConnectorTestCase.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/JettyConnectorTestCase.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource09.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource09.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource09.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource09.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource10.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource10.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource10.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource10.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource11.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource11.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource11.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource11.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SIMethod.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SIMethod.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SIMethod.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SIMethod.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SNIMethod.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SNIMethod.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SNIMethod.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SNIMethod.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USIMethod.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USIMethod.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USIMethod.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USIMethod.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USNIMethod.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USNIMethod.java similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USNIMethod.java rename to org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USNIMethod.java diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks b/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks rename to org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks diff --git a/org.restlet.java/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 b/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 similarity index 100% rename from org.restlet.java/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 rename to org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 diff --git a/org.restlet.java/org.restlet.ext.json/pom.xml b/org.restlet.ext.json/pom.xml similarity index 96% rename from org.restlet.java/org.restlet.ext.json/pom.xml rename to org.restlet.ext.json/pom.xml index 6f8027ff63..60aca3af9c 100644 --- a/org.restlet.java/org.restlet.ext.json/pom.xml +++ b/org.restlet.ext.json/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.json diff --git a/org.restlet.gwt/org.restlet.gwt.ext.json/src/main/resources/org/restlet/JSON.gwt.xml b/org.restlet.ext.json/src/main/java/org/restlet/JSON.gwt.xml similarity index 100% rename from org.restlet.gwt/org.restlet.gwt.ext.json/src/main/resources/org/restlet/JSON.gwt.xml rename to org.restlet.ext.json/src/main/java/org/restlet/JSON.gwt.xml diff --git a/org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonConverter.java b/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonConverter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonConverter.java rename to org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonConverter.java diff --git a/org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonRepresentation.java b/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonRepresentation.java rename to org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonpFilter.java b/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonpFilter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonpFilter.java rename to org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonpFilter.java diff --git a/org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonpRepresentation.java b/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonpRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonpRepresentation.java rename to org.restlet.ext.json/src/main/java/org/restlet/ext/json/JsonpRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/package.html b/org.restlet.ext.json/src/main/java/org/restlet/ext/json/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/ext/json/package.html rename to org.restlet.ext.json/src/main/java/org/restlet/ext/json/package.html diff --git a/org.restlet.java/org.restlet.ext.json/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.ext.json/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.json/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper rename to org.restlet.ext.json/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper diff --git a/org.restlet.java/org.restlet.ext.json/src/test/java/org/restlet/ext/json/JsonpFilterTestCase.java b/org.restlet.ext.json/src/test/java/org/restlet/ext/json/JsonpFilterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.json/src/test/java/org/restlet/ext/json/JsonpFilterTestCase.java rename to org.restlet.ext.json/src/test/java/org/restlet/ext/json/JsonpFilterTestCase.java diff --git a/org.restlet.java/org.restlet.ext.json/src/test/java/org/restlet/ext/json/JsonpRepresentationTestCase.java b/org.restlet.ext.json/src/test/java/org/restlet/ext/json/JsonpRepresentationTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.json/src/test/java/org/restlet/ext/json/JsonpRepresentationTestCase.java rename to org.restlet.ext.json/src/test/java/org/restlet/ext/json/JsonpRepresentationTestCase.java diff --git a/org.restlet.java/org.restlet.ext.servlet/pom.xml b/org.restlet.ext.servlet/pom.xml similarity index 96% rename from org.restlet.java/org.restlet.ext.servlet/pom.xml rename to org.restlet.ext.servlet/pom.xml index e0e1ccdc50..4604892819 100644 --- a/org.restlet.java/org.restlet.ext.servlet/pom.xml +++ b/org.restlet.ext.servlet/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.servlet diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServerServlet.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServerServlet.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServerServlet.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServerServlet.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletAdapter.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletAdapter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletAdapter.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletAdapter.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletUtils.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletUtils.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletUtils.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletUtils.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/package.html b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/package.html rename to org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/package.html diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/resources/META-INF/MANIFEST.MF b/org.restlet.ext.servlet/src/main/resources/META-INF/MANIFEST.MF similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/resources/META-INF/MANIFEST.MF rename to org.restlet.ext.servlet/src/main/resources/META-INF/MANIFEST.MF diff --git a/org.restlet.java/org.restlet.ext.servlet/src/main/resources/OSGI-INF/restlet.xml b/org.restlet.ext.servlet/src/main/resources/OSGI-INF/restlet.xml similarity index 100% rename from org.restlet.java/org.restlet.ext.servlet/src/main/resources/OSGI-INF/restlet.xml rename to org.restlet.ext.servlet/src/main/resources/OSGI-INF/restlet.xml diff --git a/org.restlet.java/org.restlet.ext.slf4j/pom.xml b/org.restlet.ext.slf4j/pom.xml similarity index 96% rename from org.restlet.java/org.restlet.ext.slf4j/pom.xml rename to org.restlet.ext.slf4j/pom.xml index e673a0cbc4..04cc137b84 100644 --- a/org.restlet.java/org.restlet.ext.slf4j/pom.xml +++ b/org.restlet.ext.slf4j/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.slf4j diff --git a/org.restlet.java/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/Slf4jLogger.java b/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/Slf4jLogger.java similarity index 100% rename from org.restlet.java/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/Slf4jLogger.java rename to org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/Slf4jLogger.java diff --git a/org.restlet.java/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/Slf4jLoggerFacade.java b/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/Slf4jLoggerFacade.java similarity index 100% rename from org.restlet.java/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/Slf4jLoggerFacade.java rename to org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/Slf4jLoggerFacade.java diff --git a/org.restlet.java/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/package.html b/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/package.html rename to org.restlet.ext.slf4j/src/main/java/org/restlet/ext/slf4j/package.html diff --git a/org.restlet.java/org.restlet.ext.spring/pom.xml b/org.restlet.ext.spring/pom.xml similarity index 98% rename from org.restlet.java/org.restlet.ext.spring/pom.xml rename to org.restlet.ext.spring/pom.xml index c16297791b..81f0e5338c 100644 --- a/org.restlet.java/org.restlet.ext.spring/pom.xml +++ b/org.restlet.ext.spring/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.spring diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringBeanFinder.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringBeanFinder.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringBeanFinder.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringBeanFinder.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringBeanRouter.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringBeanRouter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringBeanRouter.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringBeanRouter.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringComponent.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringComponent.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringComponent.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringComponent.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringContext.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringContext.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringContext.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringContext.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringFinder.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringFinder.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringFinder.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringFinder.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringHost.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringHost.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringHost.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringHost.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringResource.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringResource.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringResource.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringResource.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringRouter.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringRouter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringRouter.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringRouter.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServer.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServer.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServer.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServer.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServerServlet.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServerServlet.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServerServlet.java rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServerServlet.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/package.html b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/package.html rename to org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/package.html diff --git a/org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringBeanFinderTestCase.java b/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringBeanFinderTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringBeanFinderTestCase.java rename to org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringBeanFinderTestCase.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringBeanRouterTestCase.java b/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringBeanRouterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringBeanRouterTestCase.java rename to org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringBeanRouterTestCase.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringTestCase.java b/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringTestCase.java rename to org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/SpringTestCase.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/OrderResource.java b/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/OrderResource.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/OrderResource.java rename to org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/OrderResource.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/OrdersResource.java b/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/OrdersResource.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/OrdersResource.java rename to org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/OrdersResource.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/UserResource.java b/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/UserResource.java similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/UserResource.java rename to org.restlet.ext.spring/src/test/java/org/restlet/ext/spring/resources/UserResource.java diff --git a/org.restlet.java/org.restlet.ext.spring/src/test/resources/org/restlet/ext/spring/SpringTestCase.xml b/org.restlet.ext.spring/src/test/resources/org/restlet/ext/spring/SpringTestCase.xml similarity index 100% rename from org.restlet.java/org.restlet.ext.spring/src/test/resources/org/restlet/ext/spring/SpringTestCase.xml rename to org.restlet.ext.spring/src/test/resources/org/restlet/ext/spring/SpringTestCase.xml diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/pom.xml b/org.restlet.ext.thymeleaf/pom.xml similarity index 96% rename from org.restlet.java/org.restlet.ext.thymeleaf/pom.xml rename to org.restlet.ext.thymeleaf/pom.xml index 927997c5cd..4f55c634a9 100644 --- a/org.restlet.java/org.restlet.ext.thymeleaf/pom.xml +++ b/org.restlet.ext.thymeleaf/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.thymeleaf diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/TemplateFilter.java b/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/TemplateFilter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/TemplateFilter.java rename to org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/TemplateFilter.java diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/TemplateRepresentation.java b/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/TemplateRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/TemplateRepresentation.java rename to org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/TemplateRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/ThymeleafConverter.java b/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/ThymeleafConverter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/ThymeleafConverter.java rename to org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/ThymeleafConverter.java diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/package.html b/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/package.html rename to org.restlet.ext.thymeleaf/src/main/java/org/restlet/ext/thymeleaf/package.html diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.ext.thymeleaf/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.thymeleaf/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper rename to org.restlet.ext.thymeleaf/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/src/test/java/org/restlet/ext/thymeleaf/ThymeleafTestCase.java b/org.restlet.ext.thymeleaf/src/test/java/org/restlet/ext/thymeleaf/ThymeleafTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.thymeleaf/src/test/java/org/restlet/ext/thymeleaf/ThymeleafTestCase.java rename to org.restlet.ext.thymeleaf/src/test/java/org/restlet/ext/thymeleaf/ThymeleafTestCase.java diff --git a/org.restlet.java/org.restlet.ext.thymeleaf/src/test/resources/org/restlet/ext/thymeleaf/test.html b/org.restlet.ext.thymeleaf/src/test/resources/org/restlet/ext/thymeleaf/test.html similarity index 100% rename from org.restlet.java/org.restlet.ext.thymeleaf/src/test/resources/org/restlet/ext/thymeleaf/test.html rename to org.restlet.ext.thymeleaf/src/test/resources/org/restlet/ext/thymeleaf/test.html diff --git a/org.restlet.java/org.restlet.ext.velocity/pom.xml b/org.restlet.ext.velocity/pom.xml similarity index 96% rename from org.restlet.java/org.restlet.ext.velocity/pom.xml rename to org.restlet.ext.velocity/pom.xml index 61d13dcb8b..143e0d805b 100644 --- a/org.restlet.java/org.restlet.ext.velocity/pom.xml +++ b/org.restlet.ext.velocity/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.velocity diff --git a/org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/RepresentationResourceLoader.java b/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/RepresentationResourceLoader.java similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/RepresentationResourceLoader.java rename to org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/RepresentationResourceLoader.java diff --git a/org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/TemplateFilter.java b/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/TemplateFilter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/TemplateFilter.java rename to org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/TemplateFilter.java diff --git a/org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/TemplateRepresentation.java b/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/TemplateRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/TemplateRepresentation.java rename to org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/TemplateRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/VelocityConverter.java b/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/VelocityConverter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/VelocityConverter.java rename to org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/VelocityConverter.java diff --git a/org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/package.html b/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/package.html rename to org.restlet.ext.velocity/src/main/java/org/restlet/ext/velocity/package.html diff --git a/org.restlet.java/org.restlet.ext.velocity/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.ext.velocity/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper rename to org.restlet.ext.velocity/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper diff --git a/org.restlet.java/org.restlet.ext.velocity/src/test/java/org/restlet/ext/velocity/TemplateFilterTestCase.java b/org.restlet.ext.velocity/src/test/java/org/restlet/ext/velocity/TemplateFilterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/test/java/org/restlet/ext/velocity/TemplateFilterTestCase.java rename to org.restlet.ext.velocity/src/test/java/org/restlet/ext/velocity/TemplateFilterTestCase.java diff --git a/org.restlet.java/org.restlet.ext.velocity/src/test/java/org/restlet/ext/velocity/VelocityTestCase.java b/org.restlet.ext.velocity/src/test/java/org/restlet/ext/velocity/VelocityTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/test/java/org/restlet/ext/velocity/VelocityTestCase.java rename to org.restlet.ext.velocity/src/test/java/org/restlet/ext/velocity/VelocityTestCase.java diff --git a/org.restlet.java/org.restlet.ext.velocity/src/test/resources/org/restlet/ext/velocity/notATemplate.txt b/org.restlet.ext.velocity/src/test/resources/org/restlet/ext/velocity/notATemplate.txt similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/test/resources/org/restlet/ext/velocity/notATemplate.txt rename to org.restlet.ext.velocity/src/test/resources/org/restlet/ext/velocity/notATemplate.txt diff --git a/org.restlet.java/org.restlet.ext.velocity/src/test/resources/org/restlet/ext/velocity/template.txt.vm b/org.restlet.ext.velocity/src/test/resources/org/restlet/ext/velocity/template.txt.vm similarity index 100% rename from org.restlet.java/org.restlet.ext.velocity/src/test/resources/org/restlet/ext/velocity/template.txt.vm rename to org.restlet.ext.velocity/src/test/resources/org/restlet/ext/velocity/template.txt.vm diff --git a/org.restlet.java/org.restlet.ext.xml/pom.xml b/org.restlet.ext.xml/pom.xml similarity index 96% rename from org.restlet.java/org.restlet.ext.xml/pom.xml rename to org.restlet.ext.xml/pom.xml index e554e97af9..4b85af553a 100644 --- a/org.restlet.java/org.restlet.ext.xml/pom.xml +++ b/org.restlet.ext.xml/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet.ext.xml diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/DomRepresentation.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/DomRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/DomRepresentation.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/DomRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/NodeList.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/NodeList.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/NodeList.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/NodeList.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/SaxRepresentation.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/SaxRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/SaxRepresentation.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/SaxRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/TransformRepresentation.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/TransformRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/TransformRepresentation.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/TransformRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/Transformer.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/Transformer.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/Transformer.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/Transformer.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlConverter.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlConverter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlConverter.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlConverter.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlRepresentation.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlRepresentation.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlRepresentation.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlWriter.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlWriter.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlWriter.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/XmlWriter.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/internal/AbstractXmlReader.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/internal/AbstractXmlReader.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/internal/AbstractXmlReader.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/internal/AbstractXmlReader.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/internal/ContextResolver.java b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/internal/ContextResolver.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/internal/ContextResolver.java rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/internal/ContextResolver.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/package.html b/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/package.html similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/package.html rename to org.restlet.ext.xml/src/main/java/org/restlet/ext/xml/package.html diff --git a/org.restlet.java/org.restlet.ext.xml/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.ext.xml/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper rename to org.restlet.ext.xml/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper diff --git a/org.restlet.java/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/ResolvingTransformerTestCase.java b/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/ResolvingTransformerTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/ResolvingTransformerTestCase.java rename to org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/ResolvingTransformerTestCase.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/TransformRepresentationTestCase.java b/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/TransformRepresentationTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/TransformRepresentationTestCase.java rename to org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/TransformRepresentationTestCase.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/TransformerTestCase.java b/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/TransformerTestCase.java similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/TransformerTestCase.java rename to org.restlet.ext.xml/src/test/java/org/restlet/ext/xml/TransformerTestCase.java diff --git a/org.restlet.java/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xml b/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xml similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xml rename to org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xml diff --git a/org.restlet.java/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xsl b/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xsl similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xsl rename to org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/one/1st.xsl diff --git a/org.restlet.java/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xml b/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xml similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xml rename to org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xml diff --git a/org.restlet.java/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xsl b/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xsl similarity index 100% rename from org.restlet.java/org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xsl rename to org.restlet.ext.xml/src/test/resources/org/restlet/ext/xml/xslt/two/2nd.xsl diff --git a/org.restlet.gwt/org.restlet.gwt.ext.json/pom.xml b/org.restlet.gwt/org.restlet.gwt.ext.json/pom.xml deleted file mode 100644 index 47ff19f715..0000000000 --- a/org.restlet.gwt/org.restlet.gwt.ext.json/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - org.restlet.gwt - org.restlet.gwt.parent - 2.7-SNAPSHOT - ../pom.xml - - - org.restlet.gwt.ext.json - gwt-lib - Restlet Framework - GWT edition - JSON extension - Support for JSON representations. - - - - org.restlet.gwt - org.restlet.gwt - ${project.version} - - - - - - net.ltgt.gwt.maven - gwt-maven-plugin - true - - org.restlet.JSON - - - - - diff --git a/org.restlet.gwt/org.restlet.gwt.ext.json/src/main/java/org/restlet/client/ext/json/JsonRepresentation.java b/org.restlet.gwt/org.restlet.gwt.ext.json/src/main/java/org/restlet/client/ext/json/JsonRepresentation.java deleted file mode 100644 index 7573000785..0000000000 --- a/org.restlet.gwt/org.restlet.gwt.ext.json/src/main/java/org/restlet/client/ext/json/JsonRepresentation.java +++ /dev/null @@ -1,238 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.ext.json; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.MediaType; -import org.restlet.client.engine.io.StringInputStream; -import org.restlet.client.representation.Representation; -import org.restlet.client.representation.StringRepresentation; - -import com.google.gwt.json.client.JSONArray; -import com.google.gwt.json.client.JSONBoolean; -import com.google.gwt.json.client.JSONNull; -import com.google.gwt.json.client.JSONObject; -import com.google.gwt.json.client.JSONParser; -import com.google.gwt.json.client.JSONString; -import com.google.gwt.json.client.JSONValue; - -/** - * JSON representation based on an JSON value. JSON (JavaScript Object Notation) - * is a common serialization format similar to XML but lighter. - * - * @see JSON - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class JsonRepresentation extends Representation { - /** The source JSON representation. */ - private Representation jsonRepresentation; - - /** The wrapped JSON value. */ - private JSONValue value; - - /** - * Constructor for an empty document. - * - * @param mediaType - * The representation's media type. - */ - public JsonRepresentation(MediaType mediaType) { - super(mediaType); - this.value = JSONNull.getInstance(); - } - - /** - * Constructor from an existing DOM document. - * - * @param mediaType - * The representation's media type. - * @param value - * The source JSON value. - */ - public JsonRepresentation(MediaType mediaType, JSONValue value) { - super(mediaType); - this.value = value; - } - - /** - * Constructor. - * - * @param jsonRepresentation - * A source JSON representation to parse. - */ - public JsonRepresentation(Representation jsonRepresentation) { - super((jsonRepresentation == null) ? null : jsonRepresentation - .getMediaType()); - this.jsonRepresentation = jsonRepresentation; - } - - /** - * Constructor from a JSON string. - * - * @param jsonString - * The JSON string. - */ - public JsonRepresentation(String jsonString) { - super(MediaType.APPLICATION_JSON); - setCharacterSet(CharacterSet.UTF_8); - this.jsonRepresentation = new StringRepresentation(jsonString); - } - - /** - * Converts the representation to a JSON array. This method might trigger - * the parsing of the wrapped JSON textual representation. - * - * @return The converted JSON array. - * @throws IOException - */ - public JSONArray getJsonArray() throws IOException { - if (getValue() != null) { - return getValue().isArray(); - } - - return null; - } - - /** - * Converts the representation to a JSON Boolean. This method might trigger - * the parsing of the wrapped JSON textual representation. - * - * @return The converted JSON Boolean. - * @throws IOException - */ - public JSONBoolean getJsonBoolean() throws IOException { - if (getValue() != null) { - return getValue().isBoolean(); - } - - return null; - } - - /** - * Converts the representation to a JSON null value. This method might - * trigger the parsing of the wrapped JSON textual representation. - * - * @return The converted JSON null value. - * @throws IOException - */ - public JSONNull getJsonNull() throws IOException { - if (getValue() != null) { - return getValue().isNull(); - } - - return null; - } - - /** - * Converts the representation to a JSON object. This method might trigger - * the parsing of the wrapped JSON textual representation. - * - * @return The converted JSON object. - * @throws IOException - */ - public JSONObject getJsonObject() throws IOException { - if (getValue() != null) { - return getValue().isObject(); - } - - return null; - } - - /** - * Converts the representation to a JSON string. This method might trigger - * the parsing of the wrapped JSON textual representation. - * - * @return The converted JSON string. - * @throws IOException - */ - public JSONString getJsonString() throws IOException { - if (getValue() != null) { - return getValue().isString(); - } - - return null; - } - - @Override - public StringReader getReader() throws IOException { - return new StringReader(getText()); - } - - @Override - public long getSize() { - if (this.jsonRepresentation != null) { - return this.jsonRepresentation.getSize(); - } - return super.getSize(); - } - - @Override - public InputStream getStream() throws IOException { - return new StringInputStream(getValue().toString()); - } - - @Override - public String getText() throws IOException { - return (getValue() != null) ? getValue().toString() : null; - } - - /** - * Returns the wrapped JSON value. If no value is defined yet, it attempts - * to parse the JSON representation eventually given at construction time. - * Otherwise, it just creates a null JSON value. - * - * @return The wrapped DOM document. - * @throws IOException - */ - public JSONValue getValue() throws IOException { - if (this.value == null) { - if (this.jsonRepresentation != null) { - this.value = JSONParser - .parse(this.jsonRepresentation.getText()); - } else { - this.value = JSONNull.getInstance(); - } - } - - return this.value; - } - - /** - * Releases the wrapped JSON value and the source JSON representation if - * they have been defined. - */ - @Override - public void release() { - setValue(null); - - if (this.jsonRepresentation != null) { - this.jsonRepresentation.release(); - } - - super.release(); - } - - /** - * Sets the wrapped JSON value. - * - * @param json - * The wrapped JSON value. - */ - public void setValue(JSONValue json) { - this.value = json; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt.ext.json/src/main/java/org/restlet/client/ext/json/package.html b/org.restlet.gwt/org.restlet.gwt.ext.json/src/main/java/org/restlet/client/ext/json/package.html deleted file mode 100644 index d174d05b46..0000000000 --- a/org.restlet.gwt/org.restlet.gwt.ext.json/src/main/java/org/restlet/client/ext/json/package.html +++ /dev/null @@ -1,15 +0,0 @@ - - -Support for JSON representations. JSON stands for JavaScript Object Notation and is a lightweight -data-interchange format. This extension is based on the JSON library from Java provided -by the official JSON.org Web site. This library is useful in simple cases, but not tuned -for performance or extensive serialization support of POJOs. If you need such features, -you can also consider the XStream extension which supports both XML and JSON serialization. -

- -@since Restlet 1.0 -@see JSON project -@see User Guide - JSON extension -@deprecated Will be removed in the next 2.7/3.0 release. - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt.ext.xml/pom.xml b/org.restlet.gwt/org.restlet.gwt.ext.xml/pom.xml deleted file mode 100644 index 5346953bcd..0000000000 --- a/org.restlet.gwt/org.restlet.gwt.ext.xml/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - org.restlet.gwt - org.restlet.gwt.parent - 2.7-SNAPSHOT - ../pom.xml - - - org.restlet.gwt.ext.xml - gwt-lib - Restlet Framework - GWT edition - XML extension - Support for the XML documents. - - - - org.restlet.gwt - org.restlet.gwt - ${project.version} - - - - - - net.ltgt.gwt.maven - gwt-maven-plugin - true - - org.restlet.XML - - - - - diff --git a/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/java/org/restlet/client/ext/xml/DomRepresentation.java b/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/java/org/restlet/client/ext/xml/DomRepresentation.java deleted file mode 100644 index 37c7e11cba..0000000000 --- a/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/java/org/restlet/client/ext/xml/DomRepresentation.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.ext.xml; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; - -import org.restlet.client.data.MediaType; -import org.restlet.client.engine.io.StringInputStream; -import org.restlet.client.representation.Representation; - -import com.google.gwt.xml.client.Document; -import com.google.gwt.xml.client.XMLParser; - -/** - * XML representation based on an XML DOM document. DOM is a standard XML object - * model defined by the W3C. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class DomRepresentation extends Representation { - /** The wrapped DOM document. */ - private Document dom; - - /** The source XML representation. */ - private Representation xmlRepresentation; - - /** - * Constructor for an empty document. - * - * @param mediaType - * The representation's media type. - */ - public DomRepresentation(MediaType mediaType) { - super(mediaType); - this.dom = XMLParser.createDocument(); - } - - /** - * Constructor from an existing DOM document. - * - * @param mediaType - * The representation's media type. - * @param xmlDocument - * The source DOM document. - */ - public DomRepresentation(MediaType mediaType, Document xmlDocument) { - super(mediaType); - this.dom = xmlDocument; - } - - /** - * Constructor. - * - * @param xmlRepresentation - * A source XML representation to parse. - */ - public DomRepresentation(Representation xmlRepresentation) { - super((xmlRepresentation == null) ? null : xmlRepresentation - .getMediaType()); - this.xmlRepresentation = xmlRepresentation; - } - - /** - * Returns the wrapped DOM document. If no document is defined yet, it - * attempts to parse the XML representation eventually given at construction - * time. Otherwise, it just creates a new document. - * - * @return The wrapped DOM document. - * @throws IOException - */ - public Document getDocument() throws IOException { - if (this.dom == null) { - if (this.xmlRepresentation != null) { - this.dom = XMLParser.parse(this.xmlRepresentation.getText()); - } else { - this.dom = XMLParser.createDocument(); - } - } - - return this.dom; - } - - @Override - public StringReader getReader() throws IOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public InputStream getStream() throws IOException { - return new StringInputStream(getText()); - } - - @Override - public String getText() throws IOException { - return (getDocument() != null) ? getDocument().toString() : null; - } - - /** - * Releases the wrapped DOM document and the source XML representation if - * they have been defined. - */ - @Override - public void release() { - setDocument(null); - - if (this.xmlRepresentation != null) { - this.xmlRepresentation.release(); - } - - super.release(); - } - - /** - * Sets the wrapped DOM document. - * - * @param dom - * The wrapped DOM document. - */ - public void setDocument(Document dom) { - this.dom = dom; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/java/org/restlet/client/ext/xml/package.html b/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/java/org/restlet/client/ext/xml/package.html deleted file mode 100644 index 6cb03bc1d6..0000000000 --- a/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/java/org/restlet/client/ext/xml/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - -Support for XML and XSLT representations. - -@since Restlet 2.0 -@see User Guide - XML extension -@deprecated Will be removed in the next 2.7/3.0 release. - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/resources/org/restlet/XML.gwt.xml b/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/resources/org/restlet/XML.gwt.xml deleted file mode 100644 index c4b8a2f2ec..0000000000 --- a/org.restlet.gwt/org.restlet.gwt.ext.xml/src/main/resources/org/restlet/XML.gwt.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/org.restlet.gwt/org.restlet.gwt/pom.xml b/org.restlet.gwt/org.restlet.gwt/pom.xml deleted file mode 100644 index ebdd270862..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - 4.0.0 - - org.restlet.gwt - org.restlet.gwt.parent - 2.7-SNAPSHOT - ../pom.xml - - - org.restlet.gwt - Restlet Framework - GWT edition - Core - RESTful web framework for GWT (API and Engine). - gwt-lib - - - - org.gwtproject - gwt-user - ${lib-gwt-version} - - - org.gwtproject - gwt-dev - ${lib-gwt-version} - - - org.junit.jupiter - junit-jupiter-api - ${lib-junit-version} - test - - - - - - src/test/resources - true - - - - - net.ltgt.gwt.maven - gwt-maven-plugin - true - - org.restlet.Restlet - - - - - diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/Restlet.gwt.xml b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/Restlet.gwt.xml deleted file mode 100644 index 9b655ad73e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/Restlet.gwt.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Client.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Client.java deleted file mode 100644 index ef30076198..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Client.java +++ /dev/null @@ -1,184 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client; - -import java.util.Arrays; -import java.util.List; - -import org.restlet.client.data.Protocol; -import org.restlet.client.data.Status; -import org.restlet.client.engine.Engine; -import org.restlet.client.engine.RestletHelper; - -/** - * Connector acting as a generic client. It internally uses one of the available - * connector helpers registered with the Restlet engine.
- *
- * Concurrency note: instances of this class or its subclasses can be invoked by - * several threads at the same time and therefore must be thread-safe. You - * should be especially careful when storing state in member variables.
- *
- * For advanced cases, it is possible to obtain the wrapped - * {@link RestletHelper} instance that is used by this client to handle the - * calls via the "org.restlet.client.engine.helper" attribute stored in the - * {@link Context} object. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Client extends Connector { - - /** The helper provided by the implementation. */ - private final RestletHelper helper; - - /** - * Constructor. - * - * @param context - * The context. - * @param protocols - * The connector protocols. - */ - public Client(Context context, List protocols) { - this(context, protocols, null); - } - - /** - * Constructor. - * - * @param context - * The context. - * @param protocols - * The connector protocols. - * @param helperClass - * Optional helper class name. - */ - public Client(Context context, List protocols, String helperClass) { - super(context, protocols); - - if ((protocols != null) && !protocols.isEmpty()) { - if (Engine.getInstance() != null) { - this.helper = Engine.getInstance().createHelper(this, - helperClass); - } else { - this.helper = null; - } - } else { - this.helper = null; - } - - if (context != null && this.helper != null) { - context.getAttributes().put("org.restlet.client.engine.helper", - this.helper); - } - } - - /** - * Constructor. - * - * @param context - * The context. - * @param protocol - * The connector protocol. - */ - public Client(Context context, Protocol protocol) { - this(context, (protocol == null) ? null : Arrays.asList(protocol), null); - } - - /** - * Constructor. - * - * @param protocols - * The connector protocols. - */ - public Client(List protocols) { - this(null, protocols, null); - } - - /** - * Constructor. - * - * @param protocol - * The connector protocol. - */ - public Client(Protocol protocol) { - this(null, protocol); - } - - /** - * Constructor. - * - * @param protocolName - * The connector protocol. - */ - public Client(String protocolName) { - this(Protocol.valueOf(protocolName)); - } - - /** - * Returns the helper provided by the implementation. - * - * @return The helper provided by the implementation. - */ - private RestletHelper getHelper() { - return this.helper; - } - - @Override - public void handle(Request request, Response response) { - super.handle(request, response); - - if (getHelper() != null) { - getHelper().handle(request, response); - } else { - StringBuilder sb = new StringBuilder(); - sb.append("No available client connector supports the required protocol: "); - sb.append("'").append(request.getProtocol().getName()).append("'."); - sb.append(" Please add the JAR of a matching connector to your classpath."); - response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, sb.toString()); - } - } - - /** - * Indicates the underlying connector helper is available. - * - * @return True if the underlying connector helper is available. - */ - @Override - public boolean isAvailable() { - return getHelper() != null; - } - - @Override - public synchronized void start() throws Exception { - if (isStopped()) { - if (getHelper() != null) { - getHelper().start(); - } - - // Must be invoked as a last step - super.start(); - } - } - - @Override - public synchronized void stop() throws Exception { - if (isStarted()) { - // Must be invoked as a first step - super.stop(); - - if (getHelper() != null) { - getHelper().stop(); - } - } - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Connector.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Connector.java deleted file mode 100644 index c5199ca566..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Connector.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client; - -import java.util.List; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -import org.restlet.client.data.Protocol; - -/** - * Restlet enabling communication between Components. "A connector is an - * abstract mechanism that mediates communication, coordination, or cooperation - * among components. Connectors enable communication between components by - * transferring data elements from one interface to another without changing the - * data." Roy T. Fielding
- *
- * "Encapsulate the activities of accessing resources and transferring resource - * representations. The connectors present an abstract interface for component - * communication, enhancing simplicity by providing a clean separation of - * concerns and hiding the underlying implementation of resources and - * communication mechanisms" Roy T. Fielding
- *
- * Concurrency note: instances of this class or its subclasses can be invoked by - * several threads at the same time and therefore must be thread-safe. You - * should be especially careful when storing state in member variables. - * - * @see Source - * dissertation - * @see Source - * dissertation - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Connector extends Restlet { - /** The list of protocols simultaneously supported. */ - private final List protocols; - - /** - * Constructor. - * - * @param context - * The context. - */ - public Connector(Context context) { - this(context, null); - } - - /** - * Constructor. - * - * @param context - * The context. - * @param protocols - * The supported protocols. - */ - public Connector(Context context, List protocols) { - super(context); - - if (protocols == null) { - this.protocols = new CopyOnWriteArrayList(); - } else { - this.protocols = new CopyOnWriteArrayList(protocols); - } - } - - /** - * Returns the modifiable list of protocols simultaneously supported. - * - * @return The protocols simultaneously supported. - */ - public List getProtocols() { - return this.protocols; - } - - /** - * Indicates the underlying connector helper is available. - * - * @return True if the underlying connector helper is available. - */ - public abstract boolean isAvailable(); - - /** - * Sets the list of protocols simultaneously supported. This method clears - * the current list and adds all entries in the parameter list. - * - * @param protocols - * A list of protocols. - */ - public void setProtocols(List protocols) { - synchronized (getProtocols()) { - if (protocols != getProtocols()) { - getProtocols().clear(); - - if (protocols != null) { - getProtocols().addAll(protocols); - } - } - } - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Context.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Context.java deleted file mode 100644 index 153357a810..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Context.java +++ /dev/null @@ -1,260 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client; - -import java.awt.Component; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; -import java.util.logging.Logger; - -import org.restlet.client.data.Parameter; -import org.restlet.client.engine.Engine; -import org.restlet.client.util.Series; - -/** - * Contextual data and services provided to a set of Restlets. The context is - * the means by which a Restlet may access the software environment within the - * framework. It is typically provided by the immediate parent Restlet - * (Application is the most common case).
- *
- * Concurrency note: attributes and parameters of a context are stored in - * concurrent collections that guarantee thread safe access and modification. If - * several threads concurrently access objects and modify these collections, - * they should synchronize on the lock of the Context instance. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Context { - - /** - * Returns the context associated to the current {@link Restlet}. - * - * @return The current context. - */ - public static Context getCurrent() { - return new Context(); - } - - /** - * Returns the current context's logger. - * - * @return The current context's logger. - */ - public static Logger getCurrentLogger() { - return Engine.getLogger("org.restlet.client"); - } - - /** The client dispatcher. */ - private volatile Restlet clientDispatcher; - - - /** The modifiable attributes map. */ - private final ConcurrentMap attributes; - - /** The logger instance to use. */ - private volatile Logger logger; - - /** The modifiable series of parameters. */ - private final Series parameters; - - - - - /** - * Constructor. Writes log messages to "org.restlet.client". - */ - public Context() { - this("org.restlet.client"); - } - - /** - * Constructor. - * - * @param logger - * The logger instance of use. - */ - public Context(Logger logger) { - this.attributes = new ConcurrentHashMap(); - this.logger = logger; - this.parameters = new org.restlet.client.engine.util.ParameterSeries(new - CopyOnWriteArrayList()); - this.clientDispatcher = null; - - } - - /** - * Constructor. - * - * @param loggerName - * The name of the logger to use. - */ - public Context(String loggerName) { - this(Engine.getLogger(loggerName)); - } - - /** - * Creates a protected child context. This is especially useful for new - * application attached to their parent component, to ensure their isolation - * from the other applications. By default, it creates a new context instance - * with empty or null properties, except the client and server dispatchers - * that are wrapped for isolation purpose. - * - * @return The child context. - */ - public Context createChildContext() { - return new Context(); - } - - /** - * Returns a modifiable attributes map that can be used by developers to - * save information relative to the context. This is a convenient means to - * provide common objects to all the Restlets and Resources composing an - * Application.
- *
- * - * In addition, this map is a shared space between the developer and the - * Restlet implementation. For this purpose, all attribute names starting - * with "org.restlet.client" are reserved. Currently, the following attributes are - * used: - * - * - * - * - * - * - * - * - * - * - * - *
Attribute nameClass nameDescription
org.restlet.client.applicationorg.restlet.client.ApplicationThe parent application providing this context, if any.
- * - * - * @return The modifiable attributes map. - */ - public ConcurrentMap getAttributes() { - return this.attributes; - } - - /** - * Returns a request dispatcher to available client connectors. When you ask - * the dispatcher to handle a request, it will automatically select the - * appropriate client connector for your request, based on the - * "request.protocol" property or on the resource URI's scheme. This call - * blocks and will return an updated response object. - * - * @return A request dispatcher to available client connectors. - */ - public Restlet getClientDispatcher() { - return this.clientDispatcher; - } - - - - - /** - * Returns the logger. - * - * @return The logger. - */ - public Logger getLogger() { - return this.logger; - } - - /** - * Returns the modifiable series of parameters. A parameter is a pair - * composed of a name and a value and is typically used for configuration - * purpose, like Java properties. Note that multiple parameters with the - * same name can be declared and accessed. - * - * @return The modifiable series of parameters. - */ - public Series getParameters() { - return this.parameters; - } - - - /** - * Sets the modifiable map of attributes. This method clears the current map - * and puts all entries in the parameter map. - * - * @param attributes - * A map of attributes. - */ - public void setAttributes(Map attributes) { - synchronized (getAttributes()) { - if (attributes != getAttributes()) { - getAttributes().clear(); - - if (attributes != null) { - getAttributes().putAll(attributes); - } - } - } - } - - /** - * Sets the client dispatcher. - * - * @param clientDispatcher - * The new client dispatcher. - */ - public void setClientDispatcher(Restlet clientDispatcher) { - this.clientDispatcher = clientDispatcher; - } - - - - - /** - * Sets the logger. - * - * @param logger - * The logger. - */ - public void setLogger(Logger logger) { - this.logger = logger; - } - - /** - * Sets the logger. - * - * @param loggerName - * The name of the logger to use. - */ - public void setLogger(String loggerName) { - setLogger(Engine.getLogger(loggerName)); - } - - /** - * Sets the modifiable series of parameters. This method clears the current - * series and adds all entries in the parameter series. - * - * @param parameters - * A series of parameters. - */ - public void setParameters(Series parameters) { - synchronized (getParameters()) { - if (parameters != getParameters()) { - getParameters().clear(); - - if (parameters != null) { - getParameters().addAll(parameters); - } - } - } - } - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Message.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Message.java deleted file mode 100644 index bd618676fe..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Message.java +++ /dev/null @@ -1,442 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client; - -import static org.restlet.client.engine.header.HeaderConstants.ATTRIBUTE_HEADERS; - -import java.io.IOException; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -import org.restlet.client.data.CacheDirective; -import org.restlet.client.data.Header; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.RecipientInfo; -import org.restlet.client.data.Warning; -import org.restlet.client.representation.Representation; -import org.restlet.client.representation.StringRepresentation; -import org.restlet.client.util.Series; - -/** - * Generic message exchanged between components. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Message { - /** The modifiable attributes map. */ - private volatile ConcurrentMap attributes; - - /** The caching directives. */ - private volatile List cacheDirectives; - - /** The date and time at which the message was originated. */ - private volatile Date date; - - /** The payload of the message. */ - private volatile Representation entity; - - - /** Callback invoked when an error occurs when sending the message. */ - private volatile Uniform onError; - - /** Callback invoked after sending the message. */ - private volatile Uniform onSent; - - /** The intermediary recipients info. */ - private volatile List recipientsInfo; - - /** The additional warnings information. */ - private volatile List warnings; - - /** - * Constructor. - */ - public Message() { - this(null); - } - - /** - * Constructor. - * - * @param entity - * The payload of the message. - */ - public Message(Representation entity) { - this.attributes = null; - this.cacheDirectives = null; - this.date = null; - this.entity = entity; - this.onSent = null; - this.recipientsInfo = null; - this.warnings = null; - } - - - /** - * Asks the underlying connector to immediately flush the network buffers. - * - * @throws IOException - */ - public void flushBuffers() throws IOException { - } - - /** - * Returns the modifiable map of attributes that can be used by developers - * to save information relative to the message. Creates a new instance if no - * one has been set. This is an easier alternative to the creation of a - * wrapper instance around the whole message.
- *
- * - * In addition, this map is a shared space between the developer and the - * connectors. In this case, it is used to exchange information that is not - * uniform across all protocols and couldn't therefore be directly included - * in the API. For this purpose, all attribute names starting with - * "org.restlet.client" are reserved. Currently the following attributes are used: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Attribute nameClass nameDescription
org.restlet.client.http.headersorg.restlet.client.util.Series<org.restlet.client.engine.header.Header>Server HTTP connectors must provide all request headers and client HTTP connectors must provide all response - * headers, exactly as they were received. In addition, developers can also use this attribute to specify - * non-standard headers that should be added to the request or to the response.
org.restlet.client.https.clientCertificatesListFor requests received via a secure connector, indicates the ordered list of client certificates, if they are - * available and accessible.
- *
- * Most of the standard HTTP headers are directly supported via the Restlet - * API. Thus, adding such HTTP headers is forbidden because it could - * conflict with the connector's internal behavior, limit portability or - * prevent future optimizations. The other standard HTTP headers (that are - * not supported) can be added as attributes via the - * "org.restlet.client.http.headers" key.
- * - * @return The modifiable attributes map. - */ - public ConcurrentMap getAttributes() { - // Lazy initialization with double-check. - ConcurrentMap r = this.attributes; - if (r == null) { - synchronized (this) { - r = this.attributes; - if (r == null) { - this.attributes = r = new ConcurrentHashMap(); - } - } - } - - return this.attributes; - } - - /** - * Returns the cache directives.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Cache-Control" header. - * - * @return The cache directives. - */ - public List getCacheDirectives() { - // Lazy initialization with double-check. - List r = this.cacheDirectives; - if (r == null) { - synchronized (this) { - r = this.cacheDirectives; - if (r == null) { - this.cacheDirectives = r = new CopyOnWriteArrayList(); - } - } - } - return r; - } - - /** - * Returns the date and time at which the message was originated. - * - * @return The date and time at which the message was originated. - */ - public Date getDate() { - return date; - } - - /** - * Returns the entity representation. - * - * @return The entity representation. - */ - public Representation getEntity() { - return this.entity; - } - - - /** - * Returns the series of lower-level HTTP headers. Please not that this - * method should rarely be used as most HTTP headers are already surfaced by - * the Restlet API. The result series can be used to deal with HTTP - * extension headers. - * - * @return The HTTP headers. - */ - @SuppressWarnings("unchecked") - public Series

getHeaders() { - Series
headers = (Series
) getAttributes().get(ATTRIBUTE_HEADERS); - if (headers == null) { - headers = new org.restlet.client.engine.util.HeaderSeries(); - getAttributes().put(ATTRIBUTE_HEADERS, headers); - } - return headers; - } - - /** - * Returns the callback invoked when an error occurs when sending the - * message. - * - * @return The callback invoked when an error occurs when sending the - * message. - */ - public Uniform getOnError() { - return onError; - } - - /** - * Returns the callback invoked after sending the message. - * - * @return The callback invoked after sending the message. - */ - public Uniform getOnSent() { - return onSent; - } - - /** - * Returns the intermediary recipient information.
- *
- * Note that when used with HTTP connectors, this property maps to the "Via" - * headers. - * - * @return The intermediary recipient information. - */ - public List getRecipientsInfo() { - // Lazy initialization with double-check. - List r = this.recipientsInfo; - if (r == null) { - synchronized (this) { - r = this.recipientsInfo; - if (r == null) { - this.recipientsInfo = r = new CopyOnWriteArrayList(); - } - } - } - return r; - } - - /** - * Returns the additional warnings information.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Warning" headers. - * - * @return The additional warnings information. - */ - public List getWarnings() { - // Lazy initialization with double-check. - List r = this.warnings; - if (r == null) { - synchronized (this) { - r = this.warnings; - if (r == null) { - this.warnings = r = new CopyOnWriteArrayList(); - } - } - } - return r; - } - - /** - * Indicates if the message was or will be exchanged confidentially, for - * example via a SSL-secured connection. - * - * @return True if the message is confidential. - */ - public abstract boolean isConfidential(); - - /** - * Indicates if a content is available and can be sent or received. Several - * conditions must be met: the content must exists and have some available - * data. - * - * @return True if a content is available and can be sent. - */ - public boolean isEntityAvailable() { - // The declaration of the "result" variable is a workaround for the GWT - // platform. Please keep it! - boolean result = (getEntity() != null) && getEntity().isAvailable(); - return result; - } - - /** - * Releases the message's entity if present. - * - * @see org.restlet.client.representation.Representation#release() - */ - public void release() { - if (getEntity() != null) { - getEntity().release(); - } - } - - /** - * Sets the modifiable map of attributes. This method clears the current map - * and puts all entries in the parameter map. - * - * @param attributes - * A map of attributes - */ - public void setAttributes(Map attributes) { - synchronized (getAttributes()) { - if (attributes != getAttributes()) { - getAttributes().clear(); - - if (attributes != null) { - getAttributes().putAll(attributes); - } - } - } - } - - /** - * Sets the cache directives. Note that when used with HTTP connectors, this - * property maps to the "Cache-Control" header. This method clears the - * current list and adds all entries in the parameter list. - * - * @param cacheDirectives - * The cache directives. - */ - public void setCacheDirectives(List cacheDirectives) { - synchronized (getCacheDirectives()) { - if (cacheDirectives != getCacheDirectives()) { - getCacheDirectives().clear(); - - if (cacheDirectives != null) { - getCacheDirectives().addAll(cacheDirectives); - } - } - } - } - - /** - * Sets the date and time at which the message was originated. - * - * @param date - * The date and time at which the message was originated. - */ - public void setDate(Date date) { - this.date = date; - } - - /** - * Sets the entity representation. - * - * @param entity - * The entity representation. - */ - public void setEntity(Representation entity) { - this.entity = entity; - } - - /** - * Sets a textual entity. - * - * @param value - * The represented string. - * @param mediaType - * The representation's media type. - */ - public void setEntity(String value, MediaType mediaType) { - setEntity(new StringRepresentation(value, mediaType)); - } - - /** - * Sets the callback invoked when an error occurs when sending the message. - * - * @param onError - * The callback invoked when an error occurs when sending the - * message. - */ - public void setOnError(Uniform onError) { - this.onError = onError; - } - - /** - * Sets the callback invoked after sending the message. - * - * @param onSentCallback - * The callback invoked after sending the message. - */ - public void setOnSent(Uniform onSentCallback) { - this.onSent = onSentCallback; - } - - /** - * Sets the modifiable list of intermediary recipients. Note that when used - * with HTTP connectors, this property maps to the "Via" headers. This - * method clears the current list and adds all entries in the parameter - * list. - * - * @param recipientsInfo - * A list of intermediary recipients. - */ - public void setRecipientsInfo(List recipientsInfo) { - synchronized (getRecipientsInfo()) { - if (recipientsInfo != getRecipientsInfo()) { - getRecipientsInfo().clear(); - - if (recipientsInfo != null) { - getRecipientsInfo().addAll(recipientsInfo); - } - } - } - } - - /** - * Sets the additional warnings information. Note that when used with HTTP - * connectors, this property maps to the "Warning" headers. This method - * clears the current list and adds all entries in the parameter list. - * - * @param warnings - * The warnings. - */ - public void setWarnings(List warnings) { - synchronized (getWarnings()) { - if (warnings != getWarnings()) { - getWarnings().clear(); - - if (warnings != null) { - getWarnings().addAll(warnings); - } - } - } - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Request.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Request.java deleted file mode 100644 index 2c9b774e0c..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Request.java +++ /dev/null @@ -1,916 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client; - -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; -import org.restlet.client.engine.util.emul.CopyOnWriteArraySet; - -import org.restlet.client.data.CacheDirective; -import org.restlet.client.data.ChallengeResponse; -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.ClientInfo; -import org.restlet.client.data.Conditions; -import org.restlet.client.data.Cookie; -import org.restlet.client.data.Encoding; -import org.restlet.client.data.Language; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Method; -import org.restlet.client.data.Preference; -import org.restlet.client.data.Protocol; -import org.restlet.client.data.Range; -import org.restlet.client.data.Reference; -import org.restlet.client.data.Tag; -import org.restlet.client.data.Warning; -import org.restlet.client.representation.Representation; -import org.restlet.client.util.Series; - -/** - * Generic request sent by client connectors. It is then received by server - * connectors and processed by {@link Restlet}s. This request can also be - * processed by a chain of Restlets, on both client and server sides. Requests - * are uniform across all types of connectors, protocols and components. - * - * @see org.restlet.client.Response - * @see org.restlet.client.Uniform - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Request extends Message { - - - /** - * Used when issuing a preflight CORS request to let the origin server knows - * what headers the client is willing to send in future request to this - * resource. - */ - private volatile Set accessControlRequestHeaders; - - /** - * Used when issuing a preflight CORS request to let the origin server knows - * what method the client is willing to send in future request to this - * resource. - */ - private volatile Method accessControlRequestMethod; - - /** The authentication response sent by a client to an origin server. */ - private volatile ChallengeResponse challengeResponse; - - /** The client-specific information. */ - private volatile ClientInfo clientInfo; - - /** The condition data. */ - private volatile Conditions conditions; - - /** The cookies provided by the client. */ - private volatile Series cookies; - - /** The host reference. */ - private volatile Reference hostRef; - - /** Indicates if the call is loggable. */ - private volatile boolean loggable; - - /** The maximum number of intermediaries. */ - private volatile int maxForwards; - - /** The method. */ - private volatile Method method; - - /** Callback invoked on response reception. */ - private volatile Uniform onResponse; - - /** The original reference. */ - private volatile Reference originalRef; - - /** The protocol. */ - private volatile Protocol protocol; - - - /** The ranges to return from the target resource's representation. */ - private volatile List ranges; - - /** The referrer reference. */ - private volatile Reference referrerRef; - - /** The resource reference. */ - private volatile Reference resourceRef; - - /** The application root reference. */ - private volatile Reference rootRef; - - /** - * Constructor. - */ - public Request() { - this(null, (Reference) null, null); - } - - /** - * Constructor. - * - * @param method - * The call's method. - * @param resourceRef - * The resource reference. - */ - public Request(Method method, Reference resourceRef) { - this(method, resourceRef, null); - } - - /** - * Constructor. - * - * @param method - * The call's method. - * @param resourceRef - * The resource reference. - * @param entity - * The entity. - */ - public Request(Method method, Reference resourceRef, Representation entity) { - super(entity); - this.accessControlRequestHeaders = null; - this.accessControlRequestMethod = null; - this.challengeResponse = null; - this.clientInfo = null; - this.conditions = null; - this.cookies = null; - this.hostRef = null; - this.loggable = true; - this.maxForwards = -1; - this.method = method; - this.originalRef = null; - this.onResponse = null; - this.protocol = null; - this.ranges = null; - this.referrerRef = null; - this.resourceRef = resourceRef; - this.rootRef = null; - } - - /** - * Constructor. - * - * @param method - * The call's method. - * @param resourceUri - * The resource URI. - */ - public Request(Method method, String resourceUri) { - this(method, new Reference(resourceUri)); - } - - /** - * Constructor. - * - * @param method - * The call's method. - * @param resourceUri - * The resource URI. - * @param entity - * The entity. - */ - public Request(Method method, String resourceUri, Representation entity) { - this(method, new Reference(resourceUri), entity); - } - - /** - * Copy constructor. - * - * @param request - * The request to copy. - */ - public Request(Request request) { - this(request.getMethod(), new Reference(request.getResourceRef()), - request.getEntity()); - challengeResponse = request.getChallengeResponse(); - - // Copy client info - ClientInfo rci = request.getClientInfo(); - clientInfo = new ClientInfo(); - - for (Preference o : rci.getAcceptedCharacterSets()) { - clientInfo.getAcceptedCharacterSets().add(o); - } - - for (Preference o : rci.getAcceptedEncodings()) { - clientInfo.getAcceptedEncodings().add(o); - } - - for (Preference o : rci.getAcceptedLanguages()) { - clientInfo.getAcceptedLanguages().add(o); - } - - for (Preference o : rci.getAcceptedMediaTypes()) { - clientInfo.getAcceptedMediaTypes().add(o); - } - - clientInfo.setAddress(rci.getAddress()); - clientInfo.setAgent(rci.getAgent()); - - for (String o : rci.getForwardedAddresses()) { - clientInfo.getForwardedAddresses().add(o); - } - - clientInfo.setFrom(rci.getFrom()); - clientInfo.setPort(rci.getPort()); - - - // Copy conditions - conditions = new Conditions(); - - for (Tag o : request.getConditions().getMatch()) { - conditions.getMatch().add(o); - } - - conditions.setModifiedSince(request.getConditions().getModifiedSince()); - - for (Tag o : request.getConditions().getNoneMatch()) { - conditions.getNoneMatch().add(o); - } - - conditions.setRangeDate(request.getConditions().getRangeDate()); - conditions.setRangeTag(request.getConditions().getRangeTag()); - conditions.setUnmodifiedSince(request.getConditions() - .getUnmodifiedSince()); - - for (Cookie o : request.getCookies()) { - getCookies().add(o); - } - - this.hostRef = request.getHostRef(); - this.maxForwards = request.getMaxForwards(); - this.originalRef = (request.getOriginalRef() == null) ? null - : new Reference(request.getOriginalRef()); - this.onResponse = request.getOnResponse(); - this.protocol = request.getProtocol(); - - for (Range o : request.getRanges()) { - getRanges().add(o); - } - - this.referrerRef = (request.getReferrerRef() == null) ? null - : new Reference(request.getReferrerRef()); - this.rootRef = (request.getRootRef() == null) ? null : request - .getRootRef(); - - for (Entry e : request.getAttributes().entrySet()) { - getAttributes().put(e.getKey(), e.getValue()); - } - - for (CacheDirective o : request.getCacheDirectives()) { - getCacheDirectives().add(o); - } - - this.setOnSent(request.getOnSent()); - - for (Warning o : request.getWarnings()) { - getWarnings().add(o); - } - - this.setDate(request.getDate()); - } - - /** - * Ask the connector to attempt to abort the related network connection, for - * example, immediately closing the socket. - * - * @return True if the request was aborted. - */ - public boolean abort() { - return false; - } - - /** - * Asks the server connector to immediately commit the given response - * associated to this request, making it ready to be sent back to the - * client. Note that all server connectors don't necessarily support this - * feature. - */ - public void commit(Response response) { - } - - /** - * Returns the modifiable set of headers the client is willing to send in - * future request to this resource. Used when issuing a preflight CORS - * request to let the origin server knows what headers will be sent later.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Headers" header. - * - * @return The headers the client is willing to send in future request to - * this resource. Useful for CORS support. - */ - public Set getAccessControlRequestHeaders() { - // Lazy initialization with double-check. - Set a = this.accessControlRequestHeaders; - if (a == null) { - synchronized (this) { - a = this.accessControlRequestHeaders; - if (a == null) { - this.accessControlRequestHeaders = a = new CopyOnWriteArraySet(); - } - } - } - return a; - } - - /** - * Returns the method the client is willing to use in future request to this - * resource. Used when issuing a preflight CORS request to let the origin - * server knows what method will be sent later.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Request-Method" header. - * - * @return The method the client is willing to send in future request to - * this resource. Useful for CORS support. - */ - public Method getAccessControlRequestMethod() { - return this.accessControlRequestMethod; - } - - /** - * Returns the authentication response sent by a client to an origin server. - * Note that when used with HTTP connectors, this property maps to the - * "Authorization" header. - * - * @return The authentication response sent by a client to an origin server. - */ - public ChallengeResponse getChallengeResponse() { - return this.challengeResponse; - } - - /** - * Returns the client-specific information. Creates a new instance if no one - * has been set. - * - * @return The client-specific information. - */ - public ClientInfo getClientInfo() { - // Lazy initialization with double-check. - ClientInfo c = this.clientInfo; - if (c == null) { - synchronized (this) { - c = this.clientInfo; - if (c == null) { - this.clientInfo = c = new ClientInfo(); - } - } - } - return c; - } - - /** - * Returns the modifiable conditions applying to this request. Creates a new - * instance if no one has been set. - * - * @return The conditions applying to this call. - */ - public Conditions getConditions() { - // Lazy initialization with double-check. - Conditions c = this.conditions; - if (c == null) { - synchronized (this) { - c = this.conditions; - if (c == null) { - this.conditions = c = new Conditions(); - } - } - } - return c; - } - - /** - * Returns the modifiable series of cookies provided by the client. Creates - * a new instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Cookie" header. - * - * @return The cookies provided by the client. - */ - public Series getCookies() { - // Lazy initialization with double-check. - Series c = this.cookies; - if (c == null) { - synchronized (this) { - c = this.cookies; - if (c == null) { - this.cookies = c = new - org.restlet.client.engine.util.CookieSeries(); - } - } - } - return c; - } - - /** - * Returns the host reference. This may be different from the resourceRef's - * host, for example, for URNs and other URIs that don't contain host - * information.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Host" header. - * - * @return The host reference. - */ - public Reference getHostRef() { - return this.hostRef; - } - - /** - * Returns the maximum number of intermediaries. - * - * @return The maximum number of intermediaries. - */ - public int getMaxForwards() { - return maxForwards; - } - - /** - * Returns the method. - * - * @return The method. - */ - public Method getMethod() { - return this.method; - } - - /** - * Returns the callback invoked on response reception. If the value is not - * null, then the associated request will be executed asynchronously. - * - * @return The callback invoked on response reception. - */ - public Uniform getOnResponse() { - return onResponse; - } - - /** - * Returns the original reference as requested by the client. Note that this - * property is not used during request routing. See the {@link #getResourceRef()} method for details. - * - * @return The original reference. - * @see #getResourceRef() - */ - public Reference getOriginalRef() { - return this.originalRef; - } - - /** - * Returns the protocol used or to be used, if known. - * - * @return The protocol used or to be used. - */ - public Protocol getProtocol() { - Protocol result = this.protocol; - - if ((result == null) && (getResourceRef() != null)) { - // Attempt to guess the protocol to use - // from the target reference scheme - result = getResourceRef().getSchemeProtocol(); - // Fallback: look at the scheme of the base reference - if (result == null) { - result = (getResourceRef().getBaseRef() != null) - ? getResourceRef() .getBaseRef().getSchemeProtocol() - : null; - } - } - - return result; - } - - - /** - * Returns the ranges to return from the target resource's representation. - * Note that when used with HTTP connectors, this property maps to the - * "Range" header. - * - * @return The ranges to return. - */ - public List getRanges() { - // Lazy initialization with double-check. - List r = this.ranges; - if (r == null) { - synchronized (this) { - r = this.ranges; - if (r == null) { - this.ranges = r = new CopyOnWriteArrayList(); - } - } - } - return r; - } - - /** - * Returns the referrer reference if available. Note that when used with - * HTTP connectors, this property maps to the "Referer" header. - * - * @return The referrer reference. - */ - public Reference getReferrerRef() { - return this.referrerRef; - } - - /** - * Returns the reference of the target resource. This reference is - * especially important during routing, dispatching and resource finding. - * During such processing, its base reference is constantly updated to - * reflect the reference of the parent Restlet or resource and the remaining - * part of the URI that must be routed or analyzed. - * - * If you need to get the URI reference originally requested by the client, - * then you should use the {@link #getOriginalRef()} method instead. Also, - * note that besides the update of its base property, the resource reference - * can be modified during the request processing. - * - * Finally, when sending out requests via a dispatcher such as {@link Context#getClientDispatcher()}, - * if the reference contains URI template variables, those variables are automatically resolved using the - * request's attributes. - * - * @return The reference of the target resource. - * @see #getOriginalRef() - * @see #getHostRef() - */ - public Reference getResourceRef() { - return this.resourceRef; - } - - /** - * Returns the application root reference. - * - * @return The application root reference. - */ - public Reference getRootRef() { - return this.rootRef; - } - - /** - * Indicates if the request is asynchronous. The test consist in verifying - * that the {@link #getOnResponse()} method returns a callback object. - * - * @return True if the request is synchronous. - */ - public boolean isAsynchronous() { - return getOnResponse() != null; - } - - /** - * Implemented based on the {@link Protocol#isConfidential()} method for the - * request's protocol returned by {@link #getProtocol()}; - */ - @Override - public boolean isConfidential() { - return (getProtocol() == null) ? false : getProtocol().isConfidential(); - } - - /** - * Indicates if a content is available and can be sent. Several conditions - * must be met: the method must allow the sending of content, the content - * must exist and have some available data. - * - * @return True if a content is available and can be sent. - */ - @Override - public boolean isEntityAvailable() { - // The declaration of the "result" variable is a workaround for the GWT - // platform. - boolean result = (Method.GET.equals(getMethod()) - || Method.HEAD.equals(getMethod())); - if (result) { - return false; - } - - return super.isEntityAvailable(); - } - - /** - * Indicates if an associated response is expected. - * - * @return True if an associated response is expected. - */ - public boolean isExpectingResponse() { - return (getMethod() == null) ? false : getMethod().isReplying(); - } - - /** - * Indicates if the call is loggable - * - * @return True if the call is loggable - */ - public boolean isLoggable() { - return loggable; - } - - /** - * Indicates if the request is synchronous. The test consist in verifying - * that the {@link #getOnResponse()} method returns null. - * - * @return True if the request is synchronous. - */ - public boolean isSynchronous() { - return getOnResponse() == null; - } - - /** - * Sets the set of headers the client is willing to use in future request to - * this resource. Used when issuing a preflight CORS request to let the - * origin server knows what headers will be sent later.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Request-Method" header. - * - * @param accessControlRequestHeaders - * The set of headers the client is willing to send in future - * request to this resource. Useful for CORS support. - */ - public void setAccessControlRequestHeaders( - Set accessControlRequestHeaders) { - synchronized (getAccessControlRequestHeaders()) { - if (accessControlRequestHeaders != this.accessControlRequestHeaders) { - this.accessControlRequestHeaders.clear(); - - if (accessControlRequestHeaders != null) { - this.accessControlRequestHeaders - .addAll(accessControlRequestHeaders); - } - } - } - } - - /** - * Sets the method the client is willing to use in future request to this - * resource. Used when issuing a preflight CORS request to let the origin - * server knows what method will be sent later.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Request-Method" header. - * - * @param accessControlRequestMethod - * The method the client is willing to send in future request to - * this resource. Useful for CORS support. - */ - public void setAccessControlRequestMethod(Method accessControlRequestMethod) { - this.accessControlRequestMethod = accessControlRequestMethod; - } - - /** - * Sets the authentication response sent by a client to an origin server. - * Note that when used with HTTP connectors, this property maps to the - * "Authorization" header. - * - * @param challengeResponse - * The authentication response sent by a client to an origin - * server. - */ - public void setChallengeResponse(ChallengeResponse challengeResponse) { - this.challengeResponse = challengeResponse; - } - - /** - * Sets the client-specific information. - * - * @param clientInfo - * The client-specific information. - */ - public void setClientInfo(ClientInfo clientInfo) { - this.clientInfo = clientInfo; - } - - /** - * Sets the conditions applying to this request. - * - * @param conditions - * The conditions applying to this request. - */ - public void setConditions(Conditions conditions) { - this.conditions = conditions; - } - - /** - * Sets the modifiable series of cookies provided by the client. Note that - * when used with HTTP connectors, this property maps to the "Cookie" - * header. This method clears the current series and adds all entries in the - * parameter series. - * - * @param cookies - * A series of cookies provided by the client. - */ - public void setCookies(Series cookies) { - synchronized (getCookies()) { - if (cookies != getCookies()) { - if (getCookies() != null) { - getCookies().clear(); - } - - if (cookies != null) { - getCookies().addAll(cookies); - } - } - } - } - - /** - * Sets the host reference. Note that when used with HTTP connectors, this - * property maps to the "Host" header. - * - * @param hostRef - * The host reference. - */ - public void setHostRef(Reference hostRef) { - this.hostRef = hostRef; - } - - /** - * Sets the host reference using a URI string. Note that when used with - * HTTP connectors, this property maps to the "Host" header. - * - * @param hostUri - * The host URI. - */ - public void setHostRef(String hostUri) { - setHostRef(new Reference(hostUri)); - } - - /** - * Indicates if the call is loggable - * - * @param loggable - * True if the call is loggable - */ - public void setLoggable(boolean loggable) { - this.loggable = loggable; - } - - /** - * Sets the maximum number of intermediaries. - * - * @param maxForwards - * The maximum number of intermediaries. - */ - public void setMaxForwards(int maxForwards) { - this.maxForwards = maxForwards; - } - - /** - * Sets the method called. - * - * @param method - * The method called. - */ - public void setMethod(Method method) { - this.method = method; - } - - /** - * Sets the callback invoked on response reception. If the value is not - * null, then the associated request will be executed asynchronously. - * - * @param onResponseCallback - * The callback invoked on response reception. - */ - public void setOnResponse(Uniform onResponseCallback) { - this.onResponse = onResponseCallback; - } - - /** - * Sets the original reference requested by the client. - * - * @param originalRef - * The original reference. - * @see #getOriginalRef() - */ - public void setOriginalRef(Reference originalRef) { - this.originalRef = originalRef; - } - - /** - * Sets the protocol used or to be used. - * - * @param protocol - * The protocol used or to be used. - */ - public void setProtocol(Protocol protocol) { - this.protocol = protocol; - } - - - /** - * Sets the modifiable list of ranges to return from the target resource's - * representation. Note that when used with HTTP connectors, this property - * maps to the "Range" header. This method clears the current list and adds - * all entries in the parameter list. - * - * @param ranges - * A list of ranges. - */ - public void setRanges(List ranges) { - synchronized (getRanges()) { - if (ranges != getRanges()) { - getRanges().clear(); - - if (ranges != null) { - getRanges().addAll(ranges); - } - } - } - } - - /** - * Sets the referrer reference if available. Note that when used with HTTP - * connectors, this property maps to the "Referer" header. - * - * @param referrerRef - * The referrer reference. - */ - public void setReferrerRef(Reference referrerRef) { - this.referrerRef = referrerRef; - - // A referrer reference must not include a fragment. - if ((this.referrerRef != null) - && (this.referrerRef.getFragment() != null)) { - this.referrerRef.setFragment(null); - } - } - - /** - * Sets the referrer reference if available using a URI string. Note that - * when used with HTTP connectors, this property maps to the "Referer" - * header. - * - * @param referrerUri - * The referrer URI. - * @see #setReferrerRef(Reference) - */ - public void setReferrerRef(String referrerUri) { - setReferrerRef(new Reference(referrerUri)); - } - - /** - * Sets the target resource reference. If the reference is relative, it will - * be resolved as an absolute reference. Also, the context's base reference - * will be reset. Finally, the reference will be normalized to ensure a - * consistent handling of the call. - * - * @param resourceRef - * The resource reference. - * @see #getResourceRef() - */ - public void setResourceRef(Reference resourceRef) { - this.resourceRef = resourceRef; - } - - /** - * Sets the target resource reference using a URI string. - * Note that the URI can be either absolute or relative to the context's base reference. - * - * @param resourceUri - * The resource URI. - * @see #setResourceRef(Reference) - */ - public void setResourceRef(String resourceUri) { - if (getResourceRef() != null) { - // Allow usage of URIs relative to the current base reference - setResourceRef(new Reference(getResourceRef().getBaseRef(), - resourceUri)); - } else { - setResourceRef(new Reference(resourceUri)); - } - } - - /** - * Sets the application root reference. - * - * @param rootRef - * The application root reference. - */ - public void setRootRef(Reference rootRef) { - this.rootRef = rootRef; - } - - /** - * Displays a synthesis of the request like an HTTP request line. - * - * @return A synthesis of the request like an HTTP request line. - */ - public String toString() { - return ((getMethod() == null) ? "" : getMethod().toString()) - + " " - + ((getResourceRef() == null) ? "" : getResourceRef() - .toString()) - + " " - + ((getProtocol() == null) ? "" - : (getProtocol().getName() + ((getProtocol() - .getVersion() == null) ? "" : "/" - + getProtocol().getVersion()))); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Response.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Response.java deleted file mode 100644 index 38dcee9f5f..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Response.java +++ /dev/null @@ -1,1049 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client; - -import java.io.IOException; -import java.util.Date; -import java.util.List; -import java.util.Set; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; -import org.restlet.client.engine.util.emul.CopyOnWriteArraySet; - -import org.restlet.client.data.AuthenticationInfo; -import org.restlet.client.data.ChallengeRequest; -import org.restlet.client.data.CookieSetting; -import org.restlet.client.data.Dimension; -import org.restlet.client.data.Method; -import org.restlet.client.data.Reference; -import org.restlet.client.data.ServerInfo; -import org.restlet.client.data.Status; -import org.restlet.client.util.Series; - -/** - * Generic response sent by server connectors. It is then received by client - * connectors. Responses are uniform across all types of connectors, protocols - * and components. - * - * @see org.restlet.client.Request - * @see org.restlet.client.Uniform - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Response extends Message { - - - - /** - * When used as part of a response to a preflight CORS request, this - * indicates whether or not the actual request can be made using - * credentials. - */ - private volatile Boolean accessControlAllowCredentials; - - /** - * When used as part of a response to a preflight CORS request, this lists - * the headers allowed by the actual request on the current resource. - */ - private volatile Set accessControlAllowHeaders; - - /** - * When used as part of a response to a preflight CORS request, this lists - * the methods allowed by the actual request on the current resource. - */ - private volatile Set accessControlAllowMethods; - - /** - * When used in the context of CORS support, it specifies the URI an origin - * server allows for the requested resource. Use "*" as a wildcard - * character. - */ - private volatile String accessControlAllowOrigin; - - /** - * The whitelist of headers an origin server allows for the requested - * resource. - */ - private volatile Set accessControlExposeHeaders; - - /** - * When used in the context of CORS support, it indicates how long the results of a preflight request can be cached - * in a preflight result cache. - */ - private volatile int accessControlMaxAge; - - /** - * Estimated amount of time since a response was generated or revalidated by the origin server. - */ - private volatile int age; - - /** The set of methods allowed on the requested resource. */ - private volatile Set allowedMethods; - - /** - * The authentication information sent by an origin server to a client in - * the case of a successful authentication attempt. - */ - private volatile AuthenticationInfo authenticationInfo; - - /** Indicates if the response should be automatically committed. */ - private volatile boolean autoCommitting; - - /** The authentication requests sent by an origin server to a client. */ - private volatile List challengeRequests; - - /** Indicates if the response has been committed. */ - private volatile boolean committed; - - /** The cookie settings provided by the server. */ - private volatile Series cookieSettings; - - /** The set of dimensions on which the response entity may vary. */ - private volatile Set dimensions; - - /** The reference used for redirections or creations. */ - private volatile Reference locationRef; - - /** The authentication requests sent by a proxy to a client. */ - private volatile List proxyChallengeRequests; - - /** The associated request. */ - private volatile Request request; - - /** - * Indicates how long the service is expected to be unavailable to the - * requesting client. - */ - private volatile Date retryAfter; - - /** The server-specific information. */ - private volatile ServerInfo serverInfo; - - /** The status. */ - private volatile Status status; - - /** - * Constructor. - * - * @param request - * The request associated to this response. - */ - public Response(Request request) { - this.age = 0; - this.accessControlAllowCredentials = null; - this.accessControlAllowHeaders = null; - this.accessControlAllowMethods = null; - this.accessControlAllowOrigin = null; - this.accessControlExposeHeaders = null; - this.allowedMethods = null; - this.autoCommitting = true; - this.challengeRequests = null; - this.cookieSettings = null; - this.committed = false; - this.dimensions = null; - this.locationRef = null; - this.proxyChallengeRequests = null; - this.request = request; - this.retryAfter = null; - this.serverInfo = null; - this.status = Status.SUCCESS_OK; - } - - /** - * Ask the connector to abort the related network connection, for example - * immediately closing the socket. - */ - public void abort() { - getRequest().abort(); - } - - /** - * Asks the server connector to immediately commit the given response, - * making it ready to be sent back to the client. Note that all server - * connectors don't necessarily support this feature.
- *
- * When the response is in autoCommit mode (see related property), then - * calling this method isn't necessary. Also, be aware that committing the - * response doesn't necessarily means that is will be immediately be written - * on the network as some buffering can occurs. If you want to ensure that - * response buffers are flushed,
- *
- * Note that this calls back {@link Request#commit(Response)} on the parent - * request which holds the link with the underlying network connection. - */ - public void commit() { - getRequest().commit(this); - } - - /** - * Asks the server connector to immediately flush the network buffers. Note - * that this calls back {@link Request#flushBuffers()} on the parent request - * which holds the link with the underlying network connection. - * - * @throws IOException - */ - @Override - public void flushBuffers() throws IOException { - getRequest().flushBuffers(); - } - - /** - * When used as part of a response to a preflight CORS request, this - * indicates whether or not the actual request can be made using - * credentials.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Credentials" header. - * - * @return True if the requested resource allows credential. - */ - public Boolean getAccessControlAllowCredentials() { - return this.accessControlAllowCredentials; - } - - /** - * Returns the modifiable set of headers allowed by the actual request on - * the current resource when used as part of a response to a preflight CORS - * request.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Headers" header. - * - * @return The set of headers allowed by the actual request on the current - * resource. - */ - public Set getAccessControlAllowHeaders() { - // Lazy initialization with double-check. - Set a = this.accessControlAllowHeaders; - if (a == null) { - synchronized (this) { - a = this.accessControlAllowHeaders; - if (a == null) { - this.accessControlAllowHeaders = a = new CopyOnWriteArraySet(); - } - } - } - return a; - } - - /** - * Returns the modifiable set of methods allowed by the actual request on - * the current resource when used as part of a response to a preflight CORS - * request
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Methods" header. - * - * @return The set of methods allowed by the actual request on the current - * resource. - */ - public Set getAccessControlAllowMethods() { - // Lazy initialization with double-check. - Set a = this.accessControlAllowMethods; - if (a == null) { - synchronized (this) { - a = this.accessControlAllowMethods; - if (a == null) { - this.accessControlAllowMethods = a = new CopyOnWriteArraySet(); - } - } - } - return a; - } - - /** - * When used in the context of CORS support, it returns the URI an origin - * server allows for the requested resource. Use "*" as a wildcard - * character.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Origin" header. - * - * @return The origin allowed by the requested resource. - */ - public String getAccessControlAllowOrigin() { - return this.accessControlAllowOrigin; - } - - /** - * Returns a modifiable whitelist of headers an origin server allows for the - * requested resource.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Expose-Headers" header. - * - * @return The set of headers an origin server allows for the requested - * resource. - */ - public Set getAccessControlExposeHeaders() { - // Lazy initialization with double-check. - Set a = this.accessControlExposeHeaders; - if (a == null) { - synchronized (this) { - a = this.accessControlExposeHeaders; - if (a == null) { - this.accessControlExposeHeaders = a = new CopyOnWriteArraySet(); - } - } - } - return a; - } - - /** - * Indicates how long the results of a preflight CORS request can be cached in a preflight result cache.
- * In case of a negative value, the results of a preflight request is not meant to be cached.
- * Note that when used with HTTP connectors, this property maps to the "Access-Control-Max-Age" header. - * - * @return Indicates how long the results of a preflight request can be cached in a preflight result cache. - */ - public int getAccessControlMaxAge() { - return accessControlMaxAge; - } - - /** - * Returns the estimated amount of time since a response was generated or - * revalidated by the origin server. Origin servers should leave the 0 - * default value. Only caches are expected to set this property.
- *
- * Note that when used with HTTP connectors, this property maps to the "Age" - * header. - * - * @return The response age. - */ - public int getAge() { - return age; - } - - /** - * Returns the modifiable set of methods allowed on the requested resource. - * This property only has to be updated when a status - * CLIENT_ERROR_METHOD_NOT_ALLOWED is set. Creates a new instance if no one - * has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Allow" header. - * - * @return The set of allowed methods. - */ - public Set getAllowedMethods() { - // Lazy initialization with double-check. - Set a = this.allowedMethods; - if (a == null) { - synchronized (this) { - a = this.allowedMethods; - if (a == null) { - this.allowedMethods = a = new CopyOnWriteArraySet(); - } - } - } - return a; - } - - /** - * Returns information sent by an origin server related to an successful - * authentication attempt. If none is available, null is returned.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Authentication-Info" header. - * - * @return The authentication information provided by the server. - */ - public AuthenticationInfo getAuthenticationInfo() { - return this.authenticationInfo; - } - - /** - * Returns the list of authentication requests sent by an origin server to a - * client. If none is available, an empty list is returned.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "WWW-Authenticate" header. - * - * @return The list of authentication requests. - */ - public List getChallengeRequests() { - // Lazy initialization with double-check. - List cr = this.challengeRequests; - if (cr == null) { - synchronized (this) { - cr = this.challengeRequests; - if (cr == null) { - this.challengeRequests = cr = new CopyOnWriteArrayList(); - } - } - } - return cr; - } - - /** - * Returns the modifiable series of cookie settings provided by the server. - * Creates a new instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Set-Cookie" and "Set-Cookie2" headers. - * - * @return The cookie settings provided by the server. - */ - public Series getCookieSettings() { - // Lazy initialization with double-check. - Series c = this.cookieSettings; - if (c == null) { - synchronized (this) { - c = this.cookieSettings; - if (c == null) { - this.cookieSettings = c = new - org.restlet.client.engine.util.CookieSettingSeries(); - } - } - } - return c; - } - - /** - * Returns the modifiable set of selecting dimensions on which the response - * entity may vary. If some server-side content negotiation is done, this - * set should be properly updated, other it can be left empty. Creates a new - * instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Vary" header. - * - * @return The set of dimensions on which the response entity may vary. - */ - public Set getDimensions() { - if (this.dimensions == null) { - this.dimensions = new CopyOnWriteArraySet(); - } - return this.dimensions; - } - - /** - * Returns the location reference. This is the reference that the client - * should follow for redirections or resource creations.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Location" header. - * - * @return The redirection reference. - */ - public Reference getLocationRef() { - return this.locationRef; - } - - /** - * Returns the list of authentication requests sent by an origin server to a - * client. If none is available, an empty list is returned.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Proxy-Authenticate" header. - * - * @return The list of authentication requests. - */ - public List getProxyChallengeRequests() { - // Lazy initialization with double-check. - List cr = this.proxyChallengeRequests; - if (cr == null) { - synchronized (this) { - cr = this.proxyChallengeRequests; - if (cr == null) { - this.proxyChallengeRequests = cr = new CopyOnWriteArrayList(); - } - } - } - return cr; - } - - /** - * Returns the associated request - * - * @return The associated request - */ - public Request getRequest() { - return this.request; - } - - /** - * Indicates how long the service is expected to be unavailable to the - * requesting client. Default value is null.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Retry-After" header. - * - * @return Date after with a retry attempt could occur. - */ - public Date getRetryAfter() { - return retryAfter; - } - - /** - * Returns the server-specific information. Creates a new instance if no one - * has been set. - * - * @return The server-specific information. - */ - public ServerInfo getServerInfo() { - // Lazy initialization with double-check. - ServerInfo s = this.serverInfo; - if (s == null) { - synchronized (this) { - s = this.serverInfo; - if (s == null) { - this.serverInfo = s = new ServerInfo(); - } - } - } - return s; - } - - /** - * Returns the status. - * - * @return The status. - */ - public Status getStatus() { - return this.status; - } - - /** - * Indicates if the response should be automatically committed. When - * processing a request on the server-side, setting this property to 'false' - * let you ask to the server connector to wait before sending the response - * back to the client when the initial calling thread returns. This will let - * you do further updates to the response and manually calling {@link #commit()} later on, using another thread. - * - * @return True if the response should be automatically committed. - */ - public boolean isAutoCommitting() { - return autoCommitting; - } - - /** - * Indicates if the response has already been committed. - * - * @return True if the response has already been committed. - */ - public boolean isCommitted() { - return committed; - } - - @Override - public boolean isConfidential() { - return getRequest().isConfidential(); - } - - /** - * Indicates if the response is final or provisional. It relies on the {@link Status#isInformational()} method. - * - * @return True if the response is final. - */ - public boolean isFinal() { - return !getStatus().isInformational(); - } - - /** - * Indicates if the response is provisional or final. It relies on the {@link Status#isInformational()} method. - * - * @return True if the response is provisional. - */ - public boolean isProvisional() { - return getStatus().isInformational(); - } - - /** - * Permanently redirects the client to a target URI. The client is expected - * to reuse the same method for the new request. - * - * @param targetRef - * The target URI reference. - */ - public void redirectPermanent(Reference targetRef) { - setLocationRef(targetRef); - setStatus(Status.REDIRECTION_PERMANENT); - } - - /** - * Permanently redirects the client to a target URI. The client is expected - * to reuse the same method for the new request.
- *
- * If you pass a relative target URI, it will be resolved with the current - * base reference of the request's resource reference (see {@link Request#getResourceRef()} and - * {@link Reference#getBaseRef()}. - * - * @param targetUri - * The target URI. - */ - public void redirectPermanent(String targetUri) { - setLocationRef(targetUri); - setStatus(Status.REDIRECTION_PERMANENT); - } - - /** - * Redirects the client to a different URI that SHOULD be retrieved using a - * GET method on that resource. This method exists primarily to allow the - * output of a POST-activated script to redirect the user agent to a - * selected resource. The new URI is not a substitute reference for the - * originally requested resource. - * - * @param targetRef - * The target reference. - */ - public void redirectSeeOther(Reference targetRef) { - setLocationRef(targetRef); - setStatus(Status.REDIRECTION_SEE_OTHER); - } - - /** - * Redirects the client to a different URI that SHOULD be retrieved using a - * GET method on that resource. This method exists primarily to allow the - * output of a POST-activated script to redirect the user agent to a - * selected resource. The new URI is not a substitute reference for the - * originally requested resource.
- *
- * If you pass a relative target URI, it will be resolved with the current - * base reference of the request's resource reference (see {@link Request#getResourceRef()} and - * {@link Reference#getBaseRef()}. - * - * @param targetUri - * The target URI. - */ - public void redirectSeeOther(String targetUri) { - setLocationRef(targetUri); - setStatus(Status.REDIRECTION_SEE_OTHER); - } - - /** - * Temporarily redirects the client to a target URI. The client is expected - * to reuse the same method for the new request. - * - * @param targetRef - * The target reference. - */ - public void redirectTemporary(Reference targetRef) { - setLocationRef(targetRef); - setStatus(Status.REDIRECTION_TEMPORARY); - } - - /** - * Temporarily redirects the client to a target URI. The client is expected - * to reuse the same method for the new request.
- *
- * If you pass a relative target URI, it will be resolved with the current - * base reference of the request's resource reference (see {@link Request#getResourceRef()} and - * {@link Reference#getBaseRef()}. - * - * @param targetUri - * The target URI. - */ - public void redirectTemporary(String targetUri) { - setLocationRef(targetUri); - setStatus(Status.REDIRECTION_TEMPORARY); - } - - /** - * When used as part of a response to a preflight CORS request, indicates - * whether or not the actual request can be made using credentials.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Credentials" header. - * - * @param accessControlAllowCredentials - * True if the requested resource allows credential. - */ - public void setAccessControlAllowCredentials( - Boolean accessControlAllowCredentials) { - this.accessControlAllowCredentials = accessControlAllowCredentials; - } - - /** - * When used as part of a response to a preflight CORS request, indicates how long (in seconds) the results of a - * preflight request can be cached in a preflight result cache.
- * Note that when used with HTTP connectors, this property maps to the "Access-Control-Max-Age" header.
- * In case of negative value, the header is not set. - * - * @param accessControlMaxAge - * How long the results of a preflight request can be cached in a preflight result cache. - */ - public void setAccessControlMaxAge(int accessControlMaxAge) { - this.accessControlMaxAge = accessControlMaxAge; - } - - /** - * Sets the set of headers allowed by the actual request on the current - * resource when used as part of a response to a preflight CORS request.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Headers" header. - * - * @param accessControlAllowHeaders - * The set of headers allowed by the actual request on the - * current resource. - */ - public void setAccessControlAllowHeaders( - Set accessControlAllowHeaders) { - synchronized (getAccessControlAllowHeaders()) { - if (accessControlAllowHeaders != this.accessControlAllowHeaders) { - this.accessControlAllowHeaders.clear(); - - if (accessControlAllowHeaders != null) { - this.accessControlAllowHeaders - .addAll(accessControlAllowHeaders); - } - } - } - } - - /** - * Sets the set of methods allowed by the actual request on the current - * resource when used as part of a response to a preflight CORS request.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Methods" header. - * - * @param accessControlAllowMethods - * The set of methods allowed by the actual request on the - * current resource. - */ - public void setAccessControlAllowMethods( - Set accessControlAllowMethods) { - synchronized (getAccessControlAllowMethods()) { - if (accessControlAllowMethods != this.accessControlAllowMethods) { - this.accessControlAllowMethods.clear(); - - if (accessControlAllowMethods != null) { - this.accessControlAllowMethods - .addAll(accessControlAllowMethods); - } - } - } - } - - /** - * When used in the context of CORS support, it sets the URI an origin - * server allows for the requested resource. Use "*" as a wildcard - * character.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Allow-Origin" header. - * - * @param accessControlAllowOrigin - * The origin allowed by the requested resource. - */ - public void setAccessControlAllowOrigin(String accessControlAllowOrigin) { - // TODO Add some input validation here. - this.accessControlAllowOrigin = accessControlAllowOrigin; - } - - /** - * Sets the list of headers an origin server allows for the requested - * resource.
- * Note that when used with HTTP connectors, this property maps to the - * "Access-Control-Expose-Headers" header. - * - * @param accessControlExposeHeaders - * The set of headers an origin server allows for the requested - * resource. - */ - public void setAccessControlExposeHeaders( - Set accessControlExposeHeaders) { - synchronized (getAccessControlExposeHeaders()) { - if (accessControlExposeHeaders != this.accessControlExposeHeaders) { - this.accessControlExposeHeaders.clear(); - - if (accessControlExposeHeaders != null) { - this.accessControlExposeHeaders - .addAll(accessControlExposeHeaders); - } - } - } - } - - /** - * Sets the estimated amount of time since a response was generated or - * revalidated by the origin server. Origin servers should leave the 0 - * default value. Only caches are expected to set this property.
- *
- * Note that when used with HTTP connectors, this property maps to the "Age" - * header. - * - * @param age - * The response age. - */ - public void setAge(int age) { - this.age = age; - } - - /** - * Sets the set of methods allowed on the requested resource. The set - * instance set must be thread-safe (use {@link CopyOnWriteArraySet} for - * example.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Allow" header. - * - * @param allowedMethods - * The set of methods allowed on the requested resource. - */ - public void setAllowedMethods(Set allowedMethods) { - synchronized (getAllowedMethods()) { - if (allowedMethods != this.allowedMethods) { - this.allowedMethods.clear(); - - if (allowedMethods != null) { - this.allowedMethods.addAll(allowedMethods); - } - } - } - } - - /** - * Sets the authentication information sent by an origin server to a client - * after a successful authentication attempt.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Authentication-Info" header. - * - * @param authenticationInfo - * The data returned by the server in response to successful - * authentication. - */ - public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) { - this.authenticationInfo = authenticationInfo; - } - - /** - * Indicates if the response should be automatically committed. - * - * @param autoCommitting - * True if the response should be automatically committed - */ - public void setAutoCommitting(boolean autoCommitting) { - this.autoCommitting = autoCommitting; - } - - /** - * Sets the list of authentication requests sent by an origin server to a - * client. Note that when used with HTTP connectors, this property maps to - * the "WWW-Authenticate" header. This method clears the current list and - * adds all entries in the parameter list. - * - * @param challengeRequests - * A list of authentication requests sent by an origin server to - * a client. - */ - public void setChallengeRequests(List challengeRequests) { - synchronized (getChallengeRequests()) { - if (challengeRequests != getChallengeRequests()) { - getChallengeRequests().clear(); - - if (challengeRequests != null) { - getChallengeRequests().addAll(challengeRequests); - } - } - } - } - - /** - * Indicates if the response has already been committed. - * - * @param committed - * True if the response has already been committed. - */ - public void setCommitted(boolean committed) { - this.committed = committed; - } - - /** - * Sets the modifiable series of cookie settings provided by the server. - * Note that when used with HTTP connectors, this property maps to the - * "Set-Cookie" and "Set-Cookie2" headers. This method clears the current - * series and adds all entries in the parameter series. - * - * @param cookieSettings - * A series of cookie settings provided by the server. - */ - public void setCookieSettings(Series cookieSettings) { - synchronized (getCookieSettings()) { - if (cookieSettings != getCookieSettings()) { - getCookieSettings().clear(); - - if (cookieSettings != null) { - getCookieSettings().addAll(cookieSettings); - } - } - } - } - - /** - * Sets the set of dimensions on which the response entity may vary. Note - * that when used with HTTP connectors, this property maps to the "Vary" - * header. This method clears the current set and adds all entries in the - * parameter set. - * - * @param dimensions - * The set of dimensions on which the response entity may vary. - */ - public void setDimensions(Set dimensions) { - synchronized (getDimensions()) { - if (dimensions != getDimensions()) { - getDimensions().clear(); - - if (dimensions != null) { - getDimensions().addAll(dimensions); - } - } - } - } - - /** - * Sets the reference that the client should follow for redirections or - * resource creations. Note that when used with HTTP connectors, this - * property maps to the "Location" header. - * - * @param locationRef - * The reference to set. - */ - public void setLocationRef(Reference locationRef) { - this.locationRef = locationRef; - } - - /** - * Sets the reference that the client should follow for redirections or - * resource creations. If you pass a relative location URI, it will be - * resolved with the current base reference of the request's resource - * reference (see {@link Request#getResourceRef()} and {@link Reference#getBaseRef()}.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Location" header. - * - * @param locationUri - * The URI to set. - * @see #setLocationRef(Reference) - */ - public void setLocationRef(String locationUri) { - Reference baseRef = null; - - if (getRequest().getResourceRef() != null) { - if (getRequest().getResourceRef().getBaseRef() != null) { - baseRef = getRequest().getResourceRef().getBaseRef(); - } else { - baseRef = getRequest().getResourceRef(); - } - } - - setLocationRef(new Reference(baseRef, locationUri).getTargetRef()); - } - - /** - * Sets the modifiable list of authentication requests sent by a proxy to a - * client. The list instance set must be thread-safe (use {@link CopyOnWriteArrayList} for example. Note that when - * used with HTTP - * connectors, this property maps to the "Proxy-Authenticate" header. This - * method clears the current list and adds all entries in the parameter - * list. - * - * @param proxyChallengeRequests - * A list of authentication requests sent by a proxy to a client. - */ - public void setProxyChallengeRequests( - List proxyChallengeRequests) { - synchronized (getProxyChallengeRequests()) { - if (proxyChallengeRequests != getProxyChallengeRequests()) { - getProxyChallengeRequests().clear(); - - if (proxyChallengeRequests != null) { - getProxyChallengeRequests().addAll(proxyChallengeRequests); - } - } - } - } - - /** - * Sets the associated request. - * - * @param request - * The associated request - */ - public void setRequest(Request request) { - this.request = request; - } - - /** - * Indicates how long the service is expected to be unavailable to the - * requesting client. Default value is null.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Retry-After" header. - * - * @param retryAfter - * Date after with a retry attempt could occur. - */ - public void setRetryAfter(Date retryAfter) { - this.retryAfter = retryAfter; - } - - /** - * Sets the server-specific information. - * - * @param serverInfo - * The server-specific information. - */ - public void setServerInfo(ServerInfo serverInfo) { - this.serverInfo = serverInfo; - } - - /** - * Sets the status. - * - * @param status - * The status to set. - */ - public void setStatus(Status status) { - this.status = status; - } - - /** - * Sets the status. - * - * @param status - * The status to set (code and reason phrase). - * @param description - * The longer status description. - */ - public void setStatus(Status status, String description) { - setStatus(new Status(status, description)); - } - - /** - * Sets the status. - * - * @param status - * The status to set. - * @param throwable - * The related error or exception. - */ - public void setStatus(Status status, Throwable throwable) { - setStatus(new Status(status, throwable)); - } - - /** - * Sets the status. - * - * @param status - * The status to set. - * @param throwable - * The related error or exception. - * @param message - * The status message. - */ - public void setStatus(Status status, Throwable throwable, String message) { - setStatus(new Status(status, throwable, message)); - } - - /** - * Displays a synthesis of the response like an HTTP status line. - * - * @return A synthesis of the response like an HTTP status line. - */ - public String toString() { - return ((getRequest() == null) ? "?" : getRequest().getProtocol()) - + " - " + getStatus(); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Restlet.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Restlet.java deleted file mode 100644 index f00b01d01c..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Restlet.java +++ /dev/null @@ -1,332 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.restlet.client.data.Status; -import org.restlet.client.engine.Engine; - -/** - * Uniform class that provides a context and life cycle support. It has many - * subclasses that focus on specific ways to process calls. The context property - * is typically provided by a parent Component as a way to encapsulate access to - * shared features such as logging and client connectors.
- *
- * Concurrency note: instances of this class or its subclasses can be invoked by - * several threads at the same time and therefore must be thread-safe. You - * should be especially careful when storing state in member variables. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Restlet implements Uniform { - /** Error message. */ - private static final String UNABLE_TO_START = "Unable to start the Restlet"; - - - /** The author(s). */ - private volatile String author; - - /** The context. */ - private volatile Context context; - - /** The description. */ - private volatile String description; - - - /** The display name. */ - private volatile String name; - - /** The owner(s). */ - private volatile String owner; - - /** Indicates if the Restlet was started. */ - private volatile boolean started; - - /** - * Constructor with null context. - */ - public Restlet() { - this(null); - } - - /** - * Constructor with the Restlet's context, which can be the parent's - * application context, but shouldn't be the parent Component's context for - * security reasons. - * - * @see Context#createChildContext() - * - * @param context - * The context of the Restlet. - * - */ - public Restlet(Context context) { - this.context = (context != null) ? context : new Context(); - this.started = false; - this.name = toString(); - this.description = null; - this.author = null; - this.owner = null; - - } - - - /** - * Attempts to {@link #stop()} the Restlet if it is still started. - */ - @Override - protected void finalize() throws Throwable { - if (isStarted()) { - stop(); - } - super.finalize(); - } - - - /** - * Returns the author(s). - * - * @return The author(s). - */ - public String getAuthor() { - return this.author; - } - - /** - * Returns the context. - * - * @return The context. - */ - public Context getContext() { - return this.context; - } - - /** - * Returns the description. - * - * @return The description - */ - public String getDescription() { - return this.description; - } - - - /** - * Returns the context's logger. - * - * @return The context's logger. - */ - public Logger getLogger() { - Logger result = null; - Context context = getContext(); - - if (context == null) { - context = Context.getCurrent(); - } - - if (context != null) { - result = context.getLogger(); - } - - if (result == null) { - result = Engine.getLogger(this, "org.restlet.client"); - } - - return result; - } - - /** - * Returns the display name. - * - * @return The display name. - */ - public String getName() { - return this.name; - } - - /** - * Returns the owner(s). - * - * @return The owner(s). - */ - public String getOwner() { - return this.owner; - } - - - /** - * Handles a call. - * The default behavior is to attempt to start it, unless it was already started. - * If an exception is thrown during the start action, then the response status - * is set to {@link Status#SERVER_ERROR_INTERNAL}. - *

- * Subclasses overriding this method should make sure that they call - * super.handle(request, response) before adding their own logic. - * - * @param request - * The request to handle. - * @param response - * The response to update. - */ - public void handle(Request request, Response response) { - - // Check if the Restlet was started - if (isStopped()) { - try { - start(); - } catch (Exception e) { - // Occurred while starting the Restlet - if (getContext() != null) { - getContext().getLogger().log(Level.WARNING, - UNABLE_TO_START, e); - } else { - Context.getCurrentLogger().log(Level.WARNING, - UNABLE_TO_START, e); - } - - response.setStatus(Status.SERVER_ERROR_INTERNAL); - } - - if (!isStarted()) { - // No exception raised but the Restlet somehow couldn't be - // started - getContext().getLogger().log(Level.WARNING, UNABLE_TO_START); - response.setStatus(Status.SERVER_ERROR_INTERNAL); - } - } - } - - /** - * Handles a call. - * - * @param request - * The request to handle. - * @param response - * The response to update. - * @param onResponseCallback - * The callback invoked upon response reception. - */ - public final void handle(Request request, Response response, - Uniform onResponseCallback) { - request.setOnResponse(onResponseCallback); - handle(request, response); - } - - /** - * Handles a call. - * - * @param request - * The request to handle. - * @param onReceivedCallback - * The callback invoked upon request reception. - */ - public final void handle(Request request, Uniform onReceivedCallback) { - Response response = new Response(request); - handle(request, response, onReceivedCallback); - } - - /** - * Indicates if the Restlet is started. - * - * @return True if the Restlet is started. - */ - public boolean isStarted() { - return this.started; - } - - /** - * Indicates if the Restlet is stopped. - * - * @return True if the Restlet is stopped. - */ - public boolean isStopped() { - return !this.started; - } - - /** - * Sets the author(s). - * - * @param author - * The author(s). - */ - public void setAuthor(String author) { - this.author = author; - } - - /** - * Sets the context. - * - * @param context - * The context. - */ - public void setContext(Context context) { - this.context = context; - } - - /** - * Sets the description. - * - * @param description - * The description. - */ - public void setDescription(String description) { - this.description = description; - } - - - /** - * Sets the display name. - * - * @param name - * The display name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the owner(s). - * - * @param owner - * The owner(s). - */ - public void setOwner(String owner) { - this.owner = owner; - } - - /** - * Starts the Restlet. - * By default, its only sets "started" internal property to true. - * - * WARNING: this method must be called at the end of the starting process by - * subclasses, otherwise concurrent threads could enter into the call - * handling logic too early. - */ - public synchronized void start() throws Exception { - this.started = true; - } - - /** - * Stops the Restlet. - * By default, its only sets "started" internal property to false. - * - * WARNING: this method must be called at the beginning of the stopping - * process by subclasses, otherwise concurrent threads could continue to - * (improperly) handle calls. - */ - public synchronized void stop() throws Exception { - this.started = false; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Uniform.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Uniform.java deleted file mode 100644 index ebde08ebfa..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/Uniform.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client; - -/** - * Uniform REST interface. "The central feature that distinguishes the REST - * architectural style from other network-based styles is its emphasis on a - * uniform interface between components. By applying the software engineering - * principle of generality to the component interface, the overall system - * architecture is simplified and the visibility of interactions is improved. - * Implementations are decoupled from the services they provide, which - * encourages independent evolvability." Roy T. Fielding - * - * @see Source - * dissertation - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public interface Uniform { - - /** - * Handles a uniform call. It is important to realize that this interface - * can be used either on the client-side or on the server-side. - * - * @param request - * The request to handle. - * @param response - * The associated response. - */ - void handle(Request request, Response response); -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/AuthenticationInfo.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/AuthenticationInfo.java deleted file mode 100644 index b8d4b4f285..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/AuthenticationInfo.java +++ /dev/null @@ -1,246 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import org.restlet.client.engine.util.SystemUtils; - -/** - * Preemptive authentication information. Sent by an origin server to a client - * after a successful digest authentication attempt.
- *
- * Note that when used with HTTP connectors, this class maps to the - * "Authentication-Info" header. - * - * @see HTTP - * Authentication - The Authentication-Info Header - * - * @author Kelly McLaughlin - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class AuthenticationInfo { - - /** The next nonce value. */ - private volatile String nextServerNonce; - - /** The nonce-count value. */ - private volatile int nonceCount; - - /** The client nonce. */ - private volatile String clientNonce; - - /** The quality of protection. */ - private volatile String quality; - - /** The optional response digest for mutual authentication. */ - private volatile String responseDigest; - - /** - * Default constructor. - * - * @param nextNonce - * The next nonce value. - */ - // public AuthenticationInfo(String nextNonce) { - // this(nextNonce, 0, ); - // } - - /** - * Constructor. - * - * @param nextNonce - * The next nonce value. - * @param nonceCount - * The nonce-count value. - * @param cnonce - * The cnonce value. - * @param quality - * The quality of protection. - * @param responseDigest - * The optional response digest for mutual authentication. - */ - public AuthenticationInfo(String nextNonce, int nonceCount, String cnonce, - String quality, String responseDigest) { - this.nextServerNonce = nextNonce; - this.nonceCount = nonceCount; - this.clientNonce = cnonce; - this.quality = quality; - this.responseDigest = responseDigest; - } - - /** {@inheritDoc} */ - @Override - public final boolean equals(final Object obj) { - boolean result = (obj == this); - - // if obj == this no need to go further - if (!result) { - // if obj isn't a challenge request or is null don't evaluate - // further - if (obj instanceof AuthenticationInfo) { - final AuthenticationInfo that = (AuthenticationInfo) obj; - if (getNextServerNonce() != null) { - result = getNextServerNonce().equals( - that.getNextServerNonce()); - } else { - result = (that.getNextServerNonce() == null); - } - - if (result) { - result = (getNonceCount() == that.getNonceCount()); - } - - if (result) { - if (getClientNonce() != null) { - result = getClientNonce().equals(that.getClientNonce()); - } else { - result = (that.getClientNonce() == null); - } - } - - if (result) { - if (getQuality() != null) { - result = getQuality().equals(that.getQuality()); - } else { - result = (that.getQuality() == null); - } - } - - if (result) { - if (getResponseDigest() != null) { - result = getResponseDigest().equals( - that.getResponseDigest()); - } else { - result = (that.getResponseDigest() == null); - } - } - } - } - - return result; - } - - /** - * Returns the client nonce. - * - * @return The client nonce. - */ - public String getClientNonce() { - return this.clientNonce; - } - - /** - * Returns the next server nonce. This is the nonce the server wishes the - * client to use for a future authentication response - * - * @return The next nonce value. - */ - public String getNextServerNonce() { - return this.nextServerNonce; - } - - /** - * Returns the nonce-count value. - * - * @return The nonce-count value. - */ - public int getNonceCount() { - return this.nonceCount; - } - - /** - * Returns the quality of protection. The value can be - * {@link ChallengeMessage#QUALITY_AUTHENTICATION} for authentication or - * {@link ChallengeMessage#QUALITY_AUTHENTICATION_INTEGRITY} for - * authentication with integrity protection. - * - * @return The quality of protection. - */ - public String getQuality() { - return this.quality; - } - - /** - * Returns the optional response digest for mutual authentication. Note that - * when used with HTTP connectors, this property maps to the - * "response-digest" value in the "response-auth" directive of the - * "Authentication-Info" header. - * - * @return The optional response digest for mutual authentication. - */ - public String getResponseDigest() { - return this.responseDigest; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(getNextServerNonce(), getNonceCount(), - getClientNonce(), getQuality(), getResponseDigest()); - } - - /** - * Sets the client nonce. - * - * @param clientNonce - * The client nonce. - */ - public void setClientNonce(String clientNonce) { - this.clientNonce = clientNonce; - } - - /** - * Sets the next server nonce. This is the nonce the server wishes the - * client to use for a future authentication response - * - * @param nextNonce - * The next nonce. - */ - public void setNextServerNonce(String nextNonce) { - this.nextServerNonce = nextNonce; - } - - /** - * Sets the nonce-count value. - * - * @param nonceCount - * The nonceCount value. - */ - public void setNonceCount(int nonceCount) { - this.nonceCount = nonceCount; - } - - /** - * Sets the quality of protection. The value can be - * {@link ChallengeMessage#QUALITY_AUTHENTICATION} for authentication or - * {@link ChallengeMessage#QUALITY_AUTHENTICATION_INTEGRITY} for - * authentication with integrity protection. - * - * @param qop - * The quality of protection. - */ - public void setQuality(String qop) { - this.quality = qop; - } - - /** - * Sets the optional response digest for mutual authentication. Note that - * when used with HTTP connectors, this property maps to the - * "response-digest" value in the "response-auth" directive of the - * "Authentication-Info" header. - * - * @param responseDigest - * The response digest. - */ - public void setResponseDigest(String responseDigest) { - this.responseDigest = responseDigest; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CacheDirective.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CacheDirective.java deleted file mode 100644 index 5aaff5cd98..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CacheDirective.java +++ /dev/null @@ -1,464 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.List; -import java.util.Objects; - -import org.restlet.client.engine.header.HeaderConstants; -import org.restlet.client.engine.util.SystemUtils; -import org.restlet.client.util.NamedValue; - -/** - * Directive for caching mechanisms along the call chain. This overrides the - * default behavior of those caches and proxies.
- *
- * Note that when used with HTTP connectors, this class maps to the - * "Cache-Control" header. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class CacheDirective implements NamedValue { - - /** - * Creates a "max-age" directive. Indicates that the client is willing to - * accept a response whose age is no greater than the specified time in - * seconds. Unless "max-stale" directive is also included, the client is not - * willing to accept a stale response.
- *
- * Note that this directive can be used on requests or responses. - * - * @param maxAge - * Maximum age in seconds. - * @return A new "max-age" directive. - * @see HTTP 1.1 - Modifications of the - * Basic Expiration Mechanism - * @see HTTP 1.1 - Cache Revalidation and - * Reload Controls - */ - public static CacheDirective maxAge(int maxAge) { - return new CacheDirective(HeaderConstants.CACHE_MAX_AGE, - Integer.toString(maxAge), true); - } - - /** - * Creates a "max-stale" directive. Indicates that the client is willing to - * accept a response that has exceeded its expiration time by any amount of - * time.
- *
- * Note that this directive can be used on requests only. - * - * @return A new "max-stale" directive. - * @see HTTP 1.1 - Modifications of the - * Basic Expiration Mechanism - */ - public static CacheDirective maxStale() { - return new CacheDirective(HeaderConstants.CACHE_MAX_STALE); - } - - /** - * Creates a "max-stale" directive. Indicates that the client is willing to - * accept a response that has exceeded its expiration time by a given amount - * of time.
- *
- * Note that this directive can be used on requests only. - * - * @param maxStale - * Maximum stale age in seconds. - * @return A new "max-stale" directive. - * @see HTTP 1.1 - Modifications of the - * Basic Expiration Mechanism - */ - public static CacheDirective maxStale(int maxStale) { - return new CacheDirective(HeaderConstants.CACHE_MAX_STALE, - Integer.toString(maxStale), true); - } - - /** - * Creates a "min-fresh" directive. Indicates that the client is willing to - * accept a response whose freshness lifetime is no less than its current - * age plus the specified time in seconds. That is, the client wants a - * response that will still be fresh for at least the specified number of - * seconds.
- *
- * Note that this directive can be used on requests only. - * - * @param minFresh - * Minimum freshness lifetime in seconds. - * @return A new "min-fresh" directive. - * @see HTTP 1.1 - Modifications of the - * Basic Expiration Mechanism - */ - public static CacheDirective minFresh(int minFresh) { - return new CacheDirective(HeaderConstants.CACHE_MIN_FRESH, - Integer.toString(minFresh), true); - } - - /** - * Creates a "must-revalidate" directive. Indicates that the origin server - * requires revalidation of a cache entry on any subsequent use.
- *
- * Note that this directive can be used on responses only. - * - * @return A new "must-revalidate" directive. - * @see HTTP 1.1 - Cache Revalidation and - * Reload Controls - */ - public static CacheDirective mustRevalidate() { - return new CacheDirective(HeaderConstants.CACHE_MUST_REVALIDATE); - } - - /** - * Creates a "no-cache" directive. Indicates that a cache must not use the - * response to satisfy subsequent requests without successful revalidation - * with the origin server.
- *
- * Note that this directive can be used on requests or responses. - * - * @return A new "no-cache" directive. - * @see HTTP 1.1 - What is Cacheable - */ - public static CacheDirective noCache() { - return new CacheDirective(HeaderConstants.CACHE_NO_CACHE); - } - - /** - * Creates a "no-cache" directive. Indicates that a cache must not use the - * response to satisfy subsequent requests without successful revalidation - * with the origin server.
- *
- * Note that this directive can be used on requests or responses. - * - * @param fieldNames - * Field names, typically a HTTP header name, that must not be - * sent by caches. - * @return A new "no-cache" directive. - * @see HTTP 1.1 - What is Cacheable - */ - public static CacheDirective noCache(List fieldNames) { - StringBuilder sb = new StringBuilder(); - - if (fieldNames != null) { - for (int i = 0; i < fieldNames.size(); i++) { - sb.append("\"").append(fieldNames.get(i)).append("\""); - - if (i < fieldNames.size() - 1) { - sb.append(','); - } - } - } - - return new CacheDirective(HeaderConstants.CACHE_NO_CACHE, sb.toString()); - } - - /** - * Creates a "no-cache" directive. Indicates that a cache must not use the - * response to satisfy subsequent requests without successful revalidation - * with the origin server.
- *
- * Note that this directive can be used on requests or responses. - * - * @param fieldName - * A field name, typically a HTTP header name, that must not be - * sent by caches. - * @return A new "no-cache" directive. - * @see HTTP 1.1 - What is Cacheable - */ - public static CacheDirective noCache(String fieldName) { - return new CacheDirective(HeaderConstants.CACHE_NO_CACHE, "\"" - + fieldName + "\""); - } - - /** - * Creates a "no-store" directive. Indicates that a cache must not release - * or retain any information about the call. This applies to both private - * and shared caches.
- *
- * Note that this directive can be used on requests or responses. - * - * @return A new "no-store" directive. - * @see HTTP 1.1 - What May be Stored by - * Caches - */ - public static CacheDirective noStore() { - return new CacheDirective(HeaderConstants.CACHE_NO_STORE); - } - - /** - * Creates a "no-transform" directive. Indicates that a cache or - * intermediary proxy must not transform the response entity.
- *
- * Note that this directive can be used on requests or responses. - * - * @return A new "no-transform" directive. - * @see HTTP 1.1 - No-Transform - * Directive - */ - public static CacheDirective noTransform() { - return new CacheDirective(HeaderConstants.CACHE_NO_TRANSFORM); - } - - /** - * Creates a "onlyIfCached" directive. Indicates that only cached responses - * should be returned to the client.
- *
- * Note that this directive can be used on requests only. - * - * @return A new "only-if-cached" directive. - * @see HTTP 1.1 - Cache Revalidation and - * Reload Controls - */ - public static CacheDirective onlyIfCached() { - return new CacheDirective(HeaderConstants.CACHE_ONLY_IF_CACHED); - } - - /** - * Creates a "private" directive. Indicates that all or part of the response - * message is intended for a single user and must not be cached by a shared - * cache.
- *
- * Note that this directive can be used on responses only. - * - * @return A new "private" directive. - * @see HTTP 1.1 - What is Cacheable - */ - public static CacheDirective privateInfo() { - return new CacheDirective(HeaderConstants.CACHE_PRIVATE); - } - - /** - * Creates a "private" directive. Indicates that all or part of the response - * message is intended for a single user and must not be cached by a shared - * cache.
- *
- * Note that this directive can be used on responses only. - * - * @param fieldNames - * Field names, typically a HTTP header name, that must be - * private. - * @return A new "private" directive. - * @see HTTP 1.1 - What is Cacheable - */ - public static CacheDirective privateInfo(List fieldNames) { - StringBuilder sb = new StringBuilder(); - - if (fieldNames != null) { - for (int i = 0; i < fieldNames.size(); i++) { - sb.append("\"").append(fieldNames.get(i)).append("\""); - - if (i < fieldNames.size() - 1) { - sb.append(','); - } - } - } - - return new CacheDirective(HeaderConstants.CACHE_PRIVATE, sb.toString()); - } - - /** - * Creates a "private" directive. Indicates that all or part of the response - * message is intended for a single user and must not be cached by a shared - * cache.
- *
- * Note that this directive can be used on responses only. - * - * @param fieldName - * A field name, typically a HTTP header name, that is private. - * @return A new "private" directive. - * @see HTTP 1.1 - What is Cacheable - */ - public static CacheDirective privateInfo(String fieldName) { - return new CacheDirective(HeaderConstants.CACHE_PRIVATE, "\"" - + fieldName + "\""); - } - - /** - * Creates a "proxy-revalidate" directive. Indicates that the origin server - * requires revalidation of a cache entry on any subsequent use, except that - * it does not apply to non-shared user agent caches
- *
- * Note that this directive can be used on responses only. - * - * @return A new "proxy-revalidate" directive. - * @see HTTP 1.1 - Cache Revalidation and - * Reload Controls - */ - public static CacheDirective proxyMustRevalidate() { - return new CacheDirective(HeaderConstants.CACHE_PROXY_MUST_REVALIDATE); - } - - /** - * Creates a "public" directive. Indicates that the response may be cached - * by any cache, even if it would normally be non-cacheable or cacheable - * only within a non-shared cache.
- *
- * Note that this directive can be used on responses only. - * - * @return A new "public" directive. - * @see HTTP 1.1 - What is Cacheable - */ - public static CacheDirective publicInfo() { - return new CacheDirective(HeaderConstants.CACHE_PUBLIC); - } - - /** - * Creates a "s-maxage" directive. Indicates that the client is willing to - * accept a response from a shared cache (but not a private cache) whose age - * is no greater than the specified time in seconds.
- *
- * Note that this directive can be used on responses only. - * - * @param sharedMaxAge - * Maximum age in seconds. - * @return A new "s-maxage" directive. - * @see HTTP 1.1 - Modifications of the - * Basic Expiration Mechanism - */ - public static CacheDirective sharedMaxAge(int sharedMaxAge) { - return new CacheDirective(HeaderConstants.CACHE_SHARED_MAX_AGE, - Integer.toString(sharedMaxAge), true); - } - - /** Indicates if the directive is a digit value. */ - private boolean digit; - - /** The name. */ - private volatile String name; - - /** The value. */ - private volatile String value; - - /** - * Constructor for directives with no value. - * - * @param name - * The directive name. - */ - public CacheDirective(String name) { - this(name, null); - } - - /** - * Constructor for directives with a value. - * - * @param name - * The directive name. - * @param value - * The directive value. - */ - public CacheDirective(String name, String value) { - this(name, value, false); - } - - /** - * Constructor for directives with a value. - * - * @param name - * The directive name. - * @param value - * The directive value. - * @param digit - * The kind of value (true for a digit value, false otherwise). - */ - public CacheDirective(String name, String value, boolean digit) { - this.name = name; - this.value = value; - this.digit = digit; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - - if (!(obj instanceof CacheDirective)) { - return false; - } - - CacheDirective that = (CacheDirective) obj; - - return Objects.equals(getName(), that.getName()) - && Objects.equals(getValue(), that.getValue()) - && (this.digit == that.digit); - } - - /** - * Returns the name. - * - * @return The name. - */ - public String getName() { - return name; - } - - /** - * Returns the value. - * - * @return The value. - */ - public String getValue() { - return value; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(getName(), getValue(), isDigit()); - } - - /** - * Returns true if the directive contains a digit value. - * - * @return True if the directive contains a digit value. - */ - public boolean isDigit() { - return digit; - } - - /** - * Indicates if the directive is a digit value. - * - * @param digit - * True if the directive contains a digit value. - */ - public void setDigit(boolean digit) { - this.digit = digit; - } - - /** - * Sets the name. - * - * @param name - * The name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the value. - * - * @param value - * The value. - */ - public void setValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return "CacheDirective [digit=" + digit + ", name=" + name + ", value=" - + value + "]"; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeMessage.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeMessage.java deleted file mode 100644 index d2c4e87e3e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeMessage.java +++ /dev/null @@ -1,302 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Objects; - -import org.restlet.client.engine.util.SystemUtils; -import org.restlet.client.util.Series; - -/** - * Base authentication challenge message exchanged between an origin server and - * a client. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class ChallengeMessage { - - /** Authentication quality. */ - public static final String QUALITY_AUTHENTICATION = "auth"; - - /** Authentication and integrity. */ - public static final String QUALITY_AUTHENTICATION_INTEGRITY = "auth-int"; - - /** The raw value for custom challenge schemes. */ - private volatile String rawValue; - - /** The additional scheme parameters. */ - private volatile Series parameters; - - /** The challenge scheme. */ - private volatile ChallengeScheme scheme; - - /** The server nonce. */ - private volatile String serverNonce; - - /** The authentication realm. */ - private volatile String realm; - - /** - * An opaque string of data which should be returned by the client - * unchanged. - */ - private volatile String opaque; - - /** The digest algorithm. */ - private volatile String digestAlgorithm; - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - */ - public ChallengeMessage(ChallengeScheme scheme) { - this(scheme, null, null); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param parameters - * The additional scheme parameters. - */ - public ChallengeMessage(ChallengeScheme scheme, Series parameters) { - this(scheme, null, null); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param realm - * The authentication realm. - */ - public ChallengeMessage(ChallengeScheme scheme, String realm) { - this(scheme, realm, null); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param realm - * The authentication realm. - * @param parameters - * The additional scheme parameters. - */ - public ChallengeMessage(ChallengeScheme scheme, String realm, - Series parameters) { - this(scheme, realm, parameters, Digest.ALGORITHM_MD5, null, null); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param realm - * The authentication realm. - * @param parameters - * The additional scheme parameters. - * @param digestAlgorithm - * The digest algorithm. - * @param opaque - * An opaque string of data which should be returned by the - * client unchanged. - * @param serverNonce - * The server nonce. - */ - public ChallengeMessage(ChallengeScheme scheme, String realm, - Series parameters, String digestAlgorithm, - String opaque, String serverNonce) { - super(); - this.parameters = parameters; - this.scheme = scheme; - this.serverNonce = serverNonce; - this.realm = realm; - this.opaque = opaque; - this.digestAlgorithm = digestAlgorithm; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof ChallengeMessage)) { - return false; - } - - final ChallengeMessage that = (ChallengeMessage) obj; - - return getParameters().equals(that.getParameters()) - && Objects.equals(getRealm(), that.getRealm()) - && Objects.equals(getScheme(), that.getScheme()) - && Objects.equals(getServerNonce(), that.getServerNonce()) - && Objects.equals(getOpaque(), that.getOpaque()) - && Objects.equals(getDigestAlgorithm(), that.getDigestAlgorithm()); - } - - /** - * Returns the digest algorithm. See {@link Digest} class for DIGEST_* - * constants. Default value is {@link Digest#ALGORITHM_MD5}. - * - * @return The digest algorithm. - */ - public String getDigestAlgorithm() { - return digestAlgorithm; - } - - /** - * Returns an opaque string of data which should be returned by the client - * unchanged. - * - * @return An opaque string of data. - */ - public String getOpaque() { - return opaque; - } - - /** - * Returns the modifiable series of scheme parameters. Creates a new - * instance if no one has been set. - * - * @return The modifiable series of scheme parameters. - */ - public Series getParameters() { - if (this.parameters == null) { - this.parameters = new org.restlet.client.engine.util.ParameterSeries(); - } - - return this.parameters; - } - - /** - * Returns the raw challenge value. - * - * @return The raw challenge value. - */ - public String getRawValue() { - return this.rawValue; - } - - /** - * Returns the realm name. - * - * @return The realm name. - */ - public String getRealm() { - return this.realm; - } - - /** - * Returns the scheme used. - * - * @return The scheme used. - */ - public ChallengeScheme getScheme() { - return this.scheme; - } - - /** - * Returns the server nonce. - * - * @return The server nonce. - */ - public String getServerNonce() { - return serverNonce; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(getScheme(), getRealm(), getParameters()); - } - - /** - * Sets the digest algorithm. See {@link Digest} class for ALGORITHM_* - * constants. Default value is {@link Digest#ALGORITHM_MD5}. - * - * @param digestAlgorithm - * The digest algorithm. - */ - public void setDigestAlgorithm(String digestAlgorithm) { - this.digestAlgorithm = digestAlgorithm; - } - - /** - * Sets an opaque string of data which should be returned by the client - * unchanged. - * - * @param opaque - * An opaque string of data. - */ - public void setOpaque(String opaque) { - this.opaque = opaque; - } - - /** - * Sets the parameters. - * - * @param parameters - * The parameters. - */ - public void setParameters(Series parameters) { - this.parameters = parameters; - } - - /** - * Sets the raw value. - * - * @param rawValue - * The raw value. - */ - public void setRawValue(String rawValue) { - this.rawValue = rawValue; - } - - /** - * Sets the realm name. - * - * @param realm - * The realm name. - */ - public void setRealm(String realm) { - this.realm = realm; - } - - /** - * Sets the scheme used. - * - * @param scheme - * The scheme used. - */ - public void setScheme(ChallengeScheme scheme) { - this.scheme = scheme; - } - - /** - * Sets the server nonce. - * - * @param serverNonce - * The server nonce. - */ - public void setServerNonce(String serverNonce) { - this.serverNonce = serverNonce; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeRequest.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeRequest.java deleted file mode 100644 index 0cbfef9ab7..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeRequest.java +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -import org.restlet.client.engine.util.SystemUtils; - -/** - * Authentication challenge sent by an origin server to a client. Upon reception - * of this request, the client should send a new request with the proper {@link ChallengeResponse} set.
- *
- * Note that when used with HTTP connectors, this class maps to the - * "WWW-Authenticate" header. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class ChallengeRequest extends ChallengeMessage { - - /** The available options for quality of protection. */ - private volatile List qualityOptions; - - /** The URI references that define the protection domains. */ - private volatile List domainRefs; - - /** Indicates if the previous request from the client was stale. */ - private volatile boolean stale; - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - */ - public ChallengeRequest(ChallengeScheme scheme) { - this(scheme, null); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param realm - * The authentication realm. - */ - public ChallengeRequest(ChallengeScheme scheme, String realm) { - super(scheme, realm); - this.domainRefs = null; - this.qualityOptions = null; - this.stale = false; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(final Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof ChallengeRequest)) { - return false; - } - - final ChallengeRequest that = (ChallengeRequest) obj; - - return getParameters().equals(that.getParameters()) - && Objects.equals(getRealm(), that.getRealm()) - && Objects.equals(getScheme(), that.getScheme()); - } - - /** - * Returns the base URI references that collectively define the protected - * domains for the digest authentication. By default it return a list with a - * single "/" URI reference. - * - * @return The base URI references. - */ - public List getDomainRefs() { - // Lazy initialization with double-check. - List r = this.domainRefs; - if (r == null) { - synchronized (this) { - r = this.domainRefs; - if (r == null) { - this.domainRefs = r = new CopyOnWriteArrayList(); - this.domainRefs.add(new Reference("/")); - } - } - } - return r; - } - - /** - * Returns the available options for quality of protection. The default - * value is {@link #QUALITY_AUTHENTICATION}. - * - * @return The available options for quality of protection. - */ - public List getQualityOptions() { - // Lazy initialization with double-check. - List r = this.qualityOptions; - if (r == null) { - synchronized (this) { - r = this.qualityOptions; - if (r == null) { - this.qualityOptions = r = new CopyOnWriteArrayList(); - this.qualityOptions.add(QUALITY_AUTHENTICATION); - } - } - } - return r; - } - - @Override - public int hashCode() { - return SystemUtils.hashCode(super.hashCode(), qualityOptions, domainRefs, stale); - } - - /** - * Indicates if the previous request from the client was stale. - * - * @return True if the previous request from the client was stale. - */ - public boolean isStale() { - return stale; - } - - /** - * Sets the URI references that define the protection domains for the digest - * authentication. - * - * @param domainRefs - * The base URI references. - */ - public void setDomainRefs(List domainRefs) { - this.domainRefs = domainRefs; - } - - /** - * Sets the URI references that define the protection domains for the digest - * authentication. Note that the parameters are copied into a new {@link CopyOnWriteArrayList} instance. - * - * @param domainUris - * The base URI references. - * @see #setDomainRefs(List) - */ - public void setDomainUris(Collection domainUris) { - List domainRefs = null; - - if (domainUris != null) { - domainRefs = new CopyOnWriteArrayList(); - - for (String domainUri : domainUris) { - domainRefs.add(new Reference(domainUri)); - } - } - - setDomainRefs(domainRefs); - } - - /** - * Sets the available options for quality of protection. The default value - * is {@link #QUALITY_AUTHENTICATION}. - * - * @param qualityOptions - * The available options for quality of protection. - */ - public void setQualityOptions(List qualityOptions) { - this.qualityOptions = qualityOptions; - } - - /** - * Indicates if the previous request from the client was stale. - * - * @param stale - * True if the previous request from the client was stale. - */ - public void setStale(boolean stale) { - this.stale = stale; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeResponse.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeResponse.java deleted file mode 100644 index 1c5b832d4a..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeResponse.java +++ /dev/null @@ -1,421 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Objects; - -import org.restlet.client.Request; -import org.restlet.client.engine.util.SystemUtils; -import org.restlet.client.util.Series; - -/** - * Authentication response sent by client to an origin server. This is typically - * following a {@link ChallengeRequest} sent by the origin server to the client.
- *
- * Sometimes, it might be faster to preemptively issue a challenge response if - * the client knows for sure that the target resource will require - * authentication.
- *
- * Note that when used with HTTP connectors, this class maps to the - * "Authorization" header. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class ChallengeResponse extends ChallengeMessage { - - /** The client nonce value. */ - private volatile String clientNonce; - - /** - * The {@link Request#getResourceRef()} value duplicated here in case a - * proxy changed it. - */ - private volatile Reference digestRef; - - /** The user identifier, such as a login name or an access key. */ - private volatile String identifier; - - /** The chosen quality of protection. */ - private volatile String quality; - - /** The user secret, such as a password or a secret key. */ - private volatile char[] secret; - - /** The digest algorithm name optionally applied on the user secret. */ - private volatile String secretAlgorithm; - - /** The server nonce count. */ - private volatile int serverNonceCount; - - /** - * The time when the response was issued, as returned by {@link System#currentTimeMillis()}. - */ - private volatile long timeIssued; - - /** - * Constructor with no credentials. - * - * @param scheme - * The challenge scheme. - */ - public ChallengeResponse(ChallengeScheme scheme) { - this(scheme, null, (char[]) null); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param parameters - * The additional scheme parameters. - * @param identifier - * The user identifier, such as a login name or an access key. - * @param secret - * The user secret, such as a password or a secret key. - * @param secretAlgorithm - * The digest algorithm name optionally applied on the user - * secret. - * @param realm - * The authentication realm. - * @param quality - * The chosen quality of protection. - * @param digestRef - * The {@link Request#getResourceRef()} value duplicated here in - * case a proxy changed it. - * @param digestAlgorithm - * The digest algorithm. - * @param opaque - * An opaque string of data which should be returned by the - * client unchanged. - * @param clientNonce - * The client nonce value. - * @param serverNonce - * The server nonce. - * @param serverNonceCount - * The server nonce count. - * @param timeIssued - * The time when the response was issued, as returned by {@link System#currentTimeMillis()}. - */ - public ChallengeResponse(ChallengeScheme scheme, - Series parameters, String identifier, char[] secret, - String secretAlgorithm, String realm, String quality, - Reference digestRef, String digestAlgorithm, String opaque, - String clientNonce, String serverNonce, int serverNonceCount, - long timeIssued) { - super(scheme, realm, parameters, digestAlgorithm, opaque, serverNonce); - this.clientNonce = clientNonce; - this.digestRef = digestRef; - this.identifier = identifier; - this.quality = quality; - this.secret = secret; - this.secretAlgorithm = secretAlgorithm; - this.serverNonceCount = serverNonceCount; - this.timeIssued = timeIssued; - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param identifier - * The user identifier, such as a login name or an access key. - * @param secret - * The user secret, such as a password or a secret key. - */ - public ChallengeResponse(ChallengeScheme scheme, String identifier, - char[] secret) { - this(scheme, identifier, secret, null); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param identifier - * The user identifier, such as a login name or an access key. - * @param parameters - * The additional scheme parameters. - */ - public ChallengeResponse(ChallengeScheme scheme, String identifier, - char[] secret, Series parameters) { - this(scheme, parameters, identifier, secret, Digest.ALGORITHM_NONE, - null, null, null, null, null, null, null, 0, 0L); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param identifier - * The user identifier, such as a login name or an access key. - * @param parameters - * The additional scheme parameters. - */ - public ChallengeResponse(ChallengeScheme scheme, String identifier, - Series parameters) { - this(scheme, identifier, null, parameters); - } - - /** - * Constructor. - * - * @param scheme - * The challenge scheme. - * @param identifier - * The user identifier, such as a login name or an access key. - * @param secret - * The user secret, such as a password or a secret key. - */ - public ChallengeResponse(ChallengeScheme scheme, String identifier, - String secret) { - this(scheme, identifier, (secret != null) ? secret.toCharArray() : null); - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object obj) { - // if obj == this no need to go further - if (obj == this) { - return true; - } - - // if obj isn't a challenge request or is null don't evaluate further - if (!(obj instanceof ChallengeResponse)) { - return false; - } - - ChallengeResponse that = (ChallengeResponse) obj; - - if (!Objects.equals(getRawValue(), that.getRawValue()) - || !Objects.equals(getIdentifier(), that.getIdentifier()) - || !Objects.equals(getScheme(), that.getScheme())) { - return false; - } - - if ((getSecret() == null) - || (that.getSecret() == null)) { - // check if both are null - return (getSecret() == that.getSecret()); - } - - if (getSecret().length != that.getSecret().length) { - return false; - } - - boolean equals = true; - for (int i = 0; equals && (i < getSecret().length); i++) { - equals = (getSecret()[i] == that.getSecret()[i]); - } - return equals; - } - - /** - * Returns the client nonce. - * - * @return The client nonce. - */ - public String getClientNonce() { - return this.clientNonce; - } - - /** - * Returns the {@link Request#getResourceRef()} value duplicated here in - * case a proxy changed it. - * - * @return The digest URI reference. - */ - public Reference getDigestRef() { - return digestRef; - } - - /** - * Returns the user identifier, such as a login name or an access key. - * - * @return The user identifier, such as a login name or an access key. - */ - public String getIdentifier() { - return this.identifier; - } - - - /** - * Returns the chosen quality of protection. - * - * @return The chosen quality of protection. - */ - public String getQuality() { - return quality; - } - - /** - * Returns the user secret, such as a password or a secret key. - * - * It is not recommended to use {@link String#String(char[])} for security - * reasons. - * - * @return The user secret, such as a password or a secret key. - */ - public char[] getSecret() { - return this.secret; - } - - /** - * Returns the digest algorithm name optionally applied on the user secret. - * - * @return The digest algorithm name optionally applied on the user secret. - */ - public String getSecretAlgorithm() { - return secretAlgorithm; - } - - /** - * Returns the server nonce count. - * - * @return The server nonce count. - * @deprecated Use {@code getServerNonceCount} instead. - */ - @Deprecated - public int getServerNounceCount() { - return getServerNonceCount(); - } - - /** - * Returns the server nonce count. - * - * @return The server nonce count. - */ - public int getServerNonceCount() { - return serverNonceCount; - } - - /** - * Returns the time when the response was issued, as returned by {@link System#currentTimeMillis()}. - * - * @return The time when the response was issued. - */ - public long getTimeIssued() { - return timeIssued; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - // Note that the secret is simply discarded from hash code calculation - // because we don't want it to be materialized as a string - return SystemUtils - .hashCode(getScheme(), getIdentifier(), getRawValue()); - } - - /** - * Sets the client nonce. - * - * @param clientNonce - * The client nonce. - */ - public void setClientNonce(String clientNonce) { - this.clientNonce = clientNonce; - } - - /** - * Sets the digest URI reference. - * - * @param digestRef - * The digest URI reference. - */ - public void setDigestRef(Reference digestRef) { - this.digestRef = digestRef; - } - - /** - * Sets the user identifier, such as a login name or an access key. - * - * @param identifier - * The user identifier, such as a login name or an access key. - */ - public void setIdentifier(String identifier) { - this.identifier = identifier; - } - - /** - * Sets the chosen quality of protection. - * - * @param quality - * The chosen quality of protection. - */ - public void setQuality(String quality) { - this.quality = quality; - } - - /** - * Sets the user secret, such as a password or a secret key. - * - * @param secret - * The user secret, such as a password or a secret key. - */ - public void setSecret(char[] secret) { - this.secret = secret; - } - - /** - * Sets the user secret, such as a password or a secret key. - * - * @param secret - * The user secret, such as a password or a secret key. - */ - public void setSecret(String secret) { - this.secret = (secret == null) ? null : secret.toCharArray(); - } - - /** - * Sets the digest algorithm name optionally applied on the user secret. - * - * @param secretDigestAlgorithm - * The digest algorithm name optionally applied on the user - * secret. - */ - public void setSecretAlgorithm(String secretDigestAlgorithm) { - this.secretAlgorithm = secretDigestAlgorithm; - } - - /** - * Sets the server nonce count. - * - * @param serverNonceCount The server nonce count. - * @deprecated Use {@code setServerNonceCount} instead. - */ - @Deprecated - public void setServerNounceCount(int serverNonceCount) { - setServerNonceCount(serverNonceCount); - } - - /** - * Sets the server nonce count. - * - * @param serverNonceCount The server nonce count. - */ - public void setServerNonceCount(int serverNonceCount) { - this.serverNonceCount = serverNonceCount; - } - /** - * Sets the time when the response was issued, as returned by {@link System#currentTimeMillis()}. - * - * @param timeIssued - * The time when the response was issued. - */ - public void setTimeIssued(long timeIssued) { - this.timeIssued = timeIssued; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeScheme.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeScheme.java deleted file mode 100644 index b3a424fdcb..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ChallengeScheme.java +++ /dev/null @@ -1,268 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -/** - * Challenge scheme used to authenticate remote clients. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class ChallengeScheme { - /** Custom scheme based on IP address or cookies or query parameters, etc. */ - public static final ChallengeScheme CUSTOM = new ChallengeScheme("CUSTOM", - "Custom", "Custom authentication"); - - /** Plain FTP scheme. */ - public static final ChallengeScheme FTP_PLAIN = new ChallengeScheme( - "FTP_PLAIN", "PLAIN", "Plain FTP authentication"); - - /** Amazon Query String HTTP scheme. */ - public static final ChallengeScheme HTTP_AWS_IAM = new ChallengeScheme( - "HTTP_AWS_IAM", "AWS3", "Amazon IAM-based authentication"); - - /** Amazon Query String HTTP scheme. */ - public static final ChallengeScheme HTTP_AWS_QUERY = new ChallengeScheme( - "HTTP_AWS_QUERY", "AWS_QUERY", "Amazon Query String authentication"); - - /** Amazon S3 HTTP scheme. */ - public static final ChallengeScheme HTTP_AWS_S3 = new ChallengeScheme( - "HTTP_AWS_S3", "AWS", "Amazon S3 HTTP authentication"); - - /** - * Microsoft Azure Shared Key scheme. - * - * @see MSDN - * page - */ - public static final ChallengeScheme HTTP_AZURE_SHAREDKEY = new ChallengeScheme( - "HTTP_AZURE_SHAREDKEY", "SharedKey", - "Microsoft Azure Shared Key authorization (authentication)"); - - /** - * Microsoft Azure Shared Key lite scheme. - * - * @see MSDN - * page - */ - public static final ChallengeScheme HTTP_AZURE_SHAREDKEY_LITE = new ChallengeScheme( - "HTTP_AZURE_SHAREDKEY_LITE", "SharedKeyLite", - "Microsoft Azure Shared Key lite authorization (authentication)"); - - /** Basic HTTP scheme. */ - public static final ChallengeScheme HTTP_BASIC = new ChallengeScheme( - "HTTP_BASIC", "Basic", "Basic HTTP authentication"); - - /** Cookie HTTP scheme. */ - public static final ChallengeScheme HTTP_COOKIE = new ChallengeScheme( - "HTTP_Cookie", "Cookie", "Cookie HTTP authentication"); - - /** Digest HTTP scheme. */ - public static final ChallengeScheme HTTP_DIGEST = new ChallengeScheme( - "HTTP_DIGEST", "Digest", "Digest HTTP authentication"); - - /** Microsoft NTML HTTP scheme. */ - public static final ChallengeScheme HTTP_NTLM = new ChallengeScheme( - "HTTP_NTLM", "NTLM", "Microsoft NTLM HTTP authentication"); - - /** - * OAuth 1.0 HTTP scheme. Removed in later drafts and final OAuth 2.0 - * specification. - */ - public static final ChallengeScheme HTTP_OAUTH = new ChallengeScheme( - "HTTP_OAuth", "OAuth", "OAuth 1.0 authentication"); - - /** OAuth Bearer HTTP scheme. */ - public static final ChallengeScheme HTTP_OAUTH_BEARER = new ChallengeScheme( - "HTTP_Bearer", "Bearer", "OAuth 2.0 bearer token authentication"); - - /** OAuth MAC HTTP scheme. */ - public static final ChallengeScheme HTTP_OAUTH_MAC = new ChallengeScheme( - "HTTP_MAC", "Mac", - "OAuth 2.0 message authentication code authentication"); - - /** Basic POP scheme. Based on the USER/PASS commands. */ - public static final ChallengeScheme POP_BASIC = new ChallengeScheme( - "POP_BASIC", "Basic", - "Basic POP authentication (USER/PASS commands)"); - - /** Digest POP scheme. Based on the APOP command. */ - public static final ChallengeScheme POP_DIGEST = new ChallengeScheme( - "POP_DIGEST", "Digest", "Digest POP authentication (APOP command)"); - - /** Private list of schemes for optimization purpose. */ - private static Map SCHEMES; - - /** Secure Data Connector scheme. */ - @Deprecated - public static final ChallengeScheme SDC = new ChallengeScheme("SDC", "SDC", - "Secure Data Connector authentication"); - - /** Plain SMTP scheme. */ - public static final ChallengeScheme SMTP_PLAIN = new ChallengeScheme( - "SMTP_PLAIN", "PLAIN", "Plain SMTP authentication"); - - static { - Map schemes = new HashMap(); - - schemes.put(CUSTOM.getName().toLowerCase(), CUSTOM); - schemes.put(FTP_PLAIN.getName().toLowerCase(), FTP_PLAIN); - schemes.put(HTTP_AWS_IAM.getName().toLowerCase(), HTTP_AWS_S3); - schemes.put(HTTP_AWS_QUERY.getName().toLowerCase(), HTTP_AWS_S3); - schemes.put(HTTP_AWS_S3.getName().toLowerCase(), HTTP_AWS_S3); - schemes.put(HTTP_AZURE_SHAREDKEY.getName().toLowerCase(), - HTTP_AZURE_SHAREDKEY); - schemes.put(HTTP_AZURE_SHAREDKEY_LITE.getName().toLowerCase(), - HTTP_AZURE_SHAREDKEY_LITE); - schemes.put(HTTP_BASIC.getName().toLowerCase(), HTTP_BASIC); - schemes.put(HTTP_COOKIE.getName().toLowerCase(), HTTP_COOKIE); - schemes.put(HTTP_DIGEST.getName().toLowerCase(), HTTP_DIGEST); - schemes.put(HTTP_NTLM.getName().toLowerCase(), HTTP_NTLM); - schemes.put(HTTP_OAUTH.getName().toLowerCase(), HTTP_OAUTH); - schemes.put(HTTP_OAUTH_BEARER.getName().toLowerCase(), HTTP_OAUTH); - schemes.put(HTTP_OAUTH_MAC.getName().toLowerCase(), HTTP_OAUTH); - schemes.put(POP_BASIC.getName().toLowerCase(), POP_BASIC); - schemes.put(POP_DIGEST.getName().toLowerCase(), POP_DIGEST); - schemes.put(SDC.getName().toLowerCase(), SDC); - schemes.put(SMTP_PLAIN.getName().toLowerCase(), SMTP_PLAIN); - - ChallengeScheme.SCHEMES = Collections.unmodifiableMap(schemes); - } - - /** - * Returns the challenge scheme associated to a scheme name. If an existing - * constant exists then it is returned, otherwise a new instance is created. - * - * @param name - * The scheme name. - * @return The associated challenge scheme. - */ - public static ChallengeScheme valueOf(final String name) { - if (name == null) { - throw new IllegalArgumentException( - "ChallengeScheme.valueOf(name) name must not be null"); - } - - ChallengeScheme result = SCHEMES.get(name.toLowerCase()); - - if (result == null) { - result = new ChallengeScheme(name, null, null); - } - - return result; - } - - /** The description. */ - private final String description; - - /** The name. */ - private volatile String name; - - /** The technical name. */ - private volatile String technicalName; - - /** - * Constructor. - * - * @param name - * The unique name. - * @param technicalName - * The technical name. - */ - public ChallengeScheme(final String name, final String technicalName) { - this(name, technicalName, null); - } - - /** - * Constructor. - * - * @param name - * The unique name. - * @param technicalName - * The technical name. - * @param description - * The description. - */ - public ChallengeScheme(final String name, final String technicalName, - final String description) { - this.name = name; - this.description = description; - this.technicalName = technicalName; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(final Object object) { - return (object instanceof ChallengeScheme) - && ((ChallengeScheme) object).getName().equalsIgnoreCase(getName()); - } - - /** - * Returns the description. - * - * @return The description. - */ - public String getDescription() { - return this.description; - } - - /** - * Returns the name. - * - * @return The name. - */ - public String getName() { - return name; - } - - /** - * Returns the technical name (ex: BASIC). - * - * @return The technical name (ex: BASIC). - */ - public String getTechnicalName() { - return this.technicalName; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return (getName() == null) ? 0 : getName().toLowerCase().hashCode(); - } - - /** - * Sets the technical name (ex: BASIC). - * - * @param technicalName - * The technical name (ex: BASIC). - */ - @SuppressWarnings("unused") - private void setTechnicalName(String technicalName) { - this.technicalName = technicalName; - } - - /** - * Returns the name. - * - * @return The name. - */ - @Override - public String toString() { - return getName(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CharacterSet.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CharacterSet.java deleted file mode 100644 index 358493e63f..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CharacterSet.java +++ /dev/null @@ -1,294 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -/** - * Metadata used to specify the character set of textual representations. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class CharacterSet extends Metadata { - /** All character sets acceptable. */ - public static final CharacterSet ALL = new CharacterSet("*", - "All character sets"); - - /** - * The ISO/IEC 8859-1 (Latin 1) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_1 = new CharacterSet( - "ISO-8859-1", "ISO/IEC 8859-1 or Latin 1 character set"); - - /** - * The ISO/IEC 8859-2 (Latin 2) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_2 = new CharacterSet( - "ISO-8859-2", "ISO/IEC 8859-2 or Latin 2 character set"); - - /** - * The ISO/IEC 8859-3 (Latin 3) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_3 = new CharacterSet( - "ISO-8859-3", "ISO/IEC 8859-3 or Latin 3 character set"); - - /** - * The ISO/IEC 8859-4 (Latin 4) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_4 = new CharacterSet( - "ISO-8859-4", "ISO/IEC 8859-4 or Latin 4 character set"); - - /** - * The ISO/IEC 8859-5 (Cyrillic) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_5 = new CharacterSet( - "ISO-8859-5", "ISO/IEC 8859-5 or Cyrillic character set"); - - /** - * The ISO/IEC 8859-6 (Arabic) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_6 = new CharacterSet( - "ISO-8859-6", "ISO/IEC 8859-6 or Arabic character set"); - - /** - * The ISO/IEC 8859-7 (Greek) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_7 = new CharacterSet( - "ISO-8859-7", "ISO/IEC 8859-7 or Greek character set"); - - /** - * The ISO/IEC 8859-8 (Hebrew) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_8 = new CharacterSet( - "ISO-8859-8", "ISO/IEC 8859-8 or Hebrew character set"); - - /** - * The ISO/IEC 8859-9 (Latin 5) character set. - * - * @see Wikipedia page - */ - public static final CharacterSet ISO_8859_9 = new CharacterSet( - "ISO-8859-9", "ISO/IEC 8859-9 or Latin 5 character set"); - - /** - * The ISO/IEC 8859-10 (Latin 6) character set. - * - * @see Wikipedia - * page - */ - public static final CharacterSet ISO_8859_10 = new CharacterSet( - "ISO-8859-10", "ISO/IEC 8859-10 or Latin 6 character set"); - - /** - * The Macintosh ("Mac OS Roman") character set. - * - * @see Wikipedia - * page - */ - public static final CharacterSet MACINTOSH = new CharacterSet("macintosh", - "Mac OS Roman character set"); - - /** - * The US-ASCII character set. - * - * @see Wikipedia page - */ - public static final CharacterSet US_ASCII = new CharacterSet("US-ASCII", - "US ASCII character set"); - - /** - * The UTF-16 character set. - * - * @see Wikipedia page - */ - public static final CharacterSet UTF_16 = new CharacterSet("UTF-16", - "UTF 16 character set"); - - /** - * The UTF-8 character set. - * - * @see Wikipedia page - */ - public static final CharacterSet UTF_8 = new CharacterSet("UTF-8", - "UTF 8 character set"); - - /** - * The Windows-1252 ('ANSI') character set. - * - * @see Wikipedia - * page - * - */ - public static final CharacterSet WINDOWS_1252 = new CharacterSet( - "windows-1252", "Windows 1232 character set"); - - - public static final CharacterSet DEFAULT = new CharacterSet("ISO-8859-1", - "ISO/IEC 8859-1 or Latin 1 character set"); - - /** - * Handles mapping between Java character set names and IANA preferred name. - * For example, "MACROMAN" is not an official IANA name and "ISO-8859-6" is - * preferred over "arabic". - * - * @param name - * The character set name. - * @return The IANA character set name. - */ - private static String getIanaName(String name) { - if (name != null) { - name = name.toUpperCase(); - - if (name.equalsIgnoreCase("MACROMAN")) { - name = MACINTOSH.getName(); - } else if (name.equalsIgnoreCase("ASCII")) { - name = US_ASCII.getName(); - } else if (name.equalsIgnoreCase("latin1")) { - name = ISO_8859_1.getName(); - } else if (name.equalsIgnoreCase("latin2")) { - name = ISO_8859_2.getName(); - } else if (name.equalsIgnoreCase("latin3")) { - name = ISO_8859_3.getName(); - } else if (name.equalsIgnoreCase("latin4")) { - name = ISO_8859_4.getName(); - } else if (name.equalsIgnoreCase("cyrillic")) { - name = ISO_8859_5.getName(); - } else if (name.equalsIgnoreCase("arabic")) { - name = ISO_8859_6.getName(); - } else if (name.equalsIgnoreCase("greek")) { - name = ISO_8859_7.getName(); - } else if (name.equalsIgnoreCase("hebrew")) { - name = ISO_8859_8.getName(); - } else if (name.equalsIgnoreCase("latin5")) { - name = ISO_8859_9.getName(); - } else if (name.equalsIgnoreCase("latin6")) { - name = ISO_8859_10.getName(); - } - } - - return name; - } - - /** - * Returns the character set associated to a name. If an existing constant - * exists then it is returned, otherwise a new instance is created. - * - * @param name - * The name. - * @return The associated character set. - */ - public static CharacterSet valueOf(String name) { - CharacterSet result = null; - name = getIanaName(name); - - if ((name != null) && !name.isEmpty()) { - if (name.equalsIgnoreCase(ALL.getName())) { - result = ALL; - } else if (name.equalsIgnoreCase(ISO_8859_1.getName())) { - result = ISO_8859_1; - } else if (name.equalsIgnoreCase(US_ASCII.getName())) { - result = US_ASCII; - } else if (name.equalsIgnoreCase(UTF_8.getName())) { - result = UTF_8; - } else if (name.equalsIgnoreCase(UTF_16.getName())) { - result = UTF_16; - } else if (name.equalsIgnoreCase(WINDOWS_1252.getName())) { - result = WINDOWS_1252; - } else if (name.equalsIgnoreCase(MACINTOSH.getName())) { - result = MACINTOSH; - } else { - result = new CharacterSet(name); - } - } - - return result; - } - - - /** - * Constructor. - * - * @param name - * The name. - */ - public CharacterSet(String name) { - this(name == null ? null : name.toUpperCase(), - "Character set or range of character sets"); - } - - /** - * Constructor. - * - * @param name - * The name. - * @param description - * The description. - */ - public CharacterSet(String name, String description) { - super(getIanaName(name), description); - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object object) { - return (object instanceof CharacterSet) - && getName().equalsIgnoreCase(((CharacterSet) object).getName()); - } - - @Override - public Metadata getParent() { - return equals(ALL) ? null : ALL; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return (getName() == null) ? 0 : getName().toLowerCase().hashCode(); - } - - /** - * Indicates if a given character set is included in the current one. The - * test is true if both character sets are equal or if the given character - * set is within the range of the current one. For example, ALL includes all - * character sets. A null character set is considered as included into the - * current one. - *

- * Examples: - *

    - *
  • ALL.includes(UTF_16) -> true
  • - *
  • UTF_16.includes(ALL) -> false
  • - *
- * - * @param included - * The character set to test for inclusion. - * @return True if the given character set is included in the current one. - * @see #isCompatible(Metadata) - */ - public boolean includes(Metadata included) { - return equals(ALL) || (included == null) || equals(included); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ClientInfo.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ClientInfo.java deleted file mode 100644 index 0ff8e3b8ad..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ClientInfo.java +++ /dev/null @@ -1,542 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.List; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -/** - * Client-specific data related to a call. When extracted from a request, most - * of these data are directly taken from the underlying headers. There are some - * exceptions: agentAttributes and mainAgentProduct that are taken from the - * agent name (for example, the "user-agent" header for HTTP requests).
- *
- * As described by the HTTP specification, the "user-agent" can be seen as an - * ordered list of products name (i.e., a name and a version) and/or comments.
- *
- * Each HTTP client (mainly browsers and web crawlers) defines its own - * "user-agent" header which can be seen as the "signature" of the client. - * Unfortunately, there is no rule to identify clearly a kind of client and its - * version (let's say Firefox 2.x, Internet Explorer IE 7.0, Opera, etc.) - * according to its signature. Each signature follows its own rules which may - * vary according to the version of the client.
- *
- * In order to help retrieve interesting data such as product name (Firefox, - * IE, etc.), version, operating system, Restlet users can define - * their own way to extract data from the "user-agent" header. It is based on a - * list of templates declared in a file called "agent.properties" and located in - * the classpath in the subdirectory "org/restlet/data". Each template - * describes a typical user-agent string and allows to use predefined variables - * that help to retrieve the content of the agent name, version, operating - * system.
- *
- * The "user-agent" string is confronted to each template from the beginning - * of the property file to the end. The loop stops at the first matched - * template.
- *
- * Here is a sample of such a template:
- * - *
- * #Firefox for Windows
- *  Mozilla/{mozillaVersion} (Windows; U; {agentOs}; {osData}; rv:{releaseVersion}) Gecko/{geckoReleaseDate} {agentName}/{agentVersion}
- * 
- * - * This template matches the "user-agent" string of the Firefox client for - * windows: - * - *
- *  Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1) Gecko/20060918 Firefox/2.0
- * 
- * - * At this time, six predefined variables are used:
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
NameDescription
agentNameName of the user agent (i.e.: Firefox)
agentVersionVersion of the user agent
agentOsOperating system of the user agent
agentCommentComment string, that is to say a sequence of characters enclosed "(", or - * ")"
commentAttributeA sequence of characters enclosed by ";", "(", or ")"
facultativeDataA sequence of characters that can be empty
- *
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class ClientInfo { - - /** The character set preferences. */ - private volatile List> acceptedCharacterSets; - - /** The encoding preferences. */ - private volatile List> acceptedEncodings; - - /** The language preferences. */ - private volatile List> acceptedLanguages; - - /** The media preferences. */ - private volatile List> acceptedMediaTypes; - - /** The patch preferences. */ - private volatile List> acceptedPatches; - - /** The immediate IP addresses. */ - private volatile String address; - - /** The agent name. */ - private volatile String agent; - - - - - - - - - /** The forwarded IP addresses. */ - private volatile List forwardedAddresses; - - /** The email address of the human user controlling the user agent. */ - private volatile String from; - - /** The port number. */ - private volatile int port; - - - - - /** - * Constructor. - */ - public ClientInfo() { - this.address = null; - this.agent = null; - this.port = -1; - this.acceptedCharacterSets = null; - this.acceptedEncodings = null; - this.acceptedLanguages = null; - this.acceptedMediaTypes = null; - this.acceptedPatches = null; - this.forwardedAddresses = null; - this.from = null; - } - - - /** - * Constructor from a media type. - * - * @param mediaType - * The preferred media type. - */ - public ClientInfo(MediaType mediaType) { - getAcceptedMediaTypes().add(new Preference(mediaType)); - } - - /** - * Updates the client preferences to accept the given metadata (media types, - * character sets, etc.) with a 1.0 quality in addition to existing ones. - * - * @param metadata - * The metadata to accept. - */ - public void accept(Metadata... metadata) { - if (metadata != null) { - for (Metadata md : metadata) { - accept(md, 1.0F); - } - } - } - - /** - * Updates the client preferences to accept the given metadata (media types, - * character sets, etc.) with a given quality in addition to existing ones. - * - * @param metadata - * The metadata to accept. - * @param quality - * The quality to set. - */ - public void accept(Metadata metadata, float quality) { - if (metadata instanceof MediaType) { - getAcceptedMediaTypes().add( - new Preference((MediaType) metadata, quality)); - } else if (metadata instanceof Language) { - getAcceptedLanguages().add( - new Preference((Language) metadata, quality)); - } else if (metadata instanceof Encoding) { - getAcceptedEncodings().add( - new Preference((Encoding) metadata, quality)); - } else { - getAcceptedCharacterSets().add( - new Preference((CharacterSet) metadata, - quality)); - } - } - - /** - * Returns the modifiable list of character set preferences. Creates a new - * instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Accept-Charset" header. - * - * @return The character set preferences. - */ - public List> getAcceptedCharacterSets() { - // Lazy initialization with double-check. - List> a = this.acceptedCharacterSets; - if (a == null) { - synchronized (this) { - a = this.acceptedCharacterSets; - if (a == null) { - this.acceptedCharacterSets = a = new CopyOnWriteArrayList>(); - } - } - } - return a; - } - - /** - * Returns the modifiable list of encoding preferences. Creates a new - * instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Accept-Encoding" header. - * - * @return The encoding preferences. - */ - public List> getAcceptedEncodings() { - // Lazy initialization with double-check. - List> a = this.acceptedEncodings; - if (a == null) { - synchronized (this) { - a = this.acceptedEncodings; - if (a == null) { - this.acceptedEncodings = a = new CopyOnWriteArrayList>(); - } - } - } - return a; - } - - /** - * Returns the modifiable list of language preferences. Creates a new - * instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Accept-Language" header. - * - * @return The language preferences. - */ - public List> getAcceptedLanguages() { - // Lazy initialization with double-check. - List> a = this.acceptedLanguages; - if (a == null) { - synchronized (this) { - a = this.acceptedLanguages; - if (a == null) { - this.acceptedLanguages = a = new CopyOnWriteArrayList>(); - } - } - } - return a; - } - - /** - * Returns the modifiable list of media type preferences. Creates a new - * instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Accept" header. - * - * @return The media type preferences. - */ - public List> getAcceptedMediaTypes() { - // Lazy initialization with double-check. - List> a = this.acceptedMediaTypes; - if (a == null) { - synchronized (this) { - a = this.acceptedMediaTypes; - if (a == null) { - this.acceptedMediaTypes = a = new CopyOnWriteArrayList>(); - } - } - } - return a; - } - - /** - * Returns the modifiable list of patch preferences. Creates a new instance - * if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Accept-Patch" header. - * - * @return The patch preferences. - */ - public List> getAcceptedPatches() { - // Lazy initialization with double-check. - List> a = this.acceptedPatches; - if (a == null) { - synchronized (this) { - a = this.acceptedPatches; - if (a == null) { - this.acceptedPatches = a = new CopyOnWriteArrayList>(); - } - } - } - return a; - } - - /** - * Returns the immediate client's IP address. If the real client is - * separated from the server by a proxy server, this will return the IP - * address of the proxy. - * - * @return The immediate client's IP address. - * @see #getForwardedAddresses() - */ - public String getAddress() { - return this.address; - } - - /** - * Returns the agent name (ex: "Restlet-Framework/2.0"). Note that when used - * with HTTP connectors, this property maps to the "User-Agent" header. - * - * @return The agent name. - */ - public String getAgent() { - return this.agent; - } - - - - - - - - - /** - * Returns the list of forwarded IP addresses. This is useful when the user - * agent is separated from the origin server by a chain of intermediary - * components. Create a new instance if no one has been set.
- *
- * The first address is the one of the immediate client component, and the - * last address should correspond to the origin client (frequently a user - * agent).
- *
- * This information is only safe for intermediary components within your - * local network. Other addresses could easily be changed by setting a fake - * header and should not be trusted for serious security checks.
- *
- * Note that your HTTP server connectors need to have a special - * "useForwardedForHeader" parameter explicitly set to "true" to - * activate this feature, due to potential security issues. - * - * @return The list of forwarded IP addresses. - * @see Wikipedia - * page for the "X-Forwarded-For" HTTP header - */ - public List getForwardedAddresses() { - // Lazy initialization with double-check. - List a = this.forwardedAddresses; - if (a == null) { - synchronized (this) { - a = this.forwardedAddresses; - if (a == null) { - this.forwardedAddresses = a = new CopyOnWriteArrayList(); - } - } - } - return a; - } - - /** - * Returns the email address of the human user controlling the user agent. - * The Default value is null. - * - * @return The email address of the human user controlling the user agent. - */ - public String getFrom() { - return from; - } - - - /** - * Returns the port number which sent the call. If no port is specified, -1 - * is returned. - * - * @return The port number which sent the call. - */ - public int getPort() { - return this.port; - } - - /** - * Sets the character set preferences. Note that when used with HTTP - * connectors, this property maps to the "Accept-Charset" header. - * - * @param acceptedCharacterSets - * The character set preferences. - */ - public void setAcceptedCharacterSets( - List> acceptedCharacterSets) { - synchronized (this) { - List> ac = getAcceptedCharacterSets(); - ac.clear(); - ac.addAll(acceptedCharacterSets); - } - } - - /** - * Sets the encoding preferences. Note that when used with HTTP connectors, - * this property maps to the "Accept-Encoding" header. - * - * @param acceptedEncodings - * The encoding preferences. - */ - public void setAcceptedEncodings( - List> acceptedEncodings) { - synchronized (this) { - List> ac = getAcceptedEncodings(); - ac.clear(); - ac.addAll(acceptedEncodings); - } - } - - /** - * Sets the language preferences. Note that when used with HTTP connectors, - * this property maps to the "Accept-Language" header. - * - * @param acceptedLanguages - * The language preferences. - */ - public void setAcceptedLanguages( - List> acceptedLanguages) { - synchronized (this) { - List> ac = getAcceptedLanguages(); - ac.clear(); - ac.addAll(acceptedLanguages); - } - } - - /** - * Sets the media type preferences. Note that when used with HTTP - * connectors, this property maps to the "Accept" header. - * - * @param acceptedMediaTypes - * The media type preferences. - */ - public void setAcceptedMediaTypes( - List> acceptedMediaTypes) { - synchronized (this) { - List> ac = getAcceptedMediaTypes(); - ac.clear(); - ac.addAll(acceptedMediaTypes); - } - } - - /** - * Sets the patch preferences. Note that when used with HTTP connectors, - * this property maps to the "Accept-Patch" header. - * - * @param acceptedPatches - * The media type preferences. - */ - public void setAcceptedPatches(List> acceptedPatches) { - synchronized (this) { - List> ac = getAcceptedPatches(); - ac.clear(); - ac.addAll(acceptedPatches); - } - } - - /** - * Sets the client's IP address. - * - * @param address - * The client's IP address. - */ - public void setAddress(String address) { - this.address = address; - } - - /** - * Sets the agent name (ex: "Restlet-Framework/2.0"). Note that when used - * with HTTP connectors, this property maps to the "User-Agent" header. - * - * @param agent - * The agent name. - */ - public void setAgent(String agent) { - this.agent = agent; - } - - /** - * Sets the list of forwarded IP addresses. - * - * @param forwardedAddresses - * The list of forwarded IP addresses. - * @see #getForwardedAddresses() - */ - public void setForwardedAddresses(List forwardedAddresses) { - synchronized (this) { - List fa = getForwardedAddresses(); - fa.clear(); - fa.addAll(forwardedAddresses); - } - } - - /** - * Sets the email address of the human user controlling the user agent. - * - * @param from - * The email address of the human user controlling the user - * agent. - */ - public void setFrom(String from) { - this.from = from; - } - - /** - * Sets the port number which sent the call. - * - * @param port - * The port number which sent the call. - */ - public void setPort(int port) { - this.port = port; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Conditions.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Conditions.java deleted file mode 100644 index 78955ecc5c..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Conditions.java +++ /dev/null @@ -1,474 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.restlet.client.engine.util.DateUtils; -import org.restlet.client.representation.RepresentationInfo; - -/** - * Set of conditions applying to a request. This is equivalent to the HTTP - * conditional headers. - * - * @see If-Match - * @see If-Modified-Since - * @see If-None-Match - * @see If-Range - * @see If-Unmodified-Since - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class Conditions { - /** The "if-match" condition. */ - private volatile List match; - - /** The "if-modified-since" condition. */ - private volatile Date modifiedSince; - - /** The "if-none-match" condition. */ - private volatile List noneMatch; - - /** The "if-range" condition as a Date. */ - private volatile Date rangeDate; - - /** The "if-range" condition as an entity tag. */ - private volatile Tag rangeTag; - - /** The "if-unmodified-since" condition */ - private volatile Date unmodifiedSince; - - /** - * Constructor. - */ - public Conditions() { - } - - /** - * Returns the modifiable list of tags that must be matched. Creates a new - * instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Match" header. - * - * @return The "if-match" condition. - */ - public List getMatch() { - // Lazy initialization with double-check. - List m = this.match; - if (m == null) { - synchronized (this) { - m = this.match; - if (m == null) { - this.match = m = new ArrayList(); - } - } - } - return m; - } - - /** - * Returns the condition based on the modification date of the requested - * variant.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Modified-Since" header. - * - * @return The condition date. - */ - public Date getModifiedSince() { - return this.modifiedSince; - } - - /** - * Returns the modifiable list of tags that mustn't match. Creates a new - * instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-None-Match" header. - * - * @return The list of tags that mustn't match. - */ - public List getNoneMatch() { - // Lazy initialization with double-check. - List n = this.noneMatch; - if (n == null) { - synchronized (this) { - n = this.noneMatch; - if (n == null) { - this.noneMatch = n = new ArrayList(); - } - } - } - return n; - } - - /** - * Returns the range condition based on the modification date of the - * requested variant.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Range" header. - * - * @return The range condition date. - */ - public Date getRangeDate() { - return rangeDate; - } - - /** - * Returns the range conditional status of an entity. - * - * @param representationInfo - * The representation information that will be tested. - * @return the status of the response. - */ - public Status getRangeStatus(RepresentationInfo representationInfo) { - return getRangeStatus( - (representationInfo == null) ? null - : representationInfo.getTag(), - (representationInfo == null) ? null : representationInfo - .getModificationDate()); - } - - /** - * Returns the range conditional status of an entity. - * - * @param tag - * The tag of the entity. - * @param modificationDate - * The modification date of the entity. - * @return The status of the response. - */ - public Status getRangeStatus(Tag tag, Date modificationDate) { - Status result = Status.CLIENT_ERROR_PRECONDITION_FAILED; - if (getRangeTag() != null) { - boolean all = getRangeTag().equals(Tag.ALL); - - // If a tag exists - if (tag != null) { - if (all || getRangeTag().equals(tag)) { - result = Status.SUCCESS_OK; - } - } - } else if (getRangeDate() != null) { - // If a modification date exists - if (getRangeDate().equals(modificationDate)) { - result = Status.SUCCESS_OK; - } - } - - return result; - } - - /** - * Returns the range condition based on the entity tag of the requested - * variant.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Range" header. - * - * @return The range entity tag. - */ - public Tag getRangeTag() { - return rangeTag; - } - - /** - * Returns the conditional status of a variant using a given method. - * - * @param method - * The request method. - * @param entityExists - * Indicates if the entity exists. - * @param tag - * The tag. - * @param modificationDate - * The modification date. - * @return Null if the requested method can be performed, the status of the - * response otherwise. - */ - public Status getStatus(Method method, boolean entityExists, Tag tag, - Date modificationDate) { - Status result = null; - - // Is the "if-Match" rule followed or not? - if ((this.match != null) && !this.match.isEmpty()) { - boolean matched = false; - boolean failed = false; - boolean all = (getMatch().size() > 0) - && getMatch().get(0).equals(Tag.ALL); - String statusMessage = null; - - if (entityExists) { - // If a tag exists - if (!all && (tag != null)) { - // Check if it matches one of the representations already - // cached by the client - Tag matchTag; - - for (Iterator iter = getMatch().iterator(); !matched - && iter.hasNext();) { - matchTag = iter.next(); - matched = matchTag.equals(tag, false); - } - } else { - matched = all; - } - } else { - // See - // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.24 - // If none of the entity tags match, or if "*" is given and no - // current entity exists, the server MUST NOT perform the - // requested method - failed = all; - statusMessage = "A non existing resource can't match any tag."; - } - - failed = failed || !matched; - - if (failed) { - result = Status.CLIENT_ERROR_PRECONDITION_FAILED; - if (statusMessage != null) { - result = new Status(result, statusMessage); - } - } - } - - // Is the "if-None-Match" rule followed or not? - if ((result == null) && (this.noneMatch != null) - && !this.noneMatch.isEmpty()) { - boolean matched = false; - - if (entityExists) { - // If a tag exists - if (tag != null) { - // Check if it matches one of the representations - // already cached by the client - Tag noneMatchTag; - - for (Iterator iter = getNoneMatch().iterator(); !matched - && iter.hasNext();) { - noneMatchTag = iter.next(); - matched = noneMatchTag.equals(tag, (Method.GET - .equals(method) || Method.HEAD.equals(method))); - } - - // The current representation matches one of those already - // cached by the client - if (matched) { - // Check if the current representation has been updated - // since the "if-modified-since" date. In this case, the - // rule is followed. - Date modifiedSince = getModifiedSince(); - boolean isModifiedSince = (modifiedSince != null) - && (DateUtils.after(new Date(), modifiedSince) - || (modificationDate == null) || DateUtils - .after(modifiedSince, - modificationDate)); - matched = !isModifiedSince; - } - } else { - matched = (getNoneMatch().size() > 0) - && Tag.ALL.equals(getNoneMatch().get(0)); - } - } - - if (matched) { - if (Method.GET.equals(method) || Method.HEAD.equals(method)) { - result = Status.REDIRECTION_NOT_MODIFIED; - } else { - result = Status.CLIENT_ERROR_PRECONDITION_FAILED; - } - } - } - - // Is the "if-Modified-Since" rule followed or not? - if ((result == null) && (getModifiedSince() != null)) { - Date modifiedSince = getModifiedSince(); - boolean isModifiedSince = (DateUtils.after(new Date(), - modifiedSince) || (modificationDate == null) || DateUtils - .after(modifiedSince, modificationDate)); - - if (!isModifiedSince) { - if (Method.GET.equals(method) || Method.HEAD.equals(method)) { - result = Status.REDIRECTION_NOT_MODIFIED; - } else { - result = Status.CLIENT_ERROR_PRECONDITION_FAILED; - } - } - } - - // Is the "if-Unmodified-Since" rule followed or not? - if ((result == null) && (getUnmodifiedSince() != null)) { - Date unModifiedSince = getUnmodifiedSince(); - boolean isUnModifiedSince = ((unModifiedSince == null) - || (modificationDate == null) || !DateUtils.before( - modificationDate, unModifiedSince)); - - if (!isUnModifiedSince) { - result = Status.CLIENT_ERROR_PRECONDITION_FAILED; - } - } - - return result; - } - - /** - * Returns the conditional status of a variant using a given method. - * - * @param method - * The request method. - * @param representationInfo - * The representation information that will be tested. - * @return Null if the requested method can be performed, the status of the - * response otherwise. - */ - public Status getStatus(Method method, RepresentationInfo representationInfo) { - return getStatus( - method, - representationInfo != null, - (representationInfo == null) ? null : representationInfo - .getTag(), (representationInfo == null) ? null - : representationInfo.getModificationDate()); - } - - /** - * Returns the condition based on the modification date of the requested - * variant.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Unmodified-Since" header. - * - * @return The condition date. - */ - public Date getUnmodifiedSince() { - return this.unmodifiedSince; - } - - /** - * Indicates if there are some conditions set. - * - * @return True if there are some conditions set. - */ - public boolean hasSome() { - return (((this.match != null) && !this.match.isEmpty()) - || ((this.noneMatch != null) && !this.noneMatch.isEmpty()) - || (getModifiedSince() != null) || (getUnmodifiedSince() != null)); - } - - /** - * Indicates if there are some range conditions set. - * - * @return True if there are some range conditions set. - */ - public boolean hasSomeRange() { - return getRangeTag() != null || getRangeDate() != null; - } - - /** - * Sets the modifiable list of tags that must be matched.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Match" header. - * - * @param tags - * The "if-match" condition. - */ - public void setMatch(List tags) { - this.match = tags; - } - - /** - * Sets the condition based on the modification date of the requested - * variant.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Modified-Since" header. - * - * @param date - * The modification date. - */ - public void setModifiedSince(Date date) { - this.modifiedSince = DateUtils.unmodifiable(date); - } - - /** - * Sets the modifiable list of tags that mustn't match. Creates a new - * instance if no one has been set.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-None-Match" header. - * - * @param tags - * The list of tags that mustn't match. - */ - public void setNoneMatch(List tags) { - this.noneMatch = tags; - } - - /** - * Sets the range condition based on the modification date of the requested - * variant.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Range" header. - * - * @param rangeDate - * The date of the range condition. - */ - public void setRangeDate(Date rangeDate) { - this.rangeDate = rangeDate; - } - - /** - * Sets the range condition based on the entity tag of the requested - * variant.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Range" header. - * - * @param rangeTag - * The entity tag of the range condition. - */ - public void setRangeTag(Tag rangeTag) { - this.rangeTag = rangeTag; - } - - /** - * Sets the condition based on the modification date of the requested - * variant.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "If-Unmodified-Since" header. - * - * @param date - * The condition date. - */ - public void setUnmodifiedSince(Date date) { - this.unmodifiedSince = DateUtils.unmodifiable(date); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Cookie.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Cookie.java deleted file mode 100644 index f22b07bbf7..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Cookie.java +++ /dev/null @@ -1,235 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Objects; - -import org.restlet.client.Request; -import org.restlet.client.engine.util.SystemUtils; -import org.restlet.client.util.NamedValue; - -/** - * Cookie provided by a client. To get the list of all cookies sent by a client, - * you can use the {@link Request#getCookies()} method.
- *
- * Note that if you are on the server side and want to set a cookie on the - * client, you should use the {@link CookieSetting} class instead.
- *
- * Note that when used with HTTP connectors, this class maps to the "Cookie" - * header. - * - * @see Request#getCookies() - * @see User Guide - Getting parameter values - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Cookie implements NamedValue { - - /** The domain name. */ - private volatile String domain; - - /** The name. */ - private volatile String name; - - /** The validity path. */ - private volatile String path; - - /** The value. */ - private volatile String value; - - /** The version number. */ - private volatile int version; - - /** - * Default constructor. - */ - public Cookie() { - this(0, null, null, null, null); - } - - /** - * Constructor. - * - * @param version - * The version number. - * @param name - * The name. - * @param value - * The value. - */ - public Cookie(int version, String name, String value) { - this(version, name, value, null, null); - } - - /** - * Constructor. - * - * @param version - * The version number. - * @param name - * The name. - * @param value - * The value. - * @param path - * The validity path. - * @param domain - * The domain name. - */ - public Cookie(int version, String name, String value, String path, - String domain) { - this.version = version; - this.name = name; - this.value = value; - this.path = path; - this.domain = domain; - } - - /** - * Constructor. - * - * @param name - * The name. - * @param value - * The value. - */ - public Cookie(String name, String value) { - this(0, name, value, null, null); - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - - if (!(obj instanceof Cookie)) { - // if obj isn't a cookie or is null don't evaluate further - return false; - } - - Cookie that = (Cookie) obj; - - return Objects.equals(getName(), that.getName()) - && Objects.equals(getValue(), that.getValue()) - && (this.version == that.version) - && Objects.equals(getDomain(), that.getDomain()) - && Objects.equals(getPath(), that.getPath()); - } - - /** - * Returns the domain name. - * - * @return The domain name. - */ - public String getDomain() { - return this.domain; - } - - /** - * Returns the name. - * - * @return The name. - */ - public String getName() { - return name; - } - - /** - * Returns the validity path. - * - * @return The validity path. - */ - public String getPath() { - return this.path; - } - - /** - * Returns the value. - * - * @return The value. - */ - public String getValue() { - return value; - } - - /** - * Returns the cookie specification version. - * - * @return The cookie specification version. - */ - public int getVersion() { - return this.version; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(getName(), getValue(), getVersion(), - getPath(), getDomain()); - } - - /** - * Sets the domain name. - * - * @param domain - * The domain name. - */ - public void setDomain(String domain) { - this.domain = domain; - } - - /** - * Sets the name. - * - * @param name - * The name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the validity path. - * - * @param path - * The validity path. - */ - public void setPath(String path) { - this.path = path; - } - - /** - * Sets the value. - * - * @param value - * The value. - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Sets the cookie specification version. - * - * @param version - * The cookie specification version. - */ - public void setVersion(int version) { - this.version = version; - } - - @Override - public String toString() { - return "Cookie [domain=" + domain + ", name=" + name + ", path=" + path - + ", value=" + value + ", version=" + version + "]"; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CookieSetting.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CookieSetting.java deleted file mode 100644 index 55554fa2a7..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/CookieSetting.java +++ /dev/null @@ -1,293 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Objects; - -import org.restlet.client.Response; -import org.restlet.client.engine.util.SystemUtils; - -/** - * Cookie setting provided by a server. This allows a server side application to - * add, modify or remove a cookie on the client.
- *
- * Note that when used with HTTP connectors, this class maps to the "Set-Cookie" - * and "Set-Cookie2" headers. - * - * @see Response#getCookieSettings() - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class CookieSetting extends Cookie { - /** - * Indicates whether to restrict cookie access to untrusted parties. - * Currently this toggles the non-standard but widely supported HttpOnly - * cookie parameter. - */ - private volatile boolean accessRestricted; - - /** The user's comment. */ - private volatile String comment; - - /** - * The maximum age in seconds. Use 0 to discard an existing cookie. - */ - private volatile int maxAge; - - /** Indicates if cookie should only be transmitted by secure means. */ - private volatile boolean secure; - - /** - * Default constructor. - */ - public CookieSetting() { - this(0, null, null); - } - - /** - * Constructor. - * - * @param version - * The cookie's version. - * @param name - * The cookie's name. - * @param value - * The cookie's value. - */ - public CookieSetting(int version, String name, String value) { - this(version, name, value, null, null); - } - - /** - * Constructor. - * - * @param version - * The cookie's version. - * @param name - * The cookie's name. - * @param value - * The cookie's value. - * @param path - * The cookie's path. - * @param domain - * The cookie's domain name. - */ - public CookieSetting(int version, String name, String value, String path, - String domain) { - this(version, name, value, path, domain, null, -1, false, false); - } - - /** - * Constructor. - * - * @param version - * The cookie's version. - * @param name - * The cookie's name. - * @param value - * The cookie's value. - * @param path - * The cookie's path. - * @param domain - * The cookie's domain name. - * @param comment - * The cookie's comment. - * @param maxAge - * Sets the maximum age in seconds.
- * Use 0 to immediately discard an existing cookie.
- * Use -1 to discard the cookie at the end of the session - * (default). - * @param secure - * Indicates if cookie should only be transmitted by secure - * means. - */ - public CookieSetting(int version, String name, String value, String path, - String domain, String comment, int maxAge, boolean secure) { - this(version, name, value, path, domain, comment, maxAge, secure, false); - } - - /** - * Constructor. - * - * @param version - * The cookie's version. - * @param name - * The cookie's name. - * @param value - * The cookie's value. - * @param path - * The cookie's path. - * @param domain - * The cookie's domain name. - * @param comment - * The cookie's comment. - * @param maxAge - * Sets the maximum age in seconds.
- * Use 0 to immediately discard an existing cookie.
- * Use -1 to discard the cookie at the end of the session - * (default). - * @param secure - * Indicates if cookie should only be transmitted by secure - * means. - * @param accessRestricted - * Indicates whether to restrict cookie access to untrusted - * parties. Currently this toggles the non-standard but widely - * supported HttpOnly cookie parameter. - */ - public CookieSetting(int version, String name, String value, String path, - String domain, String comment, int maxAge, boolean secure, - boolean accessRestricted) { - super(version, name, value, path, domain); - this.comment = comment; - this.maxAge = maxAge; - this.secure = secure; - this.accessRestricted = accessRestricted; - } - - /** - * Preferred constructor. - * - * @param name - * The cookie's name. - * @param value - * The cookie's value. - */ - public CookieSetting(String name, String value) { - this(0, name, value, null, null); - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof CookieSetting)) { - return false; - } - - CookieSetting that = (CookieSetting) obj; - - return super.equals(obj) - && this.maxAge == that.maxAge - && this.secure == that.secure - && Objects.equals(this.comment, that.comment); - } - - /** - * Returns the comment for the user. - * - * @return The comment for the user. - */ - public String getComment() { - return this.comment; - } - - /** - * Returns the description of this REST element. - * - * @return The description of this REST element. - */ - public String getDescription() { - return "Cookie setting"; - } - - /** - * Returns the maximum age in seconds. Use 0 to immediately discard an - * existing cookie. Use -1 to discard the cookie at the end of the session - * (default). - * - * @return The maximum age in seconds. - */ - public int getMaxAge() { - return this.maxAge; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(super.hashCode(), getComment(), - getMaxAge(), isSecure()); - } - - /** - * Indicates if cookie access is restricted for untrusted parties. Currently - * this toggles the non-standard but widely supported HttpOnly cookie - * parameter. - * - * @return accessRestricted True if cookie access should be restricted - */ - public boolean isAccessRestricted() { - return this.accessRestricted; - } - - /** - * Indicates if cookie should only be transmitted by secure means. - * - * @return True if cookie should only be transmitted by secure means. - */ - public boolean isSecure() { - return this.secure; - } - - /** - * Indicates whether to restrict cookie access to untrusted parties. - * Currently this toggles the non-standard but widely supported HttpOnly - * cookie parameter. - * - * @param accessRestricted - * True if cookie access should be restricted - */ - public void setAccessRestricted(boolean accessRestricted) { - this.accessRestricted = accessRestricted; - } - - /** - * Sets the comment for the user. - * - * @param comment - * The comment for the user. - */ - public void setComment(String comment) { - this.comment = comment; - } - - /** - * Sets the maximum age in seconds. Use 0 to immediately discard an existing - * cookie. Use -1 to discard the cookie at the end of the session (default). - * - * @param maxAge - * The maximum age in seconds. - */ - public void setMaxAge(int maxAge) { - this.maxAge = maxAge; - } - - /** - * Indicates if cookie should only be transmitted by secure means. - * - * @param secure - * True if cookie should only be transmitted by secure means. - */ - public void setSecure(boolean secure) { - this.secure = secure; - } - - @Override - public String toString() { - return "CookieSetting [accessRestricted=" + accessRestricted - + ", comment=" + comment + ", maxAge=" + maxAge + ", secure=" - + secure + ", domain=" + getDomain() + ", name=" + getName() - + ", path=" + getPath() + ", value=" + getValue() - + ", version=" + getVersion() + "]"; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Digest.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Digest.java deleted file mode 100644 index bba6097e07..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Digest.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Arrays; - -import org.restlet.client.engine.util.SystemUtils; - -/** - * Describes a digest value and the digest algorithm used. Digests can have - * several use cases such as ensuring the integrity of representations' exchanges - * between resources, or for authentication purpose. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Digest { - - /** Digest algorithm defined in RFC 1319. */ - public static final String ALGORITHM_MD2 = "MD2"; - - /** Digest algorithm defined in RFC 1321. */ - public static final String ALGORITHM_MD5 = "MD5"; - - /** No digest algorithm defined. */ - public static final String ALGORITHM_NONE = "NONE"; - - /** Digest algorithm defined in Secure Hash Standard, NIST FIPS 180-1. */ - public static final String ALGORITHM_SHA_1 = "SHA-1"; - - /** NIST approved digest algorithm from the SHA-2 family. */ - public static final String ALGORITHM_SHA_256 = "SHA-256"; - - /** NIST approved digest algorithm from the SHA-2 family. */ - public static final String ALGORITHM_SHA_384 = "SHA-384"; - - /** NIST approved digest algorithm from the SHA-2 family. */ - public static final String ALGORITHM_SHA_512 = "SHA-512"; - - /** - * Digest algorithm for the HTTP DIGEST scheme. This is exactly the A1 value - * specified in RFC2617, which is a MD5 hash of the username, realm and - * password, separated by a colon character. - */ - public static final String ALGORITHM_HTTP_DIGEST = "HTTP-DIGEST-A1"; - - /** The digest algorithm. */ - private final String algorithm; - - /** The digest value. */ - private final byte[] value; - - /** - * Constructor using the MD5 algorithm by default. - * - * @param value - * The digest value. - */ - public Digest(byte[] value) { - this(ALGORITHM_MD5, value); - } - - /** - * Constructor. - * - * @param algorithm - * The digest algorithm. - * @param value - * The digest value. - */ - public Digest(String algorithm, byte[] value) { - this.algorithm = algorithm; - - // In Java 6, use Arrays.copyOf. - this.value = new byte[value.length]; - System.arraycopy(value, 0, this.value, 0, value.length); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof Digest that) { - if (getAlgorithm().equals(that.getAlgorithm())) { - return Arrays.equals(getValue(), that.getValue()); - } - } - return false; - } - - /** - * Returns the digest algorithm. - * - * @return The digest algorithm. - */ - public String getAlgorithm() { - return algorithm; - } - - /** - * Returns the digest value. - * - * @return The digest value. - */ - public byte[] getValue() { - // In Java 6, use Arrays.copyOf. - byte[] result = new byte[this.value.length]; - System.arraycopy(this.value, 0, result, 0, this.value.length); - - return result; - } - - @Override - public int hashCode() { - return SystemUtils.hashCode(algorithm, value); - } - - @Override - public String toString() { - return "Digest [algorithm=" + algorithm + ", value=" - + Arrays.toString(value) + "]"; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Dimension.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Dimension.java deleted file mode 100644 index 109531f332..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Dimension.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import org.restlet.client.Response; - -/** - * Dimension on which the representations of a resource may vary. Note that when - * used with HTTP connectors, this class maps to the "Vary" header. - * - * @see Response#getDimensions() - * @author Jerome Louvel - * @author Piyush Purang (ppurang@gmail.com) - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public enum Dimension { - AUTHORIZATION, CHARACTER_SET, CLIENT_ADDRESS, CLIENT_AGENT, UNSPECIFIED, ENCODING, LANGUAGE, MEDIA_TYPE, TIME, ORIGIN -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Disposition.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Disposition.java deleted file mode 100644 index 0dd71b8c64..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Disposition.java +++ /dev/null @@ -1,228 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Date; - -import org.restlet.client.engine.util.DateUtils; -import org.restlet.client.util.Series; - -/** - * Describes the presentation of a single entity especially in the case of - * multipart documents. This is an equivalent of the HTTP "Content-Disposition" - * header. - * - * @see Content-Disposition header - * @see The Content-Disposition - * Header Field - * - * @author Thierry Boileau - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Disposition { - - /** The creation date parameter name as presented by the RFC 2183. */ - public static final String NAME_CREATION_DATE = "creation-date"; - - /** The filename parameter name as presented by the RFC 2183. */ - public static final String NAME_FILENAME = "filename"; - - /** The modification date parameter name as presented by the RFCc 2183. */ - public static final String NAME_MODIFICATION_DATE = "modification-date"; - - /** The read date parameter name as presented by the RFC 2183. */ - public static final String NAME_READ_DATE = "read-date"; - - /** The size parameter name as presented by the RFC 2183. */ - public static final String NAME_SIZE = "size"; - - /** - * Indicates that the part is intended to be separated from the full - * message. - */ - public static final String TYPE_ATTACHMENT = "attachment"; - - /** - * Indicates that the part is intended to be displayed automatically upon - * display of the full message. - */ - public static final String TYPE_INLINE = "inline"; - - /** Indicates that the part is not intended to be displayed. */ - public static final String TYPE_NONE = "none"; - - /** The list of disposition parameters. */ - private Series parameters; - - /** The disposition type. */ - private String type; - - /** - * Constructor. Instantiated with the TYPE_NONE type. - */ - public Disposition() { - this(Disposition.TYPE_NONE); - } - - /** - * Constructor. - * - * @param type - * The disposition type. - */ - public Disposition(String type) { - super(); - this.type = type; - } - - /** - * Constructor. - * - * @param type - * The disposition type. - * @param parameters - * The list of disposition parameters. - */ - public Disposition(String type, Series parameters) { - this(type); - this.parameters = parameters; - } - - /** - * Adds a Date parameter. - * - * @param name - * The name of the parameter. - * @param value - * Its value as a date. - */ - public void addDate(String name, Date value) { - getParameters().add(name, - DateUtils.format(value, DateUtils.FORMAT_RFC_822.get(0))); - } - - /** - * Returns the value of the "filename" parameter. - * - * @return The value of the "filename" parameter. - */ - public String getFilename() { - return getParameters().getFirstValue(NAME_FILENAME, true); - } - - /** - * Returns the list of disposition parameters. - * - * @return The list of disposition parameters. - */ - public Series getParameters() { - if (this.parameters == null) { - this.parameters = new org.restlet.client.engine.util.ParameterSeries(); - } - - return this.parameters; - } - - /** - * Returns the disposition type. - * - * @return The disposition type. - */ - public String getType() { - return type; - } - - /** - * Sets the creation date parameter. - * - * @param value - * The creation date. - */ - public void setCreationDate(Date value) { - setDate(NAME_CREATION_DATE, value); - } - - /** - * Sets a Date parameter. - * - * @param name - * The name of the parameter. - * @param value - * Its value as a date. - */ - public void setDate(String name, Date value) { - getParameters().set(name, - DateUtils.format(value, DateUtils.FORMAT_RFC_822.get(0)), true); - } - - /** - * Sets the value of the "filename" parameter. - * - * @param fileName - * The file name value. - */ - public void setFilename(String fileName) { - getParameters().set(Disposition.NAME_FILENAME, fileName, true); - } - - /** - * Sets the modification date parameter. - * - * @param value - * The modification date. - */ - public void setModificationDate(Date value) { - setDate(NAME_MODIFICATION_DATE, value); - } - - /** - * Sets the list of disposition parameters. - * - * @param parameters - * The list of disposition parameters. - */ - public void setParameters(Series parameters) { - this.parameters = parameters; - } - - /** - * Sets the read date parameter. - * - * @param value - * The read date. - */ - public void setReadDate(Date value) { - setDate(NAME_READ_DATE, value); - } - - /** - * Sets the value of the "size" parameter. - * - * @param size - * The size. - */ - public void setSize(long size) { - getParameters().set(Disposition.NAME_SIZE, Long.toString(size), true); - } - - /** - * Sets the disposition type. - * - * @param type - * The disposition type. - */ - public void setType(String type) { - this.type = type; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Encoding.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Encoding.java deleted file mode 100644 index 171b48d1d3..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Encoding.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -/** - * Modifier of a representation's media type. Useful to apply compression - * without losing the identity of the underlying media type. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class Encoding extends Metadata { - /** All encodings acceptable. */ - public static final Encoding ALL = new Encoding("*", "All encodings"); - - /** The common Unix file compression. */ - public static final Encoding COMPRESS = new Encoding("compress", - "Common Unix compression"); - - /** The zlib format defined by RFC 1950 and 1951. */ - public static final Encoding DEFLATE = new Encoding("deflate", - "Deflate compression using the zlib format"); - - /** The zlib format defined by RFC 1950 and 1951, without wrapping. */ - public static final Encoding DEFLATE_NOWRAP = new Encoding( - "deflate-no-wrap", - "Deflate compression using the zlib format (without wrapping)"); - - /** The FreeMarker encoding. */ - public static final Encoding FREEMARKER = new Encoding("freemarker", - "FreeMarker templated representation"); - - /** The GNU Zip encoding. */ - public static final Encoding GZIP = new Encoding("gzip", "GZip compression"); - - /** The default (identity) encoding. */ - public static final Encoding IDENTITY = new Encoding("identity", - "The default encoding with no transformation"); - - /** The Velocity encoding. */ - public static final Encoding VELOCITY = new Encoding("velocity", - "Velocity templated representation"); - - /** The Info-Zip encoding. */ - public static final Encoding ZIP = new Encoding("zip", "Zip compression"); - - /** - * Returns the encoding associated to a name. If an existing constant exists - * then it is returned, otherwise a new instance is created. - * - * @param name - * The name. - * @return The associated encoding. - */ - public static Encoding valueOf(final String name) { - Encoding result = null; - - if ((name != null) && !name.isEmpty()) { - if (name.equalsIgnoreCase(ALL.getName())) { - result = ALL; - } else if (name.equalsIgnoreCase(GZIP.getName())) { - result = GZIP; - } else if (name.equalsIgnoreCase(ZIP.getName())) { - result = ZIP; - } else if (name.equalsIgnoreCase(COMPRESS.getName())) { - result = COMPRESS; - } else if (name.equalsIgnoreCase(DEFLATE.getName())) { - result = DEFLATE; - } else if (name.equalsIgnoreCase(DEFLATE_NOWRAP.getName())) { - result = DEFLATE_NOWRAP; - } else if (name.equalsIgnoreCase(IDENTITY.getName())) { - result = IDENTITY; - } else if (name.equalsIgnoreCase(FREEMARKER.getName())) { - result = FREEMARKER; - } else if (name.equalsIgnoreCase(VELOCITY.getName())) { - result = VELOCITY; - } else { - result = new Encoding(name); - } - } - - return result; - } - - /** - * Constructor. - * - * @param name - * The name. - */ - public Encoding(final String name) { - this(name, "Encoding applied to a representation"); - } - - /** - * Constructor. - * - * @param name - * The name. - * @param description - * The description. - */ - public Encoding(final String name, final String description) { - super(name, description); - } - - /** {@inheritDoc} */ - @Override - public boolean equals(final Object object) { - return (object instanceof Encoding) - && getName().equalsIgnoreCase(((Encoding) object).getName()); - } - - @Override - public Metadata getParent() { - return equals(ALL) ? null : ALL; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return (getName() == null) ? 0 : getName().toLowerCase().hashCode(); - } - - /** - * Indicates if a given encoding is included in the current one. The test is - * true if both encodings are equal or if the given encoding is within the - * range of the current one. For example, ALL includes all encodings. A null - * encoding is considered as included into the current one. - *

- * Examples: - *

    - *
  • ALL.includes(COMPRESS) -> true
  • - *
  • COMPRESS.includes(ALL) -> false
  • - *
- * - * @param included - * The encoding to test for inclusion. - * @return True if the given encoding is included in the current one. - * @see #isCompatible(Metadata) - */ - public boolean includes(Metadata included) { - return equals(ALL) || (included == null) || equals(included); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Form.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Form.java deleted file mode 100644 index 51aa7d0371..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Form.java +++ /dev/null @@ -1,340 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.io.IOException; -import java.util.List; - -import org.restlet.client.engine.util.FormUtils; -import org.restlet.client.representation.Representation; -import org.restlet.client.representation.StringRepresentation; -import org.restlet.client.util.Series; - -/** - * Form which is a specialized modifiable list of parameters. - * - * @see User Guide - - * Getting parameter values - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Form extends Series { - /** - * Empty constructor. - */ - public Form() { - super(Parameter.class); - } - - /** - * Constructor. - * - * @param initialCapacity - * The initial list capacity. - */ - public Form(int initialCapacity) { - super(Parameter.class, initialCapacity); - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public Form(List delegate) { - super(Parameter.class, delegate); - } - - /** - * Constructor. - * - * @param webForm - * The URL encoded Web form. - * @throws IOException - */ - public Form(Representation webForm) { - this(webForm, true); - } - - /** - * Constructor. - * - * @param webForm - * The URL encoded Web form. - * @throws IOException - */ - public Form(Representation webForm, boolean decode) { - this(); - FormUtils.parse(this, webForm, decode); - } - - /** - * Constructor. Uses UTF-8 as the character set for encoding non-ASCII - * characters. - * - * @param queryString - * The Web form parameters as a string. - * @throws IOException - */ - public Form(String queryString) { - this(queryString, true); - } - - /** - * Constructor. Uses UTF-8 as the character set for encoding non-ASCII - * characters. - * - * @param queryString - * The Web form parameters as a string. - * @param decode - * Indicates if the names and values should be automatically - * decoded. - * @throws IOException - */ - public Form(String queryString, boolean decode) { - this(queryString, CharacterSet.UTF_8, decode); - } - - /** - * Constructor. Uses UTF-8 as the character set for encoding non-ASCII - * characters. - * - * @param parametersString - * The parameters string to parse. - * @param separator - * The separator character to append between parameters. - * @throws IOException - */ - public Form(String parametersString, char separator) { - this(parametersString, separator, true); - } - - /** - * Constructor. Uses UTF-8 as the character set for encoding non-ASCII - * characters. - * - * @param parametersString - * The parameters string to parse. - * @param separator - * The separator character to append between parameters. - * @param decode - * Indicates if the names and values should be automatically - * decoded. - * @throws IOException - */ - public Form(String parametersString, char separator, boolean decode) { - this(parametersString, CharacterSet.UTF_8, separator, decode); - } - - /** - * Constructor. - * - * @param queryString - * The Web form parameters as a string. - * @param characterSet - * The supported character encoding. - * @throws IOException - */ - public Form(String queryString, CharacterSet characterSet) { - this(queryString, characterSet, true); - } - - /** - * Constructor. - * - * @param queryString - * The Web form parameters as a string. - * @param characterSet - * The supported character encoding. - * @param decode - * Indicates if the names and values should be automatically - * decoded. - * @throws IOException - */ - public Form(String queryString, CharacterSet characterSet, boolean decode) { - this(queryString, characterSet, '&', decode); - } - - /** - * Constructor. - * - * @param parametersString - * The parameters string to parse. - * @param characterSet - * The supported character encoding. - * @param separator - * The separator character to append between parameters. - * @throws IOException - */ - public Form(String parametersString, CharacterSet characterSet, - char separator) { - this(parametersString, characterSet, separator, true); - } - - /** - * Constructor. - * - * @param parametersString - * The parameters string to parse. - * @param characterSet - * The supported character encoding. - * @param separator - * The separator character to append between parameters. - * @param decode - * Indicates if the names and values should be automatically - * decoded. - * @throws IOException - */ - public Form(String parametersString, CharacterSet characterSet, - char separator, boolean decode) { - this(); - FormUtils - .parse(this, parametersString, characterSet, decode, separator); - } - - @Override - public Parameter createEntry(String name, String value) { - return new Parameter(name, value); - } - - @Override - public Series createSeries(List delegate) { - return new Form(delegate); - } - - /** - * Encodes the form using the standard URI encoding mechanism and the UTF-8 - * character set. - * - * @return The encoded form. - * @throws IOException - */ - public String encode() throws IOException { - return encode(CharacterSet.UTF_8); - } - - /** - * URL encodes the form. The '&' character is used as a separator. - * - * @param characterSet - * The supported character encoding. - * @return The encoded form. - * @throws IOException - */ - public String encode(CharacterSet characterSet) throws IOException { - return encode(characterSet, '&'); - } - - /** - * URL encodes the form. - * - * @param characterSet - * The supported character encoding. - * @param separator - * The separator character to append between parameters. - * @return The encoded form. - * @throws IOException - */ - public String encode(CharacterSet characterSet, char separator) - throws IOException { - StringBuilder sb = new StringBuilder(); - - for (int i = 0; i < size(); i++) { - if (i > 0) { - sb.append(separator); - } - - get(i).encode(sb, characterSet); - } - - return sb.toString(); - } - - /** - * Formats the form as a matrix path string. Uses UTF-8 as the character set - * for encoding non-ASCII characters. - * - * @return The form as a matrix string. - * @see Matrix URIs - * by Tim Berners Lee - */ - public String getMatrixString() { - return getMatrixString(CharacterSet.UTF_8); - } - - /** - * Formats the form as a query string. - * - * @param characterSet - * The supported character encoding. - * @return The form as a matrix string. - * @see Matrix URIs - * by Tim Berners Lee - */ - public String getMatrixString(CharacterSet characterSet) { - try { - return encode(characterSet, ';'); - } catch (IOException ioe) { - return null; - } - } - - /** - * Formats the form as a query string. Uses UTF-8 as the character set for - * encoding non-ASCII characters. - * - * @return The form as a query string. - */ - public String getQueryString() { - return getQueryString(CharacterSet.UTF_8); - } - - /** - * Formats the form as a query string. - * - * @param characterSet - * The supported character encoding. - * @return The form as a query string. - */ - public String getQueryString(CharacterSet characterSet) { - try { - return encode(characterSet); - } catch (IOException ioe) { - return null; - } - } - - /** - * Returns the form as a Web representation - * (MediaType.APPLICATION_WWW_FORM). Uses UTF-8 as the character set for - * encoding non-ASCII characters. - * - * @return The form as a Web representation. - */ - public Representation getWebRepresentation() { - return getWebRepresentation(CharacterSet.UTF_8); - } - - /** - * Returns the form as a Web representation - * (MediaType.APPLICATION_WWW_FORM). - * - * @param characterSet - * The supported character encoding. - * @return The form as a Web representation. - */ - public Representation getWebRepresentation(CharacterSet characterSet) { - return new StringRepresentation(getQueryString(characterSet), - MediaType.APPLICATION_WWW_FORM, null, characterSet); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Header.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Header.java deleted file mode 100644 index 6efbda2886..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Header.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Objects; - -import org.restlet.client.engine.util.SystemUtils; -import org.restlet.client.util.NamedValue; - -/** - * Represents an HTTP header. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Header implements NamedValue { - - /** The name. */ - private volatile String name; - - /** The value. */ - private volatile String value; - - /** - * Default constructor. - */ - public Header() { - } - - /** - * Constructor. - * - * @param name - * The header name. - * @param value - * The header value. - */ - public Header(String name, String value) { - super(); - this.name = name; - this.value = value; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Header)) { - return false; - } - - Header that = (Header) obj; - return Objects.equals(getName(), that.getName()) - && Objects.equals(getValue(), that.getValue()); - } - - /** - * Returns the name. - * - * @return The name. - */ - public String getName() { - return name; - } - - /** - * Returns the value. - * - * @return The value. - */ - public String getValue() { - return value; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(getName(), getValue()); - } - - /** - * Sets the name. - * - * @param name - * The name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the value. - * - * @param value - * The value. - */ - public void setValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return "[" + getName() + ": " + getValue() + "]"; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Language.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Language.java deleted file mode 100644 index 923e1e282d..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Language.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Collections; -import java.util.List; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -/** - * Language used in representations and preferences. A language tag is composed - * of one or more parts: A primary language tag and a possibly empty series of - * sub-tags. When formatted as a string, parts are separated by hyphens. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class Language extends Metadata { - /** All languages acceptable. */ - public static final Language ALL = new Language("*", "All languages"); - - - public static final Language DEFAULT = new Language("en", - "English language"); - - /** English language. */ - public static final Language ENGLISH = new Language("en", - "English language"); - - /** English language spoken in USA. */ - public static final Language ENGLISH_US = new Language("en-us", - "English language in USA"); - - /** French language. */ - public static final Language FRENCH = new Language("fr", "French language"); - - /** French language spoken in France. */ - public static final Language FRENCH_FRANCE = new Language("fr-fr", - "French language in France"); - - /** Spanish language. */ - public static final Language SPANISH = new Language("es", - "Spanish language"); - - /** - * Returns the language associated to a name. If an existing constant exists - * then it is returned, otherwise a new instance is created. - * - * @param name - * The name. - * @return The associated language. - */ - public static Language valueOf(final String name) { - Language result = null; - - if ((name != null) && !name.isEmpty()) { - if (name.equalsIgnoreCase(ALL.getName())) { - result = ALL; - } else if (name.equalsIgnoreCase(ENGLISH.getName())) { - result = ENGLISH; - } else if (name.equalsIgnoreCase(ENGLISH_US.getName())) { - result = ENGLISH_US; - } else if (name.equalsIgnoreCase(FRENCH.getName())) { - result = FRENCH; - } else if (name.equalsIgnoreCase(FRENCH_FRANCE.getName())) { - result = FRENCH_FRANCE; - } else if (name.equalsIgnoreCase(SPANISH.getName())) { - result = SPANISH; - } else { - result = new Language(name); - } - } - - return result; - } - - /** The metadata main list of subtags taken from the metadata name. */ - private volatile List subTags; - - /** - * Constructor. - * - * @param name - * The name. - */ - public Language(final String name) { - this(name, "Language or range of languages"); - } - - /** - * Constructor. - * - * @param name - * The name. - * @param description - * The description. - */ - public Language(final String name, final String description) { - super(name, description); - this.subTags = null; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(final Object object) { - return (object instanceof Language) - && getName().equalsIgnoreCase(((Language) object).getName()); - } - - @Override - public Language getParent() { - Language result = null; - - if ((getSubTags() != null) && !getSubTags().isEmpty()) { - result = Language.valueOf(getPrimaryTag()); - } else { - result = equals(ALL) ? null : ALL; - } - - return result; - } - - /** - * Returns the primary tag. - * - * @return The primary tag. - */ - public String getPrimaryTag() { - final int separator = getName().indexOf('-'); - - if (separator == -1) { - return getName(); - } - - return getName().substring(0, separator); - } - - /** - * Returns the unmodifiable list of subtags. This list can be empty. - * - * @return The list of subtags for this language Tag. - */ - public List getSubTags() { - // Lazy initialization with double-check. - List v = this.subTags; - if (v == null) { - synchronized (this) { - v = this.subTags; - if (v == null) { - List tokens = new CopyOnWriteArrayList(); - if (getName() != null) { - final String[] tags = getName().split("-"); - if (tags.length > 0) { - for (int i = 1; i < tags.length; i++) { - tokens.add(tags[i]); - } - } - } - - this.subTags = v = Collections.unmodifiableList(tokens); - } - } - } - return v; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return (getName() == null) ? 0 : getName().toLowerCase().hashCode(); - } - - /** - * Indicates if a given language is included in the current one. The test is - * true if both languages are equal or if the given language is within the - * range of the current one. For example, ALL includes all languages. A null - * language is considered as included into the current one. - *

- * Examples: - *

    - *
  • ENGLISH.includes(ENGLISH_US) -> true
  • - *
  • ENGLISH_US.includes(ENGLISH) -> false
  • - *
- * - * @param included - * The language to test for inclusion. - * @return True if the language type is included in the current one. - * @see #isCompatible(Metadata) - */ - public boolean includes(Metadata included) { - boolean result = equals(ALL) || (included == null) || equals(included); - - if (!result && (included instanceof Language)) { - Language includedLanguage = (Language) included; - - if (getPrimaryTag().equals(includedLanguage.getPrimaryTag())) { - // Both languages are different - if (getSubTags().equals(includedLanguage.getSubTags())) { - result = true; - } else if (getSubTags().isEmpty()) { - result = true; - } - } - } - - return result; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/MediaType.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/MediaType.java deleted file mode 100644 index 122c576c13..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/MediaType.java +++ /dev/null @@ -1,741 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.engine.header.HeaderWriter; -import org.restlet.client.engine.util.StringUtils; -import org.restlet.client.engine.util.SystemUtils; -import org.restlet.client.util.Series; - -/** - * Metadata used to specify the format of representations. The - * {@link #getName()} method returns a full String representation of the media - * type including the parameters. - * - * @see MIME types on Wikipedia - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class MediaType extends Metadata { - - /** - * Illegal ASCII characters as defined in RFC 1521.
- * Keep the underscore for the ordering - * - * @see RFC 1521 - */ - private static final String _TSPECIALS = "()<>@,;:/[]?=\\\""; - - /** - * The known media types registered with {@link #register(String, String)}, - * retrievable using {@link #valueOf(String)}.
- * Keep the underscore for the ordering. - */ - private static volatile Map _types = null; - - public static final MediaType ALL = register("*/*", "All media"); - - public static final MediaType APPLICATION_ALL = register("application/*", - "All application documents"); - - public static final MediaType APPLICATION_ALL_JSON = register( - "application/*+json", "All application/*+json documents"); - - public static final MediaType APPLICATION_ALL_XML = register( - "application/*+xml", "All application/*+xml documents"); - - public static final MediaType APPLICATION_ATOM = register( - "application/atom+xml", "Atom document"); - - - - - - - - - - - - - - - public static final MediaType APPLICATION_JAVA_OBJECT_GWT = register( - "text/x-gwt-rpc", - "Java serialized object (using GWT-RPC encoder)"); - - - public static final MediaType APPLICATION_JAVASCRIPT = register( - "application/x-javascript", "Javascript document"); - - - public static final MediaType APPLICATION_JSON = register( - "application/json", "JavaScript Object Notation document"); - - - - public static final MediaType APPLICATION_JSON_SMILE = register( - "application/x-json-smile", - "JavaScript Object Notation smile document"); - - - - - - - public static final MediaType APPLICATION_MSML = register( - "application/msml+xml", "Media Server Markup Language"); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static final MediaType APPLICATION_SDP = register("application/sdp", - "Session Description Protocol"); - - - - - - - - - - - - - - - - public static final MediaType APPLICATION_WWW_FORM = register( - "application/x-www-form-urlencoded", "Web form (URL encoded)"); - - public static final MediaType APPLICATION_XHTML = register( - "application/xhtml+xml", "XHTML document"); - - public static final MediaType APPLICATION_XMI = register( - "application/xmi+xml", "XMI document"); - - public static final MediaType APPLICATION_XML = register("application/xml", - "XML document"); - - - - - - - - - - - - - - - - - - - - - - - - - - - public static final MediaType TEXT_ALL = register("text/*", "All texts"); - - - public static final MediaType TEXT_CSS = register("text/css", - "CSS stylesheet"); - - - - public static final MediaType TEXT_HTML = register("text/html", - "HTML document"); - - - public static final MediaType TEXT_JAVASCRIPT = register("text/javascript", - "Javascript document"); - - public static final MediaType TEXT_PLAIN = register("text/plain", - "Plain text"); - - - - - - public static final MediaType TEXT_URI_LIST = register("text/uri-list", - "List of URIs"); - - - public static final MediaType TEXT_XML = register("text/xml", "XML text"); - - - - - - - - - /** - * Returns the first of the most specific media type of the given array of - * {@link MediaType}s. - *

- * Examples: - *

    - *
  • "text/plain" is more specific than "text/*" or "image/*"
  • - *
  • "text/html" is same specific as "application/pdf" or "image/jpg"
  • - *
  • "text/*" is same specific than "application/*" or "image/*"
  • - *
  • "*/*" is the most unspecific MediaType
  • - *
- * - * @param mediaTypes - * An array of media types. - * @return The most concrete MediaType. - * @throws IllegalArgumentException - * If the array is null or empty. - */ - public static MediaType getMostSpecific(MediaType... mediaTypes) - throws IllegalArgumentException { - if ((mediaTypes == null) || (mediaTypes.length == 0)) { - throw new IllegalArgumentException( - "You must give at least one MediaType"); - } - - if (mediaTypes.length == 1) { - return mediaTypes[0]; - } - - MediaType mostSpecific = mediaTypes[0]; - - for (int i = 1; i < mediaTypes.length; i++) { - MediaType mediaType = mediaTypes[i]; - - if (mediaType != null) { - if (mediaType.getMainType().equals("*")) { - continue; - } - - if (mostSpecific.getMainType().equals("*")) { - mostSpecific = mediaType; - continue; - } - - if (mostSpecific.getSubType().contains("*")) { - mostSpecific = mediaType; - continue; - } - } - } - - return mostSpecific; - } - - /** - * Returns the known media types map. - * - * @return the known media types map. - */ - private static Map getTypes() { - if (_types == null) { - _types = new HashMap(); - } - return _types; - } - - /** - * Normalizes the specified token. - * - * @param token - * Token to normalize. - * @return The normalized token. - * @throws IllegalArgumentException - * if token is not legal. - */ - private static String normalizeToken(String token) { - int length; - char c; - - // Makes sure we're not dealing with a "*" token. - token = token.trim(); - if (token.isEmpty() || "*".equals(token)) - return "*"; - - // Makes sure the token is RFC compliant. - length = token.length(); - for (int i = 0; i < length; i++) { - c = token.charAt(i); - if (c <= 32 || c >= 127 || _TSPECIALS.indexOf(c) != -1) - throw new IllegalArgumentException("Illegal token: " + token); - } - - return token; - } - - /** - * Normalizes the specified media type. - * - * @param name - * The name of the type to normalize. - * @param parameters - * The parameters of the type to normalize. - * @return The normalized type. - */ - private static String normalizeType(String name, - Series parameters) { - int slashIndex; - int colonIndex; - String mainType; - String subType; - StringBuilder params = null; - - // Ignore null names (backward compatibility). - if (name == null) - return null; - - // Check the presence of parameters - if ((colonIndex = name.indexOf(';')) != -1) { - params = new StringBuilder(name.substring(colonIndex)); - name = name.substring(0, colonIndex); - } - - // No main / sub separator, assumes name/*. - if ((slashIndex = name.indexOf('/')) == -1) { - mainType = normalizeToken(name); - subType = "*"; - } else { - // Normalizes the main and subtypes. - mainType = normalizeToken(name.substring(0, slashIndex)); - subType = normalizeToken(name.substring(slashIndex + 1)); - } - - // Merge parameters taken from the name and the method argument. - if (parameters != null && !parameters.isEmpty()) { - try { - if (params == null) { - params = new StringBuilder(); - } - HeaderWriter hw = new HeaderWriter() { - @Override - public HeaderWriter append(Parameter value) { - return appendExtension(value); - } - }; - for (int i = 0; i < parameters.size(); i++) { - Parameter p = parameters.get(i); - hw.appendParameterSeparator(); - hw.appendSpace(); - hw.append(p); - } - params.append(hw.toString()); - hw.close(); - } catch (IOException e) { - Context.getCurrentLogger().log(Level.INFO, - "Unable to parse the media type parameter", e); - } - } - - return (params == null) ? mainType + '/' + subType : mainType + '/' - + subType + params.toString(); - } - - /** - * Register a media type as a known type that can later be retrieved using - * {@link #valueOf(String)}. If the type already exists, the existing type - * is returned; otherwise a new instance is created. - * - * @param name - * The name. - * @param description - * The description. - * @return The registered media type - */ - public static synchronized MediaType register(String name, - String description) { - - if (!getTypes().containsKey(name)) { - final MediaType type = new MediaType(name, description); - getTypes().put(name, type); - } - - return getTypes().get(name); - } - - /** - * Returns the media type associated to a name. If an existing constant - * exists then it is returned, otherwise a new instance is created. - * - * @param name - * The name. - * @return The associated media type. - */ - public static MediaType valueOf(String name) { - MediaType result = null; - - if (!StringUtils.isNullOrEmpty(name)) { - result = getTypes().get(name); - if (result == null) { - result = new MediaType(name); - } - } - - return result; - } - - /** The list of parameters. */ - private volatile Series parameters; - - /** - * Constructor. - * - * @param name - * The name. - */ - public MediaType(String name) { - this(name, null, "Media type or range of media types"); - } - - /** - * Constructor. - * - * @param name - * The name. - * @param parameters - * The list of parameters. - */ - public MediaType(String name, Series parameters) { - this(name, parameters, "Media type or range of media types"); - } - - /** - * Constructor. - * - * @param name - * The name. - * @param parameters - * The list of parameters. - * @param description - * The description. - */ - public MediaType(String name, Series parameters, - String description) { - super(normalizeType(name, parameters), description); - - if (parameters != null) { - this.parameters = - org.restlet.client.engine.util.ParameterSeries.unmodifiableSeries(parameters); - } - } - - /** - * Constructor. - * - * @param name - * The name. - * @param description - * The description. - */ - public MediaType(String name, String description) { - this(name, null, description); - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object obj) { - return equals(obj, false); - } - - /** - * Test the equality of two media types, with the possibility to ignore the - * parameters. - * - * @param obj - * The object to compare to. - * @param ignoreParameters - * Indicates if parameters should be ignored during comparison. - * @return True if both media types are equal. - */ - public boolean equals(Object obj, boolean ignoreParameters) { - boolean result = (obj == this); - - // if obj == this no need to go further - if (!result) { - // if obj isn't a media-type or is null, don't evaluate further - if (obj instanceof MediaType that) { - if (getMainType().equals(that.getMainType()) - && getSubType().equals(that.getSubType())) { - result = ignoreParameters - || getParameters().equals(that.getParameters()); - } - } - } - - return result; - } - - /** - * Returns the main type. - * - * @return The main type. - */ - public String getMainType() { - String result = null; - - if (getName() != null) { - int index = getName().indexOf('/'); - - // Some clients appear to use name types without subtypes - if (index == -1) { - index = getName().indexOf(';'); - } - - if (index == -1) { - result = getName(); - } else { - result = getName().substring(0, index); - } - } - - return result; - } - - /** - * Returns the unmodifiable list of parameters corresponding to subtype - * modifiers. Creates a new instance if no one has been set. - * - * @return The list of parameters. - */ - public Series getParameters() { - // Lazy initialization with double-check. - Series p = this.parameters; - if (p == null) { - synchronized (this) { - p = this.parameters; - if (p == null) { - Series params = null; - - if (getName() != null) { - int index = getName().indexOf(';'); - - if (index != -1) { - params = new Form(getName().substring(index + 1) - .trim(), ';'); - } - } - - if (params == null) { - params = new - org.restlet.client.engine.util.ParameterSeries(); - } - - this.parameters = p = - org.restlet.client.engine.util.ParameterSeries.unmodifiableSeries(params); - } - } - } - return p; - } - - /** - * {@inheritDoc}
- * In case the media type has parameters, this method returns the - * concatenation of the main type and the subtype. If the subtype is not - * equal to "*", it returns the concatenation of the main type and "*". - * Otherwise, it returns either the {@link #ALL} media type if it is already - * the {@link #ALL} media type, or null. - */ - @Override - public MediaType getParent() { - MediaType result = null; - - if (getParameters().size() > 0) { - result = MediaType.valueOf(getMainType() + "/" + getSubType()); - } else { - if (getSubType().equals("*")) { - result = equals(ALL) ? null : ALL; - } else { - result = MediaType.valueOf(getMainType() + "/*"); - } - } - - return result; - } - - /** - * Returns the subtype. - * - * @return The subtype. - */ - public String getSubType() { - String result = null; - - if (getName() != null) { - final int slash = getName().indexOf('/'); - - if (slash == -1) { - // No subtype found, assume that all subtypes are accepted - result = "*"; - } else { - final int separator = getName().indexOf(';'); - if (separator == -1) { - result = getName().substring(slash + 1); - } else { - result = getName().substring(slash + 1, separator); - } - } - } - - return result; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(super.hashCode(), getParameters()); - } - - /** - * Indicates if a given media type is included in the current one @see - * {@link #includes(Metadata, boolean)}. It ignores the parameters. - * - * @param included - * The media type to test for inclusion. - * @return True if the given media type is included in the current one. - * @see #isCompatible(Metadata) - */ - @Override - public boolean includes(Metadata included) { - return includes(included, true); - } - - /** - * Indicates if a given media type is included in the current one. - * The test is true if both types are - * equal or if the given media type is within the range of the current one. - * For example, ALL includes all media types. Parameters are ignored for - * this comparison. A null media type is considered as included in the - * current one. It ignores the parameters. - *

- * Examples: - *

    - *
  • TEXT_ALL.includes(TEXT_PLAIN) -> true
  • - *
  • TEXT_PLAIN.includes(TEXT_ALL) -> false
  • - *
- * - * @param included - * The media type to test for inclusion. - * @return True if the given media type is included in the current one. - * @see #isCompatible(Metadata) - */ - public boolean includes(Metadata included, boolean ignoreParameters) { - boolean result = equals(ALL) || equals(included); - - if (!result && (included instanceof MediaType includedMediaType)) { - - if (getMainType().equals(includedMediaType.getMainType())) { - // Both media types are different - if (getSubType().equals(includedMediaType.getSubType())) { - if (ignoreParameters) { - result = true; - } else { - // Check parameters: - // Media type A includes media type B if for each param - // name/value pair in A, B contains the same name/value. - result = true; - for (int i = 0; result && i < getParameters().size(); i++) { - Parameter param = getParameters().get(i); - Parameter includedParam = includedMediaType - .getParameters().getFirst(param.getName()); - - // If there was no param with the same name, or the - // param with the same name had a different value, - // then no match. - result = (includedParam != null && param.getValue() - .equals(includedParam.getValue())); - } - } - } else if (getSubType().equals("*")) { - result = true; - } else if (getSubType().startsWith("*+") - && includedMediaType.getSubType().endsWith( - getSubType().substring(2))) { - result = true; - } - } - } - - return result; - } - - /** - * Checks if the current media type is concrete. A media type is concrete if - * neither the main type nor the subtype are equal to "*". - * - * @return True if this media type is concrete. - */ - public boolean isConcrete() { - return !getName().contains("*"); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Metadata.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Metadata.java deleted file mode 100644 index 442aba02fb..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Metadata.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -/** - * Representations metadata for content negotiation. "Metadata is in the form of - * name-value pairs, where the name corresponds to a standard that defines the - * value's structure and semantics. Response messages may include both - * representation metadata and resource metadata: information about the resource - * that is not specific to the supplied representation." Roy T. Fielding - * - * @see Preference - * @see Source dissertation - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Metadata { - - /** The description of this metadata. */ - private final String description; - - /** The metadata name like "text/html" or "compress" or "iso-8851-1". */ - private final String name; - - /** - * Constructor. - * - * @param name - * The unique name. - */ - public Metadata(String name) { - this(name, null); - } - - /** - * Constructor. - * - * @param name - * The unique name. - * @param description - * The description. - */ - public Metadata(String name, String description) { - this.name = name; - this.description = description; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object object) { - return (object instanceof Metadata) - && ((Metadata) object).getName().equals(getName()); - } - - /** - * Returns the description. - * - * @return The description. - */ - public String getDescription() { - return this.description; - } - - /** - * Returns the name (ex: "text/html" or "compress" or "iso-8851-1"). - * - * @return The name (ex: "text/html" or "compress" or "iso-8851-1"). - */ - public String getName() { - return this.name; - } - - /** - * Returns the parent metadata if available or null. - * - * @return The parent metadata. - */ - public abstract Metadata getParent(); - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return (getName() == null) ? 0 : getName().hashCode(); - } - - /** - * Indicates if a given metadata is included in the current one. The test is - * true if both metadata are equal or if the given metadata is within the - * range of the current one. For example, {@link MediaType#ALL} includes all - * media types. - *

- * Examples: - *

    - *
  • TEXT_ALL.includes(TEXT_PLAIN) -> true
  • - *
  • TEXT_PLAIN.includes(TEXT_ALL) -> false
  • - *
- * - * @param included - * The metadata to test for inclusion. - * @return True if the given metadata is included in the current one. - * @see #isCompatible(Metadata) - */ - public abstract boolean includes(Metadata included); - - /** - * Checks if this metadata is compatible with the given metadata. - *

- * Examples: - *

    - *
  • TEXT_ALL.isCompatible(TEXT_PLAIN) -> true
  • - *
  • TEXT_PLAIN.isCompatible(TEXT_ALL) -> true
  • - *
  • TEXT_PLAIN.isCompatible(APPLICATION_ALL) -> false
  • - *
- * - * @param otherMetadata - * The other metadata to compare. - * @return True if the metadata are compatible. - * @see #includes(Metadata) - */ - public boolean isCompatible(Metadata otherMetadata) { - boolean result = (otherMetadata != null) - && (includes(otherMetadata) || otherMetadata.includes(this)); - return result; - } - - /** - * Returns the metadata name. - * - * @return The metadata name. - */ - @Override - public String toString() { - return getName(); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Method.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Method.java deleted file mode 100644 index be2c040118..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Method.java +++ /dev/null @@ -1,519 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.restlet.client.engine.Engine; - -/** - * Method to execute when handling a call. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class Method implements Comparable { - - /** Map of registered methods. */ - private static final Map _methods = new ConcurrentHashMap(); - - /** - * Pseudo-method use to match all methods. - */ - public static final Method ALL = new Method("*", - "Pseudo-method use to match all methods."); - - private static final String BASE_HTTP = "http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html"; - - @Deprecated - private static final String BASE_WEBDAV = "http://www.webdav.org/specs/rfc2518.html"; - - /** - * Used with a proxy that can dynamically switch to being a tunnel. - * - * @see HTTP - * RFC - 9.9 CONNECT - */ - public static final Method CONNECT = new Method("CONNECT", - "Used with a proxy that can dynamically switch to being a tunnel", - BASE_HTTP + "#sec9.9", false, false); - - /** - * Creates a duplicate of the source resource, identified by the - * Request-URI, in the destination resource, identified by the URI in the - * Destination header. - * - * @see WEBDAV - * RFC - 8.8 COPY Method - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Method COPY = new Method( - "COPY", - "Creates a duplicate of the source resource, identified by the Request-URI, in the destination resource, identified by the URI in the Destination header", - BASE_WEBDAV + "#METHOD_COPY", false, true); - - /** - * Requests that the origin server deletes the resource identified by the - * request URI. - * - * @see HTTP - * RFC - 9.7 DELETE - */ - public static final Method DELETE = new Method( - "DELETE", - "Requests that the origin server deletes the resource identified by the request URI", - BASE_HTTP + "#sec9.7", false, true); - - /** - * Retrieves whatever information (in the form of an entity) that is - * identified by the request URI. - * - * @see HTTP - * RFC - 9.3 GET - */ - public static final Method GET = new Method( - "GET", - "Retrieves whatever information (in the form of an entity) that is identified by the request URI", - BASE_HTTP + "#sec9.3", true, true); - - /** - * Identical to GET except that the server must not return a message body in - * the response but only the message header. - * - * @see HTTP - * RFC - 9.4 HEAD - */ - public static final Method HEAD = new Method( - "HEAD", - "Identical to GET except that the server must not return a message body in the response", - BASE_HTTP + "#sec9.4", true, true); - - /** - * Used to take out a lock of any access type on the resource identified by - * the request URI. - * - * @see WEBDAV - * RFC - 8.10 LOCK Method - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Method LOCK = new Method("LOCK", - "Used to take out a lock of any access type (WebDAV)", BASE_WEBDAV - + "#METHOD_LOCK", false, false); - - /** - * MKCOL creates a new collection resource at the location specified by the - * Request URI. - * - * @see WEBDAV - * RFC - 8.3 MKCOL Method - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Method MKCOL = new Method("MKCOL", - "Used to create a new collection (WebDAV)", BASE_WEBDAV - + "#METHOD_MKCOL", false, true); - - /** - * Logical equivalent of a copy, followed by consistency maintenance - * processing, followed by a delete of the source where all three actions - * are performed atomically. - * - * @see WEBDAV - * RFC - 8.3 MKCOL Method - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Method MOVE = new Method( - "MOVE", - "Logical equivalent of a copy, followed by consistency maintenance processing, followed by a delete of the source (WebDAV)", - BASE_WEBDAV + "#METHOD_MOVE", false, false); - - /** - * Requests for information about the communication options available on the - * request/response chain identified by the URI. - * - * @see HTTP - * RFC - 9.2 OPTIONS - */ - public static final Method OPTIONS = new Method( - "OPTIONS", - "Requests for information about the communication options available on the request/response chain identified by the URI", - BASE_HTTP + "#sec9.2", true, true); - - /** - * Requests that the origin server applies partial modifications contained - * in the entity enclosed in the request to the resource identified by the - * request URI. - * - * @see HTTP PATCH RFC 5789 - */ - public static final Method PATCH = new Method( - "PATCH", - "Requests that the origin server applies partial modifications to the resource identified by the request URI", - "http://tools.ietf.org/html/rfc5789", false, false); - - /** - * Requests that the origin server accepts the entity enclosed in the - * request as a new subordinate of the resource identified by the request - * URI. - * - * @see HTTP - * RFC - 9.5 POST - */ - public static final Method POST = new Method( - "POST", - "Requests that the origin server accepts the entity enclosed in the request as a new subordinate of the resource identified by the request URI", - BASE_HTTP + "#sec9.5", false, false); - - /** - * Retrieves properties defined on the resource identified by the request - * URI. - * - * @see WEBDAV - * RFC - 8.1 PROPFIND - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Method PROPFIND = new Method( - "PROPFIND", - "Retrieves properties defined on the resource identified by the request URI", - BASE_WEBDAV + "#METHOD_PROPFIND", true, true); - - /** - * Processes instructions specified in the request body to set and/or remove - * properties defined on the resource identified by the request URI. - * - * @see WEBDAV - * RFC - 8.2 PROPPATCH - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Method PROPPATCH = new Method( - "PROPPATCH", - "Processes instructions specified in the request body to set and/or remove properties defined on the resource identified by the request URI", - BASE_WEBDAV + "#METHOD_PROPPATCH", false, true); - - /** - * Requests that the enclosed entity be stored under the supplied request - * URI. - * - * @see - */ - public static final Method PUT = new Method( - "PUT", - "Requests that the enclosed entity be stored under the supplied request URI", - BASE_HTTP + "#sec9.6", false, true); - - /** - * Used to invoke a remote, application-layer loop-back of the request - * message. - * - * @see HTTP - * RFC - 9.8 TRACE - */ - public static final Method TRACE = new Method( - "TRACE", - "Used to invoke a remote, application-layer loop-back of the request message", - BASE_HTTP + "#sec9.8", true, true); - - /** - * Removes the lock identified by the lock token from the request URI, and - * all other resources included in the lock. - * - * @see WEBDAV - * RFC - 8.11 UNLOCK Method - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Method UNLOCK = new Method( - "UNLOCK", - "Removes the lock identified by the lock token from the request URI, and all other resources included in the lock", - BASE_WEBDAV + "#METHOD_UNLOCK", false, false); - - /** - * Adds a new Method to the list of registered methods. - * - * @param method - * The method to register. - */ - public static void register(Method method) { - String name = (method == null) ? null : method.getName().toLowerCase(); - if ((name != null) && !name.isEmpty()) { - _methods.put(name, method); - } - } - - /** - * Sorts the given list of methods by name. - * - * @param methods - * The methods to sort. - */ - public static void sort(List methods) { - Collections.sort(methods, new Comparator() { - public int compare(Method m1, Method m2) { - return m1.getName().compareTo(m2.getName()); - } - }); - } - - /** - * Returns the method associated to a given method name. If an existing - * constant exists then it is returned, otherwise a new instance is created. - * - * @param name - * The method name. - * @return The associated method. - */ - public static Method valueOf(final String name) { - Method result = null; - - if ((name != null) && !name.isEmpty()) { - result = Method._methods.get(name.toLowerCase()); - if (result == null) { - result = new Method(name); - } - } - - return result; - } - - /** The description. */ - private final String description; - - /** - * Indicates if the side effects of several requests is the same as a single - * request. - */ - private volatile boolean idempotent; - - /** The name. */ - private volatile String name; - - /** Indicates if the method replies with a response. */ - private final boolean replying; - - /** - * Indicates if it should have the significance of taking an action other - * than retrieval. - */ - private final boolean safe; - - /** The URI of the specification describing the method. */ - private volatile String uri; - - static { - // Let the engine register all methods (the default ones and the ones to - // be discovered) as soon as the Method class is loaded or at least - // used. - Engine.getInstance(); - } - - /** - * Constructor for unsafe and non idempotent methods. - * - * @param name - * The technical name of the method. - * @see org.restlet.client.data.Method#valueOf(String) - */ - public Method(final String name) { - this(name, null); - } - - /** - * Constructor for unsafe and non idempotent methods. - * - * @param name - * The technical name of the method. - * @param description - * The description. - * @see org.restlet.client.data.Method#valueOf(String) - */ - public Method(String name, String description) { - this(name, description, null, false, false); - } - - /** - * Constructor for unsafe and non idempotent methods. - * - * @param name - * The technical name. - * @param description - * The description. - * @param uri - * The URI of the specification describing the method. - * @see org.restlet.client.data.Method#valueOf(String) - */ - public Method(String name, String description, String uri) { - this(name, description, uri, false, false); - } - - /** - * Constructor for methods that reply to requests with responses. - * - * @param name - * The technical name. - * @param description - * The description. - * @param uri - * The URI of the specification describing the method. - * @param safe - * Indicates if the method is safe. - * @param idempotent - * Indicates if the method is idempotent. - * @see org.restlet.client.data.Method#valueOf(String) - */ - public Method(String name, String description, String uri, boolean safe, - boolean idempotent) { - this(name, description, uri, safe, idempotent, true); - } - - /** - * Constructor. - * - * @param name - * The technical name. - * @param description - * The description. - * @param uri - * The URI of the specification describing the method. - * @param safe - * Indicates if the method is safe. - * @param idempotent - * Indicates if the method is idempotent. - * @param replying - * Indicates if the method replies with a response. - * @see org.restlet.client.data.Method#valueOf(String) - */ - public Method(String name, String description, String uri, boolean safe, - boolean idempotent, boolean replying) { - this.name = name; - this.description = description; - this.uri = uri; - this.safe = safe; - this.idempotent = idempotent; - this.replying = replying; - } - - /** - * Compares this method to another. Based on the method name. - * - * @param o - * The other method. - */ - public int compareTo(Method o) { - if (o != null) { - return this.getName().compareTo(o.getName()); - } - return 1; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(final Object object) { - return (object instanceof Method) - && ((Method) object).getName().equals(getName()); - } - - /** - * Returns the description. - * - * @return The description. - */ - public String getDescription() { - return this.description; - } - - /** - * Returns the name. - * - * @return The name. - */ - public String getName() { - return name; - } - - /** - * Returns the URI of the specification describing the method. - * - * @return The URI of the specification describing the method. - */ - public String getUri() { - return this.uri; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return (getName() == null) ? 0 : getName().hashCode(); - } - - /** - * Indicates if the side-effects of several requests is the same as a single - * request. - * - * @return True if the method is idempotent. - */ - public boolean isIdempotent() { - return idempotent; - } - - /** - * Indicates if the method replies with a response. - * - * @return True if the method replies with a response. - */ - public boolean isReplying() { - return replying; - } - - /** - * Indicates if it should have the significance of taking an action other - * than retrieval. - * - * @return True if the method is safe. - */ - public boolean isSafe() { - return safe; - } - - /** - * Returns the name. - * - * @return The name. - */ - @Override - public String toString() { - return getName(); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Parameter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Parameter.java deleted file mode 100644 index 042ef40791..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Parameter.java +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.io.IOException; -import java.util.Objects; - -import org.restlet.client.engine.util.SystemUtils; -import org.restlet.client.util.NamedValue; - -/** - * Multi-usage parameter. Note that the name and value properties are thread - * safe, stored in volatile members. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Parameter implements Comparable, NamedValue { - - /** The first object. */ - private volatile String name; - - /** The second object. */ - private volatile String value; - - /** - * Creates a parameter. - * - * @param name - * The parameter name buffer. - * @param value - * The parameter value buffer (can be null). - * @return The created parameter. - * @throws IOException - */ - public static Parameter create(CharSequence name, CharSequence value) { - if (value != null) { - return new Parameter(name.toString(), value.toString()); - } else { - return new Parameter(name.toString(), null); - } - } - - /** - * Default constructor. - */ - public Parameter() { - this(null, null); - } - - /** - * Preferred constructor. - * - * @param name - * The name. - * @param value - * The value. - */ - public Parameter(String name, String value) { - this.name = name; - this.value = value; - } - - /* - * (non-Javadoc) - * - * @see org.restlet.client.data.NamedValue#compareTo(org.restlet.client.data.Parameter) - */ - public int compareTo(Parameter o) { - return getName().compareTo(o.getName()); - } - - /** - * Encodes the parameter into the target buffer. - * - * @param buffer - * The target buffer. - * @param characterSet - * The character set to use. - * @throws IOException - */ - public void encode(Appendable buffer, CharacterSet characterSet) - throws IOException { - if (getName() != null) { - buffer.append(Reference.encode(getName(), characterSet)); - - if (getValue() != null) { - buffer.append('='); - buffer.append(Reference.encode(getValue(), characterSet)); - } - } - } - - /** - * Encodes the parameter as a string. - * - * @param characterSet - * The character set to use. - * @return The encoded string? - * @throws IOException - */ - public String encode(CharacterSet characterSet) throws IOException { - StringBuilder sb = new StringBuilder(); - encode(sb, characterSet); - return sb.toString(); - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof Parameter)) { - return false; - } - - Parameter that = (Parameter) obj; - return Objects.equals(getName(), that.getName()) - && Objects.equals(getValue(), that.getValue()); - } - - /* - * (non-Javadoc) - * - * @see org.restlet.client.data.NamedValue#getName() - */ - public String getName() { - return this.name; - } - - /* - * (non-Javadoc) - * - * @see org.restlet.client.data.NamedValue#getValue() - */ - public String getValue() { - return this.value; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(getName(), getValue()); - } - - /* - * (non-Javadoc) - * - * @see org.restlet.client.data.NamedValue#setName(java.lang.String) - */ - public void setName(String name) { - this.name = name; - } - - /* - * (non-Javadoc) - * - * @see org.restlet.client.data.NamedValue#setValue(java.lang.String) - */ - public void setValue(String value) { - this.value = value; - } - - @Override - public String toString() { - return "[" + getName() + "=" + getValue() + "]"; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Preference.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Preference.java deleted file mode 100644 index 0fb1ddca9b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Preference.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import org.restlet.client.util.Series; - -/** - * Metadata preference definition. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class Preference { - /** The metadata associated with this preference. */ - private volatile T metadata; - - /** The modifiable list of parameters. */ - private volatile Series parameters; - - /** The quality/preference level. */ - private volatile float quality; - - /** - * Constructor. - */ - public Preference() { - this(null, 1F, null); - } - - /** - * Constructor. - * - * @param metadata - * The associated metadata. - */ - public Preference(T metadata) { - this(metadata, 1F, null); - } - - /** - * Constructor. - * - * @param metadata - * The associated metadata. - * @param quality - * The quality/preference level. - */ - public Preference(T metadata, float quality) { - this(metadata, quality, null); - } - - /** - * Constructor. - * - * @param metadata - * The associated metadata. - * @param quality - * The quality/preference level. - * @param parameters - * The list of parameters. - */ - public Preference(T metadata, float quality, Series parameters) { - this.metadata = metadata; - this.quality = quality; - this.parameters = parameters; - } - - /** - * Returns the metadata associated with this preference. - * - * @return The metadata associated with this preference. - */ - public T getMetadata() { - return this.metadata; - } - - /** - * Returns the modifiable list of parameters. Creates a new instance if no - * one has been set. - * - * @return The modifiable list of parameters. - */ - public Series getParameters() { - // Lazy initialization with double-check. - Series p = this.parameters; - if (p == null) { - synchronized (this) { - p = this.parameters; - if (p == null) { - this.parameters = p = new - org.restlet.client.engine.util.ParameterSeries(); - } - } - } - return p; - } - - /** - * Returns the quality/preference level. - * - * @return The quality/preference level. - */ - public float getQuality() { - return this.quality; - } - - /** - * Sets the metadata associated with this preference. - * - * @param metadata - * The metadata associated with this preference. - */ - public void setMetadata(T metadata) { - this.metadata = metadata; - } - - /** - * Sets the modifiable list of parameters. - * - * @param parameters - * The modifiable list of parameters. - */ - public void setParameters(Series parameters) { - this.parameters = parameters; - } - - /** - * Sets the quality/preference level. - * - * @param quality - * The quality/preference level. - */ - public void setQuality(float quality) { - this.quality = quality; - } - - @Override - public String toString() { - return (getMetadata() == null) ? "" - : (getMetadata().getName() + ":" + getQuality()); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Product.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Product.java deleted file mode 100644 index bfa6ac0611..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Product.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -/** - * Product tokens are used to allow communicating applications to identify - * themselves by software name and version. - * - * @author Thierry Boileau - * @see User-Agent - * @see Product - * Tokens - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Product { - - /** Comment. */ - private volatile String comment; - - /** Product name. */ - private volatile String name; - - /** Version number. */ - private volatile String version; - - /** - * Constructor. - * - * @param name - * The product name. - * @param version - * The product version. - * @param comment - * The product comment. - */ - public Product(String name, String version, String comment) { - super(); - this.name = name; - this.version = version; - this.comment = comment; - } - - /** - * Returns the facultative comment. - * - * @return The facultative comment. - */ - public String getComment() { - return this.comment; - } - - /** - * Returns the product name. - * - * @return The product name. - */ - public String getName() { - return this.name; - } - - /** - * Returns the version of the product. - * - * @return The version of the product. - */ - public String getVersion() { - return this.version; - } - - /** - * Sets the facultative comment. - * - * @param comment - * The facultative comment. - */ - public void setComment(String comment) { - this.comment = comment; - } - - /** - * Sets the product name. - * - * @param name - * The product name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the version of the product. - * - * @param version - * The version of the product. - */ - public void setVersion(String version) { - this.version = version; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Protocol.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Protocol.java deleted file mode 100644 index 47552e9aa1..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Protocol.java +++ /dev/null @@ -1,369 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import org.restlet.client.engine.util.StringUtils; - -/** - * Protocol used by client and server connectors. Connectors enable the - * communication between components by implementing standard protocols. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class Protocol { - - /** Indicates that the port number is undefined. */ - public static final int UNKNOWN_PORT = -1; - - /** All protocols' wildcard. */ - public static final Protocol ALL = new Protocol("all", "ALL", - "Wildcard for all protocols", UNKNOWN_PORT); - - /** FTP protocol. */ - public static final Protocol FTP = new Protocol("ftp", "FTP", - "File Transfer Protocol", 21); - - /** HTTP protocol. */ - public static final Protocol HTTP = new Protocol("http", "HTTP", - "HyperText Transport Protocol", 80, "1.1"); - - /** HTTPS protocol (via SSL socket). */ - public static final Protocol HTTPS = new Protocol("https", "HTTPS", "HTTP", - "HyperText Transport Protocol (Secure)", 443, true, "1.1"); - - /** POP protocol. */ - @Deprecated - public static final Protocol POP = new Protocol("pop", "POP", - "Post Office Protocol", 110); - - /** POPS protocol (via SSL/TLS socket).. */ - @Deprecated - public static final Protocol POPS = new Protocol("pops", "POPS", - "Post Office Protocol (Secure)", 995, true); - - /** - * SDC (Secure Data Connector) protocol.
- *
- * SDC is natively available on the Google App Engine platform and via a - * special Restlet extension on other platforms. - */ - @Deprecated - public static final Protocol SDC = new Protocol("sdc", "SDC", - "Secure Data Connector Protocol", UNKNOWN_PORT, true); - - /** SIP protocol. */ - @Deprecated - public static final Protocol SIP = new Protocol("sip", "SIP", - "Session Initiation Protocol", 5060, "2.0"); - - /** SIPS protocol (via SSL socket). */ - @Deprecated - public static final Protocol SIPS = new Protocol("sips", "SIPS", "SIP", - "Session Initiation Protocol (Secure)", 5061, true, "2.0"); - - /** SMTP protocol. */ - @Deprecated - public static final Protocol SMTP = new Protocol("smtp", "SMTP", - "Simple Mail Transfer Protocol", 25); - - /** SMTPS protocol (via SSL/TLS socket). */ - @Deprecated - public static final Protocol SMTPS = new Protocol("smtps", "SMTPS", - "Simple Mail Transfer Protocol (Secure)", 465, true); - - /** - * Creates the protocol associated to a URI scheme name. If an existing - * constant exists then it is returned, otherwise a new instance is created. - * - * @param name - * The scheme name. - * @return The associated protocol. - */ - public static Protocol valueOf(String name) { - Protocol result = null; - - if (!StringUtils.isNullOrEmpty(name)) { - if (name.equalsIgnoreCase(FTP.getSchemeName())) { - result = FTP; - } else if (name.equalsIgnoreCase(HTTP.getSchemeName())) { - result = HTTP; - } else if (name.equalsIgnoreCase(HTTPS.getSchemeName())) { - result = HTTPS; - } else if (name.equalsIgnoreCase(POP.getSchemeName())) { - result = POP; - } else if (name.equalsIgnoreCase(POPS.getSchemeName())) { - result = POPS; - } else if (name.equalsIgnoreCase(SMTP.getSchemeName())) { - result = SMTP; - } else if (name.equalsIgnoreCase(SMTPS.getSchemeName())) { - result = SMTPS; - } else if (name.equalsIgnoreCase(SIP.getSchemeName())) { - result = SIP; - } else if (name.equalsIgnoreCase(SIPS.getSchemeName())) { - result = SIPS; - } else { - result = new Protocol(name); - } - } - - return result; - } - - /** - * Creates the protocol associated to a URI scheme name. If an existing - * constant exists then it is returned, otherwise a new instance is created. - * - * @param name - * The scheme name. - * @param version - * The version number. - * @return The associated protocol. - */ - public static Protocol valueOf(String name, String version) { - Protocol result = valueOf(name); - - if (!version.equals(result.getVersion())) { - result = new Protocol(result.getSchemeName(), result.getName(), - result.getTechnicalName(), result.getDescription(), - result.getDefaultPort(), result.isConfidential(), version); - } - - return result; - } - - /** The confidentiality. */ - private final boolean confidential; - - /** The default port if known or -1. */ - private final int defaultPort; - - /** The description. */ - private final String description; - - /** The name. */ - private final String name; - - /** The scheme name. */ - private final String schemeName; - - /** The technical name that appears on the wire. */ - private final String technicalName; - - /** The version. */ - private final String version; - - /** - * Constructor. - * - * @param schemeName - * The scheme name. - */ - public Protocol(String schemeName) { - this(schemeName, schemeName.toUpperCase(), schemeName.toUpperCase() - + " Protocol", UNKNOWN_PORT); - } - - /** - * Constructor. - * - * @param schemeName - * The scheme name. - * @param name - * The unique name. - * @param description - * The description. - * @param defaultPort - * The default port. - */ - public Protocol(String schemeName, String name, String description, - int defaultPort) { - this(schemeName, name, description, defaultPort, false); - } - - /** - * Constructor. - * - * @param schemeName - * The scheme name. - * @param name - * The unique name. - * @param description - * The description. - * @param defaultPort - * The default port. - * @param confidential - * The confidentiality. - */ - public Protocol(String schemeName, String name, String description, - int defaultPort, boolean confidential) { - this(schemeName, name, description, defaultPort, confidential, null); - } - - /** - * Constructor. - * - * @param schemeName - * The scheme name. - * @param name - * The unique name. - * @param description - * The description. - * @param defaultPort - * The default port. - * @param confidential - * The confidentiality. - * @param version - * The version. - */ - public Protocol(String schemeName, String name, String description, - int defaultPort, boolean confidential, String version) { - this(schemeName, name, name, description, defaultPort, confidential, - version); - } - - /** - * Constructor. - * - * @param schemeName - * The scheme name. - * @param name - * The unique name. - * @param description - * The description. - * @param defaultPort - * The default port. - * @param version - * The version. - */ - public Protocol(String schemeName, String name, String description, - int defaultPort, String version) { - this(schemeName, name, description, defaultPort, false, version); - } - - /** - * Constructor. - * - * @param schemeName - * The scheme name. - * @param name - * The unique name. - * @param technicalName - * The technical name that appears on the wire. - * @param description - * The description. - * @param defaultPort - * The default port. - * @param confidential - * The confidentiality. - * @param version - * The version. - */ - public Protocol(String schemeName, String name, String technicalName, - String description, int defaultPort, boolean confidential, - String version) { - this.name = name; - this.description = description; - this.schemeName = schemeName; - this.technicalName = technicalName; - this.defaultPort = defaultPort; - this.confidential = confidential; - this.version = version; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(final Object object) { - return (object instanceof Protocol) - && getName().equalsIgnoreCase(((Protocol) object).getName()); - } - - /** - * Returns the default port number. - * - * @return The default port number. - */ - public int getDefaultPort() { - return this.defaultPort; - } - - /** - * Returns the description. - * - * @return The description. - */ - public String getDescription() { - return this.description; - } - - /** - * Returns the name. - * - * @return The name. - */ - public String getName() { - return name; - } - - /** - * Returns the URI scheme name. - * - * @return The URI scheme name. - */ - public String getSchemeName() { - return this.schemeName; - } - - /** - * Returns the technical name that appears on the wire. - * - * @return The technical name that appears on the wire. - */ - public String getTechnicalName() { - return technicalName; - } - - /** - * Returns the version. - * - * @return The version. - */ - public String getVersion() { - return version; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return (getName() == null) ? 0 : getName().toLowerCase().hashCode(); - } - - /** - * Indicates if the protocol guarantees the confidentiality of the messages - * exchanged, for example, via an SSL-secured connection. - * - * @return True if the protocol is confidential. - */ - public boolean isConfidential() { - return this.confidential; - } - - /** - * Returns the name. - * - * @return The name. - */ - @Override - public String toString() { - return getName() + ((getVersion() == null) ? "" : "/" + getVersion()); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Range.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Range.java deleted file mode 100644 index 7cd3a2c5b3..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Range.java +++ /dev/null @@ -1,257 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import org.restlet.client.engine.util.SystemUtils; - -/** - * Describes a range of bytes. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Range { - - /** - * Index for the first byte (or range unit) of an entity. - */ - public final static long INDEX_FIRST = 0; - - /** - * Index for the last byte (or range unit) of an entity. - */ - public final static long INDEX_LAST = -1; - - public final static String RANGE_BYTES_UNIT = "bytes"; - - /** - * Maximum size available from the index. - */ - public final static long SIZE_MAX = -1; - - /** - * Indicates if the unit of the given range is "bytes". - * - * @param range - * The range. - * @return true if the unit of the given range is "bytes". - */ - public static boolean isBytesRange(Range range) { - return RANGE_BYTES_UNIT.equals(range.getUnitName()); - } - - /** - * Index from which to start the range. If the index is superior or equal to - * zero, the index will define the start of the range. If its value is {@value #INDEX_LAST} (-1), then it defines - * the end of the range. The default value is {@link #INDEX_FIRST} (0), starting at the first byte. - */ - private volatile long index; - - /** - * Total size of the instance in number of bytes (or range unit). In the case of "bytes" range, this attribute is - * ignored, as the instance size is taken from the entity. - */ - private volatile long instanceSize; - - /** - * Size of the range in number of bytes (or range unit). If the size is the maximum - * available from the index, then use the {@value #SIZE_MAX} constant. - */ - private volatile long size; - - /** - * Specifies the unit of the range. The HTTP/1.1 protocol specifies only - * 'bytes', but other ranges are allowed {@link RFC 2616} - */ - private volatile String unitName; - - /** - * Default constructor defining a range starting on the first byte and with - * a maximum size, i.e., covering the whole entity. - */ - public Range() { - this(INDEX_FIRST, SIZE_MAX); - } - - /** - * Constructor defining a range starting on the first byte and with the - * given size. - * - * @param size - * Size of the range in number of bytes. - */ - public Range(long size) { - this(INDEX_FIRST, size); - } - - /** - * Constructor. Sets the name of the range unit as "bytes" by default. - * - * @param index - * Index from which to start the range - * @param size - * Size of the range in number of bytes. - */ - public Range(long index, long size) { - this.index = index; - this.size = size; - this.unitName = RANGE_BYTES_UNIT; - } - - /** - * Constructor. Sets the name of the range unit as "bytes" by default. - * - * @param index - * Index from which to start the range - * @param size - * Size of the range in number of bytes. - * @param instanceSize - * Size of the instance in number of bytes. - * @param unitName - * Unit of the range. - */ - public Range(long index, long size, long instanceSize, String unitName) { - this.index = index; - this.instanceSize = instanceSize; - this.size = size; - this.unitName = unitName; - } - - @Override - public boolean equals(Object object) { - return (object instanceof Range) - && ((Range) object).getIndex() == getIndex() - && ((Range) object).getSize() == getSize(); - } - - /** - * Returns the index from which to start the range. If the index is superior - * or equal to zero, the index will define the start of the range. If its - * value is {@value #INDEX_LAST} (-1), then it defines the end of the range. - * The default value is {@link #INDEX_FIRST} (0), starting at the first - * byte. - * - * @return The index from which to start the range. - */ - public long getIndex() { - return index; - } - - /** - * Returns the total size of the instance in number of bytes (or range unit). - * In the case of "bytes" range, this attribute is ignored, as the instance size is taken from the entity. - * - * @return The total size of the instance. - */ - public long getInstanceSize() { - return instanceSize; - } - - /** - * Returns the size of the range in number of bytes. If the size is the - * maximum available from the index, then use the {@value #SIZE_MAX} constant. - * - * @return The size of the range in number of bytes. - */ - public long getSize() { - return size; - } - - /** - * Returns the name of the range unit. - * - * @return The name of the range unit. - */ - public String getUnitName() { - return unitName; - } - - @Override - public int hashCode() { - return SystemUtils.hashCode(index, instanceSize, size, unitName); - } - - /** - * Indicates if the given index is included in the range. - * - * @param position - * The position to test. - * @param totalSize - * - * @return True if the given index is included in the range, false - * otherwise. - */ - public boolean isIncluded(long position, long totalSize) { - boolean result = false; - - if (getIndex() == INDEX_LAST) { - // The range starts from the end - result = (0 <= position) && (position < totalSize); - - if (result) { - result = position >= (totalSize - getSize()); - } - } else { - // The range starts from the beginning - result = position >= getIndex(); - - if (result && (getSize() != SIZE_MAX)) { - result = position < getIndex() + getSize(); - } - } - - return result; - } - - /** - * Sets the index from which to start the range. If the index is superior or - * equal to zero, the index will define the start of the range. If its value - * is {@value #INDEX_LAST} (-1), then it defines the end of the range. The - * default value is {@link #INDEX_FIRST} (0), starting at the first byte - * - * @param index - * The index from which to start the range. - */ - public void setIndex(long index) { - this.index = index; - } - - /** - * Sets the total size of the instance in number of bytes (or range unit). - * - * @param instanceSize - * The total size of the instance. - */ - public void setInstanceSize(long instanceSize) { - this.instanceSize = instanceSize; - } - - /** - * Sets the size of the range in number of bytes. If the size is the maximum - * available from the index, then use the {@value #SIZE_MAX} constant. - * - * @param size - * The size of the range in number of bytes. - */ - public void setSize(long size) { - this.size = size; - } - - /** - * Sets the name of the range unit. - * - * @param unitName - * The name of the range unit. - */ - public void setUnitName(String unitName) { - this.unitName = unitName; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/RecipientInfo.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/RecipientInfo.java deleted file mode 100644 index 1bf1d8a48a..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/RecipientInfo.java +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -/** - * Describes an intermediary via which the call went through. The intermediary - * is typically a proxy or a cache.
- *
- * Note that when used with HTTP connectors, this class maps to the "Via" - * header. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class RecipientInfo { - - /** The protocol used to communicate with the recipient. */ - private volatile Protocol protocol; - - /** The optional comment, typically the software agent name. */ - private volatile String comment; - - /** The host name and port number or a pseudonym. */ - private volatile String name; - - /** - * Default constructor. - */ - public RecipientInfo() { - } - - /** - * Constructor. - * - * @param protocol - * The protocol used to communicate with the recipient. - * @param name - * The host name and port number or a pseudonym. - * @param agent - * The software agent. - */ - public RecipientInfo(Protocol protocol, String name, String agent) { - this.protocol = protocol; - this.name = name; - this.comment = agent; - } - - /** - * Returns the optional comment, typically the software agent name. - * - * @return The optional comment. - */ - public String getComment() { - return comment; - } - - /** - * Returns the host name and port number or a pseudonym. - * - * @return The host name and port number or a pseudonym. - */ - public String getName() { - return name; - } - - /** - * Returns the protocol used to communicate with the recipient. - * - * @return The protocol used to communicate with the recipient. - */ - public Protocol getProtocol() { - return protocol; - } - - /** - * Sets the optional comment, typically the software agent name. - * - * @param comment - * The optional comment. - */ - public void setComment(String comment) { - this.comment = comment; - } - - /** - * Sets the host name and port number or a pseudonym. - * - * @param name - * The host name and port number or a pseudonym. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the protocol used to communicate with the recipient. - * - * @param protocol - * The protocol used to communicate with the recipient. - */ - public void setProtocol(Protocol protocol) { - this.protocol = protocol; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Reference.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Reference.java deleted file mode 100644 index ab5471ca3e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Reference.java +++ /dev/null @@ -1,2928 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - -import org.restlet.client.Context; - -/** - * Reference to a Uniform Resource Identifier (URI). Contrary to the - * java.net.URI class, this interface represents mutable references. It strictly - * conforms to the RFC 3986 specifying URIs and follow its naming conventions.
- * - *
- * URI reference        = absolute-reference | relative-reference
- *
- * absolute-reference   = scheme ":" scheme-specific-part [ "#" fragment ]
- * scheme-specific-part = ( hierarchical-part [ "?" query ] ) | opaque-part
- * hierarchical-part    = ( "//" authority path-abempty ) | path-absolute | path-rootless | path-empty
- * authority            = [ user-info "@" ] host-domain [ ":" host-port ]
- *
- * relative-reference   = relative-part [ "?" query ] [ "#" fragment ]
- * relative-part        = ( "//" authority path-abempty ) | path-absolute | path-noscheme | path-empty
- *
- * path-abempty         = begins with "/" or is empty
- * path-absolute        = begins with "/" but not "//"
- * path-noscheme        = begins with a non-colon segment
- * path-rootless        = begins with a segment
- * path-empty           = zero characters
- * 
- * - *

- * Note that this class doesn't encode or decode the reserved characters. It assumes that the URIs or the URI parts - * passed in are properly encoded using the standard URI encoding mechanism. You can use the static "encode()" and - * "decode()" methods for this purpose. Note that if an invalid URI character is detected by the constructor or one of - * the setters, a trace will be logged and the character will be automatically encoded. - *

- *

- * The fundamental point to underline is the difference between an URI "reference" and an URI. Contrary to an URI (the - * target identifier of a REST resource), an URI reference can be relative (with or without query and fragment part). - * This relative URI reference can then be resolved against a base reference via the getTargetRef() method which will - * return a new resolved Reference instance, an absolute URI reference with no base reference and with no dot-segments - * (the path segments "." and ".."). - *

- *

- * You can also apply the getTargetRef() method on absolute references in order to solve the dot-segments. Note that - * applying the getRelativeRef() method on an absolute reference returns the current reference relatively to a base - * reference, if any, and solves the dot-segments. - *

- *

- * The Reference stores its data as a single string, the one passed to the constructor. This string can always be - * obtained using the toString() method. A couple of integer indexes are maintained to improve the extraction time of - * various reference properties (URI components). - *

- *

- * When you modify a specific component of the URI reference, via the setPath() method for example, the internal string - * is simply regenerated by updating only the relevant part. We try as much as possible to protect the bytes given to - * the Reference class instead of transparently parsing and normalizing the URI data. Our idea is to protect encodings - * and special characters in all case and reduce the memory size taken by this class while making Reference instances - * mutable. - *

- *

- * Because the base reference is only a property of the Reference ("baseRef"). When you use the "Reference(base, path)" - * constructor, it is equivalent to doing:
- * ref = new Reference(path);
- * ref.setBaseRef(base); - *

- *

- * The base ref is not automatically resolved or "merged" with the rest of the reference information (the path here). - * For example, this let's you reuse a single reference as the base of several relative references. If you modify the - * base reference, all relative references are still accurate. - *

- * Note that the name and value properties are thread safe, stored in volatile - * members. - * - * @author Jerome Louvel - * @see RFC 3986 - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Reference { - - /** Helps to map characters and their validity as URI characters. */ - private static final boolean[] charValidityMap = new boolean[127]; - - static { - // Initialize the map of valid characters. - for (int character = 0; character < 127; character++) { - charValidityMap[character] = isReserved(character) - || isUnreserved(character) || (character == '%') - || (character == '{') || (character == '}'); - } - } - - /** - * Decodes a given string using the standard URI encoding mechanism and the - * UTF-8 character set. - * - * @param toDecode - * The string to decode. - * @return The decoded string. - */ - public static String decode(String toDecode) { - return decode(toDecode, CharacterSet.UTF_8); - } - - /** - * Decodes a given string using the standard URI encoding mechanism. If the - * provided character set is null, the string is returned but not decoded. Note: The - * World Wide Web Consortium Recommendation states that UTF-8 should be - * used. Not doing so may introduce incompatibilities. - * - * @param toDecode - * The string to decode. - * @param characterSet - * The name of a supported character encoding. - * @return The decoded string or null if the named character encoding is not - * supported. - */ - public static String decode(String toDecode, CharacterSet characterSet) { - if (!CharacterSet.UTF_8.equals(characterSet)) { - throw new IllegalArgumentException( - "Only UTF-8 URL encoding is supported under GWT"); - } - - String result = null; - - try { - result = (characterSet == null) - ? toDecode - : com.google.gwt.http.client.URL.decodeComponent(toDecode); - } catch (NullPointerException npe) { - System.err - .println("Unable to decode the string with the UTF-8 character set."); - } - - return result; - } - - /** - * Encodes a given string using the standard URI encoding mechanism and the - * UTF-8 character set. - * - * @param toEncode - * The string to encode. - * @return The encoded string. - */ - public static String encode(String toEncode) { - return encode(toEncode, true, CharacterSet.UTF_8); - } - - /** - * Encodes a given string using the standard URI encoding mechanism and the - * UTF-8 character set. Useful to prevent the usage of '+' to encode spaces - * (%20 instead). The '*' characters are encoded as %2A and %7E are replaced - * by '~'. - * - * @param toEncode - * The string to encode. - * @param queryString - * True if the string to encode is part of a query string instead - * of a HTML form post. - * @return The encoded string. - */ - public static String encode(String toEncode, boolean queryString) { - return encode(toEncode, queryString, CharacterSet.UTF_8); - } - - /** - * Encodes a given string using the standard URI encoding mechanism and the - * UTF-8 character set. Useful to prevent the usage of '+' to encode spaces - * (%20 instead). The '*' characters are encoded as %2A and %7E are replaced - * by '~'. - * - * @param toEncode - * The string to encode. - * @param queryString - * True if the string to encode is part of a query string instead - * of a HTML form post. - * @param characterSet - * The supported character encoding. - * @return The encoded string. - */ - public static String encode(String toEncode, boolean queryString, - CharacterSet characterSet) { - if (!CharacterSet.UTF_8.equals(characterSet)) { - throw new IllegalArgumentException( - "Only UTF-8 URL encoding is supported under GWT"); - } - - String result = null; - - try { - result = (characterSet == null) ? toEncode : - com.google.gwt.http.client.URL.encodeComponent(toEncode); - } catch (NullPointerException npe) { - System.err - .println("Unable to encode the string with the UTF-8 character set."); - } - - if (result != null && queryString) { - result = result.replace("+", "%20").replace("*", "%2A") - .replace("%7E", "~"); - } - - return result; - } - - /** - * Encodes a given string using the standard URI encoding mechanism. If the - * provided character set is null, the string is returned but not encoded. - * - * Note: The - * World Wide Web Consortium Recommendation states that UTF-8 should be - * used. Not doing so may introduce incompatibilities. - * - * @param toEncode - * The string to encode. - * @param characterSet - * The supported character encoding. - * @return The encoded string or null if the named character encoding is not - * supported. - */ - public static String encode(String toEncode, CharacterSet characterSet) { - return encode(toEncode, true, characterSet); - } - - /** - * Indicates if the given character is alphabetical (a-z or A-Z). - * - * @param character - * The character to test. - * @return True if the given character is alphabetical (a-z or A-Z). - */ - private static boolean isAlpha(int character) { - return isUpperCase(character) || isLowerCase(character); - } - - /** - * Indicates if the given character is a digit (0-9). - * - * @param character - * The character to test. - * @return True if the given character is a digit (0-9). - */ - private static boolean isDigit(int character) { - return (character >= '0') && (character <= '9'); - } - - /** - * Indicates if the given character is a generic URI component delimiter - * character. - * - * @param character - * The character to test. - * @return True if the given character is a generic URI component delimiter - * character. - */ - public static boolean isGenericDelimiter(int character) { - return (character == ':') || (character == '/') || (character == '?') - || (character == '#') || (character == '[') - || (character == ']') || (character == '@'); - } - - /** - * Indicates if the given character is lower case (a-z). - * - * @param character - * The character to test. - * @return True if the given character is lower case (a-z). - */ - private static boolean isLowerCase(int character) { - return (character >= 'a') && (character <= 'z'); - } - - /** - * Indicates if the given character is a reserved URI character. - * - * @param character - * The character to test. - * @return True if the given character is a reserved URI character. - */ - public static boolean isReserved(int character) { - return isGenericDelimiter(character) || isSubDelimiter(character); - } - - /** - * Indicates if the given character is an URI subcomponent delimiter - * character. - * - * @param character - * The character to test. - * @return True if the given character is an URI subcomponent delimiter - * character. - */ - public static boolean isSubDelimiter(int character) { - return (character == '!') || (character == '$') || (character == '&') - || (character == '\'') || (character == '(') - || (character == ')') || (character == '*') - || (character == '+') || (character == ',') - || (character == ';') || (character == '='); - } - - /** - * Indicates if the given character is an unreserved URI character. - * - * @param character - * The character to test. - * @return True if the given character is an unreserved URI character. - */ - public static boolean isUnreserved(int character) { - return isAlpha(character) || isDigit(character) || (character == '-') - || (character == '.') || (character == '_') - || (character == '~'); - } - - /** - * Indicates if the given character is upper case (A-Z). - * - * @param character - * The character to test. - * @return True if the given character is upper case (A-Z). - */ - private static boolean isUpperCase(int character) { - return (character >= 'A') && (character <= 'Z'); - } - - /** - * Indicates if the given character is a valid URI character. - * - * @param character - * The character to test. - * @return True if the given character is a valid URI character. - */ - public static boolean isValid(int character) { - return character >= 0 && character < 127 && charValidityMap[character]; - } - - /** - * Creates a reference string from its parts. - * - * @param scheme - * The scheme ("http", "https" or "ftp"). - * @param hostName - * The host name or IP address. - * @param hostPort - * The host port (default ports are correctly ignored). - * @param path - * The path component for hierarchical identifiers. - * @param query - * The optional query component for hierarchical identifiers. - * @param fragment - * The optional fragment identifier. - * @return The reference as String. - */ - public static String toString(String scheme, String hostName, - Integer hostPort, String path, String query, String fragment) { - String host = hostName; - - // Appends the host port number - if (hostPort != null) { - final int defaultPort = Protocol.valueOf(scheme).getDefaultPort(); - if (hostPort != defaultPort) { - host = hostName + ':' + hostPort; - } - } - - return toString(scheme, host, path, query, fragment); - } - - /** - * Creates a relative reference string from its parts. - * - * @param relativePart - * The relative part component. - * @param query - * The optional query component for hierarchical identifiers. - * @param fragment - * The optional fragment identifier. - * @return The relative reference as a String. - */ - public static String toString(String relativePart, String query, - String fragment) { - final StringBuilder sb = new StringBuilder(); - - // Append the path - if (relativePart != null) { - sb.append(relativePart); - } - - // Append the query string - if (query != null) { - sb.append('?').append(query); - } - - // Append the fragment identifier - if (fragment != null) { - sb.append('#').append(fragment); - } - - // Actually construct the reference - return sb.toString(); - } - - /** - * Creates a reference string from its parts. - * - * @param scheme - * The scheme ("http", "https" or "ftp"). - * @param host - * The host name or IP address plus the optional port number. - * @param path - * The path component for hierarchical identifiers. - * @param query - * The optional query component for hierarchical identifiers. - * @param fragment - * The optional fragment identifier. - * @return The reference a String. - */ - public static String toString(String scheme, String host, String path, - String query, String fragment) { - final StringBuilder sb = new StringBuilder(); - - if (scheme != null) { - // Append the scheme and host name - sb.append(scheme.toLowerCase()).append("://").append(host); - } - - // Append the path - if (path != null) { - sb.append(path); - } - - // Append the query string - if (query != null) { - sb.append('?').append(query); - } - - // Append the fragment identifier - if (fragment != null) { - sb.append('#').append(fragment); - } - - // Actually construct the reference - return sb.toString(); - } - - /** The base reference for relative references. */ - private volatile Reference baseRef; - - /** The fragment separator index. */ - private volatile int fragmentIndex; - - /** The internal reference. */ - private volatile String internalRef; - - /** The query separator index. */ - private volatile int queryIndex; - - /** The scheme separator index. */ - private volatile int schemeIndex; - - /** - * Empty constructor. - */ - public Reference() { - this((Reference) null, (String) null); - } - - /** - * Constructor for a protocol and host name. Uses the default port for the - * given protocol. - * - * @param protocol - * Protocol/scheme to use - * @param hostName - * The host name or IP address. - */ - public Reference(Protocol protocol, String hostName) { - this(protocol, hostName, protocol.getDefaultPort()); - } - - /** - * Constructor for a protocol, host name and host port - * - * @param protocol - * Protocol/scheme to use - * @param hostName - * The host name or IP address. - * @param hostPort - * The host port (default ports are correctly ignored). - */ - public Reference(Protocol protocol, String hostName, int hostPort) { - this(protocol.getSchemeName(), hostName, hostPort, null, null, null); - } - - /** - * Clone constructor. - * - * @param ref - * The reference to clone. - */ - public Reference(Reference ref) { - this(ref.baseRef, ref.internalRef); - } - - /** - * Constructor from an URI reference (most likely relative). - * - * @param baseRef - * The base reference. - * @param uriReference - * The URI reference, either absolute or relative. - */ - public Reference(Reference baseRef, Reference uriReference) { - this(baseRef, uriReference.toString()); - } - - /** - * Constructor from an URI reference (most likely relative). - * - * @param baseRef - * The base reference. - * @param uriRef - * The URI reference, either absolute or relative. - */ - public Reference(Reference baseRef, String uriRef) { - uriRef = encodeInvalidCharacters(uriRef); - this.baseRef = baseRef; - this.internalRef = uriRef; - updateIndexes(); - } - - /** - * Constructor of relative reference from its parts. - * - * @param baseRef - * The base reference. - * @param relativePart - * The relative part component (most of the time it is the path - * component). - * @param query - * The optional query component for hierarchical identifiers. - * @param fragment - * The optional fragment identifier. - */ - public Reference(Reference baseRef, String relativePart, String query, - String fragment) { - this(baseRef, toString(relativePart, query, fragment)); - } - - /** - * Constructor from an URI reference. - * - * @param uriReference - * The URI reference, either absolute or relative. - */ - public Reference(String uriReference) { - this((Reference) null, uriReference); - } - - /** - * Constructor from an identifier and a fragment. - * - * @param identifier - * The resource identifier. - * @param fragment - * The fragment identifier. - */ - public Reference(String identifier, String fragment) { - this((fragment == null) ? identifier : identifier + '#' + fragment); - } - - /** - * Constructor of absolute reference from its parts. - * - * @param scheme - * The scheme ("http", "https" or "ftp"). - * @param hostName - * The host name or IP address. - * @param hostPort - * The host port (default ports are correctly ignored). - * @param path - * The path component for hierarchical identifiers. - * @param query - * The optional query component for hierarchical identifiers. - * @param fragment - * The optional fragment identifier. - */ - public Reference(String scheme, String hostName, int hostPort, String path, - String query, String fragment) { - this(toString(scheme, hostName, hostPort, path, query, fragment)); - } - - /** - * Adds a parameter to the query component. The name and value are - * automatically URL encoded if necessary. - * - * @param parameter - * The parameter to add. - * @return The updated reference. - */ - public Reference addQueryParameter(Parameter parameter) { - return addQueryParameter(parameter.getName(), parameter.getValue()); - } - - /** - * Adds a parameter to the query component. The name and value are - * automatically URL encoded if necessary. - * - * @param name - * The parameter name. - * @param value - * The optional parameter value. - * @return The updated reference. - */ - public Reference addQueryParameter(String name, String value) { - String query = getQuery(); - - if (query == null) { - if (value == null) { - setQuery(encode(name)); - } else { - setQuery(encode(name) + '=' + encode(value)); - } - } else { - if (value == null) { - setQuery(query + '&' + encode(name)); - } else { - setQuery(query + '&' + encode(name) + '=' + encode(value)); - } - } - - return this; - } - - /** - * Adds several parameters to the query component. The name and value are - * automatically URL encoded if necessary. - * - * @param parameters - * The parameters to add. - * @return The updated reference. - */ - public Reference addQueryParameters(Iterable parameters) { - for (Parameter param : parameters) { - addQueryParameter(param); - } - - return this; - } - - /** - * Adds a segment at the end of the path. If the current path doesn't end - * with a slash character, one is inserted before the new segment value. The - * value is automatically encoded if necessary. - * - * @param value - * The segment value to add. - * @return The updated reference. - */ - public Reference addSegment(String value) { - final String path = getPath(); - - if (value != null) { - if (path == null) { - setPath("/" + value); - } else if (path.endsWith("/")) { - setPath(path + encode(value)); - } else { - setPath(path + "/" + encode(value)); - } - } - - return this; - } - - /** - * Checks if all characters are valid and encodes invalid characters if - * necessary. - * - * @param uriRef - * The URI reference to check. - * @return The original reference, eventually with invalid URI characters - * encoded. - */ - private String encodeInvalidCharacters(String uriRef) - throws IllegalArgumentException { - String result = uriRef; - - if (uriRef != null) { - boolean valid = true; - - // Ensure that all characters are valid, otherwise encode them - for (int i = 0; valid && (i < uriRef.length()); i++) { - if (!isValid(uriRef.charAt(i))) { - valid = false; - Context.getCurrentLogger().fine( - "Invalid character detected in URI reference at index '" - + i + "': \"" + uriRef.charAt(i) - + "\". It will be automatically encoded."); - } else if ((uriRef.charAt(i) == '%') - && (i > uriRef.length() - 2)) { - // A percent encoding character has been detected but - // without the necessary two hexadecimal digits following - valid = false; - Context.getCurrentLogger().fine( - "Invalid percent encoding detected in URI reference at index '" - + i + "': \"" + uriRef.charAt(i) - + "\". It will be automatically encoded."); - } - } - - if (!valid) { - StringBuilder sb = new StringBuilder(); - - for (int i = 0; (i < uriRef.length()); i++) { - if (isValid(uriRef.charAt(i))) { - if ((uriRef.charAt(i) == '%') - && (i > uriRef.length() - 2)) { - sb.append("%25"); - } else { - sb.append(uriRef.charAt(i)); - } - } else { - sb.append(encode(String.valueOf(uriRef.charAt(i)))); - } - } - - result = sb.toString(); - } - } - - return result; - } - - /** - * Indicates whether some other object is "equal to" this one. - * - * @param object - * The object to compare to. - * @return True if this object is the same as the obj argument. - */ - @Override - public boolean equals(Object object) { - if (object instanceof Reference) { - final Reference ref = (Reference) object; - if (this.internalRef == null) { - return ref.internalRef == null; - } - return this.internalRef.equals(ref.internalRef); - - } - - return false; - } - - /** - * Returns the authority component for hierarchical identifiers. Includes - * the user info, host name and the host port number.
- * Note that no URI decoding is done by this method. - * - * @return The authority component for hierarchical identifiers. - */ - public String getAuthority() { - final String part = isRelative() ? getRelativePart() - : getSchemeSpecificPart(); - - if ((part != null) && part.startsWith("//")) { - int index = part.indexOf('/', 2); - - if (index != -1) { - return part.substring(2, index); - } - - index = part.indexOf('?'); - if (index != -1) { - return part.substring(2, index); - } - - return part.substring(2); - - } - - return null; - } - - /** - * Returns the optionnally decoded authority component. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded authority component. - * @see #getAuthority() - */ - public String getAuthority(boolean decode) { - return decode ? decode(getAuthority()) : getAuthority(); - } - - /** - * Returns the base reference for relative references. - * - * @return The base reference for relative references. - */ - public Reference getBaseRef() { - return this.baseRef; - } - - /** - * Returns the optional extensions for hierarchical identifiers. An - * extensions part starts after the first '.' character of the last path - * segment and ends with either the end of the segment of with the first ';' - * character (matrix start). It is a token similar to file extensions - * separated by '.' characters. The value can be ommited.
- * Note that no URI decoding is done by this method. - * - * @return The extensions or null. - * @see #getExtensionsAsArray() - * @see #setExtensions(String) - */ - public String getExtensions() { - String result = null; - final String lastSegment = getLastSegment(); - - if (lastSegment != null) { - final int extensionIndex = lastSegment.indexOf('.'); - final int matrixIndex = lastSegment.indexOf(';'); - - if (extensionIndex != -1) { - // Extensions found - if (matrixIndex != -1) { - result = lastSegment.substring(extensionIndex + 1, - matrixIndex); - } else { - // No matrix found - result = lastSegment.substring(extensionIndex + 1); - } - } - } - - return result; - } - - /** - * Returns the extensions as an array or null if no extension is found. - * - * @return The extensions as an array or null if no extension is found. - * @see #getExtensions() - */ - public String[] getExtensionsAsArray() { - String[] result = null; - final String extensions = getExtensions(); - - if (extensions != null) { - result = extensions.split("\\."); - } - - return result; - } - - /** - * Returns the fragment identifier.
- * Note that no URI decoding is done by this method. - * - * @return The fragment identifier. - */ - public String getFragment() { - if (hasFragment()) { - return this.internalRef.substring(this.fragmentIndex + 1); - } - - return null; - } - - /** - * Returns the optionnally decoded fragment identifier. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded fragment identifier. - * @see #getFragment() - */ - public String getFragment(boolean decode) { - return decode ? decode(getFragment()) : getFragment(); - } - - /** - * Returns the hierarchical part which is equivalent to the scheme specific - * part less the query component.
- * Note that no URI decoding is done by this method. - * - * @return The hierarchical part . - */ - public String getHierarchicalPart() { - if (hasScheme()) { - // Scheme found - if (hasQuery()) { - // Query found - return this.internalRef.substring(this.schemeIndex + 1, - this.queryIndex); - } - - // No query found - if (hasFragment()) { - // Fragment found - return this.internalRef.substring(this.schemeIndex + 1, - this.fragmentIndex); - } - - // No fragment found - return this.internalRef.substring(this.schemeIndex + 1); - } - - // No scheme found - if (hasQuery()) { - // Query found - return this.internalRef.substring(0, this.queryIndex); - } - if (hasFragment()) { - // Fragment found - return this.internalRef.substring(0, this.fragmentIndex); - } - - // No fragment found - return this.internalRef; - } - - /** - * Returns the optionnally decoded hierarchical part. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded hierarchical part. - * @see #getHierarchicalPart() - */ - public String getHierarchicalPart(boolean decode) { - return decode ? decode(getHierarchicalPart()) : getHierarchicalPart(); - } - - /** - * Returns the host domain name component for server based hierarchical - * identifiers. It can also be replaced by an IP address when no domain name - * was registered.
- * Note that no URI decoding is done by this method. - * - * @return The host domain name component for server based hierarchical - * identifiers. - */ - public String getHostDomain() { - String result = null; - final String authority = getAuthority(); - - if (authority != null) { - // We must prevent the case where the userinfo part contains ':' - // and the case of IPV6 addresses - int indexUI = authority.indexOf('@'); // user info - int indexIPV6 = authority.indexOf(']'); // IPV6 - int indexP = authority.indexOf(':', (indexIPV6 == -1) ? indexUI - : indexIPV6); - - if (indexUI != -1) { - // User info found - if (indexP != -1) { - // Port found - result = authority.substring(indexUI + 1, indexP); - } else { - // No port found - result = authority.substring(indexUI + 1); - } - } else { - // No user info found - if (indexP != -1) { - // Port found - result = authority.substring(0, indexP); - } else { - // No port found - result = authority; - } - } - } - - return result; - } - - /** - * Returns the optionally decoded host domain name component. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionally decoded host domain name component. - * @see #getHostDomain() - */ - public String getHostDomain(boolean decode) { - return decode ? decode(getHostDomain()) : getHostDomain(); - } - - /** - * Returns the host identifier. Includes the scheme, the host name and the - * host port number.
- * Note that no URI decoding is done by this method. - * - * @return The host identifier. - */ - public String getHostIdentifier() { - final StringBuilder result = new StringBuilder(); - result.append(getScheme()).append("://").append(getAuthority()); - return result.toString(); - } - - /** - * Returns the optionnally decoded host identifier. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded host identifier. - * @see #getHostIdentifier() - */ - public String getHostIdentifier(boolean decode) { - return decode ? decode(getHostIdentifier()) : getHostIdentifier(); - } - - /** - * Returns the optional port number for server based hierarchical - * identifiers. - * - * @return The optional port number for server based hierarchical - * identifiers or -1 if the port number does not exist. - */ - public int getHostPort() { - int result = -1; - final String authority = getAuthority(); - - if (authority != null) { - // We must prevent the case where the userinfo part contains ':' - // and the case of IPV6 addresses - int indexUI = authority.indexOf('@'); // user info - int indexIPV6 = authority.indexOf(']'); // IPV6 - int index = authority.indexOf(':', (indexIPV6 == -1) ? indexUI - : indexIPV6); - - if (index != -1) { - try { - result = Integer.parseInt(authority.substring(index + 1)); - } catch (NumberFormatException nfe) { - Context.getCurrentLogger().log( - Level.WARNING, - "Can't parse hostPort : [hostRef,requestUri]=[" - + getBaseRef() + "," + this.internalRef - + "]"); - } - } - } - - return result; - } - - /** - * Returns the absolute resource identifier, without the fragment.
- * Note that no URI decoding is done by this method. - * - * @return The absolute resource identifier, without the fragment. - */ - public String getIdentifier() { - if (hasFragment()) { - // Fragment found - return this.internalRef.substring(0, this.fragmentIndex); - } - - // No fragment found - return this.internalRef; - } - - /** - * Returns the optionnally decoded absolute resource identifier. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded absolute resource identifier. - * @see #getIdentifier() - */ - public String getIdentifier(boolean decode) { - return decode ? decode(getIdentifier()) : getIdentifier(); - } - - /** - * Returns the last segment of a hierarchical path.
- * For example the "/a/b/c" and "/a/b/c/" paths have the same segments: "a", - * "b", "c.
- * Note that no URI decoding is done by this method. - * - * @return The last segment of a hierarchical path. - */ - public String getLastSegment() { - String result = null; - String path = getPath(); - - if (path != null) { - if (path.endsWith("/")) { - path = path.substring(0, path.length() - 1); - } - - final int lastSlash = path.lastIndexOf('/'); - - if (lastSlash != -1) { - result = path.substring(lastSlash + 1); - } - } - - return result; - } - - /** - * Returns the optionnally decoded last segment. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded last segment. - * @see #getLastSegment() - */ - public String getLastSegment(boolean decode) { - return getLastSegment(decode, false); - } - - /** - * Returns the optionnally decoded last segment. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @param excludeMatrix - * @return The optionnally decoded last segment. - * @see #getLastSegment() - */ - public String getLastSegment(boolean decode, boolean excludeMatrix) { - String result = getLastSegment(); - - if (excludeMatrix && (result != null)) { - final int matrixIndex = result.indexOf(';'); - - if (matrixIndex != -1) { - result = result.substring(0, matrixIndex); - } - } - - return decode ? decode(result) : result; - } - - /** - * Returns the optional matrix for hierarchical identifiers. A matrix part - * starts after the first ';' character of the last path segment. It is a - * sequence of 'name=value' parameters separated by ';' characters. The - * value can be ommitted.
- * Note that no URI decoding is done by this method. - * - * @return The matrix or null. - */ - public String getMatrix() { - String lastSegment = getLastSegment(); - - if (lastSegment != null) { - final int matrixIndex = lastSegment.indexOf(';'); - - if (matrixIndex != -1) { - return lastSegment.substring(matrixIndex + 1); - } - } - - // No matrix found - return null; - } - - /** - * Returns the optionnally decoded matrix. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded matrix. - * @see #getMatrix() - */ - public String getMatrix(boolean decode) { - return decode ? decode(getMatrix()) : getMatrix(); - } - - /** - * Returns the optional matrix as a form. - * - * @return The optional matrix component as a form. - */ - public Form getMatrixAsForm() { - return new Form(getMatrix(), ';'); - } - - /** - * Returns the optional matrix as a form submission. - * - * @param characterSet - * The supported character encoding. - * @return The optional matrix as a form. - */ - public Form getMatrixAsForm(CharacterSet characterSet) { - return new Form(getMatrix(), characterSet, ';'); - } - - /** - * Returns the parent reference of a hierarchical reference. The last slash - * of the path will be considered as the end of the parent path. - * - * @return The parent reference of a hierarchical reference. - */ - public Reference getParentRef() { - Reference result = null; - - if (isHierarchical()) { - String parentRef = null; - String path = getPath(); - - if (!path.equals("/") && !path.isEmpty()) { - if (path.endsWith("/")) { - path = path.substring(0, path.length() - 1); - } - - if (isAbsolute()) { - parentRef = getHostIdentifier() - + path.substring(0, path.lastIndexOf('/') + 1); - } else { - parentRef = path.substring(0, path.lastIndexOf('/') + 1); - } - } else { - parentRef = this.internalRef; - } - - result = new Reference(parentRef); - } - - return result; - } - - /** - * Returns the path component for hierarchical identifiers. If not path is - * available it returns null.
- * Note that no URI decoding is done by this method. - * - * @return The path component for hierarchical identifiers. - */ - public String getPath() { - String result = null; - String part = isRelative() ? getRelativePart() - : getSchemeSpecificPart(); - - if (part != null) { - if (part.startsWith("//")) { - // Authority found - int index1 = part.indexOf('/', 2); - - if (index1 != -1) { - // Path found - int index2 = part.indexOf('?'); - - if (index2 != -1) { - // Query found - result = part.substring(Math.min(index1, index2), - index2); - } else { - // No query found - result = part.substring(index1); - } - } else { - // Path must be empty in this case - } - } else { - // No authority found - int index = part.indexOf('?'); - - if (index != -1) { - // Query found - result = part.substring(0, index); - } else { - // No query found - result = part; - } - } - } - - return result; - } - - /** - * Returns the optionnally decoded path component. If not path is available - * it returns null. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded path component. - * @see #getPath() - */ - public String getPath(boolean decode) { - return decode ? decode(getPath()) : getPath(); - } - - /** - * Returns the optional query component for hierarchical identifiers.
- * Note that no URI decoding is done by this method. - * - * @return The query component or null. - */ - public String getQuery() { - if (hasQuery()) { - // Query found - if (hasFragment()) { - if (this.queryIndex < this.fragmentIndex) { - // Fragment found and query sign not inside fragment - return this.internalRef.substring(this.queryIndex + 1, - this.fragmentIndex); - } - - return null; - } - - // No fragment found - return this.internalRef.substring(this.queryIndex + 1); - } - - // No query found - return null; - } - - /** - * Returns the optionnally decoded query component. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded query component. - * @see #getQuery() - */ - public String getQuery(boolean decode) { - return decode ? decode(getQuery()) : getQuery(); - } - - /** - * Returns the optional query component as a form. - * - * @return The optional query component as a form. - */ - public Form getQueryAsForm() { - return new Form(getQuery()); - } - - /** - * Returns the optional query component as a form. - * - * @param decode - * Indicates if the names and values should be automatically - * decoded. - * @return The optional query component as a form. - */ - public Form getQueryAsForm(boolean decode) { - return new Form(getQuery(), decode); - } - - /** - * Returns the optional query component as a form submission. - * - * @param characterSet - * The supported character encoding. - * @return The optional query component as a form submission. - */ - public Form getQueryAsForm(CharacterSet characterSet) { - return new Form(getQuery(), characterSet); - } - - /** - * Returns the relative part of relative references, without the query and - * fragment. If the reference is absolute, then null is returned.
- * Note that no URI decoding is done by this method. - * - * @return The relative part. - */ - public String getRelativePart() { - return isRelative() ? toString(false, false) : null; - } - - /** - * Returns the optionnally decoded relative part. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded relative part. - * @see #getRelativePart() - */ - public String getRelativePart(boolean decode) { - return decode ? decode(getRelativePart()) : getRelativePart(); - } - - /** - * Returns the current reference as a relative reference to the current base - * reference. This method should only be invoked for absolute references, - * otherwise an IllegalArgumentException will be raised. - * - * @return The current reference as a relative reference to the current base - * reference. - * @see #getRelativeRef(Reference) - */ - public Reference getRelativeRef() { - return getRelativeRef(getBaseRef()); - } - - /** - * Returns the current reference relatively to a base reference. This method - * should only be invoked for absolute references, otherwise an - * IllegalArgumentException will be raised. - * - * @param base - * The base reference to use. - * @return The current reference relatively to a base reference. - * @throws IllegalArgumentException - * If the relative reference is computed although the reference - * or the base reference are not absolute or not hierarchical. - */ - public Reference getRelativeRef(Reference base) { - Reference result = null; - - if (base == null) { - result = this; - } else if (!isAbsolute() || !isHierarchical()) { - throw new IllegalArgumentException( - "The reference must have an absolute hierarchical path component"); - } else if (!base.isAbsolute() || !base.isHierarchical()) { - throw new IllegalArgumentException( - "The base reference must have an absolute hierarchical path component"); - } else if (!getHostIdentifier().equals(base.getHostIdentifier())) { - result = this; - } else { - final String localPath = getPath(); - final String basePath = base.getPath(); - String relativePath = null; - - if ((basePath == null) || (localPath == null)) { - relativePath = localPath; - } else { - // Find the junction point - boolean diffFound = false; - int lastSlashIndex = -1; - int i = 0; - char current; - while (!diffFound && (i < localPath.length()) - && (i < basePath.length())) { - current = localPath.charAt(i); - - if (current != basePath.charAt(i)) { - diffFound = true; - } else { - if (current == '/') { - lastSlashIndex = i; - } - i++; - } - } - - if (!diffFound) { - if (localPath.length() == basePath.length()) { - // Both paths are strictly equivalent - relativePath = "."; - } else if (i == localPath.length()) { - // End of local path reached - if (basePath.charAt(i) == '/') { - if ((i + 1) == basePath.length()) { - // Both paths are strictly equivalent - relativePath = "."; - } else { - // The local path is a direct parent of the base - // path - // We need to add enough ".." in the relative - // path - final StringBuilder sb = new StringBuilder(); - - // Count segments - int segments = 0; - for (int j = basePath.indexOf('/', i); j != -1; j = basePath - .indexOf('/', j + 1)) - segments++; - - // Build relative path - for (int j = 0; j < segments; j++) - sb.append("../"); - - int lastLocalSlash = localPath.lastIndexOf('/'); - sb.append(localPath - .substring(lastLocalSlash + 1)); - - relativePath = sb.toString(); - } - } else { - // The base path has a segment that starts like - // the last local path segment - // But that is longer. Situation similar to a - // junction - final StringBuilder sb = new StringBuilder(); - - // Count segments - int segments = 0; - for (int j = basePath.indexOf('/', i); j != -1; j = basePath - .indexOf('/', j + 1)) - segments++; - - // Build relative path - for (int j = 0; j < segments; j++) - if (j > 0) - sb.append("/.."); - else - sb.append(".."); - - relativePath = sb.toString(); - - if (relativePath.isEmpty()) { - relativePath = "."; - } - } - } else if (i == basePath.length()) { - if (localPath.charAt(i) == '/') { - if ((i + 1) == localPath.length()) { - // Both paths are strictly equivalent - relativePath = "."; - } else { - // The local path is a direct child of the base - // path - relativePath = localPath.substring(i + 1); - } - } else { - if (lastSlashIndex == (i - 1)) { - // The local path is a direct subpath of the - // base path - relativePath = localPath.substring(i); - } else { - relativePath = ".." - + localPath.substring(lastSlashIndex); - } - } - } - } else { - // We found a junction point, we need to add enough ".." in - // the relative path and append the rest of the local path - // the local path is a direct subpath of the base path - final StringBuilder sb = new StringBuilder(); - - // Count segments - int segments = 0; - for (int j = basePath.indexOf('/', i); j != -1; j = basePath - .indexOf('/', j + 1)) - segments++; - - // Build relative path - for (int j = 0; j < segments; j++) - sb.append("../"); - - sb.append(localPath.substring(lastSlashIndex + 1)); - - relativePath = sb.toString(); - } - } - - // Build the result reference - result = new Reference(); - final String query = getQuery(); - final String fragment = getFragment(); - boolean modified = false; - - if ((query != null) && (!query.equals(base.getQuery()))) { - result.setQuery(query); - modified = true; - } - - if ((fragment != null) && (!fragment.equals(base.getFragment()))) { - result.setFragment(fragment); - modified = true; - } - - if (!modified || !".".equals(relativePath)) { - result.setPath(relativePath); - } - } - - return result; - } - - /** - * Returns the part of the resource identifier remaining after the base - * reference. Note that the optional fragment is not returned by this - * method. Must be used with the following prerequisites: - *
    - *
  • the reference is absolute
  • - *
  • the reference identifier starts with the resource baseRef
  • - *
- *
- * Note that no URI decoding is done by this method. - * - * @return The remaining resource part or null if the prerequisites are not - * satisfied. - * @see #getRemainingPart(boolean) - */ - public String getRemainingPart() { - return getRemainingPart(false, true); - } - - /** - * Returns the optionally decoded remaining part. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionally decoded remaining part. - * @see #getRemainingPart() - */ - public String getRemainingPart(boolean decode) { - return getRemainingPart(decode, true); - } - - /** - * Returns the optionally decoded remaining part with or without the query - * part of the reference. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @param query - * True if the query part should be returned, false otherwise. - * @return The optionally decoded remaining part. - * @see #getRemainingPart() - */ - public String getRemainingPart(boolean decode, boolean query) { - String result = null; - final String all = toString(query, false); - - if (getBaseRef() != null) { - final String base = getBaseRef().toString(query, false); - - if ((base != null) && all.startsWith(base)) { - result = all.substring(base.length()); - } - } else { - result = all; - } - - return decode ? decode(result) : result; - } - - /** - * Returns the scheme component.
- * Note that no URI decoding is done by this method. - * - * @return The scheme component. - */ - public String getScheme() { - if (hasScheme()) { - // Scheme found - return this.internalRef.substring(0, this.schemeIndex); - } - - // No scheme found - return null; - } - - /** - * Returns the optionnally decoded scheme component. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded scheme component. - * @see #getScheme() - */ - public String getScheme(boolean decode) { - return decode ? decode(getScheme()) : getScheme(); - } - - /** - * Returns the protocol associated with the scheme component. - * - * @return The protocol associated with the scheme component. - */ - public Protocol getSchemeProtocol() { - return Protocol.valueOf(getScheme()); - } - - /** - * Returns the scheme specific part.
- * Note that no URI decoding is done by this method. - * - * @return The scheme specific part. - */ - public String getSchemeSpecificPart() { - String result = null; - - if (hasScheme()) { - // Scheme found - if (hasFragment()) { - // Fragment found - result = this.internalRef.substring(this.schemeIndex + 1, - this.fragmentIndex); - } else { - // No fragment found - result = this.internalRef.substring(this.schemeIndex + 1); - } - } - - return result; - } - - /** - * Returns the optionnally decoded scheme specific part. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded scheme specific part. - * @see #getSchemeSpecificPart() - */ - public String getSchemeSpecificPart(boolean decode) { - return decode ? decode(getSchemeSpecificPart()) - : getSchemeSpecificPart(); - } - - /** - * Returns the list of segments in a hierarchical path.
- * A new list is created for each call.
- * Note that no URI decoding is done by this method. - * - * @return The segments of a hierarchical path. - */ - public List getSegments() { - final List result = new ArrayList(); - final String path = getPath(); - int start = -2; // The index of the slash starting the segment - char current; - - if (path != null) { - for (int i = 0; i < path.length(); i++) { - current = path.charAt(i); - - if (current == '/') { - if (start == -2) { - // Beginning of an absolute path or sequence of two - // separators - start = i; - } else { - // End of a segment - result.add(path.substring(start + 1, i)); - start = i; - } - } else { - if (start == -2) { - // Starting a new segment for a relative path - start = -1; - } else { - // Looking for the next character - } - } - } - - if (start != -2) { - // Add the last segment - result.add(path.substring(start + 1)); - } - } - - return result; - } - - /** - * Returns the optionnally decoded list of segments. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded list of segments. - * @see #getSegments() - */ - public List getSegments(boolean decode) { - final List result = getSegments(); - - if (decode) { - for (int i = 0; i < result.size(); i++) { - result.set(i, decode(result.get(i))); - } - } - - return result; - } - - /** - * Returns the target reference. This method resolves relative references - * against the base reference then normalize them. - * - * @return The target reference. - * @throws IllegalArgumentException - * If the base reference (after resolution) is not absolute. - * @throws IllegalArgumentException - * If the reference is relative and not base reference has been - * provided. - */ - public Reference getTargetRef() { - Reference result = null; - - // Step 1 - Resolve relative reference against their base reference - if (isRelative() && (this.baseRef != null)) { - Reference baseReference = null; - - if (this.baseRef.isAbsolute()) { - baseReference = this.baseRef; - } else { - baseReference = this.baseRef.getTargetRef(); - } - - if (baseReference.isRelative()) { - throw new IllegalArgumentException( - "The base reference must have an absolute hierarchical path component"); - } - - // Relative URI detected - String authority = getAuthority(); - String path = getPath(); - String query = getQuery(); - String fragment = getFragment(); - - // Create an empty reference - result = new Reference(); - result.setScheme(baseReference.getScheme()); - - if (authority != null) { - result.setAuthority(authority); - result.setPath(path); - result.setQuery(query); - } else { - result.setAuthority(baseReference.getAuthority()); - - if ((path == null) || (path.isEmpty())) { - result.setPath(baseReference.getPath()); - - if (query != null) { - result.setQuery(query); - } else { - result.setQuery(baseReference.getQuery()); - } - } else { - if (path.startsWith("/")) { - result.setPath(path); - } else { - final String basePath = baseReference.getPath(); - String mergedPath = null; - - if ((baseReference.getAuthority() != null) - && ((basePath == null) || (basePath.isEmpty()))) { - mergedPath = "/" + path; - } else { - // Remove the last segment which may be empty if - // the path is ending with a slash - final int lastSlash = basePath.lastIndexOf('/'); - if (lastSlash == -1) { - mergedPath = path; - } else { - mergedPath = basePath.substring(0, - lastSlash + 1) + path; - } - } - - result.setPath(mergedPath); - } - - result.setQuery(query); - } - } - - result.setFragment(fragment); - } else if (isRelative()) { - // Relative reference with no baseRef detected - throw new IllegalArgumentException( - "Relative references are only usable when a base reference is set."); - } else { - // Absolute URI detected - result = new Reference(this.internalRef); - } - - // Step 2 - Normalize the target reference - result.normalize(); - - return result; - } - - /** - * Returns the user info component for server based hierarchical - * identifiers.
- * Note that no URI decoding is done by this method. - * - * @return The user info component for server based hierarchical - * identifiers. - */ - public String getUserInfo() { - String result = null; - final String authority = getAuthority(); - - if (authority != null) { - final int index = authority.indexOf('@'); - - if (index != -1) { - result = authority.substring(0, index); - } - } - - return result; - } - - /** - * Returns the optionnally decoded user info component. - * - * @param decode - * Indicates if the result should be decoded using the {@link #decode(String)} method. - * @return The optionnally decoded user info component. - * @see #getUserInfo() - */ - public String getUserInfo(boolean decode) { - return decode ? decode(getUserInfo()) : getUserInfo(); - } - - /** - * Indicates if this reference has file-like extensions on its last path - * segment. - * - * @return True if there is are extensions. - * @see #getExtensions() - */ - public boolean hasExtensions() { - boolean result = false; - - // If these reference ends with a "/", it cannot be a file. - final String path = getPath(); - if (!((path != null) && path.endsWith("/"))) { - final String lastSegment = getLastSegment(); - - if (lastSegment != null) { - final int extensionsIndex = lastSegment.indexOf('.'); - final int matrixIndex = lastSegment.indexOf(';'); - result = (extensionsIndex != -1) - && ((matrixIndex == -1) || (extensionsIndex < matrixIndex)); - } - } - - return result; - } - - /** - * Indicates if this reference has a fragment identifier. - * - * @return True if there is a fragment identifier. - */ - public boolean hasFragment() { - return (this.fragmentIndex != -1); - } - - /** - * Returns a hash code value for the object. - * - * @return A hash code value for the object. - */ - @Override - public int hashCode() { - return (this.internalRef == null) ? 0 : this.internalRef.hashCode(); - } - - /** - * Indicates if this reference has a matrix. - * - * @return True if there is a matrix. - * @see #getMatrix() - */ - public boolean hasMatrix() { - return (getLastSegment().indexOf(';') != -1); - } - - /** - * Indicates if this reference has a query component. - * - * @return True if there is a query. - */ - public boolean hasQuery() { - return (this.queryIndex != -1); - } - - /** - * Indicates if this reference has a scheme component. - * - * @return True if there is a scheme component. - */ - public boolean hasScheme() { - return (this.schemeIndex != -1); - } - - /** - * Indicates if the reference is absolute. - * - * @return True if the reference is absolute. - */ - public boolean isAbsolute() { - return (getScheme() != null); - } - - /** - * Returns true if both reference are equivalent, meaning that they resolve - * to the same target reference. - * - * @param ref - * The reference to compare. - * @return True if both reference are equivalent. - */ - public boolean isEquivalentTo(Reference ref) { - return getTargetRef().equals(ref.getTargetRef()); - } - - /** - * Indicates if the identifier is hierarchical. - * - * @return True if the identifier is hierarchical, false if it is opaque. - */ - public boolean isHierarchical() { - return isRelative() || (getSchemeSpecificPart().charAt(0) == '/'); - } - - /** - * Indicates if the identifier is opaque. - * - * @return True if the identifier is opaque, false if it is hierarchical. - */ - public boolean isOpaque() { - return isAbsolute() && (getSchemeSpecificPart().charAt(0) != '/'); - } - - /** - * Indicates if the reference is a parent of the hierarchical child - * reference. - * - * @param childRef - * The hierarchical reference. - * @return True if the reference is a parent of the hierarchical child - * reference. - */ - public boolean isParent(Reference childRef) { - boolean result = false; - - if ((childRef != null) && (childRef.isHierarchical())) { - result = childRef.toString(false, false).startsWith( - toString(false, false)); - } - - return result; - } - - /** - * Indicates if the reference is relative. - * - * @return True if the reference is relative. - */ - public boolean isRelative() { - return (getScheme() == null); - } - - /** - * Normalizes the reference. Useful before comparison between references or - * when building a target reference from a base and a relative references. - * - * @return The current reference. - */ - public Reference normalize() { - // 1. The input buffer is initialized with the now-appended path - // components and the output buffer is initialized to the empty string. - StringBuilder output = new StringBuilder(); - StringBuilder input = new StringBuilder(); - String path = getPath(); - - if (path != null) { - input.append(path); - } - - // 2. While the input buffer is not empty, loop as follows: - while (input.length() > 0) { - // A. If the input buffer begins with a prefix of "../" or "./", - // then remove that prefix from the input buffer; otherwise, - if ((input.length() >= 3) && input.substring(0, 3).equals("../")) { - input.delete(0, 3); - } else if ((input.length() >= 2) - && input.substring(0, 2).equals("./")) { - input.delete(0, 2); - } - - // B. if the input buffer begins with a prefix of "/./" or "/.", - // where "." is a complete path segment, then replace that - // prefix with "/" in the input buffer; otherwise, - else if ((input.length() >= 3) - && input.substring(0, 3).equals("/./")) { - input.delete(0, 2); - } else if ((input.length() == 2) - && input.substring(0, 2).equals("/.")) { - input.delete(1, 2); - } - - // C. if the input buffer begins with a prefix of "/../" or "/..", - // where ".." is a complete path segment, then replace that prefix - // with "/" in the input buffer and remove the last segment and its - // preceding "/" (if any) from the output buffer; otherwise, - else if ((input.length() >= 4) - && input.substring(0, 4).equals("/../")) { - input.delete(0, 3); - removeLastSegment(output); - } else if ((input.length() == 3) - && input.substring(0, 3).equals("/..")) { - input.delete(1, 3); - removeLastSegment(output); - } - - // D. if the input buffer consists only of "." or "..", then remove - // that from the input buffer; otherwise, - else if ((input.length() == 1) && input.substring(0, 1).equals(".")) { - input.delete(0, 1); - } else if ((input.length() == 2) - && input.substring(0, 2).equals("..")) { - input.delete(0, 2); - } - - // E. move the first path segment in the input buffer to the end of - // the output buffer, including the initial "/" character (if any) - // and any subsequent characters up to, but not including, the next - // "/" character or the end of the input buffer. - else { - int max = -1; - for (int i = 1; (max == -1) && (i < input.length()); i++) { - if (input.charAt(i) == '/') { - max = i; - } - } - - if (max != -1) { - // We found the next "/" character. - output.append(input.substring(0, max)); - input.delete(0, max); - } else { - // End of input buffer reached - output.append(input.toString()); - input.delete(0, input.length()); - } - } - } - - // Finally, the output buffer is returned as the result - setPath(output.toString()); - - // Ensure that the scheme and host names are reset in lower case - setScheme(getScheme()); - setHostDomain(getHostDomain()); - - // Remove the port if it is equal to the default port of the reference's - // Protocol. - final int hostPort = getHostPort(); - if (hostPort != -1) { - final int defaultPort = Protocol.valueOf(getScheme()) - .getDefaultPort(); - if (hostPort == defaultPort) { - setHostPort(null); - } - } - - return this; - } - - /** - * Removes the last segement from the output builder. - * - * @param output - * The output builder to update. - */ - private void removeLastSegment(StringBuilder output) { - int min = -1; - for (int i = output.length() - 1; (min == -1) && (i >= 0); i--) { - if (output.charAt(i) == '/') { - min = i; - } - } - - if (min != -1) { - // We found the previous "/" character. - output.delete(min, output.length()); - } else { - // End of output buffer reached - output.delete(0, output.length()); - } - - } - - /** - * Sets the authority component for hierarchical identifiers. - * - * @param authority - * The authority component for hierarchical identifiers. - */ - public void setAuthority(String authority) { - final String oldPart = isRelative() ? getRelativePart() - : getSchemeSpecificPart(); - String newPart; - final String newAuthority = (authority == null) ? "" : "//" + authority; - - if (oldPart == null) { - newPart = newAuthority; - } else if (oldPart.startsWith("//")) { - int index = oldPart.indexOf('/', 2); - - if (index != -1) { - newPart = newAuthority + oldPart.substring(index); - } else { - index = oldPart.indexOf('?'); - if (index != -1) { - newPart = newAuthority + oldPart.substring(index); - } else { - newPart = newAuthority; - } - } - } else { - newPart = newAuthority + oldPart; - } - - if (isAbsolute()) { - setSchemeSpecificPart(newPart); - } else { - setRelativePart(newPart); - } - } - - /** - * Sets the base reference for relative references. - * - * @param baseRef - * The base reference for relative references. - */ - public void setBaseRef(Reference baseRef) { - this.baseRef = baseRef; - } - - /** - * Sets the base reference for relative references. - * - * @param baseUri - * The base URI for relative references. - */ - public void setBaseRef(String baseUri) { - setBaseRef(new Reference(baseUri)); - } - - /** - * Sets the extensions for hierarchical identifiers. An extensions part - * starts after the first '.' character of the last path segment and ends - * with either the end of the segment of with the first ';' character - * (matrix start). It is a token similar to file extensions separated by '.' - * characters. The value can be ommited.
- * Note that no URI decoding is done by this method. - * - * @param extensions - * The extensions to set or null (without leading or trailing - * dots). - * @see #getExtensions() - * @see #getExtensionsAsArray() - * @see #setExtensions(String[]) - */ - public void setExtensions(String extensions) { - final String lastSegment = getLastSegment(); - - if (lastSegment != null) { - final int extensionIndex = lastSegment.indexOf('.'); - final int matrixIndex = lastSegment.indexOf(';'); - final StringBuilder sb = new StringBuilder(); - - if (extensionIndex != -1) { - // Extensions found - sb.append(lastSegment, 0, extensionIndex); - - if ((extensions != null) && (!extensions.isEmpty())) { - sb.append('.').append(extensions); - } - - if (matrixIndex != -1) { - sb.append(lastSegment.substring(matrixIndex)); - } - } else { - // Extensions not found - if ((extensions != null) && (!extensions.isEmpty())) { - if (matrixIndex != -1) { - // Matrix found, make sure we append it - // after the extensions - sb.append(lastSegment, 0, matrixIndex) - .append('.').append(extensions) - .append(lastSegment.substring(matrixIndex)); - } else { - // No matrix found, just append the extensions - sb.append(lastSegment).append('.').append(extensions); - } - } else { - // No change necessary - sb.append(lastSegment); - } - } - - // Finally update the last segment - setLastSegment(sb.toString()); - } else { - setLastSegment('.' + extensions); - } - } - - /** - * Sets the extensions based on an array of extension tokens (without dots). - * - * @param extensions - * The array of extensions. - * @see #getExtensions() - * @see #getExtensionsAsArray() - * @see #setExtensions(String) - */ - public void setExtensions(String[] extensions) { - String exts = null; - - if (extensions != null) { - final StringBuilder sb = new StringBuilder(); - - for (int i = 0; i < extensions.length; i++) { - if (i > 0) { - sb.append('.'); - } - - sb.append(extensions[i]); - } - - exts = sb.toString(); - } - - setExtensions(exts); - } - - /** - * Sets the fragment identifier. - * - * @param fragment - * The fragment identifier. - * @throws IllegalArgumentException - * if the fragment parameter contains the fragment delimiter - * ('#'). - */ - public void setFragment(String fragment) { - fragment = encodeInvalidCharacters(fragment); - - if ((fragment != null) && (fragment.indexOf('#') != -1)) { - throw new IllegalArgumentException( - "Illegal '#' character detected in parameter"); - } - - if (hasFragment()) { - // Existing fragment - if (fragment != null) { - this.internalRef = this.internalRef.substring(0, - this.fragmentIndex + 1) + fragment; - } else { - this.internalRef = this.internalRef.substring(0, - this.fragmentIndex); - } - } else { - // No existing fragment - if (fragment != null) { - if (this.internalRef != null) { - this.internalRef = this.internalRef + '#' + fragment; - } else { - this.internalRef = '#' + fragment; - } - } else { - // Do nothing - } - } - - updateIndexes(); - } - - /** - * Sets the host domain component for server based hierarchical identifiers. - * - * @param domain - * The host component for server based hierarchical identifiers. - */ - public void setHostDomain(String domain) { - final String authority = getAuthority(); - - if (authority == null) { - setAuthority(domain); - } else { - if (domain == null) { - domain = ""; - } else { - // URI specification indicates that host names should be - // produced in lower case - domain = domain.toLowerCase(); - } - - // We must prevent the case where the userinfo part contains ':' - // and the case of IPV6 addresses - int indexUI = authority.indexOf('@'); // user info - int indexIPV6 = authority.indexOf(']'); // IPV6 - int indexP = authority.indexOf(':', (indexIPV6 == -1) ? indexUI - : indexIPV6); - - if (indexUI != -1) { - // User info found - if (indexP != -1) { - // Port found - setAuthority(authority.substring(0, indexUI + 1) + domain - + authority.substring(indexP)); - } else { - // No port found - setAuthority(authority.substring(0, indexUI + 1) + domain); - } - } else { - // No user info found - if (indexP != -1) { - // Port found - setAuthority(domain + authority.substring(indexP)); - } else { - // No port found - setAuthority(domain); - } - } - } - } - - /** - * Sets the optional port number for server based hierarchical identifiers. - * - * @param port - * The optional port number for server based hierarchical - * identifiers. - * @throws IllegalArgumentException - * If the autority has not been defined. - */ - public void setHostPort(Integer port) { - final String authority = getAuthority(); - - if (authority != null) { - // We must prevent the case where the userinfo part contains ':' - // and the case of IPV6 addresses - int indexUI = authority.indexOf('@'); // user info - int indexIPV6 = authority.indexOf(']'); // IPV6 - int index = authority.indexOf(':', (indexIPV6 == -1) ? indexUI - : indexIPV6); - String newPort = (port == null) ? "" : ":" + port; - - if (index != -1) { - setAuthority(authority.substring(0, index) + newPort); - } else { - setAuthority(authority + newPort); - } - } else { - throw new IllegalArgumentException( - "No authority defined, please define a host name first"); - } - } - - /** - * Sets the absolute resource identifier. - * - * @param identifier - * The absolute resource identifier. - * @throws IllegalArgumentException - * If the identifier parameter contains the fragment delimiter - * ('#'). - */ - public void setIdentifier(String identifier) { - identifier = encodeInvalidCharacters(identifier); - - if (identifier == null) { - identifier = ""; - } - - if (identifier.indexOf('#') != -1) { - throw new IllegalArgumentException( - "Illegal '#' character detected in parameter"); - } - - if (hasFragment()) { - // Fragment found - this.internalRef = identifier - + this.internalRef.substring(this.fragmentIndex); - } else { - // No fragment found - this.internalRef = identifier; - } - - updateIndexes(); - } - - /** - * Sets the last segment of the path. If no path is available, then it - * creates one and adds a slash in front of the given last segmetn.
- * Note that no URI decoding is done by this method. - * - * @param lastSegment - * The last segment of a hierarchical path. - */ - public void setLastSegment(String lastSegment) { - String path = getPath(); - - if (path != null) { - int lastSlashIndex = path.lastIndexOf('/'); - - if (lastSlashIndex != -1) { - setPath(path.substring(0, lastSlashIndex + 1) + lastSegment); - return; - } - } - - setPath('/' + lastSegment); - } - - /** - * Sets the path component for hierarchical identifiers. - * - * @param path - * The path component for hierarchical identifiers. - */ - public void setPath(String path) { - final String oldPart = isRelative() ? getRelativePart() - : getSchemeSpecificPart(); - String newPart = null; - - if (oldPart != null) { - if (path == null) { - path = ""; - } - - if (oldPart.startsWith("//")) { - // Authority found - final int index1 = oldPart.indexOf('/', 2); - - if (index1 != -1) { - // Path found - final int index2 = oldPart.indexOf('?'); - - if (index2 != -1) { - // Query found - newPart = oldPart.substring(0, index1) + path - + oldPart.substring(index2); - } else { - // No query found - newPart = oldPart.substring(0, index1) + path; - } - } else { - // No path found - final int index2 = oldPart.indexOf('?'); - - if (index2 != -1) { - // Query found - newPart = oldPart.substring(0, index2) + path - + oldPart.substring(index2); - } else { - // No query found - newPart = oldPart + path; - } - } - } else { - // No authority found - final int index = oldPart.indexOf('?'); - - if (index != -1) { - // Query found - newPart = path + oldPart.substring(index); - } else { - // No query found - newPart = path; - } - } - } else { - newPart = path; - } - - if (isAbsolute()) { - setSchemeSpecificPart(newPart); - } else { - setRelativePart(newPart); - } - } - - /** - * Sets the scheme component based on this protocol. - * - * @param protocol - * The protocol of the scheme component. - */ - public void setProtocol(Protocol protocol) { - setScheme(protocol.getSchemeName()); - } - - /** - * Sets the query component for hierarchical identifiers. - * - * @param query - * The query component for hierarchical identifiers. - */ - public void setQuery(String query) { - query = encodeInvalidCharacters(query); - final boolean emptyQueryString = ((query == null) || query.isEmpty()); - - if (hasQuery()) { - // Query found - if (hasFragment()) { - // Fragment found - if (!emptyQueryString) { - this.internalRef = this.internalRef.substring(0, - this.queryIndex + 1) - + query - + this.internalRef.substring(this.fragmentIndex); - } else { - this.internalRef = this.internalRef.substring(0, - this.queryIndex) - + this.internalRef.substring(this.fragmentIndex); - } - } else { - // No fragment found - if (!emptyQueryString) { - this.internalRef = this.internalRef.substring(0, - this.queryIndex + 1) + query; - } else { - this.internalRef = this.internalRef.substring(0, - this.queryIndex); - } - } - } else { - // No query found - if (hasFragment()) { - // Fragment found - if (!emptyQueryString) { - this.internalRef = this.internalRef.substring(0, - this.fragmentIndex) - + '?' - + query - + this.internalRef.substring(this.fragmentIndex); - } else { - // Do nothing; - } - } else { - // No fragment found - if (!emptyQueryString) { - if (this.internalRef != null) { - this.internalRef = this.internalRef + '?' + query; - } else { - this.internalRef = '?' + query; - } - } else { - // Do nothing; - } - } - } - - updateIndexes(); - } - - /** - * Sets the relative part for relative references only. - * - * @param relativePart - * The relative part to set. - */ - public void setRelativePart(String relativePart) { - relativePart = encodeInvalidCharacters(relativePart); - - if (relativePart == null) { - relativePart = ""; - } - - if (!hasScheme()) { - // This is a relative reference, no scheme found - if (hasQuery()) { - // Query found - this.internalRef = relativePart - + this.internalRef.substring(this.queryIndex); - } else if (hasFragment()) { - // Fragment found - this.internalRef = relativePart - + this.internalRef.substring(this.fragmentIndex); - } else { - // No fragment found - this.internalRef = relativePart; - } - } - - updateIndexes(); - } - - /** - * Sets the scheme component. - * - * @param scheme - * The scheme component. - */ - public void setScheme(String scheme) { - scheme = encodeInvalidCharacters(scheme); - - if (scheme != null) { - // URI specification indicates that scheme names should be - // produced in lower case - scheme = scheme.toLowerCase(); - } - - if (hasScheme()) { - // Scheme found - if (scheme != null) { - this.internalRef = scheme - + this.internalRef.substring(this.schemeIndex); - } else { - this.internalRef = this.internalRef - .substring(this.schemeIndex + 1); - } - } else { - // No scheme found - if (scheme != null) { - if (this.internalRef == null) { - this.internalRef = scheme + ':'; - } else { - this.internalRef = scheme + ':' + this.internalRef; - } - } - } - - updateIndexes(); - } - - /** - * Sets the scheme specific part. - * - * @param schemeSpecificPart - * The scheme specific part. - */ - public void setSchemeSpecificPart(String schemeSpecificPart) { - schemeSpecificPart = encodeInvalidCharacters(schemeSpecificPart); - - if (schemeSpecificPart == null) { - schemeSpecificPart = ""; - } - - if (hasScheme()) { - // Scheme found - if (hasFragment()) { - // Fragment found - this.internalRef = this.internalRef.substring(0, - this.schemeIndex + 1) - + schemeSpecificPart - + this.internalRef.substring(this.fragmentIndex); - } else { - // No fragment found - this.internalRef = this.internalRef.substring(0, - this.schemeIndex + 1) + schemeSpecificPart; - } - } else { - // No scheme found - if (hasFragment()) { - // Fragment found - this.internalRef = schemeSpecificPart - + this.internalRef.substring(this.fragmentIndex); - } else { - // No fragment found - this.internalRef = schemeSpecificPart; - } - } - - updateIndexes(); - } - - /** - * Sets the segments of a hierarchical path.
- * A new absolute path will replace any existing one. - * - * @param segments - * The segments of the hierarchical path. - */ - public void setSegments(List segments) { - final StringBuilder sb = new StringBuilder(); - - for (final String segment : segments) { - sb.append('/').append(segment); - } - - setPath(sb.toString()); - } - - /** - * Sets the user info component for server based hierarchical identifiers. - * - * @param userInfo - * The user info component for server based hierarchical - * identifiers. - * @throws IllegalArgumentException - * If the autority part has not been defined. - */ - public void setUserInfo(String userInfo) { - final String authority = getAuthority(); - - if (authority != null) { - final int index = authority.indexOf('@'); - final String newUserInfo = (userInfo == null) ? "" : userInfo + '@'; - - if (index != -1) { - setAuthority(newUserInfo + authority.substring(index + 1)); - } else { - setAuthority(newUserInfo + authority); - } - } else { - throw new IllegalArgumentException( - "No authority defined, please define a host name first"); - } - } - - /** - * Returns the reference as an URI string. - * - * @return The reference as an URI string. - */ - @Override - public String toString() { - return this.internalRef; - } - - /** - * Returns the URI reference string. - * - * @param query - * Indicates if the query should be included; - * @param fragment - * Indicates if the fragment should be included; - * @return The URI reference string. - */ - public String toString(boolean query, boolean fragment) { - if (query) { - if (fragment) { - return this.internalRef; - } - - if (hasFragment()) { - return this.internalRef.substring(0, this.fragmentIndex); - } - return this.internalRef; - } - - if (fragment) { - // Fragment should be included - if (hasQuery()) { - // Query found - if (hasFragment()) { - // Fragment found - return this.internalRef.substring(0, this.queryIndex) + "#" - + getFragment(); - } - - // No fragment found - return this.internalRef.substring(0, this.queryIndex); - } - - // No query found - return this.internalRef; - } - - // Fragment should not be included - if (hasQuery()) { - // Query found - return this.internalRef.substring(0, this.queryIndex); - } - if (hasFragment()) { - // Fragment found - return this.internalRef.substring(0, this.fragmentIndex); - } - - return this.internalRef; - } - - /** - * Updates internal indexes. - */ - private void updateIndexes() { - if (this.internalRef != null) { - // Compute the indexes - final int firstSlashIndex = this.internalRef.indexOf('/'); - this.schemeIndex = this.internalRef.indexOf(':'); - - if ((firstSlashIndex != -1) && (this.schemeIndex > firstSlashIndex)) { - // We are in the rare case of a relative reference where one of - // the path segments contains a colon character. In this case, - // we ignore the colon as a valid scheme index. - // Note that this colon can't be in the first segment as it is - // forbidden by the URI RFC. - this.schemeIndex = -1; - } - - this.queryIndex = this.internalRef.indexOf('?'); - this.fragmentIndex = this.internalRef.indexOf('#'); - - if (hasQuery() && hasFragment() - && (this.queryIndex > this.fragmentIndex)) { - // Query sign inside fragment - this.queryIndex = -1; - } - - if (hasQuery() && this.schemeIndex > this.queryIndex) { - // Colon sign inside query - this.schemeIndex = -1; - } - - if (hasFragment() && this.schemeIndex > this.fragmentIndex) { - // Colon sign inside fragment - this.schemeIndex = -1; - } - } else { - this.schemeIndex = -1; - this.queryIndex = -1; - this.fragmentIndex = -1; - } - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ServerInfo.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ServerInfo.java deleted file mode 100644 index 1ae553f0f6..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/ServerInfo.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -/** - * Server specific data related to a call. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class ServerInfo { - /** Indicates if the server accepts range requests for a resource. */ - private volatile boolean acceptingRanges; - - /** The IP address. */ - private volatile String address; - - /** The agent name. */ - private volatile String agent; - - /** The port number. */ - private volatile int port; - - /** - * Constructor. - */ - public ServerInfo() { - this.address = null; - this.agent = null; - this.port = -1; - this.acceptingRanges = false; - } - - /** - * Returns the IP address. - * - * @return The IP address. - */ - public String getAddress() { - return this.address; - } - - /** - * Returns the agent name (ex: "Restlet-Framework/2.0"). Note that when used - * with HTTP connectors, this property maps to the "Server" header. - * - * @return The agent name. - */ - public String getAgent() { - return this.agent; - } - - /** - * Returns the port number which received the call. If no port is specified, - * -1 is returned. - * - * @return The port number which received the call. - */ - public int getPort() { - return this.port; - } - - /** - * Return true if the server accepts range requests for a resource, with the - * "byte" range unit. Note that when used with HTTP connectors, this - * property maps to the "Accept-Ranges" header. - * - * @return True if the server accepts range requests for a resource. - */ - public boolean isAcceptingRanges() { - return acceptingRanges; - } - - /** - * Indicates if the server accepts range requests for a resource, with the - * "byte" range unit. Note that when used with HTTP connectors, this - * property maps to the "Accept-Ranges" header. - * - * @param acceptingRanges - * True if the server accepts range requests for a resource. - */ - public void setAcceptingRanges(boolean acceptingRanges) { - this.acceptingRanges = acceptingRanges; - } - - /** - * Sets the IP address which received the call. - * - * @param address - * The IP address which received the call. - */ - public void setAddress(String address) { - this.address = address; - } - - /** - * Sets the agent name (ex: "Restlet-Framework/2.0"). Note that when used - * with HTTP connectors, this property maps to the "Server" header. - * - * @param agent - * The agent name. - */ - public void setAgent(String agent) { - this.agent = agent; - } - - /** - * Sets the port number which received the call. - * - * @param port - * The port number which received the call. - */ - public void setPort(int port) { - this.port = port; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Status.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Status.java deleted file mode 100644 index e766cf7f0d..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Status.java +++ /dev/null @@ -1,1636 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import org.restlet.client.engine.Engine; - -/** - * Status to return after handling a call. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class Status { - private static final String BASE_ADDED_HTTP = "http://tools.ietf.org/html/rfc6585"; - - private static final String BASE_HTTP = "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"; - - private static final String BASE_RESTLET = "https://javadoc.io/static/org.restlet.gwt/org.restlet.gwt/" + Engine.VERSION + "/"; - - @Deprecated - private static final String BASE_WEBDAV = "http://www.webdav.org/specs/rfc2518.html"; - - /** - * The request could not be understood by the server due to malformed - * syntax. - * - * @see HTTP - * RFC - 10.4.1 400 Bad Request - */ - public static final Status CLIENT_ERROR_BAD_REQUEST = new Status(400); - - /** - * The request could not be completed due to a conflict with the current - * state of the resource (as experienced in a version control system). - * - * @see HTTP - * RFC - 10.4.10 409 Conflict - */ - public static final Status CLIENT_ERROR_CONFLICT = new Status(409); - - /** - * The user agent expects some behavior of the server (given in an Expect - * request-header field), but this expectation could not be met by this - * server. - * - * @see HTTP - * RFC - 10.4.18 417 Expectation Failed - */ - public static final Status CLIENT_ERROR_EXPECTATION_FAILED = new Status(417); - - /** - * This status code means that the method could not be performed on the - * resource because the requested action depended on another action and that - * action failed. - * - * @see WEBDAV - * RFC - 10.5 424 Failed Dependency - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Status CLIENT_ERROR_FAILED_DEPENDENCY = new Status(424); - - /** - * The server understood the request, but is refusing to fulfill it as it - * could be explained in the entity. - * - * @see HTTP - * RFC - 10.4.4 403 Forbidden - */ - public static final Status CLIENT_ERROR_FORBIDDEN = new Status(403); - - /** - * The requested resource is no longer available at the server and no - * forwarding address is known. - * - * @see HTTP - * RFC - 10.4.11 410 Gone - */ - public static final Status CLIENT_ERROR_GONE = new Status(410); - - /** - * The server refuses to accept the request without a defined - * Content-Length. - * - * @see HTTP - * RFC - 10.4.12 411 Length Required - */ - public static final Status CLIENT_ERROR_LENGTH_REQUIRED = new Status(411); - - /** - * The source or destination resource of a method is locked (or temporarily - * involved in another process). - * - * @see WEBDAV - * RFC - 10.4 423 Locked - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Status CLIENT_ERROR_LOCKED = new Status(423); - - /** - * The method specified in the Request-Line is not allowed for the resource - * identified by the Request-URI. - * - * @see HTTP - * RFC - 10.4.6 405 Method Not Allowed - */ - public static final Status CLIENT_ERROR_METHOD_NOT_ALLOWED = new Status(405); - - /** - * The resource identified by the request is only capable of generating - * response entities whose content characteristics do not match the user's - * requirements (in Accept* headers). - * - * @see HTTP - * RFC - 10.4.7 406 Not Acceptable - */ - public static final Status CLIENT_ERROR_NOT_ACCEPTABLE = new Status(406); - - /** - * The server has not found anything matching the Request-URI or the server - * does not wish to reveal exactly why the request has been refused, or no - * other response is applicable. - * - * @see HTTP - * RFC - 10.4.5 404 Not Found - */ - public static final Status CLIENT_ERROR_NOT_FOUND = new Status(404); - - /** - * This code is reserved for future use. - * - * @see HTTP - * RFC - 10.4.3 402 Payment Required - */ - public static final Status CLIENT_ERROR_PAYMENT_REQUIRED = new Status(402); - - /** - * Sent by the server when the user agent asks the server to carry out a - * request under certain conditions that are not met. - * - * @see HTTP - * RFC - 10.4.13 412 Precondition Failed - */ - public static final Status CLIENT_ERROR_PRECONDITION_FAILED = new Status( - 412); - - /** - * This code is similar to 401 (Unauthorized), but indicates that the client - * must first authenticate itself with the proxy. - * - * @see HTTP - * RFC - 10.4.8 407 Proxy Authentication Required - */ - public static final Status CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED = new Status( - 407); - - /** - * The server is refusing to process a request because the request entity is - * larger than the server is willing or able to process. - * - * @see HTTP - * RFC - 10.4.14 413 Request Entity Too Large - */ - public static final Status CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE = new Status( - 413); - - /** - * Sent by the server when an HTTP client opens a connection, but has never - * sent a request (or never sent the blank line that signals the end of the - * request). - * - * @see HTTP - * RFC - 10.4.9 408 Request Timeout - */ - public static final Status CLIENT_ERROR_REQUEST_TIMEOUT = new Status(408); - - /** - * The server is refusing to service the request because the Request-URI is - * longer than the server is willing to interpret. - * - * @see HTTP - * RFC - 10.4.15 414 Request-URI Too Long - */ - public static final Status CLIENT_ERROR_REQUEST_URI_TOO_LONG = new Status( - 414); - - /** - * The request includes a Range request-header field and the selected - * resource is too small for any of the byte-ranges to apply. - * - * @see HTTP - * RFC - 10.4.17 416 Requested Range Not Satisfiable - */ - public static final Status CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE = new Status( - 416); - - /** - * The server refuses to accept the request because the user has sent too - * many requests in a given amount of time. - * - * @see HTTP RFC - - * 10.4.12 429 Too Many Requests - */ - public static final Status CLIENT_ERROR_TOO_MANY_REQUESTS = new Status(429); - - /** - * The request requires user authentication. - * - * @see HTTP - * RFC - 10.4.2 401 Unauthorized - */ - public static final Status CLIENT_ERROR_UNAUTHORIZED = new Status(401); - - /** - * This status code means the server understands the content type of the - * request entity (syntactically correct) but was unable to process the - * contained instructions. - * - * @see WEBDAV - * RFC - 10.3 422 Unprocessable Entity - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Status CLIENT_ERROR_UNPROCESSABLE_ENTITY = new Status( - 422); - - /** - * The server is refusing to service the request because the entity of the - * request is in a format not supported by the requested resource for the - * requested method. - * - * @see HTTP - * RFC - 10.4.16 415 Unsupported Media Type - */ - public static final Status CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE = new Status( - 415); - - /** - * The client connector faced an error during the communication with the - * remote server (interruption, timeout, etc.). The status code is 1001. - */ - public static final Status CONNECTOR_ERROR_COMMUNICATION = new Status(1001); - - /** - * The client connector could not connect to the remote server. The status - * code is 1000. - */ - public static final Status CONNECTOR_ERROR_CONNECTION = new Status(1000); - - /** - * The client connector faced an internal error during the process of a - * request to its server or the process of a response to its client. The - * status code is 1002. - */ - public static final Status CONNECTOR_ERROR_INTERNAL = new Status(1002); - - /** - * This interim response (the client has to wait for the final response) is - * used to inform the client that the initial part of the request has been - * received and has not yet been rejected or completed by the server. - * - * @see HTTP - * RFC - 10.1.1 100 Continue - */ - public static final Status INFO_CONTINUE = new Status(100); - - /** - * Warning status code, typically returned by a cache, indicating that it is - * intentionally disconnected from the rest of the network for a period of - * time. - * - * @see HTTP - * RFC - 14.46 Warning - */ - public static final Status INFO_DISCONNECTED_OPERATION = new Status(112); - - /** - * Warning status code, typically returned by a cache, indicating that it - * heuristically chose a freshness lifetime greater than 24 hours and the - * response's age is greater than 24 hours. - * - * @see HTTP - * RFC - 14.46 Warning - */ - public static final Status INFO_HEURISTIC_EXPIRATION = new Status(113); - - /** - * Warning status code, optionally including arbitrary information to be - * presented to a human user, typically returned by a cache. - * - * @see HTTP - * RFC - 14.46 Warning - */ - public static final Status INFO_MISC_WARNING = new Status(199); - - /** - * This interim response is used to inform the client that the server has - * accepted the complete request, but has not yet completed it since the - * server has a reasonable expectation that the request will take - * significant time to complete. - * - * @see WEBDAV - * RFC - 10.1 102 Processing - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Status INFO_PROCESSING = new Status(102); - - /** - * Warning status code, typically returned by a cache, indicating that the - * response is stale because an attempt to revalidate the response failed, - * due to an inability to reach the server. - * - * @see HTTP - * RFC - 14.46 Warning - */ - public static final Status INFO_REVALIDATION_FAILED = new Status(111); - - /** - * Warning status code, typically returned by a cache, indicating that the - * response is stale. - * - * @see HTTP - * RFC - 14.46 Warning - */ - public static final Status INFO_STALE_RESPONSE = new Status(110); - - /** - * The server understands and is willing to comply with the client's - * request, via the Upgrade message header field, for a change in the - * application protocol being used on this connection. - * - * @see HTTP - * RFC - 10.1.1 101 Switching Protocols - */ - public static final Status INFO_SWITCHING_PROTOCOL = new Status(101); - - /** - * The requested resource resides temporarily under a different URI which - * should not be used for future requests by the client (use status codes - * 303 or 307 instead since this status has been manifestly misused). - * - * @see HTTP - * RFC - 10.3.3 302 Found - */ - public static final Status REDIRECTION_FOUND = new Status(302); - - /** - * The server lets the user agent choosing one of the multiple - * representations of the requested resource, each representation having its - * own specific location provided in the response entity. - * - * @see HTTP - * RFC - 10.3.1 300 Multiple Choices - */ - public static final Status REDIRECTION_MULTIPLE_CHOICES = new Status(300); - - /** - * Status code sent by the server in response to a conditional GET request - * in case the document has not been modified. - * - * @see HTTP - * RFC - 10.3.5 304 Not Modified - */ - public static final Status REDIRECTION_NOT_MODIFIED = new Status(304); - - /** - * The requested resource has been assigned a new permanent URI and any - * future references to this resource SHOULD use one of the returned URIs. - * - * @see HTTP - * RFC - 10.3.2 301 Moved Permanently - */ - public static final Status REDIRECTION_PERMANENT = new Status(301); - - /** - * The response to the request can be found under a different URI and SHOULD - * be retrieved using a GET method on that resource. - * - * @see HTTP - * RFC - 10.3.4 303 See Other - */ - public static final Status REDIRECTION_SEE_OTHER = new Status(303); - - /** - * The requested resource resides temporarily under a different URI which - * should not be used for future requests by the client. - * - * @see HTTP - * RFC - 10.3.8 307 Temporary Redirect - */ - public static final Status REDIRECTION_TEMPORARY = new Status(307); - - /** - * The requested resource MUST be accessed through the proxy given by the - * Location field. - * - * @see HTTP - * RFC - 10.3.6 305 Use Proxy - */ - public static final Status REDIRECTION_USE_PROXY = new Status(305); - - /** - * The server, while acting as a gateway or proxy, received an invalid - * response from the upstream server it accessed in attempting to fulfill - * the request. - * - * @see HTTP - * RFC - 10.5.3 502 Bad Gateway - */ - public static final Status SERVER_ERROR_BAD_GATEWAY = new Status(502); - - /** - * The server, while acting as a gateway or proxy, could not connect to the - * upstream server. - * - * @see HTTP - * RFC - 10.5.5 504 Gateway Timeout - */ - public static final Status SERVER_ERROR_GATEWAY_TIMEOUT = new Status(504); - - /** - * This status code means the method could not be performed on the resource - * because the server is unable to store the representation needed to - * successfully complete the request. - * - * @see WEBDAV - * RFC - 10.6 507 Insufficient Storage - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Status SERVER_ERROR_INSUFFICIENT_STORAGE = new Status( - 507); - - /** - * The server encountered an unexpected condition which prevented it from - * fulfilling the request. - * - * @see HTTP - * RFC - 10.5.1 500 Internal Server Error - */ - public static final Status SERVER_ERROR_INTERNAL = new Status(500); - - /** - * The server does not support the functionality required to fulfill the - * request. - * - * @see HTTP - * RFC - 10.5.2 501 Not Implemented - */ - public static final Status SERVER_ERROR_NOT_IMPLEMENTED = new Status(501); - - /** - * The server is currently unable to handle the request due to a temporary - * overloading or maintenance of the server. - * - * @see HTTP - * RFC - 10.5.4 503 Service Unavailable - */ - public static final Status SERVER_ERROR_SERVICE_UNAVAILABLE = new Status( - 503); - - /** - * The server does not support, or refuses to support, the HTTP protocol - * version that was used in the request message. - * - * @see HTTP - * RFC - 10.5.6 505 HTTP Version Not Supported - */ - public static final Status SERVER_ERROR_VERSION_NOT_SUPPORTED = new Status( - 505); - - /** - * The request has been accepted for processing, but the processing has not - * been completed. - * - * @see HTTP - * RFC - 10.2.3 202 Accepted - */ - public static final Status SUCCESS_ACCEPTED = new Status(202); - - /** - * The request has been fulfilled and resulted in a new resource being - * created. - * - * @see HTTP - * RFC - 10.2.2 201 Created - */ - public static final Status SUCCESS_CREATED = new Status(201); - - /** - * Warning status code, optionally including arbitrary information to be - * presented to a human user, typically returned by a cache. - * - * @see HTTP - * RFC - 14.46 Warning - */ - public static final Status SUCCESS_MISC_PERSISTENT_WARNING = new Status(299); - - /** - * This response is used to inform the client that the HTTP response entity - * contains a set of status codes generated during the method invocation. - * - * @see WEBDAV - * RFC - 10.2 207 Multi-Status - * @deprecated Will be removed in next version. - */ - @Deprecated - public static final Status SUCCESS_MULTI_STATUS = new Status(207); - - /** - * The server has fulfilled the request but does not need to return an - * entity-body (for example after a DELETE), and might want to return - * updated meta-information. - * - * @see HTTP - * RFC - 10.2.5 204 No Content - */ - public static final Status SUCCESS_NO_CONTENT = new Status(204); - - /** - * The request has succeeded but the returned meta-information in the - * entity-header does not come from the origin server, but is gathered from - * a local or a third-party copy. - * - * @see HTTP - * RFC - 10.2.4 203 Non-Authoritative Information - */ - public static final Status SUCCESS_NON_AUTHORITATIVE = new Status(203); - - /** - * The request has succeeded. - * - * @see HTTP - * RFC - 10.2.1 200 OK - */ - public static final Status SUCCESS_OK = new Status(200); - - /** - * The server has fulfilled the partial GET request for the resource - * assuming the request has included a Range header field indicating the - * desired range. - * - * @see HTTP - * RFC - 10.2.7 206 Partial Content - */ - public static final Status SUCCESS_PARTIAL_CONTENT = new Status(206); - - /** - * The server has fulfilled the request and the user agent SHOULD reset the - * document view which caused the request to be sent. - * - * @see HTTP - * RFC - 10.2.6 205 Reset Content - */ - public static final Status SUCCESS_RESET_CONTENT = new Status(205); - - /** - * Warning status code, typically returned by a cache or a proxy, indicating - * that the response has been transformed. - * - * @see HTTP - * RFC - 14.46 Warning - */ - public static final Status SUCCESS_TRANSFORMATION_APPLIED = new Status(214); - - /** - * Check if the provided reason phrase of the status contains forbidden - * characters such as CR and LF. An IllegalArgumentException is thrown in - * this case. - * - * @see Status - * Code and Reason Phrase - * @param reasonPhrase - * The reason phrase to check. - * @return The name if it is correct. - */ - private static String checkReasonPhrase(String reasonPhrase) { - if (reasonPhrase != null) { - if (reasonPhrase.contains("\n") || reasonPhrase.contains("\r")) { - throw new IllegalArgumentException( - "Reason phrase of the status must not contain CR or LF characters."); - } - } - - return reasonPhrase; - } - - /** - * Indicates if the status is a client error status, meaning "The request - * contains bad syntax or cannot be fulfilled". - * - * @param code - * The code of the status. - * @return True if the status is a client error status. - */ - public static boolean isClientError(int code) { - return (code >= 400) && (code <= 499); - } - - /** - * Indicates if the status is a connector error status, meaning "The - * connector failed to send or receive an apparently valid message". - * - * @param code - * The code of the status. - * @return True if the status is a server error status. - */ - public static boolean isConnectorError(int code) { - return (code >= 1000) && (code <= 1099); - } - - /** - * Indicates if the status is an error (client or server) status. - * - * @param code - * The code of the status. - * @return True if the status is an error (client or server) status. - */ - public static boolean isError(int code) { - return isClientError(code) || isServerError(code) - || isConnectorError(code) || isGlobalError(code); - } - - /** - * Indicates if the status is a client error status, meaning "The request - * contains bad syntax or cannot be fulfilled". - * - * @param code - * The code of the status. - * @return True if the status is a client error status. - */ - public static boolean isGlobalError(int code) { - return (code >= 600) && (code <= 699); - } - - /** - * Indicates if the status is an information status, meaning "request - * received, continuing process". - * - * @param code - * The code of the status. - * @return True if the status is an information status. - */ - public static boolean isInformational(int code) { - return (code >= 100) && (code <= 199); - } - - /** - * Indicates if the status is a redirection status, meaning "Further action - * must be taken in order to complete the request". - * - * @param code - * The code of the status. - * @return True if the status is a redirection status. - */ - public static boolean isRedirection(int code) { - return (code >= 300) && (code <= 399); - } - - /** - * Indicates if the status is a server error status, meaning "The server - * failed to fulfill an apparently valid request". - * - * @param code - * The code of the status. - * @return True if the status is a server error status. - */ - public static boolean isServerError(int code) { - return (code >= 500) && (code <= 599); - } - - /** - * Indicates if the status is a success status, meaning "The action was - * successfully received, understood, and accepted". - * - * @param code - * The code of the status. - * @return True if the status is a success status. - */ - public static boolean isSuccess(int code) { - return (code >= 200) && (code <= 299); - } - - /** - * Returns the status associated to a code. If an existing constant exists - * then it is returned, otherwise a new instance is created. - * - * @param code - * The code. - * @return The associated status. - */ - public static Status valueOf(int code) { - switch (code) { - case 100: - return INFO_CONTINUE; - case 101: - return INFO_SWITCHING_PROTOCOL; - case 102: - return INFO_PROCESSING; - case 110: - return INFO_STALE_RESPONSE; - case 111: - return INFO_REVALIDATION_FAILED; - case 112: - return INFO_DISCONNECTED_OPERATION; - case 113: - return INFO_HEURISTIC_EXPIRATION; - case 199: - return INFO_MISC_WARNING; - - case 200: - return SUCCESS_OK; - case 201: - return SUCCESS_CREATED; - case 202: - return SUCCESS_ACCEPTED; - case 203: - return SUCCESS_NON_AUTHORITATIVE; - case 204: - return SUCCESS_NO_CONTENT; - case 205: - return SUCCESS_RESET_CONTENT; - case 206: - return SUCCESS_PARTIAL_CONTENT; - case 207: - return SUCCESS_MULTI_STATUS; - case 214: - return SUCCESS_TRANSFORMATION_APPLIED; - case 299: - return SUCCESS_MISC_PERSISTENT_WARNING; - - case 300: - return REDIRECTION_MULTIPLE_CHOICES; - case 301: - return REDIRECTION_PERMANENT; - case 302: - return REDIRECTION_FOUND; - case 303: - return REDIRECTION_SEE_OTHER; - case 304: - return REDIRECTION_NOT_MODIFIED; - case 305: - return REDIRECTION_USE_PROXY; - case 307: - return REDIRECTION_TEMPORARY; - - case 400: - return CLIENT_ERROR_BAD_REQUEST; - case 401: - return CLIENT_ERROR_UNAUTHORIZED; - case 402: - return CLIENT_ERROR_PAYMENT_REQUIRED; - case 403: - return CLIENT_ERROR_FORBIDDEN; - case 404: - return CLIENT_ERROR_NOT_FOUND; - case 405: - return CLIENT_ERROR_METHOD_NOT_ALLOWED; - case 406: - return CLIENT_ERROR_NOT_ACCEPTABLE; - case 407: - return CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED; - case 408: - return CLIENT_ERROR_REQUEST_TIMEOUT; - case 409: - return CLIENT_ERROR_CONFLICT; - case 410: - return CLIENT_ERROR_GONE; - case 411: - return CLIENT_ERROR_LENGTH_REQUIRED; - case 412: - return CLIENT_ERROR_PRECONDITION_FAILED; - case 413: - return CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE; - case 414: - return CLIENT_ERROR_REQUEST_URI_TOO_LONG; - case 415: - return CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE; - case 416: - return CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE; - case 417: - return CLIENT_ERROR_EXPECTATION_FAILED; - case 422: - return CLIENT_ERROR_UNPROCESSABLE_ENTITY; - case 423: - return CLIENT_ERROR_LOCKED; - case 424: - return CLIENT_ERROR_FAILED_DEPENDENCY; - case 429: - return CLIENT_ERROR_TOO_MANY_REQUESTS; - - case 500: - return SERVER_ERROR_INTERNAL; - case 501: - return SERVER_ERROR_NOT_IMPLEMENTED; - case 502: - return SERVER_ERROR_BAD_GATEWAY; - case 503: - return SERVER_ERROR_SERVICE_UNAVAILABLE; - case 504: - return SERVER_ERROR_GATEWAY_TIMEOUT; - case 505: - return SERVER_ERROR_VERSION_NOT_SUPPORTED; - case 507: - return SERVER_ERROR_INSUFFICIENT_STORAGE; - - case 1000: - return CONNECTOR_ERROR_CONNECTION; - case 1001: - return CONNECTOR_ERROR_COMMUNICATION; - case 1002: - return CONNECTOR_ERROR_INTERNAL; - - default: - return new Status(code); - } - } - - /** The specification code. */ - private final int code; - - /** The longer description. */ - private final String description; - - /** - * The short reason phrase displayed next to the status code in a HTTP - * response. - */ - private volatile String reasonPhrase; - - /** The related error or exception. */ - private final Throwable throwable; - - /** The URI of the specification describing the method. */ - private final String uri; - - /** - * Constructor. - * - * @param code - * The specification code. - */ - public Status(int code) { - this(code, null, null, null, null); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - */ - public Status(int code, String reasonPhrase) { - this(code, null, reasonPhrase, null, null); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The longer description. - */ - public Status(int code, String reasonPhrase, String description) { - this(code, null, reasonPhrase, description, null); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The longer description. - * @param uri - * The URI of the specification describing the method. - */ - public Status(int code, String reasonPhrase, String description, String uri) { - this(code, null, reasonPhrase, description, uri); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param throwable - * The related error or exception. - */ - public Status(int code, Throwable throwable) { - this(code, throwable, null, null, null); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param throwable - * The related error or exception. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - */ - public Status(int code, Throwable throwable, String reasonPhrase) { - this(code, throwable, reasonPhrase, null, null); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param throwable - * The related error or exception. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The longer description. - */ - public Status(int code, Throwable throwable, String reasonPhrase, - String description) { - this(code, throwable, reasonPhrase, description, null); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param throwable - * The related error or exception. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The longer description. - * @param uri - * The URI of the specification describing the method. - */ - public Status(int code, Throwable throwable, String reasonPhrase, - String description, String uri) { - this.code = code; - this.throwable = throwable; - this.reasonPhrase = checkReasonPhrase(reasonPhrase); - this.description = description; - this.uri = uri; - } - - /** - * Constructor. - * - * @param status - * The status to copy. - * @param description - * The description to associate. - */ - public Status(Status status, String description) { - this(status, null, null, description); - } - - /** - * Constructor. - * - * @param status - * The status to copy. - * @param description - * The description to associate. - */ - public Status(Status status, String reasonPhrase, String description) { - this(status, null, reasonPhrase, description); - } - - /** - * Constructor. - * - * @param status - * The status to copy. - * @param throwable - * The related error or exception. - */ - public Status(Status status, Throwable throwable) { - this(status, throwable, null, null); - } - - /** - * Constructor. - * - * @param status - * The status to copy. - * @param throwable - * The related error or exception. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - */ - public Status(Status status, Throwable throwable, String reasonPhrase) { - this(status, throwable, reasonPhrase, null); - } - - /** - * Constructor. - * - * @param status - * The status to copy. - * @param throwable - * The related error or exception. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The description to associate. - */ - public Status(Status status, Throwable throwable, String reasonPhrase, - String description) { - this(status.getCode(), (throwable == null) ? status.getThrowable() - : throwable, (reasonPhrase == null) ? status.getReasonPhrase() - : reasonPhrase, (description == null) ? status.getDescription() - : description, status.getUri()); - } - - /** - * Indicates if the status is equal to a given one. - * - * @param object - * The object to compare to. - * @return True if the status is equal to a given one. - */ - @Override - public boolean equals(final Object object) { - return (object instanceof Status) - && (this.code == ((Status) object).getCode()); - } - - /** - * Returns the corresponding code (HTTP or WebDAV or custom code). - * - * @return The corresponding code. - */ - public int getCode() { - return this.code; - } - - /** - * - * Returns the description. - * - * @return The description. - */ - public String getDescription() { - if (this.description != null) { - return this.description; - } - - switch (this.code) { - case 100: - return "The client should continue with its request"; - case 101: - return "The server is willing to change the application protocol being used on this connection"; - case 102: - return "Interim response used to inform the client that the server has accepted the complete request, but has not yet completed it"; - case 110: - return "MUST be included whenever the returned response is stale"; - case 111: - return "MUST be included if a cache returns a stale response because an attempt to revalidate the response failed, due to an inability to reach the server"; - case 112: - return "SHOULD be included if the cache is intentionally disconnected from the rest of the network for a period of time"; - case 113: - return "MUST be included if the cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours"; - case 199: - return "The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action, besides presenting the warning to the user"; - - case 200: - return "The request has succeeded"; - case 201: - return "The request has been fulfilled and resulted in a new resource being created"; - case 202: - return "The request has been accepted for processing, but the processing has not been completed"; - case 203: - return "The returned meta-information is not the definitive set as available from the origin server"; - case 204: - return "The server has fulfilled the request but does not need to return an entity-body, and might want to return updated meta-information"; - case 205: - return "The server has fulfilled the request and the user agent should reset the document view which caused the request to be sent"; - case 206: - return "The server has fulfilled the partial get request for the resource"; - case 207: - return "Provides status for multiple independent operations"; - case 214: - return "MUST be added by an intermediate cache or proxy if it applies any transformation changing the content-coding (as specified in the Content-Encoding header) or media-type (as specified in the Content-Type header) of the response, or the entity-body of the response, unless this Warning code already appears in the response"; - case 299: - return "The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action"; - - case 300: - return "The requested resource corresponds to any one of a set of representations"; - case 301: - return "The requested resource has been assigned a new permanent URI"; - case 302: - return "The requested resource can be found under a different URI"; - case 303: - return "The response to the request can be found under a different URI"; - case 304: - return "The client has performed a conditional GET request and the document has not been modified"; - case 305: - return "The requested resource must be accessed through the proxy given by the location field"; - case 307: - return "The requested resource resides temporarily under a different URI"; - - case 400: - return "The request could not be understood by the server due to malformed syntax"; - case 401: - return "The request requires user authentication"; - case 402: - return "This code is reserved for future use"; - case 403: - return "The server understood the request, but is refusing to fulfill it"; - case 404: - return "The server has not found anything matching the request URI"; - case 405: - return "The method specified in the request is not allowed for the resource identified by the request URI"; - case 406: - return "The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request"; - case 407: - return "This code is similar to Unauthorized, but indicates that the client must first authenticate itself with the proxy"; - case 408: - return "The client did not produce a request within the time that the server was prepared to wait"; - case 409: - return "The request could not be completed due to a conflict with the current state of the resource"; - case 410: - return "The requested resource is no longer available at the server and no forwarding address is known"; - case 411: - return "The server refuses to accept the request without a defined content length"; - case 412: - return "The precondition given in one or more of the request header fields evaluated to false when it was tested on the server"; - case 413: - return "The server is refusing to process a request because the request entity is larger than the server is willing or able to process"; - case 414: - return "The server is refusing to service the request because the request URI is longer than the server is willing to interpret"; - case 415: - return "The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method"; - case 416: - return "For byte ranges, this means that the first byte position were greater than the current length of the selected resource"; - case 417: - return "The expectation given in the request header could not be met by this server"; - case 422: - return "The server understands the content type of the request entity and the syntax of the request entity is correct but was unable to process the contained instructions"; - case 423: - return "The source or destination resource of a method is locked"; - case 424: - return "The method could not be performed on the resource because the requested action depended on another action and that action failed"; - case 429: - return "The server is refusing to service the request because the user has sent too many requests in a given amount of time (\"rate limiting\")"; - - case 500: - return "The server encountered an unexpected condition which prevented it from fulfilling the request"; - case 501: - return "The server does not support the functionality required to fulfill the request"; - case 502: - return "The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request"; - case 503: - return "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server"; - case 504: - return "The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request"; - case 505: - return "The server does not support, or refuses to support, the protocol version that was used in the request message"; - case 507: - return "The method could not be performed on the resource because the server is unable to store the representation needed to successfully complete the request"; - - case 1000: - return "The connector failed to connect to the server"; - case 1001: - return "The connector failed to complete the communication with the server"; - case 1002: - return "The connector encountered an unexpected condition which prevented it from fulfilling the request"; - } - - return null; - } - - /** - * Returns the reason phrase of this status. When supported by the HTTP - * server connector, this is returned in the first line of the HTTP - * response, next to to the status code. - * - * @return The reason phrase of this status. - */ - public String getReasonPhrase() { - if (this.reasonPhrase != null) { - return this.reasonPhrase; - } - - switch (this.code) { - case 100: - return "Continue"; - case 101: - return "Switching Protocols"; - case 102: - return "Processing"; - case 110: - return "Response is stale"; - case 111: - return "Revalidation failed"; - case 112: - return "Disconnected operation"; - case 113: - return "Heuristic expiration"; - case 199: - return "Miscellaneous warning"; - - case 200: - return "OK"; - case 201: - return "Created"; - case 202: - return "Accepted"; - case 203: - return "Non-Authoritative Information"; - case 204: - return "No Content"; - case 205: - return "Reset Content"; - case 206: - return "Partial Content"; - case 207: - return "Multi-Status"; - case 214: - return "Transformation applied"; - case 299: - return "Miscellaneous persistent warning"; - - case 300: - return "Multiple Choices"; - case 301: - return "Moved Permanently"; - case 302: - return "Found"; - case 303: - return "See Other"; - case 304: - return "Not Modified"; - case 305: - return "Use Proxy"; - case 307: - return "Temporary Redirect"; - - case 400: - return "Bad Request"; - case 401: - return "Unauthorized"; - case 402: - return "Payment Required"; - case 403: - return "Forbidden"; - case 404: - return "Not Found"; - case 405: - return "Method Not Allowed"; - case 406: - return "Not Acceptable"; - case 407: - return "Proxy Authentication Required"; - case 408: - return "Request Timeout"; - case 409: - return "Conflict"; - case 410: - return "Gone"; - case 411: - return "Length Required"; - case 412: - return "Precondition Failed"; - case 413: - return "Request Entity Too Large"; - case 414: - return "Request URI Too Long"; - case 415: - return "Unsupported Media Type"; - case 416: - return "Requested Range Not Satisfiable"; - case 417: - return "Expectation Failed"; - case 422: - return "Unprocessable Entity"; - case 423: - return "Locked"; - case 424: - return "Failed Dependency"; - case 429: - return "Too Many Requests"; - - case 500: - return "Internal Server Error"; - case 501: - return "Not Implemented"; - case 502: - return "Bad Gateway"; - case 503: - return "Service Unavailable"; - case 504: - return "Gateway Timeout"; - case 505: - return "Version Not Supported"; - case 507: - return "Insufficient Storage"; - - case 1000: - return "Connection Error"; - case 1001: - return "Communication Error"; - case 1002: - return "Internal Connector Error"; - } - - return null; - } - - /** - * Returns the related error or exception. - * - * @return The related error or exception. - */ - public Throwable getThrowable() { - return this.throwable; - } - - /** - * Returns the URI of the specification describing the status. - * - * @return The URI of the specification describing the status. - */ - public String getUri() { - if (this.uri != null) { - return this.uri; - } - - switch (this.code) { - case 100: - return BASE_HTTP + "#sec10.1.1"; - case 101: - return BASE_HTTP + "#sec10.1.2"; - case 102: - return BASE_WEBDAV + "#STATUS_102"; - case 110: - case 111: - case 112: - case 113: - case 199: - case 214: - case 299: - return "http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46"; - - case 200: - return BASE_HTTP + "#sec10.2.1"; - case 201: - return BASE_HTTP + "#sec10.2.2"; - case 202: - return BASE_HTTP + "#sec10.2.3"; - case 203: - return BASE_HTTP + "#sec10.2.4"; - case 204: - return BASE_HTTP + "#sec10.2.5"; - case 205: - return BASE_HTTP + "#sec10.2.6"; - case 206: - return BASE_HTTP + "#sec10.2.7"; - case 207: - return BASE_WEBDAV + "#STATUS_207"; - - case 300: - return BASE_HTTP + "#sec10.3.1"; - case 301: - return BASE_HTTP + "#sec10.3.2"; - case 302: - return BASE_HTTP + "#sec10.3.3"; - case 303: - return BASE_HTTP + "#sec10.3.4"; - case 304: - return BASE_HTTP + "#sec10.3.5"; - case 305: - return BASE_HTTP + "#sec10.3.6"; - case 307: - return BASE_HTTP + "#sec10.3.8"; - - case 400: - return BASE_HTTP + "#sec10.4.1"; - case 401: - return BASE_HTTP + "#sec10.4.2"; - case 402: - return BASE_HTTP + "#sec10.4.3"; - case 403: - return BASE_HTTP + "#sec10.4.4"; - case 404: - return BASE_HTTP + "#sec10.4.5"; - case 405: - return BASE_HTTP + "#sec10.4.6"; - case 406: - return BASE_HTTP + "#sec10.4.7"; - case 407: - return BASE_HTTP + "#sec10.4.8"; - case 408: - return BASE_HTTP + "#sec10.4.9"; - case 409: - return BASE_HTTP + "#sec10.4.10"; - case 410: - return BASE_HTTP + "#sec10.4.11"; - case 411: - return BASE_HTTP + "#sec10.4.12"; - case 412: - return BASE_HTTP + "#sec10.4.13"; - case 413: - return BASE_HTTP + "#sec10.4.14"; - case 414: - return BASE_HTTP + "#sec10.4.15"; - case 415: - return BASE_HTTP + "#sec10.4.16"; - case 416: - return BASE_HTTP + "#sec10.4.17"; - case 417: - return BASE_HTTP + "#sec10.4.18"; - case 422: - return BASE_WEBDAV + "#STATUS_422"; - case 423: - return BASE_WEBDAV + "#STATUS_423"; - case 424: - return BASE_WEBDAV + "#STATUS_424"; - case 429: - return BASE_ADDED_HTTP + "#section-4"; - - case 500: - return BASE_HTTP + "#sec10.5.1"; - case 501: - return BASE_HTTP + "#sec10.5.2"; - case 502: - return BASE_HTTP + "#sec10.5.3"; - case 503: - return BASE_HTTP + "#sec10.5.4"; - case 504: - return BASE_HTTP + "#sec10.5.5"; - case 505: - return BASE_HTTP + "#sec10.5.6"; - case 507: - return BASE_WEBDAV + "#STATUS_507"; - - case 1000: - return BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_CONNECTION"; - case 1001: - return BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_COMMUNICATION"; - case 1002: - return BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_INTERNAL"; - } - - return null; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return getCode(); - } - - /** - * Indicates if the status is a client error status, meaning "The request - * contains bad syntax or cannot be fulfilled". - * - * @return True if the status is a client error status. - */ - public boolean isClientError() { - return isClientError(getCode()); - } - - /** - * Indicates if the status is a connector error status, meaning "The - * connector failed to send or receive an apparently valid message". - * - * @return True if the status is a connector error status. - */ - public boolean isConnectorError() { - return isConnectorError(getCode()); - } - - /** - * Indicates if the status is an error (client or server) status. - * - * @return True if the status is an error (client or server) status. - */ - public boolean isError() { - return isError(getCode()); - } - - /** - * Indicates if the status is a global error status, meaning "The server has - * definitive information about a particular user". - * - * @return True if the status is a global error status. - */ - public boolean isGlobalError() { - return isGlobalError(getCode()); - } - - /** - * Indicates if the status is an information status, meaning "request - * received, continuing process". - * - * @return True if the status is an information status. - */ - public boolean isInformational() { - return isInformational(getCode()); - } - - /** - * Indicates if an error is recoverable, meaning that simply retrying after - * a delay could result in a success. Tests {@link #isConnectorError()} and - * if the status is {@link #CLIENT_ERROR_REQUEST_TIMEOUT} or - * {@link #SERVER_ERROR_GATEWAY_TIMEOUT} or - * {@link #SERVER_ERROR_SERVICE_UNAVAILABLE}. - * - * @return True if the error is recoverable. - */ - public boolean isRecoverableError() { - return isConnectorError() - || equals(Status.CLIENT_ERROR_REQUEST_TIMEOUT) - || equals(Status.SERVER_ERROR_GATEWAY_TIMEOUT) - || equals(Status.SERVER_ERROR_SERVICE_UNAVAILABLE); - } - - /** - * Indicates if the status is a redirection status, meaning "Further action - * must be taken in order to complete the request". - * - * @return True if the status is a redirection status. - */ - public boolean isRedirection() { - return isRedirection(getCode()); - } - - /** - * Indicates if the status is a server error status, meaning "The server - * failed to fulfill an apparently valid request". - * - * @return True if the status is a server error status. - */ - public boolean isServerError() { - return isServerError(getCode()); - } - - /** - * Indicates if the status is a success status, meaning "The action was - * successfully received, understood, and accepted". - * - * @return True if the status is a success status. - */ - public boolean isSuccess() { - return isSuccess(getCode()); - } - - /** - * Returns the reason phrase of the status followed by its HTTP code. - * - * @return The reason phrase of the status followed by its HTTP code. - */ - @Override - public String toString() { - return getReasonPhrase() + " (" + this.code + ")" - + ((getDescription() == null) ? "" : " - " + getDescription()); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Tag.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Tag.java deleted file mode 100644 index 3e1549cbbf..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Tag.java +++ /dev/null @@ -1,196 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Objects; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.representation.RepresentationInfo; - -/** - * Validation tag equivalent to an HTTP entity tag (E-Tag). "A strong entity tag - * may be shared by two entities of a resource only if they are equivalent by - * octet equality.
- *
- * A weak entity tag may be shared by two entities of a resource only if the - * entities are equivalent and could be substituted for each other with no - * significant change in semantics." - * - * @see RepresentationInfo#getTag() - * @see HTTP Entity Tags - * @see HTTP Entity Tag Cache Validators - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class Tag { - /** Tag matching any other tag, used in call's condition data. */ - public static final Tag ALL = Tag.parse("*"); - - /** - * Parses a tag formatted as defined by the HTTP standard. - * - * @param httpTag - * The HTTP tag string; if it starts with 'W/' the tag will be - * marked as weak and the data following the 'W/' used as the - * tag; otherwise it should be surrounded with quotes (e.g., - * "sometag"). - * @return A new tag instance. - * @see HTTP Entity Tags - */ - public static Tag parse(String httpTag) { - Tag result = null; - boolean weak = false; - String httpTagCopy = httpTag; - - if (httpTagCopy.startsWith("W/")) { - weak = true; - httpTagCopy = httpTagCopy.substring(2); - } - - if (httpTagCopy.startsWith("\"") && httpTagCopy.endsWith("\"")) { - result = new Tag( - httpTagCopy.substring(1, httpTagCopy.length() - 1), weak); - } else if (httpTagCopy.equals("*")) { - result = new Tag("*", weak); - } else { - Context.getCurrentLogger().log(Level.WARNING, - "Invalid tag format detected: " + httpTagCopy); - } - - return result; - } - - /** The name. */ - private volatile String name; - - /** The tag weakness. */ - private final boolean weak; - - /** - * Default constructor. The opaque tag is set to null and the weakness - * indicator is set to true. - */ - public Tag() { - this(null, true); - } - - /** - * Constructor of weak tags. - * - * @param opaqueTag - * The tag value. - */ - public Tag(String opaqueTag) { - this(opaqueTag, true); - } - - /** - * Constructor. - * - * @param opaqueTag - * The tag value. - * @param weak - * The weakness indicator. - */ - public Tag(final String opaqueTag, boolean weak) { - this.name = opaqueTag; - this.weak = weak; - } - - /** - * Indicates if both tags are equal. - * - * @param object - * The object to compare to. - * @return True if both tags are equal. - */ - @Override - public boolean equals(final Object object) { - return equals(object, true); - } - - /** - * Indicates if both tags are equal. - * - * @param object - * The object to compare to. - * @param checkWeakness - * The equality test takes care or not of the weakness. - * - * @return True if both tags are equal. - */ - public boolean equals(final Object object, boolean checkWeakness) { - if (!(object instanceof Tag)) { - return false; - } - - final Tag that = (Tag) object; - - if (checkWeakness && that.isWeak() != isWeak()) { - return false; - } - - return Objects.equals(getName(), that.getName()); - } - - /** - * Returns tag formatted as an HTTP tag string. - * - * @return The formatted HTTP tag string. - * @see HTTP Entity Tags - */ - public String format() { - if ("*".equals(getName())) { - return "*"; - } - - final StringBuilder sb = new StringBuilder(); - if (isWeak()) { - sb.append("W/"); - } - return sb.append('"').append(getName()).append('"').toString(); - } - - /** - * Returns the name, corresponding to an HTTP opaque tag value. - * - * @return The name, corresponding to an HTTP opaque tag value. - */ - public String getName() { - return this.name; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return format().hashCode(); - } - - /** - * Indicates if the tag is weak. - * - * @return True if the tag is weak, false if the tag is strong. - */ - public boolean isWeak() { - return this.weak; - } - - /** - * Returns the name. - * - * @return The name. - */ - @Override - public String toString() { - return getName(); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Warning.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Warning.java deleted file mode 100644 index 48cd61276b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/Warning.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.data; - -import java.util.Date; - -/** - * Additional information about the status or transformation of a request or - * response. This is typically used to warn about a possible issues with caching - * operations or transformations applied to the entity body.
- *
- * Note that when used with HTTP connectors, this class maps to the "Warning" - * header. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Warning { - - /** The agent. Typically a caching agent. */ - private volatile String agent; - - /** The warning date. */ - private volatile Date date; - - /** The special status. */ - private volatile Status status; - - /** The warning text. */ - private volatile String text; - - /** - * Constructor. - */ - public Warning() { - this.agent = null; - this.date = null; - this.status = null; - this.text = null; - } - - /** - * Returns the agent. Typically a caching agent. - * - * @return The agent. Typically a caching agent. - */ - public String getAgent() { - return agent; - } - - /** - * Returns the warning date. - * - * @return The warning date. - */ - public Date getDate() { - return date; - } - - /** - * Returns the special status. - * - * @return The special status. - */ - public Status getStatus() { - return status; - } - - /** - * Returns the warning text. - * - * @return The warning text. - */ - public String getText() { - return text; - } - - /** - * Sets the agent. Typically a caching agent. - * - * @param agent - * The agent. Typically a caching agent. - */ - public void setAgent(String agent) { - this.agent = agent; - } - - /** - * Sets the warning date. - * - * @param date - * The warning date. - */ - public void setDate(Date date) { - this.date = date; - } - - /** - * Sets the special status. - * - * @param status - * The special status. - */ - public void setStatus(Status status) { - this.status = status; - } - - /** - * Sets the warning text. - * - * @param text - * The warning text. - */ - public void setText(String text) { - this.text = text; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/package.html deleted file mode 100644 index 5fb7345243..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/data/package.html +++ /dev/null @@ -1,13 +0,0 @@ - - - Information exchanged by components. "A datum is an element of information - that is transferred from a component, or received by a component, via a - connector." Roy T. Fielding. -

- @since Restlet 1.0 - @see Source dissertation - @see User Guide - Mapping HTTP headers - @see User Guide - Data package - @deprecated Will be removed in the next 2.7/3.0 release. - - diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Engine.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Engine.java deleted file mode 100644 index ea99a51ed0..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Engine.java +++ /dev/null @@ -1,428 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.restlet.client.Client; -import org.restlet.client.Context; -import org.restlet.client.data.Protocol; -import org.restlet.client.engine.log.LoggerFacade; - -/** - * Engine supporting the Restlet API. The engine acts as a registry of various {@link Helper} types: - * {@link org.restlet.client.engine.connector.ClientHelper} classes.
- *
- * Note that by default the JULI logging mechanism is used, but it is possible to - * replace it by providing an alternate {@link LoggerFacade} implementation. For - * this, pass a system property named - * "org.restlet.client.engine.loggerFacadeClass" with the qualified class name as a - * value. - * - * @author Jerome Louvel - */ -public class Engine { - - public static final String DESCRIPTOR = "META-INF/services"; - - public static final String DESCRIPTOR_AUTHENTICATOR = "org.restlet.client.engine.security.AuthenticatorHelper"; - - public static final String DESCRIPTOR_AUTHENTICATOR_PATH = DESCRIPTOR + "/" - + DESCRIPTOR_AUTHENTICATOR; - - public static final String DESCRIPTOR_CLIENT = "org.restlet.client.engine.ClientHelper"; - - public static final String DESCRIPTOR_CLIENT_PATH = DESCRIPTOR + "/" - + DESCRIPTOR_CLIENT; - - public static final String DESCRIPTOR_CONVERTER = "org.restlet.client.engine.converter.ConverterHelper"; - - public static final String DESCRIPTOR_CONVERTER_PATH = DESCRIPTOR + "/" - + DESCRIPTOR_CONVERTER; - - public static final String DESCRIPTOR_PROTOCOL = "org.restlet.client.engine.ProtocolHelper"; - - public static final String DESCRIPTOR_PROTOCOL_PATH = DESCRIPTOR + "/" - + DESCRIPTOR_PROTOCOL; - - public static final String DESCRIPTOR_SERVER = "org.restlet.client.engine.ServerHelper"; - - public static final String DESCRIPTOR_SERVER_PATH = DESCRIPTOR + "/" - + DESCRIPTOR_SERVER; - - /** The registered engine. */ - private static volatile Engine instance = null; - - /** Major version number. */ - public static final String MAJOR_NUMBER = "2"; - - /** Minor version number. */ - public static final String MINOR_NUMBER = "7"; - - /** Release number. */ - public static final String RELEASE_NUMBER = "-SNAPSHOT"; - - /** Complete version. */ - public static final String VERSION = MAJOR_NUMBER + '.' + MINOR_NUMBER - + RELEASE_NUMBER; - - /** - * Clears the current Restlet Engine altogether. - */ - public static synchronized void clear() { - instance = null; - } - - - - - /** - * Returns an anonymous logger. By default, it calls {@link #getLogger(String)} with a "" name. - * - * @return The logger. - */ - public static Logger getAnonymousLogger() { - return getInstance().getLoggerFacade().getAnonymousLogger(); - } - - /** - * Returns the registered Restlet engine. - * - * @return The registered Restlet engine. - */ - public static synchronized Engine getInstance() { - Engine result = instance; - - if (result == null) { - result = register(); - } - - return result; - } - - - /** - * Returns a logger based on the class name of the given object. - * - * @param clazz - * The parent class. - * @return The logger. - */ - public static Logger getLogger(Class clazz) { - return getInstance().getLoggerFacade().getLogger(clazz); - } - - /** - * Returns a logger based on the class name of the given object. - * - * @param clazz - * The parent class. - * @param defaultLoggerName - * The default logger name to use if no one can be inferred from - * the class. - * @return The logger. - */ - public static Logger getLogger(Class clazz, String defaultLoggerName) { - return getInstance().getLoggerFacade().getLogger(clazz, - defaultLoggerName); - } - - /** - * Returns a logger based on the class name of the given object. - * - * @param object - * The parent object. - * @param defaultLoggerName - * The default logger name to use if no one can be inferred from - * the object class. - * @return The logger. - */ - public static Logger getLogger(Object object, String defaultLoggerName) { - return getInstance().getLoggerFacade().getLogger(object, - defaultLoggerName); - } - - /** - * Returns a logger based on the given logger name. - * - * @param loggerName - * The logger name. - * @return The logger. - */ - public static Logger getLogger(String loggerName) { - return getInstance().getLoggerFacade().getLogger(loggerName); - } - - - - - - /** - * Registers a new Restlet Engine. - * - * @return The registered engine. - */ - public static synchronized Engine register() { - return register(true); - } - - /** - * Registers a new Restlet Engine. - * - * @param discoverPlugins - * True if plug-ins should be automatically discovered. - * @return The registered engine. - */ - public static synchronized Engine register(boolean discoverPlugins) { - Engine result = new Engine(discoverPlugins); - instance = result; - return result; - } - - - - - - /** The logger facade to use. */ - private LoggerFacade loggerFacade; - - - /** List of available client connectors. */ - private final List> registeredClients; - - - /** List of available protocol helpers. */ - private final List registeredProtocols; - - - - /** - * Constructor that will automatically attempt to discover connectors. - */ - public Engine() { - this(true); - } - - /** - * Constructor. - * - * @param discoverHelpers - * True if helpers should be automatically discovered. - */ - public Engine(boolean discoverHelpers) { - // Prevent engine initialization code from recreating other engines - instance = this; - - // Instantiate the logger facade - this.loggerFacade = new LoggerFacade(); - this.registeredClients = new CopyOnWriteArrayList>(); - this.registeredProtocols = new CopyOnWriteArrayList(); - - if (discoverHelpers) { - try { - discoverConnectors(); - discoverProtocols(); - - } catch (IOException e) { - Context.getCurrentLogger() - .log(Level.WARNING, - "An error occurred while discovering the engine helpers.", - e); - } - } - } - - - /** - * Creates a new helper for a given client connector. - * - * @param client - * The client to help. - * @param helperClass - * Optional helper class name. - * @return The new helper. - */ - public org.restlet.client.engine.connector.ConnectorHelper createHelper( - Client client, String helperClass) { - org.restlet.client.engine.connector.ConnectorHelper result = null; - - if (!client.getProtocols().isEmpty()) { - org.restlet.client.engine.connector.ConnectorHelper connector = null; - for (final Iterator> iter = getRegisteredClients() - .iterator(); (result == null) && iter.hasNext();) { - connector = iter.next(); - - if (connector.getProtocols().containsAll(client.getProtocols())) { - result = new - org.restlet.client.engine.adapter.GwtHttpClientHelper(client); - } - } - - if (result == null) { - // Couldn't find a matching connector - StringBuilder sb = new StringBuilder(); - sb.append("No available client connector supports the required protocols: "); - - for (Protocol p : client.getProtocols()) { - sb.append("'").append(p.getName()).append("' "); - } - - sb.append(". Please add the JAR of a matching connector to your classpath."); - - Context.getCurrentLogger().log(Level.WARNING, sb.toString()); - } - } - - return result; - } - - - - /** - * Discovers the server and client connectors and register the default - * connectors. - * - * @throws IOException - */ - private void discoverConnectors() throws IOException { - registerDefaultConnectors(); - } - - - /** - * Discovers the protocol helpers and register the default helpers. - * - * @throws IOException - */ - private void discoverProtocols() throws IOException { - registerDefaultProtocols(); - } - - - - - /** - * Returns the logger facade to use. - * - * @return The logger facade to use. - */ - public LoggerFacade getLoggerFacade() { - return loggerFacade; - } - - - - /** - * Returns the list of available client connectors. - * - * @return The list of available client connectors. - */ - public List> getRegisteredClients() { - return this.registeredClients; - } - - - /** - * Returns the list of available protocol connectors. - * - * @return The list of available protocol connectors. - */ - public List getRegisteredProtocols() { - return this.registeredProtocols; - } - - - - - /** - * Registers the default client and server connectors. - */ - public void registerDefaultConnectors() { - - - - getRegisteredClients().add( - new org.restlet.client.engine.adapter.GwtHttpClientHelper(null)); - } - - - /** - * Registers the default protocols. - */ - public void registerDefaultProtocols() { - getRegisteredProtocols().add( - new org.restlet.client.engine.connector.HttpProtocolHelper()); - getRegisteredProtocols().add( - new org.restlet.client.engine.connector.WebDavProtocolHelper()); - } - - - - - - - /** - * Sets the logger facade to use. - * - * @param loggerFacade - * The logger facade to use. - */ - public void setLoggerFacade(LoggerFacade loggerFacade) { - this.loggerFacade = loggerFacade; - } - - - /** - * Sets the list of available client helpers. - * - * @param registeredClients - * The list of available client helpers. - */ - public void setRegisteredClients( - List> registeredClients) { - synchronized (this.registeredClients) { - if (registeredClients != this.registeredClients) { - this.registeredClients.clear(); - - if (registeredClients != null) { - this.registeredClients.addAll(registeredClients); - } - } - } - } - - - /** - * Sets the list of available protocol helpers. - * - * @param registeredProtocols - * The list of available protocol helpers. - */ - public void setRegisteredProtocols( - List registeredProtocols) { - synchronized (this.registeredProtocols) { - if (registeredProtocols != this.registeredProtocols) { - this.registeredProtocols.clear(); - - if (registeredProtocols != null) { - this.registeredProtocols.addAll(registeredProtocols); - } - } - } - } - - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Helper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Helper.java deleted file mode 100644 index a98121ad67..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/Helper.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine; - -/** - * Abstract marker class parent of all engine helpers. - * - * @author Jerome Louvel - */ -public abstract class Helper { - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/RestletHelper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/RestletHelper.java deleted file mode 100644 index c7ba53d029..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/RestletHelper.java +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine; - -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger; - -import org.restlet.client.Context; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.Restlet; -import org.restlet.client.data.Parameter; -import org.restlet.client.service.MetadataService; -import org.restlet.client.util.Series; - -/** - * Delegate used by API classes to get support from the implementation classes. - * Note that this is an SPI class that is not intended for public usage. - * - * @author Jerome Louvel - */ -public abstract class RestletHelper extends Helper { - - /** - * The map of attributes exchanged between the API and the Engine via this - * helper. - */ - private final Map attributes; - - /** - * The helped Restlet. - */ - private volatile T helped; - - /** - * Constructor. - * - * @param helped - * The helped Restlet. - */ - public RestletHelper(T helped) { - this.attributes = new ConcurrentHashMap(); - this.helped = helped; - } - - /** - * Returns the map of attributes exchanged between the API and the Engine - * via this helper. - * - * @return The map of attributes. - */ - public Map getAttributes() { - return this.attributes; - } - - /** - * Returns the helped Restlet context. - * - * @return The helped Restlet context. - */ - public Context getContext() { - return getHelped().getContext(); - } - - /** - * Returns the helped Restlet. - * - * @return The helped Restlet. - */ - public T getHelped() { - return this.helped; - } - - /** - * Returns the helped Restlet parameters. - * - * @return The helped Restlet parameters. - */ - public Series getHelpedParameters() { - Series result = null; - - if ((getHelped() != null) && (getHelped().getContext() != null)) { - result = getHelped().getContext().getParameters(); - } else { - result = new org.restlet.client.engine.util.ParameterSeries(); - } - - return result; - } - - /** - * Returns the helped Restlet logger. - * - * @return The helped Restlet logger. - */ - public Logger getLogger() { - if (getHelped() != null && getHelped().getContext() != null) { - return getHelped().getContext().getLogger(); - } - return Context.getCurrentLogger(); - } - - /** - * Returns the metadata service. If the parent application doesn't exist, a - * new instance is created. - * - * @return The metadata service. - */ - public MetadataService getMetadataService() { - MetadataService result = null; - - - if (result == null) { - result = new MetadataService(); - } - - return result; - } - - /** - * Handles a call. - * - * @param request - * The request to handle. - * @param response - * The response to update. - */ - public void handle(Request request, Response response) { - } - - /** - * Sets the helped Restlet. - * - * @param helpedRestlet - * The helped Restlet. - */ - public void setHelped(T helpedRestlet) { - this.helped = helpedRestlet; - } - - /** Start callback. */ - public abstract void start() throws Exception; - - /** Stop callback. */ - public abstract void stop() throws Exception; - - /** - * Update callback with less impact than a {@link #stop()} followed by a - * {@link #start()}. - */ - public abstract void update() throws Exception; -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/Adapter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/Adapter.java deleted file mode 100644 index 3e153cf964..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/Adapter.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.adapter; - -import java.util.logging.Logger; - -import org.restlet.client.Context; - -/** - * Converter between high-level and low-level HTTP calls. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Adapter { - - /** The context. */ - private volatile Context context; - - /** - * Constructor. - * - * @param context - * The context to use. - */ - public Adapter(Context context) { - this.context = context; - } - - /** - * Returns the context. - * - * @return The context. - */ - public Context getContext() { - return this.context; - } - - /** - * Returns the logger. - * - * @return The logger. - */ - public Logger getLogger() { - Logger result = (getContext() != null) ? getContext().getLogger() - : null; - return (result != null) ? result : Context.getCurrentLogger(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/Call.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/Call.java deleted file mode 100644 index 4a40f02e8d..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/Call.java +++ /dev/null @@ -1,478 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.adapter; - -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Logger; - -import org.restlet.client.Context; -import org.restlet.client.data.Header; -import org.restlet.client.data.Protocol; -import org.restlet.client.engine.header.HeaderUtils; -import org.restlet.client.representation.InputRepresentation; -import org.restlet.client.representation.Representation; -import org.restlet.client.util.Series; - -/** - * Low-level call for the HTTP connectors. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Call { - /** - * Returns true if the given exception is caused by a broken connection. - * - * @param exception - * The exception to inspect. - * @return True if the given exception is caused by a broken connection. - */ - public static boolean isBroken(Throwable exception) { - boolean result = false; - - // detect Tomcat and Jetty exceptions - if (exception instanceof IOException) { - String exceptionName = exception.getClass().getName(); - result = (exceptionName.endsWith("ClientAbortException") || - exceptionName.endsWith("jetty.io.EofException")); - } - - // check for known exception messages - if (!result) { - String exceptionMessage = exception.getMessage(); - if (exceptionMessage != null) { - result = (exceptionMessage.indexOf("Broken pipe") != -1) || - (exceptionMessage.equals("An existing connection must have been closed by the remote party.") || - (exceptionMessage.equals("An open connection has been abandonned by your network stack."))); - } - } - - if (!result && exception.getCause() != null) { - result = isBroken(exception.getCause()); - } - - return result; - } - - /** The client IP address. */ - private volatile String clientAddress; - - /** The client port. */ - private volatile int clientPort; - - /** Indicates if the call is confidential. */ - private volatile boolean confidential; - - /** The hostRef domain. */ - private volatile String hostDomain; - - /** The hostRef port. */ - private volatile int hostPort; - - /** The method. */ - private volatile String method; - - /** The exact protocol. */ - private volatile Protocol protocol; - - /** The reason phrase. */ - private volatile String reasonPhrase; - - /** The request headers. */ - private final Series

requestHeaders; - - /** The request URI. */ - private volatile String requestUri; - - /** The response headers. */ - private final Series
responseHeaders; - - /** The server IP address. */ - private volatile String serverAddress; - - /** The server port. */ - private volatile int serverPort; - - /** The status code. */ - private volatile int statusCode; - - - /** The protocol version. */ - private volatile String version; - - /** - * Constructor. - */ - public Call() { - this.hostDomain = null; - this.hostPort = -1; - this.clientAddress = null; - this.clientPort = -1; - this.confidential = false; - this.method = null; - this.protocol = null; - this.reasonPhrase = ""; - this.requestHeaders = new org.restlet.client.engine.util.HeaderSeries(); - this.requestUri = null; - this.responseHeaders = new org.restlet.client.engine.util.HeaderSeries(); - this.serverAddress = null; - this.serverPort = -1; - this.statusCode = 200; - this.version = null; - } - - /** - * Returns the client address.
- * Corresponds to the IP address of the requesting client. - * - * @return The client address. - */ - public String getClientAddress() { - return this.clientAddress; - } - - /** - * Returns the client port.
- * Corresponds to the TCP/IP port of the requesting client. - * - * @return The client port. - */ - public int getClientPort() { - return this.clientPort; - } - - /** - * Returns the host domain. - * - * @return The host domain. - */ - public String getHostDomain() { - return this.hostDomain; - } - - /** - * Returns the host port. - * - * @return The host port. - */ - public int getHostPort() { - return this.hostPort; - } - - /** - * Returns the logger. - * - * @return The logger. - */ - public Logger getLogger() { - return Context.getCurrentLogger(); - } - - /** - * Returns the request method. - * - * @return The request method. - */ - public String getMethod() { - return this.method; - } - - /** - * Returns the exact protocol (HTTP or HTTPS). - * - * @return The exact protocol (HTTP or HTTPS). - */ - public Protocol getProtocol() { - if (this.protocol == null) { - this.protocol = isConfidential() ? Protocol.HTTPS : Protocol.HTTP; - } - return this.protocol; - } - - /** - * Returns the reason phrase. - * - * @return The reason phrase. - */ - public String getReasonPhrase() { - return this.reasonPhrase; - } - - /** - * Returns the representation wrapping the given stream. - * - * @param stream - * The response input stream. - * @return The wrapping representation. - */ - protected Representation getRepresentation(InputStream stream) { - return new InputRepresentation(stream, null); - } - - - /** - * Returns the modifiable list of request headers. - * - * @return The modifiable list of request headers. - */ - public Series
getRequestHeaders() { - return this.requestHeaders; - } - - /** - * Returns the URI on the request line (most like a relative reference, but - * not necessarily). - * - * @return The URI on the request line. - */ - public String getRequestUri() { - return this.requestUri; - } - - /** - * Returns the modifiable list of server headers. - * - * @return The modifiable list of server headers. - */ - public Series
getResponseHeaders() { - return this.responseHeaders; - } - - /** - * Returns the response address.
- * Corresponds to the IP address of the responding server. - * - * @return The response address. - */ - public String getServerAddress() { - return this.serverAddress; - } - - /** - * Returns the server port. - * - * @return The server port. - */ - public int getServerPort() { - return this.serverPort; - } - - /** - * Returns the status code. - * - * @return The status code. - * @throws IOException - */ - public int getStatusCode() throws IOException { - return this.statusCode; - } - - - /** - * Returns the protocol version used. - * - * @return The protocol version used. - */ - public String getVersion() { - return this.version; - } - - /** - * Indicates if the client wants a persistent connection. - * - * @return True if the client wants a persistent connection. - */ - protected abstract boolean isClientKeepAlive(); - - /** - * Indicates if the confidentiality of the call is ensured (ex: via SSL). - * - * @return True if the confidentiality of the call is ensured (ex: via SSL). - */ - public boolean isConfidential() { - return this.confidential; - } - - - /** - * Indicates if both the client and the server want a persistent connection. - * - * @return True if the connection should be kept alive after the call - * processing. - */ - protected boolean isKeepAlive() { - return isClientKeepAlive() && isServerKeepAlive(); - } - - /** - * Indicates if the request entity is chunked. - * - * @return True if the request entity is chunked. - */ - protected boolean isRequestChunked() { - return HeaderUtils.isChunkedEncoding(getRequestHeaders()); - } - - /** - * Indicates if the response entity is chunked. - * - * @return True if the response entity is chunked. - */ - protected boolean isResponseChunked() { - return HeaderUtils.isChunkedEncoding(getResponseHeaders()); - } - - /** - * Indicates if the server wants a persistent connection. - * - * @return True if the server wants a persistent connection. - */ - protected abstract boolean isServerKeepAlive(); - - /** - * Sets the client address. - * - * @param clientAddress - * The client address. - */ - protected void setClientAddress(String clientAddress) { - this.clientAddress = clientAddress; - } - - /** - * Sets the client port. - * - * @param clientPort - * The client port. - */ - protected void setClientPort(int clientPort) { - this.clientPort = clientPort; - } - - /** - * Indicates if the confidentiality of the call is ensured (ex: via SSL). - * - * @param confidential - * True if the confidentiality of the call is ensured (ex: via - * SSL). - */ - protected void setConfidential(boolean confidential) { - this.confidential = confidential; - } - - /** - * Sets the host domain name. - * - * @param hostDomain - * The baseRef domain name. - */ - public void setHostDomain(String hostDomain) { - this.hostDomain = hostDomain; - } - - /** - * Sets the host port. - * - * @param hostPort - * The host port. - */ - public void setHostPort(int hostPort) { - this.hostPort = hostPort; - } - - /** - * Sets the request method. - * - * @param method - * The request method. - */ - protected void setMethod(String method) { - this.method = method; - } - - /** - * Sets the exact protocol used (HTTP or HTTPS). - * - * @param protocol - * The protocol. - */ - public void setProtocol(Protocol protocol) { - this.protocol = protocol; - } - - /** - * Sets the reason phrase. - * - * @param reasonPhrase - * The reason phrase. - */ - public void setReasonPhrase(String reasonPhrase) { - this.reasonPhrase = reasonPhrase; - } - - /** - * Sets the full request URI. - * - * @param requestUri - * The full request URI. - */ - protected void setRequestUri(String requestUri) { - if ((requestUri == null) || (requestUri.isEmpty())) { - requestUri = "/"; - } - - this.requestUri = requestUri; - } - - /** - * Sets the response address.
- * Corresponds to the IP address of the responding server. - * - * @param responseAddress - * The response address. - */ - public void setServerAddress(String responseAddress) { - this.serverAddress = responseAddress; - } - - /** - * Sets the server port. - * - * @param serverPort - * The server port. - */ - public void setServerPort(int serverPort) { - this.serverPort = serverPort; - } - - /** - * Sets the status code. - * - * @param code - * The status code. - */ - public void setStatusCode(int code) { - this.statusCode = code; - } - - - /** - * Sets the protocol version used. - * - * @param version - * The protocol version used. - */ - public void setVersion(String version) { - this.version = version; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/ClientAdapter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/ClientAdapter.java deleted file mode 100644 index c42a9717af..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/ClientAdapter.java +++ /dev/null @@ -1,198 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.adapter; - -import java.io.IOException; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.Uniform; -import org.restlet.client.data.Header; -import org.restlet.client.data.Method; -import org.restlet.client.data.Status; -import org.restlet.client.engine.header.HeaderConstants; -import org.restlet.client.engine.header.HeaderUtils; -import org.restlet.client.util.Series; - -/** - * Converter of high-level uniform calls into low-level HTTP client calls. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class ClientAdapter extends Adapter { - - /** - * Constructor. - * - * @param context - * The context to use. - */ - public ClientAdapter(Context context) { - super(context); - } - - /** - * Commits the changes to a handled HTTP client call back into the original - * uniform call. The default implementation first invokes the - * "addResponseHeaders" then asks the "htppCall" to send the response back - * to the client. - * - * @param httpCall - * The original HTTP call. - * @param request - * The high-level request. - * @param response - * The high-level response. - * @throws Exception - */ - public void commit(final ClientCall httpCall, Request request, - Response response) throws Exception { - if (httpCall != null) { - // Check if the call is asynchronous - if (request.isAsynchronous()) { - final Uniform userCallback = request.getOnResponse(); - - // Send the request to the client - httpCall.sendRequest(request, response, new Uniform() { - public void handle(Request request, Response response) { - try { - updateResponse(response, - new Status(httpCall.getStatusCode(), - httpCall.getReasonPhrase()), - httpCall); - - if (userCallback != null) { - userCallback.handle(request, response); - } - } catch (Throwable t) { - getLogger() - .log(Level.WARNING, - "Unexpected error or exception inside the user call back", - t); - } - } - }); - } else { - System.err - .println("HTTP client calls must have a callback in the GWT edition"); - - } - } - } - - /** - * Reads the response headers of a handled HTTP client call to update the - * original uniform call. - * - * @param httpCall - * The handled HTTP client call. - * @param response - * The high-level response to update. - */ - protected void readResponseHeaders(ClientCall httpCall, Response response) { - try { - Series
responseHeaders = httpCall.getResponseHeaders(); - - // Put the response headers in the call's attributes map - response.getAttributes().put(HeaderConstants.ATTRIBUTE_HEADERS, responseHeaders); - - HeaderUtils.copyResponseTransportHeaders(responseHeaders, response); - } catch (Exception e) { - getLogger() - .log(Level.FINE, - "An error occurred during the processing of the HTTP response.", - e); - response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, e); - } - } - - /** - * Converts a low-level HTTP call into a high-level uniform call. - * - * @param client - * The HTTP client that will handle the call. - * @param request - * The high-level request. - * @return A new high-level uniform call. - */ - public ClientCall toSpecific(HttpClientHelper client, Request request) { - // Create the low-level HTTP client call - ClientCall result = client.create(request); - - // Add the headers - if (result != null) { - HeaderUtils.addGeneralHeaders(request, result.getRequestHeaders()); - - if (request.getEntity() != null) { - HeaderUtils.addEntityHeaders(request.getEntity(), - result.getRequestHeaders()); - } - - // NOTE: This must stay at the end because the AWS challenge - // scheme requires access to all HTTP headers - HeaderUtils.addRequestHeaders(request, result.getRequestHeaders()); - } - - return result; - } - - /** - * Updates the response with information from the lower-level HTTP client - * call. - * - * @param response - * The response to update. - * @param status - * The response status to apply. - * @param httpCall - * The source HTTP client call. - * @throws IOException - */ - public void updateResponse(Response response, Status status, - ClientCall httpCall) { - // Send the request to the client - response.setStatus(status); - - // Get the server address - response.getServerInfo().setAddress(httpCall.getServerAddress()); - response.getServerInfo().setPort(httpCall.getServerPort()); - - // Read the response headers - readResponseHeaders(httpCall, response); - - // Set the entity - response.setEntity(httpCall.getResponseEntity(response)); - - // Release the representation's content for some obvious cases - if (response.getEntity() != null) { - if (response.getEntity().isEmpty()) { - response.getEntity().release(); - } else if (response.getRequest().getMethod().equals(Method.HEAD)) { - response.getEntity().release(); - } else if (response.getStatus().equals(Status.SUCCESS_NO_CONTENT)) { - response.getEntity().release(); - } else if (response.getStatus() - .equals(Status.SUCCESS_RESET_CONTENT)) { - response.getEntity().release(); - response.setEntity(null); - } else if (response.getStatus().equals( - Status.REDIRECTION_NOT_MODIFIED)) { - response.getEntity().release(); - } else if (response.getStatus().isInformational()) { - response.getEntity().release(); - response.setEntity(null); - } - } - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/ClientCall.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/ClientCall.java deleted file mode 100644 index 087053b9af..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/ClientCall.java +++ /dev/null @@ -1,226 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.adapter; - -import static org.restlet.client.data.Encoding.IDENTITY; -import static org.restlet.client.data.Status.REDIRECTION_NOT_MODIFIED; -import static org.restlet.client.data.Status.SUCCESS_NO_CONTENT; -import static org.restlet.client.data.Status.SUCCESS_RESET_CONTENT; -import static org.restlet.client.representation.Representation.UNKNOWN_SIZE; - -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.data.Header; -import org.restlet.client.data.Method; -import org.restlet.client.engine.header.HeaderConstants; -import org.restlet.client.engine.header.HeaderUtils; -import org.restlet.client.representation.Representation; -import org.restlet.client.util.Series; - -/** - * Low-level HTTP client call. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class ClientCall extends Call { - - /** - * Returns the local IP address or 127.0.0.1 if the resolution fails. - * - * @return The local IP address or 127.0.0.1 if the resolution fails. - */ - public static String getLocalAddress() { - return "127.0.0.1"; - } - - /** The parent HTTP client helper. */ - private volatile HttpClientHelper helper; - - /** - * Constructor setting the request address to the local host. - * - * @param helper - * The parent HTTP client helper. - * @param method - * The method name. - * @param requestUri - * The request URI. - */ - public ClientCall(HttpClientHelper helper, String method, String requestUri) { - this.helper = helper; - setMethod(method); - setRequestUri(requestUri); - setClientAddress(getLocalAddress()); - } - - /** - * Returns the content length of the request entity if know, {@link Representation#UNKNOWN_SIZE} otherwise. - * - * @return The request content length. - */ - protected long getContentLength() { - return HeaderUtils.getContentLength(getResponseHeaders()); - } - - /** - * Returns the HTTP client helper. - * - * @return The HTTP client helper. - */ - public HttpClientHelper getHelper() { - return this.helper; - } - - - - /** - * Returns the request entity string if it exists. - * - * @return The request entity string if it exists. - */ - public abstract String getRequestEntityString(); - - - /** - * Returns the response entity if available. Note that no metadata is - * associated by default, you have to manually set them from your headers. - * - * @param response - * the Response to get the entity from - * @return The response entity if available. - */ - public Representation getResponseEntity(Response response) { - Representation result = null; - // boolean available = false; - long size = UNKNOWN_SIZE; - - // Compute the content length - Series
responseHeaders = getResponseHeaders(); - String transferEncoding = responseHeaders.getFirstValue( - HeaderConstants.HEADER_TRANSFER_ENCODING, true); - if ((transferEncoding != null) - && !IDENTITY.getName().equalsIgnoreCase(transferEncoding)) { - size = UNKNOWN_SIZE; - } else { - size = getContentLength(); - } - - if (!getMethod().equals(Method.HEAD.getName()) - && !response.getStatus().isInformational() - && !response.getStatus().equals(REDIRECTION_NOT_MODIFIED) - && !response.getStatus().equals(SUCCESS_NO_CONTENT) - && !response.getStatus().equals(SUCCESS_RESET_CONTENT)) { - // Make sure that an InputRepresentation will not be instantiated - // while the stream is closed. - InputStream stream = getUnClosedResponseEntityStream(getResponseEntityStream(size)); - InputStream channel = null; - - if (stream != null) { - result = getRepresentation(stream); - } else if (channel != null) { - result = getRepresentation(channel); - } - } - - if (result != null) { - result.setSize(size); - - // Informs that the size has not been specified in the header. - if (size == UNKNOWN_SIZE) { - getLogger() - .fine("The length of the message body is unknown. The entity must be handled carefully and consumed entirely in order to surely release the connection."); - } - } - result = HeaderUtils.extractEntityHeaders(responseHeaders, result); - - return result; - } - - - /** - * Returns the response entity stream if it exists. - * - * @param size - * The expected entity size or -1 if unknown. - * @return The response entity stream if it exists. - */ - public abstract InputStream getResponseEntityStream(long size); - - /** - * Checks if the given input stream really contains bytes to be read. If so, - * returns the inputStream otherwise returns null. - * - * @param inputStream - * the inputStream to check. - * @return null if the given inputStream does not contain any byte, an - * inputStream otherwise. - */ - private InputStream getUnClosedResponseEntityStream(InputStream inputStream) { - InputStream result = null; - - if (inputStream != null) { - try { - if (inputStream.available() > 0) { - result = inputStream; - } - } catch (IOException ioe) { - getLogger().log(Level.FINER, "End of response entity stream.", - ioe); - } - - } - - return result; - } - - @Override - protected boolean isClientKeepAlive() { - return true; - } - - @Override - protected boolean isServerKeepAlive() { - return !HeaderUtils.isConnectionClose(getResponseHeaders()); - } - - - /** - * Sends the request to the client. Commits the request line, headers and - * optional entity and send them over the network. - * - * @param request - * The high-level request. - * @param response - * The high-level response. - * @param callback - * The callback invoked upon request completion. - */ - public void sendRequest(Request request, Response response, org.restlet.client.Uniform callback) throws Exception { - Context.getCurrentLogger().warning("Currently callbacks are not available for this connector."); - } - - /** - * Indicates if the request entity should be chunked. - * - * @return True if the request should be chunked - */ - protected boolean shouldRequestBeChunked(Request request) { - return request.isEntityAvailable() - && (request.getEntity() != null) - && !request.getEntity().hasKnownSize(); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/GwtClientCall.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/GwtClientCall.java deleted file mode 100644 index 606abf2272..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/GwtClientCall.java +++ /dev/null @@ -1,265 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.adapter; - -import java.io.InputStream; - -import org.restlet.client.Uniform; -import org.restlet.client.data.Reference; -import org.restlet.client.data.Status; -import org.restlet.client.engine.io.StringInputStream; -import org.restlet.client.util.Series; - -import com.google.gwt.http.client.Header; -import com.google.gwt.http.client.RequestBuilder; -import com.google.gwt.http.client.RequestCallback; -import com.google.gwt.http.client.Response; - -/** - * HTTP client connector call based on GWT's HTTP module. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class GwtClientCall extends ClientCall { - - /** - * Special reason phrase in case of error. - */ - private String errorReasonPhrase; - - /** - * Special status code set when an error occurs and we don't have a Response - * object. - */ - private int errorStatusCode; - - /** The wrapped HTTP request builder. */ - private final RequestBuilder requestBuilder; - - /** The GWT response. */ - private Response response; - - /** Indicates if the response headers were added. */ - private boolean responseHeadersAdded; - - /** - * Constructor. - * - * @param helper - * The parent HTTP client helper. - * @param method - * The method name. - * @param requestUri - * The request URI. - * @param hasEntity - * Indicates if the call will have an entity to send to the - * server. - */ - public GwtClientCall(GwtHttpClientHelper helper, String method, - String requestUri, boolean hasEntity) { - super(helper, method, requestUri); - - Reference requestRef = new Reference(requestUri); - if (requestRef.isRelative() - || requestRef.getScheme().startsWith("http")) { - this.requestBuilder = new RequestBuilder(method, requestUri) { - }; - this.requestBuilder.setTimeoutMillis(getHelper() - .getSocketConnectTimeoutMs()); - this.responseHeadersAdded = false; - } else { - throw new IllegalArgumentException( - "Only HTTP or HTTPS resource URIs are allowed here"); - } - } - - /** - * Returns a special reason phrase in case of error. - * - * @return A special reason phrase in case of error. - */ - private String getErrorReasonPhrase() { - return errorReasonPhrase; - } - - /** - * Returns a special status code set when an error occurs and we don't have - * a Response object. - * - * @return A special error status code. - */ - private int getErrorStatusCode() { - return this.errorStatusCode; - } - - /** - * Returns the HTTP client helper. - * - * @return The HTTP client helper. - */ - @Override - public GwtHttpClientHelper getHelper() { - return (GwtHttpClientHelper) super.getHelper(); - } - - /** - * Returns the response reason phrase. - * - * @return The response reason phrase. - */ - @Override - public String getReasonPhrase() { - return (getResponse() == null) ? getErrorReasonPhrase() : getResponse() - .getStatusText(); - } - - /** - * Returns the GWT request builder. - * - * @return The GWT request builder. - */ - public RequestBuilder getRequestBuilder() { - return this.requestBuilder; - } - - @Override - public String getRequestEntityString() { - return getRequestBuilder().getRequestData(); - } - - /** - * Returns the GWT response. - * - * @return The GWT response. - */ - public Response getResponse() { - return this.response; - } - - @Override - public InputStream getResponseEntityStream(long size) { - return (getResponse() == null) ? null : new StringInputStream( - getResponse().getText()); - } - - /** - * Returns the modifiable list of response headers. - * - * @return The modifiable list of response headers. - */ - @Override - public Series getResponseHeaders() { - final Series result = super - .getResponseHeaders(); - - if (!this.responseHeadersAdded && (getResponse() != null)) { - Header[] headers = getResponse().getHeaders(); - - for (int i = 0; i < headers.length; i++) { - if (headers[i] != null) { - result.add(headers[i].getName(), headers[i].getValue()); - } - } - - this.responseHeadersAdded = true; - } - - return result; - } - - @Override - public String getServerAddress() { - return new Reference(getRequestBuilder().getUrl()).getHostIdentifier(); - } - - @Override - public int getStatusCode() { - int result = -1; - if (getResponse() == null) { - result = getErrorStatusCode(); - } else if (1223 == getResponse().getStatusCode()) { - // IE XMLHTTP implementations turn 204 response code into bogus 1223 status code - result = 204; - } else { - result = getResponse().getStatusCode(); - } - return result; - } - - @Override - public void sendRequest(final org.restlet.client.Request request, - final org.restlet.client.Response response, - final Uniform onResponseCallback) throws Exception { - getRequestBuilder().setRequestData(request.isEntityAvailable() ? request.getEntity().getText() : null); - - // Set the request headers - for (final org.restlet.client.data.Header header : getRequestHeaders()) { - getRequestBuilder().setHeader(header.getName(), - getRequestHeaders().getValues(header.getName())); - } - - // Set the current call as the callback handler - getRequestBuilder().setCallback(new RequestCallback() { - - public void onError(com.google.gwt.http.client.Request gwtRequest, - Throwable exception) { - setErrorStatusCode(Status.CONNECTOR_ERROR_INTERNAL.getCode()); - setErrorReasonPhrase(exception == null ? "Unknown GWT HTTP communication error." - : exception.getMessage()); - onResponseCallback.handle(request, response); - } - - public void onResponseReceived( - com.google.gwt.http.client.Request gwtRequest, - Response gwtResponse) { - setResponse(gwtResponse); - onResponseCallback.handle(request, response); - } - - }); - - // Send the request - getRequestBuilder().send(); - } - - /** - * Sets a special reason phrase in case of error. - * - * @param errorReasonPhrase - * Special reason phrase in case of error. - */ - private void setErrorReasonPhrase(String errorReasonPhrase) { - this.errorReasonPhrase = errorReasonPhrase; - } - - /** - * Sets a special status code set when an error occurs and we don't have a - * Response object. - * - * @param errorStatusCode - * Special error status code. - */ - private void setErrorStatusCode(int errorStatusCode) { - this.errorStatusCode = errorStatusCode; - } - - /** - * Sets the GWT response. - * - * @param response - * The GWT response. - */ - public void setResponse(Response response) { - this.response = response; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/GwtHttpClientHelper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/GwtHttpClientHelper.java deleted file mode 100644 index de94a407db..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/GwtHttpClientHelper.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.adapter; - -import org.restlet.client.Client; -import org.restlet.client.Request; -import org.restlet.client.data.ChallengeResponse; -import org.restlet.client.data.ChallengeScheme; -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Protocol; -import org.restlet.client.engine.header.HeaderConstants; -import org.restlet.client.engine.util.Base64; - -/** - * HTTP client connector using the GWT's HTTP module. Here is the list of - * parameters that are supported: - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Parameter nameValue typeDefault valueDescription
timeoutint0Sets the request timeout to a specified timeout, in milliseconds. A - * timeout of zero is interpreted as an infinite timeout.
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class GwtHttpClientHelper extends HttpClientHelper { - /** - * Constructor. - * - * @param client - * The client to help. - */ - public GwtHttpClientHelper(Client client) { - super(client); - getProtocols().add(Protocol.HTTP); - getProtocols().add(Protocol.HTTPS); - } - - /** - * Creates a low-level HTTP client call from a high-level uniform call. - * - * @param request - * The high-level request. - * @return A low-level HTTP client call. - */ - @Override - public ClientCall create(Request request) { - GwtClientCall result = null; - - try { - result = new GwtClientCall(this, request.getMethod().toString(), - request.getResourceRef().toString(), - request.isEntityAvailable()); - - // If a challenge response is provided, update the GWT request builder - ChallengeResponse challenge = request.getChallengeResponse(); - if (challenge != null) { - if (ChallengeScheme.HTTP_BASIC.equals(challenge.getScheme())) { - // Handle manually the generation of the "Authorization" - // header, since the browser does not cope with that. - byte[] bytes = (challenge.getIdentifier() + ":" + String.valueOf(challenge.getSecret())) - .getBytes(CharacterSet.ISO_8859_1.getName()); - result.getRequestBuilder().setHeader( - HeaderConstants.HEADER_AUTHORIZATION, - "Basic " + Base64.encode(bytes, false)); - } else if (challenge.getRawValue() != null && challenge.getScheme() != null) { - result.getRequestBuilder().setHeader( - HeaderConstants.HEADER_AUTHORIZATION, - challenge.getScheme().getTechnicalName() + " " + challenge.getRawValue()); - } else { - // In this case the login and password are simply concatenated to the URL. - result.getRequestBuilder().setUser(challenge.getIdentifier()); - result.getRequestBuilder().setPassword(String.valueOf(challenge.getSecret())); - } - } - - } catch (Exception ioe) { - System.err.println("Unable to create the HTTP client call"); - } - - return result; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/HttpClientHelper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/HttpClientHelper.java deleted file mode 100644 index 4d50451d00..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/HttpClientHelper.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.adapter; - -import java.util.logging.Level; - -import org.restlet.client.Client; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.data.Status; -import org.restlet.client.engine.connector.ClientHelper; - -/** - * Base HTTP client connector. Here is the list of parameters that are - * supported. They should be set in the Client's context before it is started: - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Parameter nameValue typeDefault valueDescription
adapterStringorg.restlet.client.engine.adapter.ClientAdapterClass name of the adapter of low-level HTTP calls into high level - * requests and responses.
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class HttpClientHelper extends ClientHelper { - - /** The adapter from uniform calls to HTTP calls. */ - private volatile ClientAdapter adapter; - - /** - * Constructor. - * - * @param client - * The client to help. - */ - public HttpClientHelper(Client client) { - super(client); - this.adapter = null; - } - - /** - * Creates a low-level HTTP client call from a high-level request. - * - * @param request - * The high-level request. - * @return A low-level HTTP client call. - */ - public abstract ClientCall create(Request request); - - /** - * Returns the adapter from uniform calls to HTTP calls. - * - * @return the adapter from uniform calls to HTTP calls. - */ - public ClientAdapter getAdapter() throws Exception { - if (this.adapter == null) { - - this.adapter = new ClientAdapter(getContext()); - } - - return this.adapter; - } - - /** - * Returns the connection timeout. Defaults to 15000. - * - * @return The connection timeout. - */ - public int getSocketConnectTimeoutMs() { - int result = 0; - - if (getHelpedParameters().getNames().contains("socketConnectTimeoutMs")) { - result = Integer.parseInt(getHelpedParameters().getFirstValue( - "socketConnectTimeoutMs", "15000")); - } - - return result; - } - - @Override - public void handle(Request request, Response response) { - try { - ClientCall clientCall = getAdapter().toSpecific(this, request); - getAdapter().commit(clientCall, request, response); - } catch (Exception e) { - getLogger().log(Level.INFO, - "Error while handling an HTTP client call", e); - response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, e); - } - } - - /** - * Sets the adapter from uniform calls to HTTP calls. - * - * @param adapter - * The adapter to set. - */ - public void setAdapter(ClientAdapter adapter) { - this.adapter = adapter; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/package.html deleted file mode 100644 index 8496643f46..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/adapter/package.html +++ /dev/null @@ -1,8 +0,0 @@ - - -Adapters between low-level HTTP calls and high-level Restlet Request and -Response objects. -

@since Restlet 2.0 -@deprecated Will be removed in the next 2.7/3.0 release. - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/MetadataExtension.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/MetadataExtension.java deleted file mode 100644 index f9d99505f6..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/MetadataExtension.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.application; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Encoding; -import org.restlet.client.data.Language; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Metadata; - -/** - * Associates an extension name and a metadata. - * - * @author Alex Milowski (alexml@milowski.org) - * @author Thierry Boileau - */ -public class MetadataExtension { - - /** The mapped metadata. */ - private final Metadata metadata; - - /** The name of the extension. */ - private final String name; - - /** - * Constructor. - * - * @param name - * The extension name. - * @param metadata - * The metadata. - */ - public MetadataExtension(String name, Metadata metadata) { - this.name = name; - this.metadata = metadata; - } - - /** - * Returns the character set. - * - * @return the character set. - */ - public CharacterSet getCharacterSet() { - return (CharacterSet) getMetadata(); - } - - /** - * Returns the encoding. - * - * @return the encoding. - */ - public Encoding getEncoding() { - return (Encoding) getMetadata(); - } - - /** - * Returns the language. - * - * @return the language. - */ - public Language getLanguage() { - return (Language) getMetadata(); - } - - /** - * Returns the media type. - * - * @return the media type. - */ - public MediaType getMediaType() { - return (MediaType) getMetadata(); - } - - /** - * Returns the metadata. - * - * @return the metadata. - */ - public Metadata getMetadata() { - return this.metadata; - } - - /** - * Returns the extension name. - * - * @return The extension name. - */ - public String getName() { - return this.name; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/StatusInfo.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/StatusInfo.java deleted file mode 100644 index 6b5f69ad00..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/StatusInfo.java +++ /dev/null @@ -1,220 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.application; - -import java.io.Serializable; - -import org.restlet.client.data.Status; - -/** - * - * Representation of a {@link Status}. - * - * @author Manuel Boillod - */ -public class StatusInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** The specification code. */ - private volatile int code; - - /** The email address of the administrator to contact in case of error. */ - private volatile String contactEmail; - - /** The longer description. */ - private volatile String description; - - /** The home URI to propose in case of error. */ - private volatile String homeRef; - - /** The short reason phrase. */ - private volatile String reasonPhrase; - - /** The URI of the specification describing the method. */ - private volatile String uri; - - /** - * Empty Constructor - */ - public StatusInfo() { - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param description - * The longer description. - * @param reasonPhrase - * The short reason phrase. - */ - public StatusInfo(int code, String description, String reasonPhrase) { - this(code, description, reasonPhrase, null, null, null); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param description - * The longer description. - * @param reasonPhrase - * The short reason phrase. - * @param contactEmail - * The email address of the administrator to contact in case of - * error. - * @param homeRef - * The home URI to propose in case of error. - */ - public StatusInfo(int code, String description, String reasonPhrase, - String uri, String contactEmail, String homeRef) { - super(); - this.code = code; - this.description = description; - this.reasonPhrase = reasonPhrase; - this.uri = uri; - this.contactEmail = contactEmail; - this.homeRef = homeRef; - } - - /** - * Constructor. - * - * @param status - * The represented status. - */ - public StatusInfo(Status status) { - this(status, null, null); - } - - /** - * Constructor. - * - * @param status - * The represented status. - * @param contactEmail - * The email address of the administrator to contact in case of - * error. - * @param homeRef - * The home URI to propose in case of error. - */ - public StatusInfo(Status status, String contactEmail, String homeRef) { - this(status.getCode(), status.getDescription(), status - .getReasonPhrase(), status.getUri(), contactEmail, homeRef); - } - - /** - * Returns the code of the status. - * - * @return The code of the status. - */ - public int getCode() { - return code; - } - - /** - * Returns the email address of the administrator to contact in case of - * error. - * - * @return The email address. - */ - public String getContactEmail() { - return contactEmail; - } - - /** - * Returns the description of the status. - * - * @return The description of the status. - */ - public String getDescription() { - return description; - } - - /** - * Returns the home URI to propose in case of error. - * - * @return The home URI. - */ - public String getHomeRef() { - return homeRef; - } - - /** - * Returns the short description of the status. - * - * @return The short description of the status. - */ - public String getReasonPhrase() { - return reasonPhrase; - } - - /** - * Returns the URI of the specification describing the status. - * - * @return The URI of the specification describing the status. - */ - public String getUri() { - return this.uri; - } - - /** - * Sets the code of the status. - * - * @param code - * The code of the status. - */ - public void setCode(int code) { - this.code = code; - } - - /** - * Sets the email address of the administrator to contact in case of error. - * - * @param email - * The email address. - */ - public void setContactEmail(String email) { - this.contactEmail = email; - } - - /** - * Sets the description of the status. - * - * @param description - * The description of the status. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Sets the home URI to propose in case of error. - * - * @param homeRef - * The home URI. - */ - public void setHomeRef(String homeRef) { - this.homeRef = homeRef; - } - - /** - * Sets the short description of the status. - * - * @param reasonPhrase - * The short description of the status. - */ - public void setReasonPhrase(String reasonPhrase) { - this.reasonPhrase = reasonPhrase; - } -} \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ClientHelper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ClientHelper.java deleted file mode 100644 index 3632428ad9..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ClientHelper.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.connector; - -import org.restlet.client.Client; - -/** - * Client connector helper. Base client helper based on NIO non blocking - * sockets. Here is the list of parameters that are supported. They should be - * set in the Client's context before it is started: - * - * - * - * - * - * - * - *
Parameter nameValue typeDefault valueDescription
- * - * @author Jerome Louvel - */ -public class ClientHelper extends ConnectorHelper { - - /** - * Constructor. - * - * @param client - * The client to help. - */ - public ClientHelper(Client client) { - super(client); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ConnectorHelper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ConnectorHelper.java deleted file mode 100644 index 4fbe8dbd73..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ConnectorHelper.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.connector; - -import java.util.List; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -import org.restlet.client.Connector; -import org.restlet.client.Context; -import org.restlet.client.data.Protocol; -import org.restlet.client.engine.RestletHelper; - -/** - * Base connector helper. - * - * @author Jerome Louvel - */ -public abstract class ConnectorHelper extends - RestletHelper { - - - /** The protocols simultaneously supported. */ - private final List protocols; - - /** - * Constructor. - */ - public ConnectorHelper(T connector) { - super(connector); - this.protocols = new CopyOnWriteArrayList(); - } - - /** - * Returns the helped Restlet context. - * - * @return The helped Restlet context. - */ - @Override - public Context getContext() { - return null; - } - - /** - * Returns the protocols simultaneously supported. - * - * @return The protocols simultaneously supported. - */ - public List getProtocols() { - return this.protocols; - } - - @Override - public void start() throws Exception { - } - - @Override - public void stop() throws Exception { - } - - @Override - public void update() throws Exception { - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/HttpProtocolHelper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/HttpProtocolHelper.java deleted file mode 100644 index 2604cf561d..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/HttpProtocolHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.connector; - -import org.restlet.client.data.Method; - -/** - * Protocol helper for the HTTP protocol. - * - * @author Thierry Boileau - * - */ -public class HttpProtocolHelper extends ProtocolHelper { - - @Override - public void registerMethods() { - Method.register(Method.ALL); - Method.register(Method.CONNECT); - Method.register(Method.DELETE); - Method.register(Method.GET); - Method.register(Method.HEAD); - Method.register(Method.OPTIONS); - Method.register(Method.PATCH); - Method.register(Method.POST); - Method.register(Method.PUT); - Method.register(Method.TRACE); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/Method.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/Method.java deleted file mode 100644 index 50b574dc39..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/Method.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.connector; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.restlet.client.resource.Delete; -import org.restlet.client.resource.Get; -import org.restlet.client.resource.Options; -import org.restlet.client.resource.Patch; -import org.restlet.client.resource.Post; -import org.restlet.client.resource.Put; - -/** - * Meta annotation to declare method annotations. - * - * @see Get - * @see Post - * @see Put - * @see Delete - * @see Options - * @see Patch - * @author Jerome Louvel - */ -@Target(ElementType.ANNOTATION_TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface Method { - - /** - * Method name identified by the underlying annotation. - */ - String value(); - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ProtocolHelper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ProtocolHelper.java deleted file mode 100644 index f38c78e28f..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/ProtocolHelper.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.connector; - -import org.restlet.client.engine.Helper; - -/** - * Protocol helper. - * - * @author Thierry Boileau - * - */ -public abstract class ProtocolHelper extends Helper { - - /** - * Constructor. - */ - public ProtocolHelper() { - super(); - registerMethods(); - } - - /** - * Register all supported methods. The implementation relies on the - * {@link org.restlet.client.data.Method#register(org.restlet.client.data.Method)} method. - */ - public abstract void registerMethods(); - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/WebDavProtocolHelper.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/WebDavProtocolHelper.java deleted file mode 100644 index 13ebce0aaf..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/WebDavProtocolHelper.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.connector; - -import org.restlet.client.data.Method; - -/** - * Protocol helper for the WEBDAV protocol. - * - * @author Thierry Boileau - * @deprecated Will be removed in next version. - */ -@Deprecated -public class WebDavProtocolHelper extends ProtocolHelper { - - @Override - public void registerMethods() { - Method.register(Method.COPY); - Method.register(Method.LOCK); - Method.register(Method.MKCOL); - Method.register(Method.MOVE); - Method.register(Method.PROPFIND); - Method.register(Method.PROPPATCH); - Method.register(Method.UNLOCK); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/package.html deleted file mode 100644 index 9399adcc06..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/connector/package.html +++ /dev/null @@ -1,10 +0,0 @@ - - -Integration with Java URLConnection class. Provides FTP, HTTP and HTTPS -client connectors. - -@since Restlet 1.0 -@see URLConnection Javadocs -@see User Guide - Net extension - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CacheDirectiveReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CacheDirectiveReader.java deleted file mode 100644 index f2c1e63797..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CacheDirectiveReader.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Collection; - -import org.restlet.client.data.CacheDirective; -import org.restlet.client.data.Header; - -/** - * Cache directive header reader. - * - * @author Jerome Louvel - */ -public class CacheDirectiveReader extends HeaderReader { - - /** - * Adds values to the given collection. - * - * @param header - * The header to read. - * @param collection - * The collection to update. - */ - public static void addValues(Header header, - Collection collection) { - new CacheDirectiveReader(header.getValue()).addValues(collection); - } - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public CacheDirectiveReader(String header) { - super(header); - } - - @Override - public CacheDirective readValue() throws IOException { - return readNamedValue(CacheDirective.class); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CacheDirectiveWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CacheDirectiveWriter.java deleted file mode 100644 index 256a31ea6c..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CacheDirectiveWriter.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.List; - -import org.restlet.client.data.CacheDirective; - -/** - * Cache directive header writer. - * - * @author Thierry Boileau - */ -public class CacheDirectiveWriter extends HeaderWriter { - - /** - * Writes a list of cache directives with a comma separator. - * - * @param directives - * The list of cache directives. - * @return The formatted list of cache directives. - */ - public static String write(List directives) { - return new CacheDirectiveWriter().append(directives).toString(); - } - - @Override - public CacheDirectiveWriter append(CacheDirective directive) { - appendExtension(directive); - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ChallengeRequestReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ChallengeRequestReader.java deleted file mode 100644 index b02f8cb72d..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ChallengeRequestReader.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import static org.restlet.client.engine.header.HeaderUtils.isSpace; - -import java.io.IOException; - -import org.restlet.client.data.ChallengeRequest; -import org.restlet.client.data.ChallengeScheme; -import org.restlet.client.data.Parameter; - -/** - * Challenge request header reader. - * - * @author Thierry Boileau - */ -public class ChallengeRequestReader extends HeaderReader { - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public ChallengeRequestReader(String header) { - super(header); - } - - @Override - public ChallengeRequest readValue() throws IOException { - ChallengeRequest result = null; - - // The challenge is that this header is a comma separated lst of - // challenges, and that each challenges is also a comma separated list, - // but of parameters. - skipSpaces(); - if (peek() != -1) { - String scheme = readToken(); - result = new ChallengeRequest(new ChallengeScheme("HTTP_" + scheme, - scheme)); - skipSpaces(); - - // Header writer that will reconstruct the raw value of a challenge. - HeaderWriter w = new HeaderWriter() { - @Override - public HeaderWriter append(Parameter value) { - appendExtension(value); - return this; - } - }; - - boolean stop = false; - while (peek() != -1 && !stop) { - boolean sepSkipped = skipValueSeparator(); - // Record the start of the segment - mark(); - // Read a token and the next character. - readToken(); - int nextChar = read(); - reset(); - if (isSpace(nextChar)) { - // A new scheme has been discovered. - stop = true; - } else { - // The next segment is considered as a parameter - if (sepSkipped) { - // Add the skipped value separator. - w.appendValueSeparator(); - } - // Append the parameter - w.append(readParameter()); - } - } - result.setRawValue(w.toString()); - w.close(); - } - - return result; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ChallengeWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ChallengeWriter.java deleted file mode 100644 index bd964fe85c..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ChallengeWriter.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import org.restlet.client.data.ChallengeRequest; -import org.restlet.client.data.Parameter; - -/** - * Authentication challenge header writer. - * - * @author Jerome Louvel - */ -public class ChallengeWriter extends HeaderWriter { - - /** Indicates if the first challenge parameter is written. */ - private volatile boolean firstChallengeParameter; - - /** - * Constructor. - */ - public ChallengeWriter() { - this.firstChallengeParameter = true; - } - - @Override - public HeaderWriter append(ChallengeRequest value) { - return this; - } - - /** - * Appends a new challenge parameter, prefixed with a comma. The value is - * separated from the name by an '=' character. - * - * @param parameter - * The parameter. - * @return This writer. - */ - public ChallengeWriter appendChallengeParameter(Parameter parameter) { - return appendChallengeParameter(parameter.getName(), - parameter.getValue()); - } - - /** - * Appends a new parameter, prefixed with a comma. - * - * @param name - * The parameter name. - * @return The current builder. - */ - public ChallengeWriter appendChallengeParameter(String name) { - appendChallengeParameterSeparator(); - appendToken(name); - return this; - } - - /** - * Appends a new parameter, prefixed with a comma. The value is separated - * from the name by an '=' character. - * - * @param name - * The parameter name. - * @param value - * The parameter value. - * @return This writer. - */ - public ChallengeWriter appendChallengeParameter(String name, String value) { - appendChallengeParameterSeparator(); - - if (name != null) { - appendToken(name); - } - - if (value != null) { - append('='); - appendToken(value); - } - - return this; - } - - /** - * Appends a comma as a separator if the first parameter has already been - * written. - * - * @return This writer. - */ - public ChallengeWriter appendChallengeParameterSeparator() { - if (isFirstChallengeParameter()) { - setFirstChallengeParameter(false); - } else { - append(", "); - } - - return this; - } - - /** - * Appends a new parameter, prefixed with a comma. The value is separated - * from the name by an '=' character. - * - * @param parameter - * The parameter. - * @return This writer. - */ - public ChallengeWriter appendQuotedChallengeParameter(Parameter parameter) { - return appendQuotedChallengeParameter(parameter.getName(), - parameter.getValue()); - } - - /** - * Appends a new parameter, prefixed with a comma. The value is quoted and - * separated from the name by an '=' character. - * - * @param name - * The parameter name. - * @param value - * The parameter value to quote. - * @return This writer. - */ - public ChallengeWriter appendQuotedChallengeParameter(String name, - String value) { - appendChallengeParameterSeparator(); - - if (name != null) { - appendToken(name); - } - - if (value != null) { - append('='); - appendQuotedString(value); - } - - return this; - } - - /** - * Indicates if the first comma-separated value is written. - * - * @return True if the first comma-separated value is written. - */ - public boolean isFirstChallengeParameter() { - return firstChallengeParameter; - } - - /** - * Indicates if the first comma-separated value is written. - * - * @param firstValue - * True if the first comma-separated value is written. - */ - public void setFirstChallengeParameter(boolean firstValue) { - this.firstChallengeParameter = firstValue; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ContentType.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ContentType.java deleted file mode 100644 index 719db9421b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ContentType.java +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.MediaType; -import org.restlet.client.representation.Representation; - -/** - * Association of a media type, a character set and modifiers. - * - * @author Jerome Louvel - */ -public class ContentType { - - /** - * Parses the given content type header and returns the character set. - * - * @param contentType - * The content type header to parse. - * @return The character set. - */ - public static CharacterSet readCharacterSet(String contentType) { - return new ContentType(contentType).getCharacterSet(); - } - - /** - * Parses the given content type header and returns the media type. - * - * @param contentType - * The content type header to parse. - * @return The media type. - */ - public static MediaType readMediaType(String contentType) { - return new ContentType(contentType).getMediaType(); - } - - /** - * Writes the HTTP "Content-Type" header. - * - * @param mediaType - * The representation media type. - * @param characterSet - * The representation character set. - * @return The HTTP "Content-Type" header. - */ - public static String writeHeader(MediaType mediaType, - CharacterSet characterSet) { - String result = mediaType.toString(); - - // Specify the character set parameter if required - if ((mediaType.getParameters().getFirstValue("charset") == null) - && (characterSet != null)) { - result = result + "; charset=" + characterSet.getName(); - } - - return result; - - } - - /** - * Writes the HTTP "Content-Type" header. - * - * @param representation - * The related representation. - * @return The HTTP "Content-Type" header. - */ - public static String writeHeader(Representation representation) { - return writeHeader(representation.getMediaType(), - representation.getCharacterSet()); - } - - /** - * The content character set. - */ - private volatile CharacterSet characterSet; - - /** - * The content media type. - */ - private volatile MediaType mediaType; - - /** - * Constructor. - * - * @param mediaType - * The media type. - * @param characterSet - * The character set. - */ - public ContentType(MediaType mediaType, CharacterSet characterSet) { - this.mediaType = mediaType; - this.characterSet = characterSet; - } - - /** - * Constructor. - * - * @param representation - * The representation. - */ - public ContentType(Representation representation) { - this(representation.getMediaType(), representation.getCharacterSet()); - } - - /** - * Constructor. - * - * @param headerValue - * The "Content-type" header to parse. - */ - public ContentType(String headerValue) { - try { - ContentTypeReader ctr = new ContentTypeReader(headerValue); - ContentType ct = ctr.readValue(); - - if (ct != null) { - this.mediaType = ct.getMediaType(); - this.characterSet = ct.getCharacterSet(); - } - } catch (IOException ioe) { - throw new IllegalArgumentException( - "The Content Type could not be read.", ioe); - } - } - - /** - * Returns the character set. - * - * @return The character set. - */ - public CharacterSet getCharacterSet() { - return this.characterSet; - } - - /** - * Returns the media type. - * - * @return The media type. - */ - public MediaType getMediaType() { - return this.mediaType; - } - - @Override - public String toString() { - return writeHeader(getMediaType(), getCharacterSet()); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ContentTypeReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ContentTypeReader.java deleted file mode 100644 index 7d19ee5da8..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ContentTypeReader.java +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Parameter; -import org.restlet.client.util.Series; - -/** - * Content type header reader. - * - * @author Jerome Louvel - */ -public class ContentTypeReader extends HeaderReader { - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public ContentTypeReader(String header) { - super(header); - } - - /** - * Creates a content type. - * - * @param mediaType - * The media type name. - * @param parameters - * The parameters parsed. - * @return The content type. - */ - private ContentType createContentType(StringBuilder mediaType, - Series parameters) { - // Attempt to extract the character set - CharacterSet characterSet = null; - - if (parameters != null) { - String charSet = parameters.getFirstValue("charset"); - - if (charSet != null) { - parameters.removeAll("charset"); - characterSet = new CharacterSet(charSet); - } - - return new ContentType(new MediaType(mediaType.toString(), - parameters), characterSet); - } - - return new ContentType(new MediaType(mediaType.toString()), null); - } - - @Override - public ContentType readValue() throws IOException { - ContentType result = null; - - boolean readingMediaType = true; - boolean readingParamName = false; - boolean readingParamValue = false; - - StringBuilder mediaTypeBuffer = new StringBuilder(); - StringBuilder paramNameBuffer = null; - StringBuilder paramValueBuffer = null; - - Series parameters = null; - String nextValue = readRawValue(); - int nextIndex = 0; - - if (nextValue != null) { - int nextChar = nextValue.charAt(nextIndex++); - - while (result == null) { - if (readingMediaType) { - if (nextChar == -1) { - if (mediaTypeBuffer.length() > 0) { - // End of metadata section - // No parameters detected - result = createContentType(mediaTypeBuffer, null); - paramNameBuffer = new StringBuilder(); - } else { - // Ignore empty metadata name - } - } else if (nextChar == ';') { - if (mediaTypeBuffer.length() > 0) { - // End of mediaType section - // Parameters detected - readingMediaType = false; - readingParamName = true; - paramNameBuffer = new StringBuilder(); - parameters = new - org.restlet.client.engine.util.ParameterSeries(); - } else { - throw new IOException( - "Empty mediaType name detected."); - } - } else if (HeaderUtils.isSpace(nextChar)) { - // Ignore spaces - } else if (HeaderUtils.isText(nextChar)) { - mediaTypeBuffer.append((char) nextChar); - } else { - throw new IOException( - "The " - + (char) nextChar - + " character isn't allowed in a media type name."); - } - } else if (readingParamName) { - if (nextChar == '=') { - if (paramNameBuffer.length() > 0) { - // End of parameter name section - readingParamName = false; - readingParamValue = true; - paramValueBuffer = new StringBuilder(); - } else { - throw new IOException( - "Empty parameter name detected."); - } - } else if (nextChar == -1) { - if (paramNameBuffer.length() > 0) { - // End of parameters section - parameters.add(Parameter.create(paramNameBuffer, - null)); - result = createContentType(mediaTypeBuffer, - parameters); - } else if (paramNameBuffer.length() == 0) { - result = createContentType(mediaTypeBuffer, - parameters); - } else { - throw new IOException( - "Empty parameter name detected."); - } - } else if (nextChar == ';') { - // End of parameter - parameters.add(Parameter.create(paramNameBuffer, null)); - paramNameBuffer = new StringBuilder(); - readingParamName = true; - readingParamValue = false; - } else if (HeaderUtils.isSpace(nextChar) - && (paramNameBuffer.length() == 0)) { - // Ignore white spaces - } else if (HeaderUtils.isTokenChar(nextChar)) { - paramNameBuffer.append((char) nextChar); - } else { - throw new IOException( - "The \"" - + (char) nextChar - + "\" character isn't allowed in a media type parameter name."); - } - } else if (readingParamValue) { - if (nextChar == -1) { - if (paramValueBuffer.length() > 0) { - // End of parameters section - parameters.add(Parameter.create(paramNameBuffer, - paramValueBuffer)); - result = createContentType(mediaTypeBuffer, - parameters); - } else { - throw new IOException( - "Empty parameter value detected"); - } - } else if (nextChar == ';') { - // End of parameter - parameters.add(Parameter.create(paramNameBuffer, - paramValueBuffer)); - paramNameBuffer = new StringBuilder(); - readingParamName = true; - readingParamValue = false; - } else if ((nextChar == '"') - && (paramValueBuffer.length() == 0)) { - // Parse the quoted string - boolean done = false; - boolean quotedPair = false; - - while ((!done) && (nextChar != -1)) { - nextChar = (nextIndex < nextValue.length()) ? nextValue - .charAt(nextIndex++) : -1; - - if (quotedPair) { - // End of quoted pair (escape sequence) - if (HeaderUtils.isText(nextChar)) { - paramValueBuffer.append((char) nextChar); - quotedPair = false; - } else { - throw new IOException( - "Invalid character \"" - + (char) nextChar - + "\" detected in quoted string. Please check your value"); - } - } else if (HeaderUtils.isDoubleQuote(nextChar)) { - // End of quoted string - done = true; - } else if (nextChar == '\\') { - // Begin of quoted pair (escape sequence) - quotedPair = true; - } else if (HeaderUtils.isText(nextChar)) { - paramValueBuffer.append((char) nextChar); - } else { - throw new IOException( - "Invalid character \"" - + (char) nextChar - + "\" detected in quoted string. Please check your value"); - } - } - } else if (HeaderUtils.isTokenChar(nextChar)) { - paramValueBuffer.append((char) nextChar); - } else { - throw new IOException( - "The \"" - + (char) nextChar - + "\" character isn't allowed in a media type parameter value."); - } - } - - nextChar = (nextIndex < nextValue.length()) ? nextValue - .charAt(nextIndex++) : -1; - } - } - - return result; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieReader.java deleted file mode 100644 index 03e93f4726..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieReader.java +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; - -import org.restlet.client.data.Cookie; -import org.restlet.client.data.Parameter; - -/** - * Cookie header reader. - * - * @author Jerome Louvel - */ -public class CookieReader extends HeaderReader { - - private static final String NAME_DOMAIN = "$Domain"; - - private static final String NAME_PATH = "$Path"; - - private static final String NAME_VERSION = "$Version"; - - /** - * Parses the given String to a Cookie - * - * @param cookie - * @return the Cookie parsed from the String - * @throws IllegalArgumentException - * Thrown if the String can not be parsed as Cookie. - */ - public static Cookie read(String cookie) throws IllegalArgumentException { - CookieReader cr = new CookieReader(cookie); - - try { - return cr.readValue(); - } catch (IOException e) { - throw new IllegalArgumentException("Could not read the cookie", e); - } - } - - /** The global cookie specification version. */ - private volatile int globalVersion; - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public CookieReader(String header) { - super(header); - this.globalVersion = -1; - } - - /** - * Reads the next pair as a parameter. - * - * @param readAttribute - * True, if the intention is to read only cookie attribute. - * @return The next pair as a parameter. - * @throws IOException - */ - private Parameter readPair(boolean readAttribute) throws IOException { - Parameter result = null; - - boolean readingName = true; - StringBuilder nameBuffer = new StringBuilder(); - StringBuilder valueBuffer = new StringBuilder(); - int nextChar = 0; - - while ((result == null) && (nextChar != -1)) { - nextChar = read(); - - if (readingName) { - if ((HeaderUtils.isSpace(nextChar)) && (nameBuffer.length() == 0)) { - // Skip spaces - } else if ((nextChar == -1) || (nextChar == ';') || (nextChar == ',')) { - if (nameBuffer.length() > 0) { - // End of pair with no value - result = Parameter.create(nameBuffer, null); - } else if (nextChar == -1) { - // Do nothing return null preference - } else { - throw new IOException("Empty cookie name detected. Please check your cookies"); - } - } else if (nextChar == '=') { - readingName = false; - } else if (HeaderUtils.isTokenChar(nextChar) || (this.globalVersion < 1)) { - if (readAttribute && nextChar != '$' && (nameBuffer.length() == 0)) { - unread(); - nextChar = -1; - } else { - nameBuffer.append((char) nextChar); - } - } else { - throw new IOException( - "Separator and control characters are not allowed within a token. Please check your cookie header"); - } - } else { - // reading value - if ((HeaderUtils.isSpace(nextChar)) && (valueBuffer.length() == 0)) { - // Skip spaces - } else if ((nextChar == -1) || (nextChar == ';')) { - // End of pair - result = Parameter.create(nameBuffer, valueBuffer); - } else if ((nextChar == '"') && (valueBuffer.length() == 0)) { - // Step back - unread(); - valueBuffer.append(readQuotedString()); - } else if (HeaderUtils.isTokenChar(nextChar) || (this.globalVersion < 1)) { - valueBuffer.append((char) nextChar); - } else { - throw new IOException( - "Separator and control characters are not allowed within a token. Please check your cookie header"); - } - } - } - - return result; - } - - @Override - public Cookie readValue() throws IOException { - Cookie result = null; - Parameter pair = readPair(false); - - if (pair != null && this.globalVersion == -1) { - // Cookies version not yet detected - if (NAME_VERSION.equalsIgnoreCase(pair.getName())) { - if (pair.getValue() != null) { - this.globalVersion = Integer.parseInt(pair.getValue()); - } else { - throw new IOException( - "Empty cookies version attribute detected. Please check your cookie header"); - } - } else { - // Set the default version for old Netscape cookies - this.globalVersion = 0; - } - } - - while ((pair != null) - && (pair.getName().isEmpty() || pair.getName().charAt(0) == '$')) { - // Unexpected special attribute - // Silently ignore it as it may have been introduced by new - // specifications - pair = readPair(false); - } - - if (pair != null) { - // Set the cookie name and value - result = new Cookie(this.globalVersion, pair.getName(), - pair.getValue()); - pair = readPair(true); - } - - while ((pair != null) - && (pair.getName().isEmpty() || pair.getName().charAt(0) == '$')) { - if (pair.getName().equalsIgnoreCase(NAME_PATH)) { - result.setPath(pair.getValue()); - } else if (pair.getName().equalsIgnoreCase(NAME_DOMAIN)) { - result.setDomain(pair.getValue()); - } else { - // Unexpected special attribute - // Silently ignore it as it may have been introduced by new - // specifications - } - - pair = readPair(true); - } - - return result; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieSettingReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieSettingReader.java deleted file mode 100644 index 129f94bcdd..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieSettingReader.java +++ /dev/null @@ -1,240 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import static org.restlet.client.engine.util.DateUtils.FORMAT_ASC_TIME; -import static org.restlet.client.engine.util.DateUtils.FORMAT_RFC_1036; -import static org.restlet.client.engine.util.DateUtils.FORMAT_RFC_1123; - -import java.io.IOException; -import java.util.Date; - -import org.restlet.client.Context; -import org.restlet.client.data.CookieSetting; -import org.restlet.client.data.Parameter; -import org.restlet.client.engine.util.DateUtils; -import org.restlet.client.engine.util.StringUtils; - -/** - * Cookie setting header reader. - * - * @author Jerome Louvel - */ -public class CookieSettingReader extends HeaderReader { - - private static final String NAME_SET_ACCESS_RESTRICTED = "httpOnly"; - - private static final String NAME_SET_COMMENT = "comment"; - - private static final String NAME_SET_COMMENT_URL = "commentURL"; - - private static final String NAME_SET_DISCARD = "discard"; - - private static final String NAME_SET_DOMAIN = "domain"; - - private static final String NAME_SET_EXPIRES = "expires"; - - private static final String NAME_SET_MAX_AGE = "max-age"; - - private static final String NAME_SET_PATH = "path"; - - private static final String NAME_SET_PORT = "port"; - - private static final String NAME_SET_SECURE = "secure"; - - private static final String NAME_SET_VERSION = "version"; - - /** - * Parses the given String to a CookieSetting - * - * @param cookieSetting - * @return the CookieSetting parsed from the String - * @throws IllegalArgumentException - * Thrown if the String can not be parsed as CookieSetting. - */ - public static CookieSetting read(String cookieSetting) - throws IllegalArgumentException { - CookieSettingReader cr = new CookieSettingReader(cookieSetting); - - try { - return cr.readValue(); - } catch (IOException e) { - throw new IllegalArgumentException( - "Could not read the cookie setting", e); - } - } - - /** The cached pair. Used by the readPair() method. */ - private volatile Parameter cachedPair; - - /** The global cookie specification version. */ - private volatile int globalVersion; - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public CookieSettingReader(String header) { - super(header); - this.cachedPair = null; - this.globalVersion = -1; - } - - /** - * Reads the next pair as a parameter. - * - * @return The next pair as a parameter. - * @throws IOException - */ - private Parameter readPair() throws IOException { - if (this.cachedPair != null) { - Parameter pair = this.cachedPair; - this.cachedPair = null; - return pair; - } - - Parameter result = null; - - boolean readingName = true; - StringBuilder nameBuffer = new StringBuilder(); - StringBuilder valueBuffer = new StringBuilder(); - int nextChar = 0; - - while ((result == null) && (nextChar != -1)) { - nextChar = read(); - - if (readingName) { - if ((HeaderUtils.isSpace(nextChar)) && (nameBuffer.length() == 0)) { - // Skip spaces - } else if ((nextChar == -1) || (nextChar == ';') || (nextChar == ',')) { - if (nameBuffer.length() > 0) { - // End of pair with no value - result = Parameter.create(nameBuffer, null); - } else if (nextChar == -1) { - // Do nothing return null preference - } else { - throw new IOException("Empty cookie name detected. Please check your cookies"); - } - } else if (nextChar == '=') { - readingName = false; - } else if (HeaderUtils.isTokenChar(nextChar) || (this.globalVersion < 1)) { - nameBuffer.append((char) nextChar); - } else { - throw new IOException( - "Separator and control characters are not allowed within a token. Please check your cookie header"); - } - } else { - // reading value - if ((HeaderUtils.isSpace(nextChar)) && (valueBuffer.length() == 0)) { - // Skip spaces - } else if ((nextChar == -1) || (nextChar == ';')) { - // End of pair - result = Parameter.create(nameBuffer, valueBuffer); - } else if ((nextChar == '"') && (valueBuffer.length() == 0)) { - // Step back - unread(); - valueBuffer.append(readQuotedString()); - } else if (HeaderUtils.isTokenChar(nextChar) || (this.globalVersion < 1)) { - valueBuffer.append((char) nextChar); - } else { - throw new IOException( - "Separator and control characters are not allowed within a token. Please check your cookie header"); - } - } - } - - return result; - } - - @Override - public CookieSetting readValue() throws IOException { - Parameter pair = null; - - // Unexpected special attributes - // Silently ignore it as it may have been introduced by new specifications - do { - if ((pair = readPair()) == null) { - return null; - } - } while (pair.getName().charAt(0) == '$'); - - // Set the cookie name and value - CookieSetting result = new CookieSetting(pair.getName(), pair.getValue()); - - while ((pair = readPair()) != null) { - if (pair.getName().equalsIgnoreCase(NAME_SET_PATH)) { - result.setPath(pair.getValue()); - } else if (pair.getName().equalsIgnoreCase(NAME_SET_DOMAIN)) { - result.setDomain(pair.getValue()); - } else if (pair.getName().equalsIgnoreCase(NAME_SET_COMMENT)) { - result.setComment(pair.getValue()); - } else if (pair.getName().equalsIgnoreCase(NAME_SET_COMMENT_URL)) { - // No yet supported - } else if (pair.getName().equalsIgnoreCase(NAME_SET_DISCARD)) { - result.setMaxAge(-1); - } else if (pair.getName().equalsIgnoreCase(NAME_SET_EXPIRES)) { - Date expires = DateUtils.parse(pair.getValue(), FORMAT_RFC_1036); - - if (expires == null) { - expires = DateUtils.parse(pair.getValue(), FORMAT_RFC_1123); - } - - if (expires == null) { - expires = DateUtils.parse(pair.getValue(), FORMAT_ASC_TIME); - } - - if (expires != null) { - final Date current = new Date(System.currentTimeMillis()); - if (DateUtils.after(current, expires)) { - result.setMaxAge((int) ((expires.getTime() - current.getTime()) / 1000)); - } else { - result.setMaxAge(0); - } - } else { - // Ignore the expires header - Context.getCurrentLogger() - .warning( - "Ignoring cookie setting expiration date. Unable to parse the date: " - + pair.getValue()); - } - } else if (pair.getName().equalsIgnoreCase(NAME_SET_MAX_AGE)) { - try { - result.setMaxAge(Integer.valueOf(pair.getValue())); - } catch (NumberFormatException numberFormatException) { - result.setMaxAge(Integer.MAX_VALUE); - Context.getCurrentLogger() - .warning( - "Unable to parse the cookie setting max-age value \"" + pair.getValue() - + "\", used Integer.MAX_VALUE instead: " + Integer.MAX_VALUE); - } - } else if (pair.getName().equalsIgnoreCase(NAME_SET_PORT)) { - // No yet supported - } else if (pair.getName().equalsIgnoreCase(NAME_SET_SECURE)) { - if (StringUtils.isNullOrEmpty(pair.getValue())) { - result.setSecure(true); - } - } else if (pair.getName().equalsIgnoreCase(NAME_SET_ACCESS_RESTRICTED)) { - if (StringUtils.isNullOrEmpty(pair.getValue())) { - result.setAccessRestricted(true); - } - } else if (pair.getName().equalsIgnoreCase(NAME_SET_VERSION)) { - result.setVersion(Integer.valueOf(pair.getValue())); - } else { - // Unexpected special attribute - // Silently ignore it as it may have been introduced by new specifications - } - } - - return result; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieSettingWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieSettingWriter.java deleted file mode 100644 index 73877c164d..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieSettingWriter.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.Date; -import java.util.List; - -import org.restlet.client.data.CookieSetting; -import org.restlet.client.engine.util.DateUtils; - -/** - * Cookie setting header writer. - * - * @author Jerome Louvel - */ -public class CookieSettingWriter extends HeaderWriter { - - /** - * Writes a cookie setting. - * - * @param cookieSetting - * The cookie setting to format. - * @return The formatted cookie setting. - */ - public static String write(CookieSetting cookieSetting) { - return new CookieSettingWriter().append(cookieSetting).toString(); - } - - /** - * Writes a list of cookie settings. - * - * @param cookieSettings - * The cookie settings to write. - * @return The formatted cookie setting. - */ - public static String write(List cookieSettings) { - return new CookieSettingWriter().append(cookieSettings).toString(); - } - - @Override - public CookieSettingWriter append(CookieSetting cookieSetting) - throws IllegalArgumentException { - String name = cookieSetting.getName(); - String value = cookieSetting.getValue(); - int version = cookieSetting.getVersion(); - - if ((name == null) || (name.length() == 0)) { - throw new IllegalArgumentException( - "Can't write cookie. Invalid name detected"); - } - - append(name).append('='); - - // Append the value - if ((value != null) && (value.length() > 0)) { - appendValue(value, version); - } - - // Append the version - if (version > 0) { - append("; Version="); - appendValue(Integer.toString(version), version); - } - - // Append the path - String path = cookieSetting.getPath(); - - if ((path != null) && (path.length() > 0)) { - append("; Path="); - - if (version == 0) { - append(path); - } else { - appendQuotedString(path); - } - } - - // Append the expiration date - int maxAge = cookieSetting.getMaxAge(); - - if (maxAge >= 0) { - if (version == 0) { - long currentTime = System.currentTimeMillis(); - long maxTime = (maxAge * 1000L); - long expiresTime = currentTime + maxTime; - Date expires = new Date(expiresTime); - - append("; Expires="); - appendValue( - DateUtils.format(expires, - DateUtils.FORMAT_RFC_1123.get(0)), version); - } else { - append("; Max-Age="); - appendValue(Integer.toString(cookieSetting.getMaxAge()), - version); - } - } else if ((maxAge == -1) && (version > 0)) { - // Discard the cookie at the end of the user's session (RFC - // 2965) - append("; Discard"); - } else { - // NetScape cookies automatically expire at the end of the - // user's session - } - - // Append the domain - String domain = cookieSetting.getDomain(); - - if ((domain != null) && (domain.length() > 0)) { - append("; Domain="); - appendValue(domain.toLowerCase(), version); - } - - // Append the secure flag - if (cookieSetting.isSecure()) { - append("; Secure"); - } - - // Append the secure flag - if (cookieSetting.isAccessRestricted()) { - append("; HttpOnly"); - } - - // Append the comment - if (version > 0) { - String comment = cookieSetting.getComment(); - - if ((comment != null) && (comment.length() > 0)) { - append("; Comment="); - appendValue(comment, version); - } - } - - return this; - } - - /** - * Appends a source string as an HTTP comment. - * - * @param value - * The source string to format. - * @param version - * The cookie version. - * @return This writer. - */ - public CookieSettingWriter appendValue(String value, int version) { - if (version == 0) { - append(value); - } else { - appendQuotedString(value); - } - - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieWriter.java deleted file mode 100644 index 8aa7105118..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/CookieWriter.java +++ /dev/null @@ -1,159 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.restlet.client.data.Cookie; - -/** - * Cookie header writer. - * - * @author Jerome Louvel - */ -public class CookieWriter extends HeaderWriter { - - /** - * Gets the cookies whose name is a key in the given map. If a matching - * cookie is found, its value is put in the map. - * - * @param source - * The source list of cookies. - * @param destination - * The cookies map controlling the reading. - */ - public static void getCookies(List source, - Map destination) { - Cookie cookie; - - for (final Iterator iter = source.iterator(); iter.hasNext();) { - cookie = iter.next(); - - if (destination.containsKey(cookie.getName())) { - destination.put(cookie.getName(), cookie); - } - } - } - - /** - * Writes a cookie. - * - * @param cookie - * The cookie to format. - * @return The formatted cookie. - * @throws IllegalArgumentException - * If the Cookie contains illegal values. - */ - public static String write(Cookie cookie) throws IllegalArgumentException { - return new CookieWriter().append(cookie).toString(); - } - - /** - * Writes a cookie. - * - * @param cookies - * The cookies to format. - * @return The formatted cookie. - */ - public static String write(List cookies) { - return new CookieWriter().append(cookies).toString(); - } - - @Override - public CookieWriter append(Cookie cookie) throws IllegalArgumentException { - String name = cookie.getName(); - String value = cookie.getValue(); - int version = cookie.getVersion(); - - if ((name == null) || (name.length() == 0)) { - throw new IllegalArgumentException( - "Can't write cookie. Invalid name detected"); - } - - appendValue(name, 0).append('='); - - // Append the value - if ((value != null) && (value.length() > 0)) { - appendValue(value, version); - } - - if (version > 0) { - // Append the path - String path = cookie.getPath(); - - if ((path != null) && (path.length() > 0)) { - append("; $Path="); - appendQuotedString(path); - } - - // Append the domain - String domain = cookie.getDomain(); - - if ((domain != null) && (domain.length() > 0)) { - append("; $Domain="); - appendQuotedString(domain); - } - } - - return this; - } - - /** - * Appends a list of cookies as an HTTP header. - * - * @param cookies - * The list of cookies to format. - * @return This writer. - */ - public CookieWriter append(List cookies) { - if ((cookies != null) && !cookies.isEmpty()) { - Cookie cookie; - - for (int i = 0; i < cookies.size(); i++) { - cookie = cookies.get(i); - - if (i == 0) { - if (cookie.getVersion() > 0) { - append("$Version=\"").append(cookie.getVersion()) - .append("\"; "); - } - } else { - append("; "); - } - - append(cookie); - } - } - - return this; - } - - /** - * Appends a source string as an HTTP comment. - * - * @param value - * The source string to format. - * @param version - * The cookie version. - * @return This writer. - */ - public CookieWriter appendValue(String value, int version) { - if (version == 0) { - append(value); - } else { - appendQuotedString(value); - } - - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DateWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DateWriter.java deleted file mode 100644 index e2ba183146..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DateWriter.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.Date; - -import org.restlet.client.engine.util.DateUtils; - -/** - * Date header writer. - * - * @author Jerome Louvel - */ -public class DateWriter { - - /** - * Writes a date header. - * - * @param date - * The date to write. - * @return The formatted date. - */ - public static String write(Date date) { - return write(date, false); - } - - /** - * Writes a date header. - * - * @param date - * The date to write. - * @param cookie - * Indicates if the date should be in the cookie format. - * @return The formatted date. - */ - public static String write(Date date, boolean cookie) { - if (cookie) { - return DateUtils.format(date, DateUtils.FORMAT_RFC_1036.get(0)); - } - - return DateUtils.format(date); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DimensionReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DimensionReader.java deleted file mode 100644 index e5f1e88df2..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DimensionReader.java +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Collection; - -import org.restlet.client.data.Dimension; -import org.restlet.client.data.Header; - -/** - * Dimension header reader. - * - * @author Jerome Louvel - */ -public class DimensionReader extends HeaderReader { - /** - * Adds values to the given collection. - * - * @param header - * The header to read. - * @param collection - * The collection to update. - */ - public static void addValues(Header header, Collection collection) { - new DimensionReader(header.getValue()).addValues(collection); - } - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public DimensionReader(String header) { - super(header); - } - - @Override - public Dimension readValue() throws IOException { - Dimension result = null; - String value = readRawValue(); - - if (value != null) { - if (value.equalsIgnoreCase(HeaderConstants.HEADER_ACCEPT)) { - result = Dimension.MEDIA_TYPE; - } else if (value - .equalsIgnoreCase(HeaderConstants.HEADER_ACCEPT_CHARSET)) { - result = Dimension.CHARACTER_SET; - } else if (value - .equalsIgnoreCase(HeaderConstants.HEADER_ACCEPT_ENCODING)) { - result = Dimension.ENCODING; - } else if (value - .equalsIgnoreCase(HeaderConstants.HEADER_ACCEPT_LANGUAGE)) { - result = Dimension.LANGUAGE; - } else if (value - .equalsIgnoreCase(HeaderConstants.HEADER_AUTHORIZATION)) { - result = Dimension.AUTHORIZATION; - } else if (value - .equalsIgnoreCase(HeaderConstants.HEADER_USER_AGENT)) { - result = Dimension.CLIENT_AGENT; - } else if (value - .equalsIgnoreCase(HeaderConstants.HEADER_ORIGIN)) { - result = Dimension.ORIGIN; - } else if (value.equals("*")) { - result = Dimension.UNSPECIFIED; - } - } - - return result; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DimensionWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DimensionWriter.java deleted file mode 100644 index 6deac5966e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DimensionWriter.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.Collection; - -import org.restlet.client.data.Dimension; - -/** - * Dimension header writer. - * - * @author Thierry Boileau - */ -public class DimensionWriter extends HeaderWriter { - - /** - * Creates a vary header from the given dimensions. - * - * @param dimensions - * The dimensions to copy to the response. - * @return Returns the Vary header or null, if dimensions is null or empty. - */ - public static String write(Collection dimensions) { - return new DimensionWriter().append(dimensions).toString(); - } - - /** - * Appends a collection of dimensions as a header. - * - * @param dimensions - * The dimensions to format. - * @return This writer. - */ - public DimensionWriter append(Collection dimensions) { - if ((dimensions != null) && !dimensions.isEmpty()) { - if (dimensions.contains(Dimension.CLIENT_ADDRESS) - || dimensions.contains(Dimension.TIME) - || dimensions.contains(Dimension.UNSPECIFIED)) { - // From an HTTP point of view the representations can - // vary in unspecified ways - append("*"); - } else { - boolean first = true; - - for (Dimension dimension : dimensions) { - if (first) { - first = false; - } else { - append(", "); - } - - append(dimension); - } - } - } - - return this; - } - - @Override - public HeaderWriter append(Dimension dimension) { - if (dimension == Dimension.CHARACTER_SET) { - append(HeaderConstants.HEADER_ACCEPT_CHARSET); - } else if (dimension == Dimension.CLIENT_AGENT) { - append(HeaderConstants.HEADER_USER_AGENT); - } else if (dimension == Dimension.ENCODING) { - append(HeaderConstants.HEADER_ACCEPT_ENCODING); - } else if (dimension == Dimension.LANGUAGE) { - append(HeaderConstants.HEADER_ACCEPT_LANGUAGE); - } else if (dimension == Dimension.MEDIA_TYPE) { - append(HeaderConstants.HEADER_ACCEPT); - } else if (dimension == Dimension.AUTHORIZATION) { - append(HeaderConstants.HEADER_AUTHORIZATION); - } else if (dimension == Dimension.ORIGIN) { - append(HeaderConstants.HEADER_ORIGIN); - } - - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DispositionReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DispositionReader.java deleted file mode 100644 index 8e135dbfc5..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DispositionReader.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; - -import org.restlet.client.data.Disposition; -import org.restlet.client.data.Parameter; - -/** - * Disposition header reader. - * - * @author Thierry Boileau - */ -public class DispositionReader extends HeaderReader { - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public DispositionReader(String header) { - super(header); - } - - @Override - public Disposition readValue() throws IOException { - Disposition result = null; - String type = readToken(); - - if (type.length() > 0) { - result = new Disposition(); - result.setType(type); - - if (skipParameterSeparator()) { - Parameter param = readParameter(); - - while (param != null) { - result.getParameters().add(param); - - if (skipParameterSeparator()) { - param = readParameter(); - } else { - param = null; - } - } - } - } - - return result; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DispositionWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DispositionWriter.java deleted file mode 100644 index dc7022021e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/DispositionWriter.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import org.restlet.client.data.Disposition; -import org.restlet.client.data.Parameter; - -/** - * Disposition header writer. - * - * @author Thierry Boileau - */ -public class DispositionWriter extends HeaderWriter { - - /** - * Formats a disposition. - * - * @param disposition - * The disposition to format. - * @return The formatted disposition. - */ - public static String write(Disposition disposition) { - return new DispositionWriter().append(disposition).toString(); - } - - @Override - public DispositionWriter append(Disposition disposition) { - if (Disposition.TYPE_NONE.equals(disposition.getType()) - || disposition.getType() == null) { - return this; - } - - append(disposition.getType()); - - for (Parameter parameter : disposition.getParameters()) { - append("; "); - append(parameter.getName()); - append("="); - - if (HeaderUtils.isToken(parameter.getValue())) { - append(parameter.getValue()); - } else { - appendQuotedString(parameter.getValue()); - } - } - - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/EncodingReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/EncodingReader.java deleted file mode 100644 index d331b142ba..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/EncodingReader.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Collection; - -import org.restlet.client.data.Encoding; - -/** - * Encoding header reader. - * - * @author Jerome Louvel - */ -public class EncodingReader extends HeaderReader { - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public EncodingReader(String header) { - super(header); - } - - @Override - protected boolean canAdd(Encoding value, Collection values) { - return value != null && !Encoding.IDENTITY.equals(value); - } - - @Override - public Encoding readValue() throws IOException { - return Encoding.valueOf(readToken()); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/EncodingWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/EncodingWriter.java deleted file mode 100644 index 4e348584e8..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/EncodingWriter.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.List; - -import org.restlet.client.data.Encoding; - -/** - * Encoding header writer. - * - * @author Jerome Louvel - */ -public class EncodingWriter extends MetadataWriter { - - /** - * Writes a list of encodings. - * - * @param encodings - * The encodings to write. - * @return This writer. - */ - public static String write(List encodings) { - return new EncodingWriter().append(encodings).toString(); - } - - @Override - protected boolean canWrite(Encoding encoding) { - return !encoding.equals(Encoding.IDENTITY); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderConstants.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderConstants.java deleted file mode 100644 index ffbb19a09a..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderConstants.java +++ /dev/null @@ -1,202 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -/** - * Constants related to the HTTP protocol. - * - * @author Jerome Louvel - */ -public final class HeaderConstants { - - // -------------------- - // --- Expectations --- - // -------------------- - - public static final String EXPECT_CONTINUE = "100-continue"; - - // ------------------------ - // --- Cache directives --- - // ------------------------ - - public static final String CACHE_NO_CACHE = "no-cache"; - - public static final String CACHE_NO_STORE = "no-store"; - - public static final String CACHE_MAX_AGE = "max-age"; - - public static final String CACHE_MAX_STALE = "max-stale"; - - public static final String CACHE_MIN_FRESH = "min-fresh"; - - public static final String CACHE_NO_TRANSFORM = "no-transform"; - - public static final String CACHE_ONLY_IF_CACHED = "only-if-cached"; - - public static final String CACHE_PUBLIC = "public"; - - public static final String CACHE_PRIVATE = "private"; - - public static final String CACHE_MUST_REVALIDATE = "must-revalidate"; - - public static final String CACHE_PROXY_MUST_REVALIDATE = "proxy-revalidate"; - - public static final String CACHE_SHARED_MAX_AGE = "s-maxage"; - - // --------------------- - // --- Header names --- - // --------------------- - - public static final String HEADER_ACCEPT = "Accept"; - - public static final String HEADER_ACCEPT_CHARSET = "Accept-Charset"; - - public static final String HEADER_ACCEPT_ENCODING = "Accept-Encoding"; - - public static final String HEADER_ACCEPT_LANGUAGE = "Accept-Language"; - - public static final String HEADER_ACCEPT_PATCH = "Accept-Patch"; - - public static final String HEADER_ACCEPT_RANGES = "Accept-Ranges"; - - public static final String HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS = "Access-Control-Allow-Credentials"; - - public static final String HEADER_ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; - - public static final String HEADER_ACCESS_CONTROL_ALLOW_METHODS = "Access-Control-Allow-Methods"; - - public static final String HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; - - public static final String HEADER_ACCESS_CONTROL_EXPOSE_HEADERS = "Access-Control-Expose-Headers"; - - public static final String HEADER_ACCESS_CONTROL_MAX_AGE = "Access-Control-Max-Age"; - - public static final String HEADER_ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers"; - - public static final String HEADER_ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method"; - - public static final String HEADER_AGE = "Age"; - - public static final String HEADER_ALLOW = "Allow"; - - public static final String HEADER_AUTHENTICATION_INFO = "Authentication-Info"; - - public static final String HEADER_AUTHORIZATION = "Authorization"; - - public static final String HEADER_CACHE_CONTROL = "Cache-Control"; - - public static final String HEADER_CONNECTION = "Connection"; - - public static final String HEADER_CONTENT_DISPOSITION = "Content-Disposition"; - - public static final String HEADER_CONTENT_ENCODING = "Content-Encoding"; - - public static final String HEADER_CONTENT_LANGUAGE = "Content-Language"; - - public static final String HEADER_CONTENT_LENGTH = "Content-Length"; - - public static final String HEADER_CONTENT_LOCATION = "Content-Location"; - - public static final String HEADER_CONTENT_MD5 = "Content-MD5"; - - public static final String HEADER_CONTENT_RANGE = "Content-Range"; - - public static final String HEADER_CONTENT_TYPE = "Content-Type"; - - public static final String HEADER_COOKIE = "Cookie"; - - public static final String HEADER_DATE = "Date"; - - public static final String HEADER_ETAG = "ETag"; - - public static final String HEADER_EXPECT = "Expect"; - - public static final String HEADER_EXPIRES = "Expires"; - - public static final String HEADER_FROM = "From"; - - public static final String HEADER_HOST = "Host"; - - public static final String HEADER_IF_MATCH = "If-Match"; - - public static final String HEADER_IF_MODIFIED_SINCE = "If-Modified-Since"; - - public static final String HEADER_IF_NONE_MATCH = "If-None-Match"; - - public static final String HEADER_IF_RANGE = "If-Range"; - - public static final String HEADER_IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; - - public static final String HEADER_LAST_MODIFIED = "Last-Modified"; - - public static final String HEADER_LOCATION = "Location"; - - public static final String HEADER_MAX_FORWARDS = "Max-Forwards"; - - public static final String HEADER_ORIGIN = "Origin"; - - public static final String HEADER_PRAGMA = "Pragma"; - - public static final String HEADER_PROXY_AUTHENTICATE = "Proxy-Authenticate"; - - public static final String HEADER_PROXY_AUTHORIZATION = "Proxy-Authorization"; - - public static final String HEADER_RANGE = "Range"; - - public static final String HEADER_REFERRER = "Referer"; - - public static final String HEADER_RETRY_AFTER = "Retry-After"; - - public static final String HEADER_SERVER = "Server"; - - public static final String HEADER_SET_COOKIE = "Set-Cookie"; - - public static final String HEADER_SET_COOKIE2 = "Set-Cookie2"; - - public static final String HEADER_SLUG = "Slug"; - - public static final String HEADER_TRAILER = "Trailer"; - - public static final String HEADER_TRANSFER_ENCODING = "Transfer-Encoding"; - - public static final String HEADER_TRANSFER_EXTENSION = "TE"; - - public static final String HEADER_UPGRADE = "Upgrade"; - - public static final String HEADER_USER_AGENT = "User-Agent"; - - public static final String HEADER_VARY = "Vary"; - - public static final String HEADER_VIA = "Via"; - - public static final String HEADER_WARNING = "Warning"; - - public static final String HEADER_WWW_AUTHENTICATE = "WWW-Authenticate"; - - public static final String HEADER_X_FORWARDED_FOR = "X-Forwarded-For"; - - public static final String HEADER_X_FORWARDED_PORT = "X-Forwarded-Port"; - - public static final String HEADER_X_FORWARDED_PROTO = "X-Forwarded-Proto"; - - public static final String HEADER_X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override"; - - // ------------------------- - // --- Attribute names --- - // ------------------------- - - public static final String ATTRIBUTE_HEADERS = "org.restlet.client.http.headers"; - - public static final String ATTRIBUTE_VERSION = "org.restlet.client.http.version"; - - public static final String ATTRIBUTE_HTTPS_KEY_SIZE = "org.restlet.client.https.keySize"; - - public static final String ATTRIBUTE_HTTPS_SSL_SESSION_ID = "org.restlet.client.https.sslSessionId"; -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderReader.java deleted file mode 100644 index 884268b6c2..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderReader.java +++ /dev/null @@ -1,757 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import static org.restlet.client.engine.header.HeaderUtils.isCarriageReturn; -import static org.restlet.client.engine.header.HeaderUtils.isComma; -import static org.restlet.client.engine.header.HeaderUtils.isCommentText; -import static org.restlet.client.engine.header.HeaderUtils.isDoubleQuote; -import static org.restlet.client.engine.header.HeaderUtils.isLineFeed; -import static org.restlet.client.engine.header.HeaderUtils.isLinearWhiteSpace; -import static org.restlet.client.engine.header.HeaderUtils.isQuoteCharacter; -import static org.restlet.client.engine.header.HeaderUtils.isQuotedText; -import static org.restlet.client.engine.header.HeaderUtils.isSemiColon; -import static org.restlet.client.engine.header.HeaderUtils.isSpace; -import static org.restlet.client.engine.header.HeaderUtils.isTokenChar; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Collection; -import java.util.Date; -import java.util.List; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.data.Encoding; -import org.restlet.client.data.Header; -import org.restlet.client.data.Parameter; -import org.restlet.client.engine.util.DateUtils; -import org.restlet.client.util.NamedValue; - -/** - * HTTP-style header reader. - * - * @param - * The header value target type. There can be multiple values for a - * single header. - * @author Jerome Louvel - */ -public class HeaderReader { - - /** - * Creates a new named value with a null value. - * - * @param name - * The name. - * @param resultClass - * The named value class to return. - * @return The new named value. - */ - private static final > NV createNamedValue( - Class resultClass, String name) { - return createNamedValue(resultClass, name, null); - } - - /** - * Creates a new named value. - * - * @param name - * The name. - * @param value - * The value or null. - * @param resultClass - * The named value class to return. - * @return The new named value. - */ - private static > NV createNamedValue( - Class resultClass, String name, String value) { - if (org.restlet.client.data.Parameter.class.equals(resultClass)) { - return (NV) new org.restlet.client.data.Parameter(name, value); - } else if (org.restlet.client.data.Cookie.class.equals(resultClass)) { - return (NV) new org.restlet.client.data.Cookie(name, value); - } else if (org.restlet.client.data.CookieSetting.class.equals(resultClass)) - { - return (NV) new org.restlet.client.data.CookieSetting(name, value); - } else if (org.restlet.client.data.CacheDirective.class.equals(resultClass)) - { - return (NV) new org.restlet.client.data.CacheDirective(name, value); - } else if - (org.restlet.client.data.Header.class.equals(resultClass)) { - return (NV) new org.restlet.client.data.Header(name, value); - } - return null; - } - - /** - * Parses a date string. - * - * @param date - * The date string to parse. - * @param cookie - * Indicates if the date is in the cookie format. - * @return The parsed date. - */ - public static Date readDate(String date, boolean cookie) { - if (cookie) { - return DateUtils.parse(date, DateUtils.FORMAT_RFC_1036); - } - - return DateUtils.parse(date, DateUtils.FORMAT_RFC_1123); - } - - /** - * Read a header. Return null if the last header was already read. - * - * @param header - * The header line to parse. - * @return The header read or null. - * @throws IOException - */ - public static Header readHeader(CharSequence header) throws IOException { - Header result = null; - - if (header.length() > 0) { - // Detect the end of headers - int start = 0; - int index = 0; - int next = header.charAt(index++); - - if (isCarriageReturn(next)) { - next = header.charAt(index++); - - if (!isLineFeed(next)) { - throw new IOException( - "Invalid end of headers. Line feed missing after the carriage return."); - } - } else { - result = new Header(); - - // Parse the header name - while ((index < header.length()) && (next != ':')) { - next = header.charAt(index++); - } - - if (next != ':') { - // Colon character is mandatory - throw new IOException( - "Unable to parse the header name. End of line reached too early."); - } - - result.setName(header.subSequence(start, index - 1).toString()); - - if (index == header.length()) { - // No more content to read. - return result; - } - next = header.charAt(index++); - - while ((index < header.length()) && isSpace(next)) { - // Skip any separator space between colon and header value - next = header.charAt(index++); - } - if (index < header.length()) { - start = index - 1; - - // Parse the header value - result.setValue(header.subSequence(start, header.length()) - .toString()); - } - - } - } - - return result; - } - - /** - * Read a header. Return null if the last header was already read. - * - * @param is - * The message input stream. - * @param sb - * The string builder to reuse. - * @return The header read or null. - * @throws IOException - */ - public static Header readHeader(InputStream is, StringBuilder sb) - throws IOException { - Header result = null; - - // Detect the end of headers - int next = is.read(); - - if (isCarriageReturn(next)) { - next = is.read(); - - if (!isLineFeed(next)) { - throw new IOException( - "Invalid end of headers. Line feed missing after the carriage return."); - } - } else { - result = new Header(); - - // Parse the header name - while ((next != -1) && (next != ':')) { - sb.append((char) next); - next = is.read(); - } - - if (next == -1) { - throw new IOException( - "Unable to parse the header name. End of stream reached too early."); - } - - result.setName(sb.toString()); - sb.delete(0, sb.length()); - next = is.read(); - - while (isSpace(next)) { - // Skip any separator space between colon and header value - next = is.read(); - } - - // Parse the header value - while ((next != -1) && (!isCarriageReturn(next))) { - sb.append((char) next); - next = is.read(); - } - - if (next == -1) { - throw new IOException( - "Unable to parse the header value. End of stream reached too early."); - } - - next = is.read(); - - if (isLineFeed(next)) { - result.setValue(sb.toString()); - sb.delete(0, sb.length()); - } else { - throw new IOException( - "Unable to parse the HTTP header value. The carriage return must be followed by a line feed."); - } - } - - return result; - } - - /** The header to read. */ - private final String header; - - /** The current read index (or -1 if not reading anymore). */ - private volatile int index; - - /** The current mark. */ - private volatile int mark; - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public HeaderReader(String header) { - this.header = header; - this.index = ((header == null) || (header.length() == 0)) ? -1 : 0; - this.mark = index; - } - - /** - * Adds values to the given list. - * - * @param values - * The list of values to update. - */ - public void addValues(Collection values) { - try { - // Skip leading spaces - skipSpaces(); - boolean cont = true; - do { - int i = index; - - // Read the first value - V nextValue = readValue(); - if (canAdd(nextValue, values)) { - // Add the value to the list - values.add(nextValue); - } - - // Attempt to skip the value separator - skipValueSeparator(); - if (index == -1) { - cont = false; - } else if (i == index) { - // Infinite loop - throw new IOException( - "The reading of one header initiates an infinite loop"); - } - } while (cont); - } catch (IOException ioe) { - Context.getCurrentLogger().log(Level.INFO, - "Unable to read a header", ioe); - } - } - - /** - * Indicates if the value can be added the the list. Useful to prevent the - * addition of {@link Encoding#IDENTITY} constants for example. By default - * it returns true for non null values. - * - * @param value - * The value to add. - * - * @param values - * The target collection. - * @return True if the value can be added. - */ - protected boolean canAdd(V value, Collection values) { - return value != null && !values.contains(value); - } - - /** - * Creates a new parameter with a null value. Can be overridden. - * - * @param name - * The parameter name. - * @return The new parameter. - */ - protected final Parameter createParameter(String name) { - return createParameter(name, null); - } - - /** - * Creates a new parameter. Can be overridden. - * - * @param name - * The parameter name. - * @param value - * The parameter value or null. - * @return The new parameter. - */ - protected Parameter createParameter(String name, String value) { - return new Parameter(name, value); - } - - /** - * Marks the current position in this reader. A subsequent call to the - * reset method repositions this reader at the last marked - * position. - */ - public void mark() { - mark = index; - } - - /** - * Reads the next character without moving the reader index. - * - * @return The next character. - */ - public int peek() { - int result = -1; - - if (this.index != -1) { - result = this.header.charAt(this.index); - } - - return result; - } - - /** - * Reads the next character. - * - * @return The next character. - */ - public int read() { - int result = -1; - - if (this.index >= 0) { - result = this.header.charAt(this.index++); - - if (this.index >= this.header.length()) { - this.index = -1; - } - } - - return result; - } - - /** - * Reads a parameter value which is either a token or a quoted string. - * - * @return A parameter value. - * @throws IOException - */ - public String readActualNamedValue() throws IOException { - String result = null; - - // Discard any leading space - skipSpaces(); - - // Detect if quoted string or token available - int nextChar = peek(); - - if (isDoubleQuote(nextChar)) { - result = readQuotedString(); - } else if (isTokenChar(nextChar)) { - result = readToken(); - } - - return result; - } - - /** - * Reads the next comment. The first character must be a parenthesis. - * - * @return The next comment. - * @throws IOException - */ - public String readComment() throws IOException { - String result = null; - int next = read(); - - // First character must be a parenthesis - if (next == '(') { - StringBuilder buffer = new StringBuilder(); - - while (result == null) { - next = read(); - - if (isCommentText(next)) { - buffer.append((char) next); - } else if (isQuoteCharacter(next)) { - // Start of a quoted pair (escape sequence) - buffer.append((char) read()); - } else if (next == '(') { - // Nested comment - buffer.append('(').append(readComment()).append(')'); - } else if (next == ')') { - // End of comment - result = buffer.toString(); - } else if (next == -1) { - throw new IOException( - "Unexpected end of comment. Please check your value"); - } else { - throw new IOException("Invalid character \"" + next - + "\" detected in comment. Please check your value"); - } - } - } else { - throw new IOException("A comment must start with a parenthesis"); - } - - return result; - } - - /** - * Reads the next digits. - * - * @return The next digits. - */ - public String readDigits() { - StringBuilder sb = new StringBuilder(); - int next = read(); - - while (isTokenChar(next)) { - sb.append((char) next); - next = read(); - } - - // Unread the last character (separator or end marker) - unread(); - - return sb.toString(); - } - - /** - * Reads the next pair as a parameter. - * - * @param resultClass - * The named value class to return. - * @return The next pair as a parameter. - * @throws IOException - */ - public > NV readNamedValue( - Class resultClass) throws IOException { - NV result = null; - String name = readToken(); - int nextChar = read(); - - if (name.length() > 0) { - if (nextChar == '=') { - // The parameter has a value - result = createNamedValue(resultClass, name, - readActualNamedValue()); - } else { - // The parameter has not value - unread(); - result = createNamedValue(resultClass, name); - } - } else { - throw new IOException( - "Parameter or extension has no name. Please check your value"); - } - - return result; - } - - /** - * Reads the next pair as a parameter. - * - * @return The next pair as a parameter. - * @throws IOException - */ - public Parameter readParameter() throws IOException { - return readNamedValue(Parameter.class); - } - - /** - * Reads the next quoted string. The first character must be a double quote. - * - * @return The next quoted string. - * @throws IOException - */ - public String readQuotedString() throws IOException { - String result = null; - int next = read(); - - // First character must be a double quote - if (isDoubleQuote(next)) { - StringBuilder buffer = new StringBuilder(); - - while (result == null) { - next = read(); - - if (isQuotedText(next)) { - buffer.append((char) next); - } else if (isQuoteCharacter(next)) { - // Start of a quoted pair (escape sequence) - buffer.append((char) read()); - } else if (isDoubleQuote(next)) { - // End of quoted string - result = buffer.toString(); - } else if (next == -1) { - throw new IOException( - "Unexpected end of quoted string. Please check your value"); - } else { - throw new IOException( - "Invalid character \"" - + next - + "\" detected in quoted string. Please check your value"); - } - } - } else { - throw new IOException( - "A quoted string must start with a double quote"); - } - - return result; - } - - /** - * Read the next text until a space separator is reached. - * - * @return The next text. - */ - public String readRawText() { - // Read value until end or space - StringBuilder sb = null; - int next = read(); - - while ((next != -1) && !isSpace(next) && !isComma(next)) { - if (sb == null) { - sb = new StringBuilder(); - } - - sb.append((char) next); - next = read(); - } - - // Unread the separator - if (isSpace(next) || isComma(next)) { - unread(); - } - - return (sb == null) ? null : sb.toString(); - } - - /** - * Read the next header value of a multi-value header. It skips leading and - * trailing spaces. - * - * @see HTTP - * parsing rule - * - * @return The next header value or null. - */ - public String readRawValue() { - // Skip leading spaces - skipSpaces(); - - // Read value until end or comma - StringBuilder sb = null; - int next = read(); - - while ((next != -1) && !isComma(next)) { - if (sb == null) { - sb = new StringBuilder(); - } - - sb.append((char) next); - next = read(); - } - - // Remove trailing spaces - if (sb != null) { - for (int i = sb.length() - 1; (i >= 0) - && isLinearWhiteSpace(sb.charAt(i)); i--) { - sb.deleteCharAt(i); - } - } - - // Unread the separator - if (isComma(next)) { - unread(); - } - - return (sb == null) ? null : sb.toString(); - } - - /** - * Reads the next token. - * - * @return The next token. - */ - public String readToken() { - StringBuilder sb = new StringBuilder(); - int next = read(); - - while (isTokenChar(next)) { - sb.append((char) next); - next = read(); - } - - // Unread the last character (separator or end marker) - unread(); - - return sb.toString(); - } - - /** - * Read the next value. There can be multiple values for a single header. - * Returns null by default. - * - * @return The next value. - */ - public V readValue() throws IOException { - return null; - } - - /** - * Returns a new list with all values added. - * - * @return A new list with all values added. - */ - public List readValues() { - List result = new CopyOnWriteArrayList(); - addValues(result); - return result; - } - - /** - * Repositions this stream to the position at the time the mark - * method was last called on this input stream. - */ - public void reset() { - index = mark; - } - - /** - * Skips the next parameter separator (semi-colon) including leading and - * trailing spaces. - * - * @return True if a separator was effectively skipped. - */ - public boolean skipParameterSeparator() { - boolean result = false; - - // Skip leading spaces - skipSpaces(); - - // Check if next character is a parameter separator - if (isSemiColon(read())) { - result = true; - - // Skip trailing spaces - skipSpaces(); - } else { - // Probably reached the end of the header - unread(); - } - - return result; - } - - /** - * Skips the next spaces. - * - * @return True if spaces were skipped. - */ - public boolean skipSpaces() { - boolean result = false; - int next = peek(); - - while (isLinearWhiteSpace(next) && (next != -1)) { - result = result || isLinearWhiteSpace(next); - read(); - next = peek(); - } - - return result; - } - - /** - * Skips the next value separator (comma) including leading and trailing - * spaces. - * - * @return True if a separator was effectively skipped. - */ - public boolean skipValueSeparator() { - boolean result = false; - - // Skip leading spaces - skipSpaces(); - - // Check if next character is a value separator - if (isComma(read())) { - result = true; - - // Skip trailing spaces - skipSpaces(); - } else { - // Probably reached the end of the header - unread(); - } - - return result; - } - - /** - * Unreads the last character. - */ - public void unread() { - if (this.index > 0) { - this.index--; - } - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderUtils.java deleted file mode 100644 index cef3ce1cd8..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderUtils.java +++ /dev/null @@ -1,1026 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import static java.lang.Boolean.parseBoolean; -import static java.util.logging.Level.WARNING; -import static org.restlet.client.data.Disposition.TYPE_NONE; -import static org.restlet.client.data.Range.RANGE_BYTES_UNIT; -import static org.restlet.client.data.Range.isBytesRange; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCEPT; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCEPT_CHARSET; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCEPT_ENCODING; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCEPT_LANGUAGE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCEPT_PATCH; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCEPT_RANGES; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCESS_CONTROL_ALLOW_HEADERS; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCESS_CONTROL_ALLOW_METHODS; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCESS_CONTROL_ALLOW_ORIGIN; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCESS_CONTROL_EXPOSE_HEADERS; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCESS_CONTROL_MAX_AGE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCESS_CONTROL_REQUEST_HEADERS; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ACCESS_CONTROL_REQUEST_METHOD; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_AGE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ALLOW; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_AUTHENTICATION_INFO; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_AUTHORIZATION; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CACHE_CONTROL; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONNECTION; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONTENT_DISPOSITION; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONTENT_ENCODING; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONTENT_LANGUAGE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONTENT_LENGTH; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONTENT_LOCATION; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONTENT_MD5; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONTENT_RANGE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_CONTENT_TYPE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_COOKIE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_DATE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_ETAG; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_EXPECT; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_EXPIRES; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_FROM; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_HOST; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_IF_MATCH; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_IF_MODIFIED_SINCE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_IF_NONE_MATCH; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_IF_RANGE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_IF_UNMODIFIED_SINCE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_LAST_MODIFIED; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_LOCATION; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_MAX_FORWARDS; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_PRAGMA; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_PROXY_AUTHENTICATE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_PROXY_AUTHORIZATION; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_RANGE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_REFERRER; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_RETRY_AFTER; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_SERVER; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_SET_COOKIE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_SET_COOKIE2; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_TRAILER; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_TRANSFER_ENCODING; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_TRANSFER_EXTENSION; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_UPGRADE; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_USER_AGENT; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_VARY; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_VIA; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_WARNING; -import static org.restlet.client.engine.header.HeaderConstants.HEADER_WWW_AUTHENTICATE; -import static org.restlet.client.engine.util.StringUtils.isNullOrEmpty; -import static org.restlet.client.representation.Representation.UNKNOWN_SIZE; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.Set; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.Message; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.data.ClientInfo; -import org.restlet.client.data.Conditions; -import org.restlet.client.data.Header; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Range; -import org.restlet.client.data.Reference; -import org.restlet.client.data.Tag; -import org.restlet.client.engine.util.CaseInsensitiveHashSet; -import org.restlet.client.engine.util.DateUtils; -import org.restlet.client.representation.EmptyRepresentation; -import org.restlet.client.representation.Representation; -import org.restlet.client.util.Series; - -/** - * HTTP-style header utilities. - * - * @author Jerome Louvel - */ -public class HeaderUtils { - - /** - * Standard set of headers which cannot be modified. - */ - private static final Set STANDARD_HEADERS = Collections - .unmodifiableSet(new CaseInsensitiveHashSet(Arrays.asList( - HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS, - HEADER_ACCESS_CONTROL_ALLOW_HEADERS, - HEADER_ACCESS_CONTROL_ALLOW_METHODS, - HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, - HEADER_ACCESS_CONTROL_EXPOSE_HEADERS, - HEADER_ACCESS_CONTROL_MAX_AGE, - HEADER_ACCESS_CONTROL_REQUEST_HEADERS, - HEADER_ACCESS_CONTROL_REQUEST_METHOD, - HEADER_ACCEPT, - HEADER_ACCEPT_CHARSET, - HEADER_ACCEPT_ENCODING, - HEADER_ACCEPT_LANGUAGE, - HEADER_ACCEPT_PATCH, - HEADER_ACCEPT_RANGES, - HEADER_AGE, - HEADER_ALLOW, - HEADER_AUTHENTICATION_INFO, - HEADER_AUTHORIZATION, - HEADER_CACHE_CONTROL, - HEADER_CONNECTION, - HEADER_CONTENT_DISPOSITION, - HEADER_CONTENT_ENCODING, - HEADER_CONTENT_LANGUAGE, - HEADER_CONTENT_LENGTH, - HEADER_CONTENT_LOCATION, - HEADER_CONTENT_MD5, - HEADER_CONTENT_RANGE, - HEADER_CONTENT_TYPE, - HEADER_COOKIE, - HEADER_DATE, - HEADER_ETAG, - HEADER_EXPECT, - HEADER_EXPIRES, - HEADER_FROM, - HEADER_HOST, - HEADER_IF_MATCH, - HEADER_IF_MODIFIED_SINCE, - HEADER_IF_NONE_MATCH, - HEADER_IF_RANGE, - HEADER_IF_UNMODIFIED_SINCE, - HEADER_LAST_MODIFIED, - HEADER_LOCATION, - HEADER_MAX_FORWARDS, - HEADER_PROXY_AUTHENTICATE, - HEADER_PROXY_AUTHORIZATION, - HEADER_RANGE, - HEADER_REFERRER, - HEADER_RETRY_AFTER, - HEADER_SERVER, - HEADER_SET_COOKIE, - HEADER_SET_COOKIE2, - HEADER_USER_AGENT, - HEADER_VARY, - HEADER_VIA, - HEADER_WARNING, - HEADER_WWW_AUTHENTICATE))); - - /** - * Set of unsupported headers that will be covered in future versions. - */ - private static final Set UNSUPPORTED_STANDARD_HEADERS = Collections - .unmodifiableSet(new CaseInsensitiveHashSet(Arrays.asList( - HEADER_PRAGMA, - HEADER_TRAILER, - HEADER_TRANSFER_ENCODING, - HEADER_TRANSFER_EXTENSION, - HEADER_UPGRADE))); - - /** - * Adds the entity headers based on the {@link Representation} to the {@link Series}. - * - * @param entity - * The source entity {@link Representation}. - * @param headers - * The target headers {@link Series}. - */ - public static void addEntityHeaders(Representation entity, - Series

headers) { - if (entity == null || !entity.isAvailable()) { - addHeader(HEADER_CONTENT_LENGTH, "0", headers); - } else if (entity.getAvailableSize() != UNKNOWN_SIZE) { - addHeader(HEADER_CONTENT_LENGTH, Long.toString(entity.getAvailableSize()), headers); - } - - if (entity != null) { - addHeader(HEADER_CONTENT_ENCODING, EncodingWriter.write(entity.getEncodings()), headers); - addHeader(HEADER_CONTENT_LANGUAGE, LanguageWriter.write(entity.getLanguages()), headers); - - if (entity.getLocationRef() != null) { - addHeader(HEADER_CONTENT_LOCATION, entity.getLocationRef().getTargetRef().toString(), headers); - } - - - if (entity.getRange() != null) { - Range range = entity.getRange(); - if (isBytesRange(range)) { - addHeader(HEADER_CONTENT_RANGE, RangeWriter.write(range, entity.getSize()), headers); - } else { - addHeader(HEADER_CONTENT_RANGE, RangeWriter.write(range, range.getInstanceSize()), headers); - } - } - - if (entity.getMediaType() != null) { - addHeader(HEADER_CONTENT_TYPE, ContentType.writeHeader(entity), headers); - } - - if (entity.getExpirationDate() != null) { - addHeader(HEADER_EXPIRES, DateWriter.write(entity.getExpirationDate()), headers); - } - - if (entity.getModificationDate() != null) { - addHeader(HEADER_LAST_MODIFIED, - DateWriter.write(entity.getModificationDate()), headers); - } - - if (entity.getTag() != null) { - addHeader(HEADER_ETAG, - TagWriter.write(entity.getTag()), headers); - } - - if (entity.getDisposition() != null - && !TYPE_NONE.equals(entity.getDisposition().getType())) { - addHeader(HEADER_CONTENT_DISPOSITION, - DispositionWriter.write(entity.getDisposition()), - headers); - } - } - } - - /** - * Adds extension headers if they are non-standard headers. - * - * @param existingHeaders - * The headers to update. - * @param additionalHeaders - * The headers to add. - */ - public static void addExtensionHeaders(Series
existingHeaders, - Series
additionalHeaders) { - if (additionalHeaders != null) { - for (Header param : additionalHeaders) { - if (STANDARD_HEADERS.contains(param.getName())) { - // Standard headers that can't be overridden - Context.getCurrentLogger() - .warning( - "Addition of the standard header \"" - + param.getName() - + "\" is not allowed. Please use the equivalent property in the Restlet API."); - } else if (UNSUPPORTED_STANDARD_HEADERS.contains(param.getName())) { - Context.getCurrentLogger() - .warning( - "Addition of the standard header \"" - + param.getName() - + "\" is discouraged as a future version of the Restlet API will directly support it."); - existingHeaders.add(param); - } else { - existingHeaders.add(param); - } - } - } - } - - /** - * Adds the general headers from the {@link Message} to the {@link Series}. - * - * @param message - * The source {@link Message}. - * @param headers - * The target headers {@link Series}. - */ - public static void addGeneralHeaders(Message message, Series
headers) { - addHeader(HEADER_CACHE_CONTROL, - CacheDirectiveWriter.write(message.getCacheDirectives()), - headers); - - if (message.getDate() == null) { - message.setDate(new Date()); - } - - addHeader(HEADER_DATE, DateWriter.write(message.getDate()), headers); - - addHeader(HEADER_VIA, RecipientInfoWriter.write(message.getRecipientsInfo()), headers); - - addHeader(HEADER_WARNING, WarningWriter.write(message.getWarnings()), headers); - } - - /** - * Adds a header to the given list. Checks for exceptions and logs them. - * - * @param headerName - * The header name. - * @param headerValue - * The header value. - * @param headers - * The headers list. - */ - public static void addHeader(String headerName, String headerValue, - Series
headers) { - if (headerName != null && !isNullOrEmpty(headerValue)) { - try { - headers.add(headerName, headerValue); - } catch (Throwable t) { - Context.getCurrentLogger().log(Level.WARNING, - "Unable to format the " + headerName + " header", t); - } - } - } - - /** - * Adds the entity headers based on the {@link Representation} to the {@link Series} when a 304 (Not Modified) - * status is returned. - * - * @param entity - * The source entity {@link Representation}. - * @param headers - * The target headers {@link Series}. - */ - public static void addNotModifiedEntityHeaders(Representation entity, - Series
headers) { - if (entity != null) { - if (entity.getTag() != null) { - addHeader(HEADER_ETAG, TagWriter.write(entity.getTag()), headers); - } - - if (entity.getLocationRef() != null) { - addHeader(HEADER_CONTENT_LOCATION, - entity.getLocationRef().getTargetRef().toString(), - headers); - } - } - } - - /** - * Adds the headers based on the {@link Request} to the given {@link Series} . - * - * @param request - * The {@link Request} to copy the headers from. - * @param headers - * The {@link Series} to copy the headers to. - */ - public static void addRequestHeaders(Request request, Series
headers) { - ClientInfo clientInfo = request.getClientInfo(); - - if (!clientInfo.getAcceptedMediaTypes().isEmpty()) { - addHeader(HEADER_ACCEPT, - PreferenceWriter.write(clientInfo.getAcceptedMediaTypes()), - headers); - } else { - addHeader(HEADER_ACCEPT, MediaType.ALL.getName(), headers); - } - - if (!clientInfo.getAcceptedCharacterSets().isEmpty()) { - addHeader(HEADER_ACCEPT_CHARSET, - PreferenceWriter.write(clientInfo - .getAcceptedCharacterSets()), headers); - } - - if (!clientInfo.getAcceptedEncodings().isEmpty()) { - addHeader(HEADER_ACCEPT_ENCODING, - PreferenceWriter.write(clientInfo.getAcceptedEncodings()), - headers); - } - - if (!clientInfo.getAcceptedLanguages().isEmpty()) { - addHeader(HEADER_ACCEPT_LANGUAGE, - PreferenceWriter.write(clientInfo.getAcceptedLanguages()), - headers); - } - - if (!clientInfo.getAcceptedPatches().isEmpty()) { - addHeader(HEADER_ACCEPT_PATCH, - PreferenceWriter.write(clientInfo.getAcceptedPatches()), - headers); - } - - - if (clientInfo.getFrom() != null) { - addHeader(HEADER_FROM, request.getClientInfo().getFrom(), headers); - } - - // Manually add the host name and port when it is potentially - // different from the one specified in the target resource reference. - Reference hostRef = (request.getResourceRef().getBaseRef() != null) ? request - .getResourceRef().getBaseRef() : request.getResourceRef(); - - if (hostRef.getHostDomain() != null) { - String host = hostRef.getHostDomain(); - int hostRefPortValue = hostRef.getHostPort(); - - if ((hostRefPortValue != -1) - && (hostRefPortValue != request.getProtocol().getDefaultPort())) { - host = host + ':' + hostRefPortValue; - } - - addHeader(HEADER_HOST, host, headers); - } - - Conditions conditions = request.getConditions(); - addHeader(HEADER_IF_MATCH, TagWriter.write(conditions.getMatch()), headers); - addHeader(HEADER_IF_NONE_MATCH, TagWriter.write(conditions.getNoneMatch()), headers); - - if (conditions.getModifiedSince() != null) { - addHeader(HEADER_IF_MODIFIED_SINCE, DateWriter.write(conditions.getModifiedSince()), headers); - } - - if (conditions.getRangeTag() != null - && conditions.getRangeDate() != null) { - Context.getCurrentLogger() - .log(WARNING, - "Unable to format the HTTP If-Range header due to the presence of both entity tag and modification date."); - } else if (conditions.getRangeTag() != null) { - addHeader(HEADER_IF_RANGE, TagWriter.write(conditions.getRangeTag()), headers); - } else if (conditions.getRangeDate() != null) { - addHeader(HEADER_IF_RANGE, DateWriter.write(conditions.getRangeDate()), headers); - } - - if (conditions.getUnmodifiedSince() != null) { - addHeader(HEADER_IF_UNMODIFIED_SINCE, DateWriter.write(conditions.getUnmodifiedSince()), headers); - } - - if (request.getMaxForwards() > -1) { - addHeader(HEADER_MAX_FORWARDS, Integer.toString(request.getMaxForwards()), headers); - } - - if (!request.getRanges().isEmpty()) { - addHeader(HEADER_RANGE, RangeWriter.write(request.getRanges()), headers); - } - - if (request.getReferrerRef() != null) { - addHeader(HEADER_REFERRER, request.getReferrerRef().toString(), headers); - } - - if (request.getClientInfo().getAgent() != null) { - addHeader(HEADER_USER_AGENT, request.getClientInfo().getAgent(), headers); - } - - - // CORS headers - - if (request.getAccessControlRequestHeaders() != null) { - addHeader( - HEADER_ACCESS_CONTROL_REQUEST_HEADERS, - StringWriter.write(request.getAccessControlRequestHeaders()), - headers); - } - - if (request.getAccessControlRequestMethod() != null) { - addHeader(HEADER_ACCESS_CONTROL_REQUEST_METHOD, - request.getAccessControlRequestMethod().getName(), headers); - } - - // ---------------------------------- - // 3) Add supported extension headers - // ---------------------------------- - - if (!request.getCookies().isEmpty()) { - addHeader(HEADER_COOKIE, CookieWriter.write(request.getCookies()), headers); - } - - // ------------------------------------- - // 4) Add user-defined extension headers - // ------------------------------------- - - Series
additionalHeaders = request.getHeaders(); - addExtensionHeaders(headers, additionalHeaders); - - // --------------------------------------- - // 5) Add authorization headers at the end - // --------------------------------------- - - } - - - /** - * Remove the headers that are mapped to the framework's API from the given message's list of headers. - * - * @param message - * The message to update. - */ - public static void keepExtensionHeadersOnly(Message message) { - Series
headers = message.getHeaders(); - Series
extensionHeaders = new org.restlet.client.engine.util.HeaderSeries(); - for (Header header : headers) { - if (!STANDARD_HEADERS.contains(header.getName())) { - extensionHeaders.add(header); - } - } - message.getAttributes().put(HeaderConstants.ATTRIBUTE_HEADERS, extensionHeaders); - } - - /** - * Copies extension headers into a request or a response. - * - * @param headers - * The headers to copy. - * @param message - * The message to update. - */ - public static void copyExtensionHeaders(Series
headers, Message message) { - if (headers != null) { - Series
extensionHeaders = message.getHeaders(); - for (Header header : headers) { - if (!STANDARD_HEADERS.contains(header.getName())) { - extensionHeaders.add(header); - } - } - } - } - - /** - * Copies headers into a response. - * - * @param headers - * The headers to copy. - * @param response - * The response to update. - */ - public static void copyResponseTransportHeaders(Series
headers, Response response) { - if (headers != null) { - for (Header header : headers) { - if (HEADER_LOCATION.equalsIgnoreCase(header.getName())) { - response.setLocationRef(header.getValue()); - } else if (HEADER_AGE.equalsIgnoreCase(header.getName())) { - try { - response.setAge(Integer.parseInt(header.getValue())); - } catch (NumberFormatException nfe) { - Context.getCurrentLogger().log( - Level.WARNING, - "Error during Age header parsing. Header: " - + header.getValue(), nfe); - } - } else if (HEADER_DATE.equalsIgnoreCase(header.getName())) { - Date date = DateUtils.parse(header.getValue()); - - if (date == null) { - date = new Date(); - } - - response.setDate(date); - } else if (HEADER_RETRY_AFTER.equalsIgnoreCase(header.getName())) { - } else if (HEADER_SET_COOKIE.equalsIgnoreCase(header.getName()) - || HEADER_SET_COOKIE2.equalsIgnoreCase(header.getName())) { - try { - CookieSettingReader cr = new CookieSettingReader(header.getValue()); - response.getCookieSettings().add(cr.readValue()); - } catch (Exception e) { - Context.getCurrentLogger().log( - Level.WARNING, - "Error during cookie setting parsing. Header: " - + header.getValue(), e); - } - } else if (HEADER_WWW_AUTHENTICATE.equalsIgnoreCase(header.getName())) { - } else if (HEADER_PROXY_AUTHENTICATE.equalsIgnoreCase(header.getName())) { - } else if (HEADER_AUTHENTICATION_INFO.equalsIgnoreCase(header.getName())) { - } else if (HEADER_SERVER.equalsIgnoreCase(header.getName())) { - response.getServerInfo().setAgent(header.getValue()); - } else if (HEADER_ALLOW.equalsIgnoreCase(header.getName())) { - MethodReader.addValues(header, response.getAllowedMethods()); - } else if (HEADER_VARY.equalsIgnoreCase(header.getName())) { - DimensionReader.addValues(header, response.getDimensions()); - } else if (HEADER_VIA.equalsIgnoreCase(header.getName())) { - RecipientInfoReader.addValues(header, response.getRecipientsInfo()); - } else if (HEADER_WARNING.equalsIgnoreCase(header.getName())) { - WarningReader.addValues(header, response.getWarnings()); - } else if (HEADER_CACHE_CONTROL.equalsIgnoreCase(header.getName())) { - CacheDirectiveReader.addValues(header, response.getCacheDirectives()); - } else if (HEADER_ACCEPT_RANGES.equalsIgnoreCase(header.getName())) { - TokenReader tr = new TokenReader(header.getValue()); - response.getServerInfo().setAcceptingRanges(tr.readValues().contains(RANGE_BYTES_UNIT)); - } else if (HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS.equalsIgnoreCase(header.getName())) { - response.setAccessControlAllowCredentials(parseBoolean(header.getValue())); - StringReader.addValues(header, response.getAccessControlAllowHeaders()); - } else if (HEADER_ACCESS_CONTROL_ALLOW_ORIGIN.equalsIgnoreCase(header.getName())) { - response.setAccessControlAllowOrigin(header.getValue()); - } else if (HEADER_ACCESS_CONTROL_ALLOW_METHODS.equalsIgnoreCase(header.getName())) { - MethodReader.addValues(header, response.getAccessControlAllowMethods()); - } else if (HEADER_ACCESS_CONTROL_MAX_AGE.equalsIgnoreCase(header.getName())) { - response.setAccessControlMaxAge(Integer.parseInt(header.getValue())); - } - } - } - } - - /** - * Extracts entity headers and updates a given representation or create an - * empty one when at least one entity header is present. - * - * @param headers - * The headers to copy. - * @param representation - * The representation to update or null. - * @return a representation updated with the given entity headers. - * @throws NumberFormatException - * @see HeaderUtils#copyResponseTransportHeaders(Series, Response) - */ - public static Representation extractEntityHeaders(Iterable
headers, - Representation representation) throws NumberFormatException { - Representation result = (representation == null) ? new EmptyRepresentation() : representation; - boolean entityHeaderFound = false; - - if (headers != null) { - for (Header header : headers) { - if (HEADER_CONTENT_TYPE.equalsIgnoreCase(header.getName())) { - ContentType contentType = new ContentType(header.getValue()); - result.setMediaType(contentType.getMediaType()); - - if ((result.getCharacterSet() == null) - || (contentType.getCharacterSet() != null)) { - result.setCharacterSet(contentType.getCharacterSet()); - } - - entityHeaderFound = true; - } else if (HEADER_CONTENT_LENGTH.equalsIgnoreCase(header.getName())) { - entityHeaderFound = true; - } else if (HEADER_EXPIRES.equalsIgnoreCase(header.getName())) { - result.setExpirationDate(HeaderReader.readDate(header.getValue(), false)); - entityHeaderFound = true; - } else if (HEADER_CONTENT_ENCODING.equalsIgnoreCase(header.getName())) { - new EncodingReader(header.getValue()).addValues(result.getEncodings()); - entityHeaderFound = true; - } else if (HEADER_CONTENT_LANGUAGE.equalsIgnoreCase(header.getName())) { - new LanguageReader(header.getValue()).addValues(result.getLanguages()); - entityHeaderFound = true; - } else if (HEADER_LAST_MODIFIED.equalsIgnoreCase(header.getName())) { - result.setModificationDate(HeaderReader.readDate(header.getValue(), false)); - entityHeaderFound = true; - } else if (HEADER_ETAG.equalsIgnoreCase(header.getName())) { - result.setTag(Tag.parse(header.getValue())); - entityHeaderFound = true; - } else if (HEADER_CONTENT_LOCATION.equalsIgnoreCase(header.getName())) { - result.setLocationRef(header.getValue()); - entityHeaderFound = true; - } else if (HEADER_CONTENT_DISPOSITION.equalsIgnoreCase(header.getName())) { - try { - result.setDisposition(new DispositionReader(header.getValue()).readValue()); - entityHeaderFound = true; - } catch (IOException ioe) { - Context.getCurrentLogger().log( - Level.WARNING, - "Error during Content-Disposition header parsing. Header: " - + header.getValue(), ioe); - } - } else if (HEADER_CONTENT_RANGE.equalsIgnoreCase(header.getName())) { - } else if (HEADER_CONTENT_MD5.equalsIgnoreCase(header.getName())) { - } - } - } - - // If no representation was initially expected and no entity header - // is found, then do not return any representation - if ((representation == null) && !entityHeaderFound) { - result = null; - } - - return result; - } - - /** - * Returns the content length of the request entity if know, {@link Representation#UNKNOWN_SIZE} otherwise. - * - * @return The request content length. - */ - public static long getContentLength(Series
headers) { - long contentLength = UNKNOWN_SIZE; - - if (headers != null) { - // Extract the content length header - for (Header header : headers) { - if (HEADER_CONTENT_LENGTH.equalsIgnoreCase(header.getName())) { - try { - contentLength = Long.parseLong(header.getValue()); - } catch (NumberFormatException e) { - contentLength = UNKNOWN_SIZE; - } - } - } - } - - return contentLength; - } - - /** - * Indicates if the given character is alphabetical (a-z or A-Z). - * - * @param character - * The character to test. - * @return True if the given character is alphabetical (a-z or A-Z). - */ - public static boolean isAlpha(int character) { - return isUpperCase(character) || isLowerCase(character); - } - - /** - * Indicates if the given character is in ASCII range. - * - * @param character - * The character to test. - * @return True if the given character is in ASCII range. - */ - public static boolean isAsciiChar(int character) { - return (character >= 0) && (character <= 127); - } - - /** - * Indicates if the given character is a carriage return. - * - * @param character - * The character to test. - * @return True if the given character is a carriage return. - */ - public static boolean isCarriageReturn(int character) { - return (character == 13); - } - - /** - * Indicates if the entity is chunked. - * - * @return True if the entity is chunked. - */ - public static boolean isChunkedEncoding(Series
headers) { - boolean result = false; - - if (headers != null) { - final String header = headers.getFirstValue( - HeaderConstants.HEADER_TRANSFER_ENCODING, true); - result = "chunked".equalsIgnoreCase(header); - } - - return result; - } - - /** - * Indicates if the given character is a comma, the character used as header - * value separator. - * - * @param character - * The character to test. - * @return True if the given character is a comma. - */ - public static boolean isComma(int character) { - return (character == ','); - } - - /** - * Indicates if the given character is a comment text. It means {@link #isText(int)} returns true and the character - * is not '(' or ')'. - * - * @param character - * The character to test. - * @return True if the given character is a quoted text. - */ - public static boolean isCommentText(int character) { - return isText(character) && (character != '(') && (character != ')'); - } - - /** - * Indicates if the connection must be closed. - * - * @param headers - * The headers to test. - * @return True if the connection must be closed. - */ - public static boolean isConnectionClose(Series
headers) { - boolean result = false; - - if (headers != null) { - String header = headers.getFirstValue( - HeaderConstants.HEADER_CONNECTION, true); - result = "close".equalsIgnoreCase(header); - } - - return result; - } - - /** - * Indicates if the given character is a control character. - * - * @param character - * The character to test. - * @return True if the given character is a control character. - */ - public static boolean isControlChar(int character) { - return ((character >= 0) && (character <= 31)) || (character == 127); - } - - /** - * Indicates if the given character is a digit (0-9). - * - * @param character - * The character to test. - * @return True if the given character is a digit (0-9). - */ - public static boolean isDigit(int character) { - return (character >= '0') && (character <= '9'); - } - - /** - * Indicates if the given character is a double quote. - * - * @param character - * The character to test. - * @return True if the given character is a double quote. - */ - public static boolean isDoubleQuote(int character) { - return (character == 34); - } - - /** - * Indicates if the given character is an horizontal tab. - * - * @param character - * The character to test. - * @return True if the given character is an horizontal tab. - */ - public static boolean isHorizontalTab(int character) { - return (character == 9); - } - - /** - * Indicates if the given character is in ISO Latin 1 (8859-1) range. Note - * that this range is a superset of ASCII and a subrange of Unicode (UTF-8). - * - * @param character - * The character to test. - * @return True if the given character is in ISO Latin 1 range. - */ - public static boolean isLatin1Char(int character) { - return (character >= 0) && (character <= 255); - } - - /** - * Indicates if the given character is a value separator. - * - * @param character - * The character to test. - * @return True if the given character is a value separator. - */ - public static boolean isLinearWhiteSpace(int character) { - return (isCarriageReturn(character) || isSpace(character) - || isLineFeed(character) || HeaderUtils - .isHorizontalTab(character)); - } - - /** - * Indicates if the given character is a line feed. - * - * @param character - * The character to test. - * @return True if the given character is a line feed. - */ - public static boolean isLineFeed(int character) { - return (character == 10); - } - - /** - * Indicates if the given character is lower case (a-z). - * - * @param character - * The character to test. - * @return True if the given character is lower case (a-z). - */ - public static boolean isLowerCase(int character) { - return (character >= 'a') && (character <= 'z'); - } - - /** - * Indicates if the given character marks the start of a quoted pair. - * - * @param character - * The character to test. - * @return True if the given character marks the start of a quoted pair. - */ - public static boolean isQuoteCharacter(int character) { - return (character == '\\'); - } - - /** - * Indicates if the given character is a quoted text. It means {@link #isText(int)} returns true and - * {@link #isDoubleQuote(int)} returns - * false. - * - * @param character - * The character to test. - * @return True if the given character is a quoted text. - */ - public static boolean isQuotedText(int character) { - return isText(character) && !isDoubleQuote(character); - } - - /** - * Indicates if the given character is a semicolon, the character used as - * header parameter separator. - * - * @param character - * The character to test. - * @return True if the given character is a semicolon. - */ - public static boolean isSemiColon(int character) { - return (character == ';'); - } - - /** - * Indicates if the given character is a separator. - * - * @param character - * The character to test. - * @return True if the given character is a separator. - */ - public static boolean isSeparator(int character) { - switch (character) { - case '(': - case ')': - case '<': - case '>': - case '@': - case ',': - case ';': - case ':': - case '\\': - case '"': - case '/': - case '[': - case ']': - case '?': - case '=': - case '{': - case '}': - case ' ': - case '\t': - return true; - - default: - return false; - } - } - - /** - * Indicates if the given character is a space. - * - * @param character - * The character to test. - * @return True if the given character is a space. - */ - public static boolean isSpace(int character) { - return (character == 32); - } - - /** - * Indicates if the given character is textual (ISO Latin 1 and not a - * control character). - * - * @param character - * The character to test. - * @return True if the given character is textual. - */ - public static boolean isText(int character) { - return isLatin1Char(character) && !isControlChar(character); - } - - /** - * Indicates if the token is valid.
- * Only contains valid token characters. - * - * @param token - * The token to check - * @return True if the token is valid. - */ - public static boolean isToken(CharSequence token) { - for (int i = 0; i < token.length(); i++) { - if (!isTokenChar(token.charAt(i))) { - return false; - } - } - - return true; - } - - /** - * Indicates if the given character is a token character (text and not a - * separator). - * - * @param character - * The character to test. - * @return True if the given character is a token character (text and not a - * separator). - */ - public static boolean isTokenChar(int character) { - return isAsciiChar(character) && !isSeparator(character); - } - - /** - * Indicates if the given character is upper case (A-Z). - * - * @param character - * The character to test. - * @return True if the given character is upper case (A-Z). - */ - public static boolean isUpperCase(int character) { - return (character >= 'A') && (character <= 'Z'); - } - - - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e. it isn't instantiable and extensible. - */ - private HeaderUtils() { - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderWriter.java deleted file mode 100644 index 1043dd8436..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/HeaderWriter.java +++ /dev/null @@ -1,312 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import org.restlet.client.engine.util.emul.StringWriter; -import java.util.Collection; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Encoding; -import org.restlet.client.data.Reference; -import org.restlet.client.util.NamedValue; - -/** - * HTTP-style header writer. - * - * @param - * The value type. - * @author Jerome Louvel - */ -public abstract class HeaderWriter extends StringWriter { - - @Override - public HeaderWriter append(char c) { - super.append(c); - return this; - } - - /** - * Appends an array of characters. - * - * @param cs - * The array of characters. - * @return This writer. - */ - public HeaderWriter append(char[] cs) { - if (cs != null) { - for (char c : cs) { - append(c); - } - } - - return this; - } - - @Override - public HeaderWriter append(CharSequence csq) { - super.append(csq); - return this; - } - - /** - * Appends a collection of values. - * - * @param values - * The collection of values to append. - * @return This writer. - */ - public HeaderWriter append(Collection values) { - if ((values != null) && !values.isEmpty()) { - boolean first = true; - - for (V value : values) { - if (canWrite(value)) { - if (first) { - first = false; - } else { - appendValueSeparator(); - } - - append(value); - } - } - } - - return this; - } - - /** - * Appends an integer. - * - * @param i - * The value to append. - * @return This writer. - */ - public HeaderWriter append(int i) { - return append(Integer.toString(i)); - } - - /** - * Appends a long. - * - * @param l - * The value to append. - * @return This writer. - */ - public HeaderWriter append(long l) { - return append(Long.toString(l)); - } - - /** - * Appends a value. - * - * @param value - * The value. - * @return This writer. - */ - public abstract HeaderWriter append(V value); - - /** - * Appends a string as an HTTP comment, surrounded by parenthesis and with - * quoted pairs if needed. - * - * @param content - * The comment to write. - * @return This writer. - */ - public HeaderWriter appendComment(String content) { - append('('); - char c; - - for (int i = 0; i < content.length(); i++) { - c = content.charAt(i); - - if (HeaderUtils.isCommentText(c)) { - append(c); - } else { - appendQuotedPair(c); - } - } - - return append(')'); - } - - /** - * Formats and appends a parameter as an extension. If the value is not a - * token, then it is quoted. - * - * @param extension - * The parameter to format as an extension. - * @return This writer. - */ - public HeaderWriter appendExtension(NamedValue extension) { - if (extension != null) { - return appendExtension(extension.getName(), extension.getValue()); - } else { - return this; - } - } - - /** - * Appends an extension. If the value is not a token, then it is quoted. - * - * @param name - * The extension name. - * @param value - * The extension value. - * @return This writer. - */ - public HeaderWriter appendExtension(String name, String value) { - if ((name != null) && (name.length() > 0)) { - append(name); - - if ((value != null) && (value.length() > 0)) { - append("="); - - if (HeaderUtils.isToken(value)) { - append(value); - } else { - appendQuotedString(value); - } - } - } - - return this; - } - - /** - * Appends a semicolon as a parameter separator. - * - * @return This writer. - */ - public HeaderWriter appendParameterSeparator() { - return append(";"); - } - - /** - * Appends a product description. - * - * @param name - * The product name token. - * @param version - * The product version token. - * @return This writer. - */ - public HeaderWriter appendProduct(String name, String version) { - appendToken(name); - - if (version != null) { - append('/').appendToken(version); - } - - return this; - } - - /** - * Appends a quoted character, prefixing it with a backslash. - * - * @param character - * The character to quote. - * @return This writer. - */ - public HeaderWriter appendQuotedPair(char character) { - return append('\\').append(character); - } - - /** - * Appends a quoted string. - * - * @param content - * The string to quote and write. - * @return This writer. - */ - public HeaderWriter appendQuotedString(String content) { - if ((content != null) && (content.length() > 0)) { - append('"'); - char c; - - for (int i = 0; i < content.length(); i++) { - c = content.charAt(i); - - if (HeaderUtils.isQuotedText(c)) { - append(c); - } else { - appendQuotedPair(c); - } - } - - append('"'); - } - - return this; - } - - /** - * Appends a space character. - * - * @return This writer. - */ - public HeaderWriter appendSpace() { - return append(' '); - } - - /** - * Appends a token. - * - * @param token - * The token to write. - * @return This writer. - */ - public HeaderWriter appendToken(String token) { - if (HeaderUtils.isToken(token)) { - return append(token); - } else { - throw new IllegalArgumentException( - "Unexpected character found in token: " + token); - } - } - - /** - * Formats and appends a source string as an URI encoded string. - * - * @param source - * The source string to format. - * @param characterSet - * The supported character encoding. - * @return This writer. - */ - public HeaderWriter appendUriEncoded(CharSequence source, - CharacterSet characterSet) { - return append(Reference.encode(source.toString(), characterSet)); - } - - /** - * Appends a comma as a value separator. - * - * @return This writer. - */ - public HeaderWriter appendValueSeparator() { - return append(", "); - } - - /** - * Indicates if the value can be written to the header. Useful to prevent - * the writing of {@link Encoding#IDENTITY} constants for example. By - * default it returns true for non null values. - * - * @param value - * The value to add. - * @return True if the value can be added. - */ - protected boolean canWrite(V value) { - return (value != null); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/LanguageReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/LanguageReader.java deleted file mode 100644 index 3430ad9ba9..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/LanguageReader.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; - -import org.restlet.client.data.Language; - -/** - * Language header reader. - * - * @author Jerome Louvel - */ -public class LanguageReader extends HeaderReader { - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public LanguageReader(String header) { - super(header); - } - - @Override - public Language readValue() throws IOException { - return Language.valueOf(readRawValue()); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/LanguageWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/LanguageWriter.java deleted file mode 100644 index 7440fa06f9..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/LanguageWriter.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.List; - -import org.restlet.client.data.Language; - -/** - * Language header writer. - * - * @author Jerome Louvel - */ -public class LanguageWriter extends MetadataWriter { - - /** - * Writes a list of languages. - * - * @param languages - * The languages to write. - * @return This writer. - */ - public static String write(List languages) { - return new LanguageWriter().append(languages).toString(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MetadataWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MetadataWriter.java deleted file mode 100644 index 2a17076c54..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MetadataWriter.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import org.restlet.client.data.Metadata; - -/** - * Metadata header writer. - * - * @author Jerome Louvel - */ -public class MetadataWriter extends HeaderWriter { - - @Override - public MetadataWriter append(M metadata) { - return (MetadataWriter) append(metadata.getName()); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MethodReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MethodReader.java deleted file mode 100644 index cd33ea0cea..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MethodReader.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Collection; - -import org.restlet.client.data.Header; -import org.restlet.client.data.Method; - -/** - * Method header reader. - * - * @author Jerome Louvel - */ -public class MethodReader extends HeaderReader { - - /** - * Adds values to the given collection. - * - * @param header - * The header to read. - * @param collection - * The collection to update. - */ - public static void addValues(Header header, Collection collection) { - new MethodReader(header.getValue()).addValues(collection); - } - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public MethodReader(String header) { - super(header); - } - - @Override - public Method readValue() throws IOException { - return Method.valueOf(readToken()); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MethodWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MethodWriter.java deleted file mode 100644 index d14d2df842..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/MethodWriter.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.Set; - -import org.restlet.client.data.Method; - -/** - * Method header writer. - * - * @author Jerome Louvel - */ -public class MethodWriter extends HeaderWriter { - - /** - * Writes a set of methods with a comma separator. - * - * @param methods - * The set of methods. - * @return The formatted set of methods. - */ - public static String write(Set methods) { - return new MethodWriter().append(methods).toString(); - } - - @Override - public MethodWriter append(Method method) { - return (MethodWriter) appendToken(method.getName()); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/PreferenceReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/PreferenceReader.java deleted file mode 100644 index 447c5a5103..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/PreferenceReader.java +++ /dev/null @@ -1,473 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import static org.restlet.client.engine.header.HeaderUtils.isComma; -import static org.restlet.client.engine.header.HeaderUtils.isDoubleQuote; -import static org.restlet.client.engine.header.HeaderUtils.isSpace; -import static org.restlet.client.engine.header.HeaderUtils.isText; -import static org.restlet.client.engine.header.HeaderUtils.isTokenChar; - -import java.io.IOException; -import java.util.Iterator; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.ClientInfo; -import org.restlet.client.data.Encoding; -import org.restlet.client.data.Language; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Metadata; -import org.restlet.client.data.Parameter; -import org.restlet.client.data.Preference; -import org.restlet.client.util.Series; - -/** - * Preference header reader. Works for character sets, encodings, languages or - * media types. - * - * @author Jerome Louvel - */ -public class PreferenceReader extends - HeaderReader> { - - public static final int TYPE_CHARACTER_SET = 1; - - public static final int TYPE_ENCODING = 2; - - public static final int TYPE_LANGUAGE = 3; - - public static final int TYPE_MEDIA_TYPE = 4; - - public static final int TYPE_PATCH = 5; - - /** - * Parses character set preferences from a header. - * - * @param acceptCharsetHeader - * The header to parse. - * @param clientInfo - * The client info to update. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static void addCharacterSets(String acceptCharsetHeader, - ClientInfo clientInfo) { - if (acceptCharsetHeader != null) { - // Implementation according to - // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.2 - if (acceptCharsetHeader.length() == 0) { - clientInfo.getAcceptedCharacterSets().add( - new Preference(CharacterSet.ISO_8859_1)); - } else { - PreferenceReader pr = new PreferenceReader( - PreferenceReader.TYPE_CHARACTER_SET, - acceptCharsetHeader); - pr.addValues(clientInfo.getAcceptedCharacterSets()); - } - } else { - clientInfo.getAcceptedCharacterSets().add( - new Preference(CharacterSet.ALL)); - } - } - - /** - * Parses encoding preferences from a header. - * - * @param acceptEncodingHeader - * The header to parse. - * @param clientInfo - * The client info to update. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static void addEncodings(String acceptEncodingHeader, - ClientInfo clientInfo) { - if (acceptEncodingHeader != null) { - PreferenceReader pr = new PreferenceReader( - PreferenceReader.TYPE_ENCODING, acceptEncodingHeader); - pr.addValues(clientInfo.getAcceptedEncodings()); - } else { - clientInfo.getAcceptedEncodings().add( - new Preference(Encoding.IDENTITY)); - } - } - - /** - * Adds language preferences from a header. - * - * @param acceptLanguageHeader - * The header to parse. - * @param clientInfo - * The client info to update. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static void addLanguages(String acceptLanguageHeader, - ClientInfo clientInfo) { - if (acceptLanguageHeader != null) { - PreferenceReader pr = new PreferenceReader( - PreferenceReader.TYPE_LANGUAGE, acceptLanguageHeader); - pr.addValues(clientInfo.getAcceptedLanguages()); - } else { - clientInfo.getAcceptedLanguages().add(new Preference(Language.ALL)); - } - } - - /** - * Parses media type preferences from a header. - * - * @param acceptMediaTypeHeader - * The header to parse. - * @param clientInfo - * The client info to update. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static void addMediaTypes(String acceptMediaTypeHeader, - ClientInfo clientInfo) { - if (acceptMediaTypeHeader != null) { - PreferenceReader pr = new PreferenceReader( - PreferenceReader.TYPE_MEDIA_TYPE, acceptMediaTypeHeader); - pr.addValues(clientInfo.getAcceptedMediaTypes()); - } else { - clientInfo.getAcceptedMediaTypes().add( - new Preference(MediaType.ALL)); - } - } - - /** - * Parses patch preferences from a header. - * - * @param acceptPatchHeader - * The header to parse. - * @param clientInfo - * The client info to update. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static void addPatches(String acceptPatchHeader, - ClientInfo clientInfo) { - if (acceptPatchHeader != null) { - PreferenceReader pr = new PreferenceReader( - PreferenceReader.TYPE_PATCH, acceptPatchHeader); - pr.addValues(clientInfo.getAcceptedPatches()); - } - } - - /** - * Parses a quality value.
- * If the quality is invalid, an IllegalArgumentException is thrown. - * - * @param quality - * The quality value as a string. - * @return The parsed quality value as a float. - */ - public static float readQuality(String quality) { - try { - float result = Float.valueOf(quality); - - if (PreferenceWriter.isValidQuality(result)) { - return result; - } - - throw new IllegalArgumentException( - "Invalid quality value detected. Value must be between 0 and 1."); - } catch (NumberFormatException nfe) { - throw new IllegalArgumentException( - "Invalid quality value detected. Value must be between 0 and 1."); - } - } - - /** The type of metadata read. */ - private volatile int type; - - /** - * Constructor. - * - * @param type - * The type of metadata read. - * @param header - * The header to read. - */ - public PreferenceReader(int type, String header) { - super(header); - this.type = type; - } - - /** - * Creates a new preference. - * - * @param metadata - * The metadata name. - * @param parameters - * The parameters list. - * @return The new preference. - */ - @SuppressWarnings("unchecked") - protected Preference createPreference(CharSequence metadata, - Series parameters) { - Preference result; - - if (parameters == null) { - result = new Preference(); - - switch (this.type) { - case TYPE_CHARACTER_SET: - result.setMetadata((T) CharacterSet.valueOf(metadata.toString())); - break; - - case TYPE_ENCODING: - result.setMetadata((T) Encoding.valueOf(metadata.toString())); - break; - - case TYPE_LANGUAGE: - result.setMetadata((T) Language.valueOf(metadata.toString())); - break; - - case TYPE_MEDIA_TYPE: - case TYPE_PATCH: - result.setMetadata((T) MediaType.valueOf(metadata.toString())); - break; - } - } else { - final Series mediaParams = extractMediaParams(parameters); - final float quality = extractQuality(parameters); - result = new Preference(null, quality, parameters); - - switch (this.type) { - case TYPE_CHARACTER_SET: - result.setMetadata((T) new CharacterSet(metadata.toString())); - break; - - case TYPE_ENCODING: - result.setMetadata((T) new Encoding(metadata.toString())); - break; - - case TYPE_LANGUAGE: - result.setMetadata((T) new Language(metadata.toString())); - break; - - case TYPE_MEDIA_TYPE: - case TYPE_PATCH: - result.setMetadata((T) new MediaType(metadata.toString(), - mediaParams)); - break; - } - } - - return result; - } - - /** - * Extract the media parameters. Only leave as the quality parameter if - * found. Modifies the parameters list. - * - * @param parameters - * All the preference parameters. - * @return The media parameters. - */ - protected Series extractMediaParams(Series parameters) { - Series result = null; - boolean qualityFound = false; - Parameter param = null; - - if (parameters != null) { - result = new org.restlet.client.engine.util.ParameterSeries(); - - for (final Iterator iter = parameters.iterator(); !qualityFound - && iter.hasNext();) { - param = iter.next(); - - if (param.getName().equals("q")) { - qualityFound = true; - } else { - iter.remove(); - result.add(param); - } - } - } - - return result; - } - - /** - * Extract the quality value. If the value is not found, 1 is returned. - * - * @param parameters - * The preference parameters. - * @return The quality value. - */ - protected float extractQuality(Series parameters) { - float result = 1F; - boolean found = false; - - if (parameters != null) { - Parameter param = null; - - for (final Iterator iter = parameters.iterator(); !found - && iter.hasNext();) { - param = iter.next(); - if (param.getName().equals("q")) { - result = readQuality(param.getValue()); - found = true; - - // Remove the quality parameter as we will directly store it - // in the Preference object - iter.remove(); - } - } - } - - return result; - } - - /** - * Read the next preference. - * - * @return The next preference. - */ - public Preference readValue() throws IOException { - Preference result = null; - - boolean readingMetadata = true; - boolean readingParamName = false; - boolean readingParamValue = false; - - StringBuilder metadataBuffer = new StringBuilder(); - StringBuilder paramNameBuffer = null; - StringBuilder paramValueBuffer = null; - - Series parameters = null; - int next = 0; - - while (result == null) { - next = read(); - - if (readingMetadata) { - if ((next == -1) || isComma(next)) { - if (metadataBuffer.length() > 0) { - // End of metadata section - // No parameters detected - result = createPreference(metadataBuffer, null); - } else { - // Ignore empty metadata name - break; - } - } else if (next == ';') { - if (metadataBuffer.length() > 0) { - // End of metadata section - // Parameters detected - readingMetadata = false; - readingParamName = true; - paramNameBuffer = new StringBuilder(); - parameters = new - org.restlet.client.engine.util.ParameterSeries(); - } else { - throw new IOException("Empty metadata name detected."); - } - } else if (isSpace(next)) { - // Ignore spaces - } else if (isText(next)) { - metadataBuffer.append((char) next); - } else { - throw new IOException("Unexpected character \"" - + (char) next + "\" detected."); - } - } else if (readingParamName) { - if (next == '=') { - if (paramNameBuffer.length() > 0) { - // End of parameter name section - readingParamName = false; - readingParamValue = true; - paramValueBuffer = new StringBuilder(); - } else { - throw new IOException("Empty parameter name detected."); - } - } else if ((next == -1) || isComma(next)) { - if (paramNameBuffer.length() > 0) { - // End of parameters section - parameters.add(Parameter.create(paramNameBuffer, null)); - result = createPreference(metadataBuffer, parameters); - } else { - throw new IOException("Empty parameter name detected."); - } - } else if (next == ';') { - // End of parameter - parameters.add(Parameter.create(paramNameBuffer, null)); - paramNameBuffer = new StringBuilder(); - readingParamName = true; - readingParamValue = false; - } else if (isSpace(next) && (paramNameBuffer.length() == 0)) { - // Ignore white spaces - } else if (isTokenChar(next)) { - paramNameBuffer.append((char) next); - } else { - throw new IOException("Unexpected character \"" - + (char) next + "\" detected."); - } - } else if (readingParamValue) { - if ((next == -1) || isComma(next) || isSpace(next)) { - if (paramValueBuffer.length() > 0) { - // End of parameters section - parameters.add(Parameter.create(paramNameBuffer, - paramValueBuffer)); - result = createPreference(metadataBuffer, parameters); - } else { - throw new IOException("Empty parameter value detected"); - } - } else if (next == ';') { - // End of parameter - parameters.add(Parameter.create(paramNameBuffer, - paramValueBuffer)); - paramNameBuffer = new StringBuilder(); - readingParamName = true; - readingParamValue = false; - } else if ((next == '"') && (paramValueBuffer.length() == 0)) { - // Parse the quoted string - boolean done = false; - boolean quotedPair = false; - - while ((!done) && (next != -1)) { - next = read(); - - if (quotedPair) { - // End of quoted pair (escape sequence) - if (isText(next)) { - paramValueBuffer.append((char) next); - quotedPair = false; - } else { - throw new IOException( - "Invalid character detected in quoted string. Please check your value"); - } - } else if (isDoubleQuote(next)) { - // End of quoted string - done = true; - } else if (next == '\\') { - // Begin of quoted pair (escape sequence) - quotedPair = true; - } else if (isText(next)) { - paramValueBuffer.append((char) next); - } else { - throw new IOException( - "Invalid character detected in quoted string. Please check your value"); - } - } - } else if (isTokenChar(next)) { - paramValueBuffer.append((char) next); - } else { - throw new IOException("Unexpected character \"" - + (char) next + "\" detected."); - } - } - } - - if (isComma(next)) { - // Unread character which isn't part of the value - unread(); - } - - return result; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/PreferenceWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/PreferenceWriter.java deleted file mode 100644 index 120f3e509b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/PreferenceWriter.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; - -import org.restlet.client.data.Parameter; -import org.restlet.client.data.Preference; - -/** - * Preference header writer. - * - * @author Jerome Louvel - */ -public class PreferenceWriter extends HeaderWriter> { - /** - * Indicates if the quality value is valid. - * - * @param quality - * The quality value. - * @return True if the quality value is valid. - */ - public static boolean isValidQuality(float quality) { - return (quality >= 0F) && (quality <= 1F); - } - - /** - * Writes a list of preferences with a comma separator. - * - * @param prefs - * The list of preferences. - * @return The formatted list of preferences. - * @throws IOException - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public static String write(List prefs) { - return new PreferenceWriter().append(prefs).toString(); - } - - @Override - public PreferenceWriter append(Preference pref) { - append(pref.getMetadata().getName()); - - if (pref.getQuality() < 1F) { - append(";q="); - appendQuality(pref.getQuality()); - } - - if (pref.getParameters() != null) { - Parameter param; - - for (Iterator iter = pref.getParameters().iterator(); iter - .hasNext();) { - param = iter.next(); - - if (param.getName() != null) { - append(';').append(param.getName()); - - if ((param.getValue() != null) - && (param.getValue().length() > 0)) { - append('=').append(param.getValue()); - } - } - } - } - - return this; - } - - /** - * Formats a quality value.
- * If the quality is invalid, an IllegalArgumentException is thrown. - * - * @param quality - * The quality value as a float. - * @return This writer. - */ - public PreferenceWriter appendQuality(float quality) { - if (!isValidQuality(quality)) { - throw new IllegalArgumentException( - "Invalid quality value detected. Value must be between 0 and 1."); - } - - - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ProductReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ProductReader.java deleted file mode 100644 index 3728ac3d84..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ProductReader.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.ArrayList; -import java.util.List; - -import org.restlet.client.data.Product; - -/** - * User agent header reader. - * - * @author Thierry Boileau - */ -public class ProductReader { - - /** - * Parses the given user agent String to a list of Product instances. - * - * @param userAgent - * @return the List of Product objects parsed from the String - * @throws IllegalArgumentException - * Thrown if the String can not be parsed as a list of Product - * instances. - */ - public static List read(String userAgent) - throws IllegalArgumentException { - final List result = new ArrayList(); - - if (userAgent != null) { - String token = null; - String version = null; - String comment = null; - final char[] tab = userAgent.trim().toCharArray(); - StringBuilder tokenBuilder = new StringBuilder(); - StringBuilder versionBuilder = null; - StringBuilder commentBuilder = null; - int index = 0; - boolean insideToken = true; - boolean insideVersion = false; - boolean insideComment = false; - - for (index = 0; index < tab.length; index++) { - final char c = tab[index]; - if (insideToken) { - if (HeaderUtils.isTokenChar(c) || (c == ' ')) { - tokenBuilder.append(c); - } else { - token = tokenBuilder.toString().trim(); - insideToken = false; - if (c == '/') { - insideVersion = true; - versionBuilder = new StringBuilder(); - } else if (c == '(') { - insideComment = true; - commentBuilder = new StringBuilder(); - } - } - } else { - if (insideVersion) { - if (c != ' ') { - versionBuilder.append(c); - } else { - insideVersion = false; - version = versionBuilder.toString(); - } - } else { - if (c == '(') { - insideComment = true; - commentBuilder = new StringBuilder(); - } else { - if (insideComment) { - if (c == ')') { - insideComment = false; - comment = commentBuilder.toString(); - result.add(new Product(token, version, - comment)); - insideToken = true; - tokenBuilder = new StringBuilder(); - } else { - commentBuilder.append(c); - } - } else { - result.add(new Product(token, version, null)); - insideToken = true; - tokenBuilder = new StringBuilder(); - tokenBuilder.append(c); - } - } - } - } - } - - if (insideComment) { - comment = commentBuilder.toString(); - result.add(new Product(token, version, comment)); - } else { - if (insideVersion) { - version = versionBuilder.toString(); - result.add(new Product(token, version, null)); - } else { - if (insideToken && (tokenBuilder.length() > 0)) { - token = tokenBuilder.toString(); - result.add(new Product(token, null, null)); - } - } - } - } - - return result; - - } - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e. it isn't instantiable and extensible. - */ - private ProductReader() { - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ProductWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ProductWriter.java deleted file mode 100644 index 34f2f61b61..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/ProductWriter.java +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.Iterator; -import java.util.List; - -import org.restlet.client.data.Product; - -/** - * User agent header writer. - * - * @author Thierry Boileau - */ -public class ProductWriter { - - /** - * Formats the given List of Products to a String. - * - * @param products - * The list of products to format. - * @return the List of Products as String. - */ - public static String write(List products) { - StringBuilder builder = new StringBuilder(); - - for (Iterator iterator = products.iterator(); iterator - .hasNext();) { - Product product = iterator.next(); - - if ((product.getName() == null) - || (product.getName().length() == 0)) { - throw new IllegalArgumentException( - "Product name cannot be null."); - } - - builder.append(product.getName()); - - if (product.getVersion() != null) { - builder.append("/").append(product.getVersion()); - } - - if (product.getComment() != null) { - builder.append(" (").append(product.getComment()).append(")"); - } - - if (iterator.hasNext()) { - builder.append(" "); - } - } - - return builder.toString(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RangeReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RangeReader.java deleted file mode 100644 index 8195687360..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RangeReader.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.ArrayList; -import java.util.List; - -import org.restlet.client.data.Range; -import org.restlet.client.representation.Representation; - -/** - * Range header reader. - * - * @author Jerome Louvel - */ -public class RangeReader { - - /** - * Parse the Content-Range header value and update the given representation. - * - * @param value - * Content-range header. - * @param representation - * Representation to update. - */ - public static void update(String value, Representation representation) { - String prefix = "bytes "; - if (value != null && value.startsWith(prefix)) { - value = value.substring(prefix.length()); - - int index = value.indexOf("-"); - int index1 = value.indexOf("/"); - - if (index != -1) { - long startIndex = (index == 0) ? Range.INDEX_LAST : Long - .parseLong(value.substring(0, index)); - long endIndex = Long.parseLong(value.substring(index + 1, - index1)); - - representation.setRange(new Range(startIndex, endIndex - - startIndex + 1)); - } - - String strLength = value.substring(index1 + 1); - if (!("*".equals(strLength))) { - representation.setSize(Long.parseLong(strLength)); - } - } - } - - /** - * Parse the Range header and returns the list of corresponding Range - * objects. - * - * @param rangeHeader - * The Range header value. - * @return The list of corresponding Range objects. - */ - public static List read(String rangeHeader) { - List result = new ArrayList(); - String prefix = "bytes="; - if (rangeHeader != null && rangeHeader.startsWith(prefix)) { - rangeHeader = rangeHeader.substring(prefix.length()); - - String[] array = rangeHeader.split(","); - for (int i = 0; i < array.length; i++) { - String value = array[i].trim(); - long index = 0; - long length = 0; - if (value.startsWith("-")) { - index = Range.INDEX_LAST; - length = Long.parseLong(value.substring(1)); - } else if (value.endsWith("-")) { - index = Long.parseLong(value.substring(0, - value.length() - 1)); - length = Range.SIZE_MAX; - } else { - String[] tab = value.split("-"); - if (tab.length == 2) { - index = Long.parseLong(tab[0]); - length = Long.parseLong(tab[1]) - index + 1; - } - } - result.add(new Range(index, length)); - } - } - - return result; - } - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e. it isn't instantiable and extensible. - */ - private RangeReader() { - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RangeWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RangeWriter.java deleted file mode 100644 index f56ee735d1..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RangeWriter.java +++ /dev/null @@ -1,140 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.List; - -import org.restlet.client.data.Range; -import org.restlet.client.representation.Representation; - -/** - * Range header writer. - * - * @author Jerome Louvel - */ -public class RangeWriter extends HeaderWriter { - - /** - * Formats {@code ranges} as a Range header value - * - * @param ranges - * List of ranges to format - * @return {@code ranges} formatted or null if the list is null or empty. - */ - public static String write(List ranges) { - return new RangeWriter().append(ranges).toString(); - } - - /** - * Formats {@code range} as a Content-Range header value. - * - * @param range - * Range to format - * @param size - * Total size of the entity - * @return {@code range} formatted - */ - public static String write(Range range, long size) { - StringBuilder b = new StringBuilder(range.getUnitName() + " "); - - if (range.getIndex() >= Range.INDEX_FIRST) { - b.append(range.getIndex()); - b.append("-"); - if (range.getSize() != Range.SIZE_MAX) { - b.append(range.getIndex() + range.getSize() - 1); - } else { - if (size != Representation.UNKNOWN_SIZE) { - b.append(size - 1); - } else { - throw new IllegalArgumentException( - "The entity has an unknown size, can't determine the last byte position."); - } - } - } else if (range.getIndex() == Range.INDEX_LAST) { - if (range.getSize() != Range.SIZE_MAX) { - if (size != Representation.UNKNOWN_SIZE) { - if (range.getSize() <= size) { - b.append(size - range.getSize()); - b.append("-"); - b.append(size - 1); - } else { - throw new IllegalArgumentException( - "The size of the range (" - + range.getSize() - + ") is higher than the size of the entity (" - + size + ")."); - } - } else { - throw new IllegalArgumentException( - "The entity has an unknown size, can't determine the last byte position."); - } - } else { - // This is not a valid range. - throw new IllegalArgumentException( - "The range provides no index and no size, it is invalid."); - } - } - - if (size != Representation.UNKNOWN_SIZE) { - b.append("/").append(size); - } else { - b.append("/*"); - } - - return b.toString(); - } - - /** - * Formats {@code ranges} as a Range header value - * - * @param ranges - * List of ranges to format - * @return This writer. - */ - public RangeWriter append(List ranges) { - if (ranges == null || ranges.isEmpty()) { - return this; - } - - append(ranges.get(0).getUnitName()); - append("="); - - for (int i = 0; i < ranges.size(); i++) { - if (i > 0) { - append(", "); - } - - append(ranges.get(i)); - } - - return this; - } - - @Override - public HeaderWriter append(Range range) { - if (range.getIndex() >= Range.INDEX_FIRST) { - append(range.getIndex()); - append("-"); - - if (range.getSize() != Range.SIZE_MAX) { - append(range.getIndex() + range.getSize() - 1); - } - } else if (range.getIndex() == Range.INDEX_LAST) { - append("-"); - - if (range.getSize() != Range.SIZE_MAX) { - append(range.getSize()); - } - } - - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RecipientInfoReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RecipientInfoReader.java deleted file mode 100644 index 483170b983..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RecipientInfoReader.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Collection; - -import org.restlet.client.data.Header; -import org.restlet.client.data.Protocol; -import org.restlet.client.data.RecipientInfo; - -/** - * Recipient info header reader. - * - * @author Jerome Louvel - */ -public class RecipientInfoReader extends HeaderReader { - /** - * Adds values to the given collection. - * - * @param header - * The header to read. - * @param collection - * The collection to update. - */ - public static void addValues(Header header, - Collection collection) { - new RecipientInfoReader(header.getValue()).addValues(collection); - } - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public RecipientInfoReader(String header) { - super(header); - } - - @Override - public RecipientInfo readValue() throws IOException { - RecipientInfo result = new RecipientInfo(); - String protocolToken = readToken(); - - if (protocolToken == null || protocolToken.isEmpty()) { - throw new IOException( - "Unexpected empty protocol token for while reading recipient info header, please check the value."); - } - - if (peek() == '/') { - read(); - result.setProtocol(new Protocol(protocolToken, protocolToken, null, - -1, readToken())); - } else { - result.setProtocol(new Protocol("HTTP", "HTTP", null, -1, - protocolToken)); - } - - // Move to the next text - if (skipSpaces()) { - result.setName(readRawText()); - - // Move to the next text - if (skipSpaces()) { - result.setComment(readComment()); - } - } - - return result; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RecipientInfoWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RecipientInfoWriter.java deleted file mode 100644 index 50151a1f9f..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/RecipientInfoWriter.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.List; - -import org.restlet.client.data.RecipientInfo; - -/** - * Recipient info header writer. - * - * @author Jerome Louvel - */ -public class RecipientInfoWriter extends HeaderWriter { - - /** - * Creates a via header from the given recipients info. - * - * @param recipientsInfo - * The recipients info. - * @return Returns the Via header. - */ - public static String write(List recipientsInfo) { - return new RecipientInfoWriter().append(recipientsInfo).toString(); - } - - @Override - public RecipientInfoWriter append(RecipientInfo recipientInfo) { - if (recipientInfo.getProtocol() != null) { - appendToken(recipientInfo.getProtocol().getName()); - append('/'); - appendToken(recipientInfo.getProtocol().getVersion()); - appendSpace(); - - if (recipientInfo.getName() != null) { - append(recipientInfo.getName()); - - if (recipientInfo.getComment() != null) { - appendSpace(); - appendComment(recipientInfo.getComment()); - } - } else { - throw new IllegalArgumentException( - "The name (host or pseudonym) of a recipient can't be null"); - } - } else { - throw new IllegalArgumentException( - "The protocol of a recipient can't be null"); - } - - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/StringReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/StringReader.java deleted file mode 100644 index af831a7ece..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/StringReader.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Collection; - -import org.restlet.client.data.Header; - -/** - * String header reader. - * - * @author Manuel Boillod - */ -public class StringReader extends HeaderReader { - - /** - * Adds values to the given collection. - * - * @param header - * The header to read. - * @param collection - * The collection to update. - */ - public static void addValues(Header header, Collection collection) { - new StringReader(header.getValue()).addValues(collection); - } - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public StringReader(String header) { - super(header); - } - - @Override - public String readValue() throws IOException { - return readToken(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/StringWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/StringWriter.java deleted file mode 100644 index 37eb0475bc..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/StringWriter.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.Set; - -/** - * String header writer. - * - * @author Manuel Boillod - */ -public class StringWriter extends HeaderWriter { - - /** - * Writes a set of values with a comma separator. - * - * @param values - * The set of values. - * @return The formatted set of values. - */ - public static String write(Set values) { - return new StringWriter().append(values).toString(); - } - - @Override - public StringWriter append(String value) { - return (StringWriter) appendToken(value); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TagReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TagReader.java deleted file mode 100644 index 3de9334cdc..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TagReader.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Collection; - -import org.restlet.client.data.Header; -import org.restlet.client.data.Tag; - -/** - * Tag header reader. - * - * @author Thierry Boileau - */ -public class TagReader extends HeaderReader { - - /** - * Adds values to the given collection. - * - * @param header - * The header to read. - * @param collection - * The collection to update. - */ - public static void addValues(Header header, Collection collection) { - new TagReader(header.getValue()).addValues(collection); - } - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public TagReader(String header) { - super(header); - } - - @Override - public Tag readValue() throws IOException { - return Tag.parse(readRawValue()); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TagWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TagWriter.java deleted file mode 100644 index 1fe5cb1d33..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TagWriter.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.List; - -import org.restlet.client.data.Tag; - -/** - * Tag header writer. - * - * @author Jerome Louvel - */ -public class TagWriter extends HeaderWriter { - - /** - * Writes a list of tags. - * - * @param tags - * The tags to write. - * @return This writer. - */ - public static String write(List tags) { - return new TagWriter().append(tags).toString(); - } - - /** - * Writes a tag. - * - * @param tag - * The tag to write. - * @return This writer. - */ - public static String write(Tag tag) { - return tag.format(); - } - - @Override - public HeaderWriter append(Tag tag) { - return append(write(tag)); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TokenReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TokenReader.java deleted file mode 100644 index fd99242451..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/TokenReader.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; - -/** - * Token header reader. - * - * @author Jerome Louvel - */ -public class TokenReader extends HeaderReader { - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public TokenReader(String header) { - super(header); - } - - @Override - public String readValue() throws IOException { - return readToken(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/WarningReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/WarningReader.java deleted file mode 100644 index 1248e75db5..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/WarningReader.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.io.IOException; -import java.util.Collection; - -import org.restlet.client.data.Header; -import org.restlet.client.data.Status; -import org.restlet.client.data.Warning; -import org.restlet.client.engine.util.DateUtils; - -/** - * Warning header reader. - * - * @author Thierry Boileau - */ -public class WarningReader extends HeaderReader { - - /** - * Adds values to the given collection. - * - * @param header - * The header to read. - * @param collection - * The collection to update. - */ - public static void addValues(Header header, Collection collection) { - new WarningReader(header.getValue()).addValues(collection); - } - - /** - * Constructor. - * - * @param header - * The header to read. - */ - public WarningReader(String header) { - super(header); - } - - @Override - public Warning readValue() throws IOException { - Warning result = new Warning(); - - String code = readToken(); - skipSpaces(); - String agent = readRawText(); - skipSpaces(); - String text = readQuotedString(); - // The date is not mandatory - skipSpaces(); - String date = null; - if (peek() != -1) { - date = readQuotedString(); - } - - if ((code == null) || (agent == null) || (text == null)) { - throw new IOException("Warning header malformed."); - } - - result.setStatus(Status.valueOf(Integer.parseInt(code))); - result.setAgent(agent); - result.setText(text); - if (date != null) { - result.setDate(DateUtils.parse(date)); - } - - return result; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/WarningWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/WarningWriter.java deleted file mode 100644 index 5c2cf04f8a..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/WarningWriter.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.header; - -import java.util.List; - -import org.restlet.client.data.Warning; -import org.restlet.client.engine.util.DateUtils; - -/** - * Warning header writer. - * - * @author Thierry Boileau - */ -public class WarningWriter extends HeaderWriter { - - /** - * Writes a warning. - * - * @param warnings - * The list of warnings to format. - * @return The formatted warning. - */ - public static String write(List warnings) { - return new WarningWriter().append(warnings).toString(); - } - - @Override - public WarningWriter append(Warning warning) { - String agent = warning.getAgent(); - String text = warning.getText(); - - if (warning.getStatus() == null) { - throw new IllegalArgumentException( - "Can't write warning. Invalid status code detected"); - } - - if ((agent == null) || (agent.length() == 0)) { - throw new IllegalArgumentException( - "Can't write warning. Invalid agent detected"); - } - - if ((text == null) || (text.length() == 0)) { - throw new IllegalArgumentException( - "Can't write warning. Invalid text detected"); - } - - append(Integer.toString(warning.getStatus().getCode())); - append(" "); - append(agent); - append(" "); - appendQuotedString(text); - - if (warning.getDate() != null) { - appendQuotedString(DateUtils.format(warning.getDate())); - } - - return this; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/IoUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/IoUtils.java deleted file mode 100644 index 7fe2346bf1..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/IoUtils.java +++ /dev/null @@ -1,173 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.io; - -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.nio.charset.Charset; - -import org.restlet.client.engine.util.emul.UnsupportedEncodingException; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Range; -import org.restlet.client.representation.Representation; - -/** - * IO manipulation utilities. - * - * @author Thierry Boileau - */ -public class IoUtils { - - /** - * Returns the size effectively available. This returns the same value as {@link Representation#getSize()} if no - * range is defined, otherwise it - * returns the size of the range using {@link Range#getSize()}. - * - * @param representation - * The representation to evaluate. - * @return The available size. - */ - public static long getAvailableSize(Representation representation) { - return representation.getSize(); - } - - /** - * Returns a reader from an input stream and a character set. - * - * @param stream - * The input stream. - * @param characterSet - * The character set. May be null. - * @return The equivalent reader. - * @throws UnsupportedEncodingException - * if a character set is given, but not supported - */ - public static StringReader getReader(InputStream stream, CharacterSet characterSet) - throws UnsupportedEncodingException { - return new StringReader(toString(stream, characterSet)); - } - - - /** - * Converts an input stream to a string.
- * As this method uses the InputStreamReader class, the default character - * set is used for decoding the input stream. - * - * @see IoUtils#toString(InputStream, Charset) - * @param inputStream - * The input stream. - * @return The converted string. - */ - public static String toString(InputStream inputStream) { - return toString(inputStream, Charset.defaultCharset()); - } - - /** - * Converts an input stream to a string using the specified character set - * for decoding the input stream. Once read, the input stream is closed. - * - * @param inputStream - * The input stream. - * @param characterSet - * The character set - * @return The converted string. - */ - public static String toString(InputStream inputStream, - CharacterSet characterSet) { - final Charset charset = characterSet == null - ? Charset.defaultCharset() - : Charset.forName(characterSet.getName()); - - return toString(inputStream, charset); - } - - /** - * Converts an input stream to a string using the specified character set - * for decoding the input stream. Once read, the input stream is closed. - * - * @param inputStream - * The input stream. - * @param charset - * The character set - * @return The converted string. - */ - public static String toString(InputStream inputStream, final Charset charset) { - String result = null; - - if (inputStream != null) { - if (inputStream instanceof StringInputStream) { - return ((StringInputStream) inputStream).getText(); - } else { - try { - final Charset internalCharset = charset == null - ? Charset.defaultCharset() - : charset; - - StringBuilder sb = new StringBuilder(); - byte[] buffer = new byte[8196]; - int charsRead = inputStream.read(buffer); - - while (charsRead != -1) { - sb.append(new String(buffer, 0, charsRead, internalCharset)); - charsRead = inputStream.read(buffer); - } - - inputStream.close(); - result = sb.toString(); - } catch (Exception e) { - // Returns a null string - } - } - } - - return result; - } - - - /** - * Converts a reader to a string. - * - * @param reader - * The characters' reader. - * @return The converted string. - */ - public static String toString(Reader reader) { - String result = null; - - if (reader != null) { - try { - StringBuilder sb = new StringBuilder(); - char[] buffer = new char[8192]; - int charsRead = reader.read(buffer); - - while (charsRead != -1) { - sb.append(buffer, 0, charsRead); - charsRead = reader.read(buffer); - } - - reader.close(); - result = sb.toString(); - } catch (Exception e) { - // Returns a null string - } - } - - return result; - } - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e. it isn't instantiable and extensible. - */ - private IoUtils() { - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/StringInputStream.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/StringInputStream.java deleted file mode 100644 index b1abcdce1a..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/StringInputStream.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.io; - -import java.io.IOException; -import java.io.InputStream; - -/** - * Input stream in which the bytes read are supplied by the contents of a string - * based on the default character set. - * - * @author Thierry Boileau - */ -public class StringInputStream extends InputStream { - - /** The next position to read. */ - private int position; - - /** The text to stream. */ - protected String text; - - /** - * Constructor. - */ - public StringInputStream() { - super(); - } - - /** - * Constructor. - * - * @param text - */ - public StringInputStream(String text) { - super(); - this.position = 0; - this.text = text; - } - - /** - * - * @return - * @throws IOException - */ - public int available() throws IOException { - if (text != null) { - return text.length(); - } - - return 0; - } - - public void close() throws IOException { - - } - - /** - * Returns the text to stream. - * - * @return The text to stream. - */ - public String getText() { - return text; - } - - /** - * Reads the next character in the source text. - * - * @return The next character or -1 if end of text is reached. - * @throws IOException - */ - public int read() throws IOException { - return (this.position == this.text.length()) ? -1 : this.text - .charAt(this.position++); - } - - /** - * - * @param cbuf - * @return - * @throws IOException - */ - public int read(char[] cbuf) throws IOException { - return read(cbuf, 0, cbuf.length); - } - - /** - * - * @param cbuf - * @param off - * @param len - * @return - * @throws IOException - */ - public int read(char[] cbuf, int off, int len) throws IOException { - if (position >= text.length()) - return -1; - int n = Math.min(text.length() - position, len); - text.getChars(position, position + n, cbuf, off); - position += n; - return n; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/log/LoggerFacade.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/log/LoggerFacade.java deleted file mode 100644 index a557b661c7..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/log/LoggerFacade.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.log; - -import java.util.logging.Logger; - -/** - * Logger facade to the underlying logging framework used by the Restlet - * Framework. By default, it relies on the JULI mechanism built in Java SE. You - * can provide an alternate implementation by extending this class and - * overriding the methods. - * - * @author Jerome Louvel - */ -public class LoggerFacade { - - /** - * Returns an anonymous logger. By default it calls - * {@link Logger#getAnonymousLogger()}. This method should be overridden by - * subclasses. - * - * @return The logger. - */ - public Logger getAnonymousLogger() { - return Logger.getLogger(""); - } - - /** - * Returns a logger based on the class name of the given object. By default, - * it calls {@link #getLogger(Class, String)} with a null default logger - * name. - * - * @param clazz - * The parent class. - * @return The logger. - */ - public final Logger getLogger(Class clazz) { - return getLogger(clazz, null); - } - - /** - * Returns a logger based on the class name of the given object. - * - * @param clazz - * The parent class. - * @param defaultLoggerName - * The default logger name to use if no one can be inferred from - * the class. - * @return The logger. - */ - public final Logger getLogger(Class clazz, String defaultLoggerName) { - String loggerName = null; - - if (clazz != null) { - loggerName = clazz.getName(); - } - - if (loggerName == null) { - loggerName = defaultLoggerName; - } - - if (loggerName != null) { - return getLogger(loggerName); - } - - return getAnonymousLogger(); - } - - /** - * Returns a logger based on the class name of the given object. By default, - * it calls {@link #getLogger(Class, String)} with the object's class as a - * first parameter. - * - * @param object - * The parent object. - * @param defaultLoggerName - * The default logger name to use if no one can be inferred from - * the object class. - * @return The logger. - */ - public final Logger getLogger(Object object, String defaultLoggerName) { - return getLogger(object.getClass(), defaultLoggerName); - } - - /** - * Returns a logger based on the given logger name. By default, it calls - * {@link Logger#getLogger(String)}. This method should be overridden by - * subclasses. - * - * @param loggerName - * The logger name. - * @return The logger. - */ - public Logger getLogger(String loggerName) { - return Logger.getLogger(loggerName); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/package.html deleted file mode 100644 index 0d365e681b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/package.html +++ /dev/null @@ -1,8 +0,0 @@ - - - Implementation of Restlet API. -

- @since Restlet 2.0 - @see User Guide - Engine - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/resource/GwtClientProxy.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/resource/GwtClientProxy.java deleted file mode 100644 index f55d6e453e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/resource/GwtClientProxy.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.resource; - -import org.restlet.client.resource.ClientProxy; -import org.restlet.client.resource.ClientResource; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.rpc.SerializationException; -import com.google.gwt.user.client.rpc.SerializationStreamFactory; -import com.google.gwt.user.client.rpc.SerializationStreamReader; -import com.google.gwt.user.client.rpc.SerializationStreamWriter; -import com.google.gwt.user.client.rpc.impl.ClientSerializationStreamReader; -import com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter; -import com.google.gwt.user.client.rpc.impl.Serializer; - -/** - * Base class for resource proxies generated via deferred binding. - * - * @author Jerome Louvel - */ -public class GwtClientProxy implements ClientProxy, SerializationStreamFactory { - - /** The wrapped client resource. */ - private ClientResource clientResource; - - /** The object serializer. */ - private Serializer serializer; - - /** The location of the serialization policy. */ - private String serializationPolicy; - - /** - * Default constructor. - */ - public GwtClientProxy() { - this(GWT.getModuleBaseURL()); - } - - /** - * Constructor. - * - * @param uri - * The target resource URI. - */ - public GwtClientProxy(String uri) { - this(uri, null, null); - } - - /** - * Constructor. - * - * @param uri - * The target resource URI. - * @param serializationPolicy - * The location of the serialization policy. - * @param serializer - * The object serializer. - */ - public GwtClientProxy(String uri, String serializationPolicy, - Serializer serializer) { - this.clientResource = new ClientResource(uri); - this.serializationPolicy = serializationPolicy; - this.serializer = serializer; - } - - /** - * Creates an object stream reader. - * - * @param encoded - * The encoded string to read. - * @return A new object stream reader. - */ - public SerializationStreamReader createStreamReader(String encoded) - throws SerializationException { - ClientSerializationStreamReader clientSerializationStreamReader = new ClientSerializationStreamReader( - serializer); - - if (encoded.startsWith("//OK") || encoded.startsWith("//EX")) { - encoded = encoded.substring(4); - } - - clientSerializationStreamReader.prepareToRead(encoded); - return clientSerializationStreamReader; - } - - /** - * Creates an object stream writer. - * - * @return A new object stream writer. - */ - public SerializationStreamWriter createStreamWriter() { - ClientSerializationStreamWriter clientSerializationStreamWriter = new ClientSerializationStreamWriter( - this.serializer, getClientResource().getReference().toString(), - this.serializationPolicy); - clientSerializationStreamWriter.prepareToWrite(); - return clientSerializationStreamWriter; - } - - /** - * Returns the wrapped client resource. - * - * @return The wrapped client resource. - */ - public ClientResource getClientResource() { - return clientResource; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/Base64.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/Base64.java deleted file mode 100644 index 8ba731eb2a..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/Base64.java +++ /dev/null @@ -1,244 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.Arrays; - -/** - * Minimal but fast Base64 codec. - * - * @author Ray Waldin (ray@waldin.net) - */ -public class Base64 { - - /** alphabet used for encoding bytes into base64 */ - private static final char[] BASE64_DIGITS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" - .toCharArray(); - - /** - * Decoding involves replacing each character with the character's value, or - * position, from the above alphabet, and this table makes such lookups - * quick and easy. Couldn't help myself with the corny name :) - */ - private static final byte[] DECODER_RING = new byte[128]; - - /** - * Initializes the decoder ring. - */ - static { - Arrays.fill(DECODER_RING, (byte) -1); - int i = 0; - for (final char c : BASE64_DIGITS) { - DECODER_RING[c] = (byte) i++; - } - DECODER_RING['='] = 0; - } - - /** - * Returns the byte value at a given position in a bytes array. - * - * @param data - * The bytes array. - * @param block - * The block size. - * @param off - * The offset value. - * @return The extracted byte. - */ - private final static int byteAt(byte[] data, int block, int off) { - return unsign(data[(block * 3) + off]); - } - - /** - * Decodes base64 characters into bytes. Newline characters found at block - * boundaries will be ignored. - * - * @param chars - * The characters array to decode. - * @return The decoded byte array. - */ - public static byte[] decode(final char[] chars) { - // prepare to ignore newline chars - int newlineCount = 0; - for (char c : chars) { - switch (c) { - case '\r': - case '\n': - newlineCount++; - break; - default: - } - } - - int len = chars.length - newlineCount; - - if (len % 4 != 0) { - throw new IllegalArgumentException( - "Base64.decode() requires input length to be a multiple of 4"); - } - - int numBytes = ((len + 3) / 4) * 3; - - // fix up length relative to padding - if (len > 1) { - if (chars[chars.length - 2] == '=') { - numBytes -= 2; - } else if (chars[chars.length - 1] == '=') { - numBytes--; - } - } - - byte[] result = new byte[numBytes]; - int newlineOffset = 0; - - // decode each block of 4 chars into 3 bytes - for (int i = 0; i < (len + 3) / 4; ++i) { - int charOffset = newlineOffset + (i * 4); - - final char c1 = chars[charOffset++]; - final char c2 = chars[charOffset++]; - final char c3 = chars[charOffset++]; - final char c4 = chars[charOffset++]; - - if (!(validChar(c1) && validChar(c2) && validChar(c3) && validChar(c4))) { - throw new IllegalArgumentException( - "Invalid Base64 character in block: '" + c1 + c2 + c3 - + c4 + "'"); - } - - // pack - final int x = DECODER_RING[c1] << 18 | DECODER_RING[c2] << 12 - | (c3 == '=' ? 0 : DECODER_RING[c3] << 6) - | (c4 == '=' ? 0 : DECODER_RING[c4]); - - // unpack - int byteOffset = i * 3; - result[byteOffset++] = (byte) (x >> 16); - if (c3 != '=') { - result[byteOffset++] = (byte) ((x >> 8) & 0xFF); - if (c4 != '=') { - result[byteOffset++] = (byte) (x & 0xFF); - } - } - - // skip newlines after block - outer: while (chars.length > charOffset) { - switch (chars[charOffset++]) { - case '\r': - case '\n': - newlineOffset++; - break; - - default: - break outer; - } - } - } - return result; - }; - - /** - * Decodes a base64 string into bytes. Newline characters found at block - * boundaries will be ignored. - * - * @param encodedString - * The string to decode. - * @return The decoded byte array. - */ - public static byte[] decode(String encodedString) { - return decode(encodedString.toCharArray()); - } - - /** - * Encodes an entire byte array into a Base64 string, with optional newlines - * after every 76 characters. - * - * @param bytes - * The byte array to encode. - * @param newlines - * Indicates whether or not newlines are desired. - * @return The encoded string. - */ - public static String encode(byte[] bytes, boolean newlines) { - return encode(bytes, 0, bytes.length, newlines); - } - - /** - * Encodes specified bytes into a Base64 string, with optional newlines - * after every 76 characters. - * - * @param bytes - * The byte array to encode. - * @param off - * The starting offset. - * @param len - * The number of bytes to encode. - * @param newlines - * Indicates whether or not newlines are desired. - * - * @return The encoded string. - */ - public static String encode(byte[] bytes, int off, int len, boolean newlines) { - char[] output = new char[(((len + 2) / 3) * 4) - + (newlines ? len / 43 : 0)]; - int pos = 0; - - // encode each block of 3 bytes into 4 chars - for (int i = 0; i < (len + 2) / 3; ++i) { - int pad = 0; - - if (len + 1 < (i + 1) * 3) { - // two trailing '='s - pad = 2; - } else if (len < (i + 1) * 3) { - // one trailing '=' - pad = 1; - } - - // pack - int x = (byteAt(bytes, i, off) << 16) - | (pad > 1 ? 0 : (byteAt(bytes, i, off + 1) << 8)) - | (pad > 0 ? 0 : (byteAt(bytes, i, off + 2))); - - // unpack - output[pos++] = BASE64_DIGITS[x >> 18]; - output[pos++] = BASE64_DIGITS[(x >> 12) & 0x3F]; - output[pos++] = pad > 1 ? '=' : BASE64_DIGITS[(x >> 6) & 0x3F]; - output[pos++] = pad > 0 ? '=' : BASE64_DIGITS[x & 0x3F]; - - if (newlines && ((i + 1) % 19 == 0)) { - output[pos++] = '\n'; - } - } - return new String(output, 0, pos); - } - - /** - * Computes the unsigned value of a byte. - * - * @param b - * The input byte. - * @return The output unsigned value. - */ - private final static int unsign(byte b) { - return b < 0 ? b + 256 : b; - } - - /** - * Indicates if the character is valid and can be decoded. - * - * @param c - * The input character. - * @return True if the character is valid. - */ - private final static boolean validChar(char c) { - return (c < 128) && (DECODER_RING[c] != -1); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CacheDirectiveSeries.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CacheDirectiveSeries.java deleted file mode 100644 index 2677a13223..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CacheDirectiveSeries.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.List; - -import org.restlet.client.data.CacheDirective; -import org.restlet.client.util.Series; - -/** - * CacheDirective series. - * - * @author Thierry Boileau - */ -public class CacheDirectiveSeries extends Series { - - /** - * Constructor. - */ - public CacheDirectiveSeries() { - super(CacheDirective.class); - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public CacheDirectiveSeries(List delegate) { - super(CacheDirective.class, delegate); - } - - @Override - public CacheDirective createEntry(String name, String value) { - return new CacheDirective(name, value); - } - - @Override - public Series createSeries(List delegate) { - return new CacheDirectiveSeries(delegate); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CaseInsensitiveHashSet.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CaseInsensitiveHashSet.java deleted file mode 100644 index e342e8b8cb..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CaseInsensitiveHashSet.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.Collection; -import java.util.HashSet; - -/** - * Set implementation that is case insensitive. - */ -public class CaseInsensitiveHashSet extends HashSet { - - private static final long serialVersionUID = 1L; - - /** - * Constructor initializing the set with the given collection. - * - * @param source - * The source collection to use for initialization. - */ - public CaseInsensitiveHashSet(Collection source) { - super(source); - } - - @Override - public boolean add(String element) { - return super.add(element.toLowerCase()); - } - - /** - * Verify containment by ignoring case. - */ - public boolean contains(String element) { - return super.contains(element.toLowerCase()); - } - - @Override - public boolean contains(Object o) { - return contains(o.toString()); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CookieSeries.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CookieSeries.java deleted file mode 100644 index 357294ee9c..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CookieSeries.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.List; - -import org.restlet.client.data.Cookie; -import org.restlet.client.util.Series; - -/** - * Cookie series. - * - * @author Jerome Louvel - */ -public class CookieSeries extends Series { - - /** - * Constructor. - */ - public CookieSeries() { - super(Cookie.class); - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public CookieSeries(List delegate) { - super(Cookie.class, delegate); - } - - @Override - public Cookie createEntry(String name, String value) { - return new Cookie(name, value); - } - - @Override - public Series createSeries(List delegate) { - return new CookieSeries(delegate); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CookieSettingSeries.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CookieSettingSeries.java deleted file mode 100644 index 0aa0c18536..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/CookieSettingSeries.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.List; - -import org.restlet.client.data.CookieSetting; -import org.restlet.client.util.Series; - -/** - * Cookie setting series. - * - * @author Jerome Louvel - */ -public class CookieSettingSeries extends Series { - /** - * Constructor. - */ - public CookieSettingSeries() { - super(CookieSetting.class); - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public CookieSettingSeries(List delegate) { - super(CookieSetting.class, delegate); - } - - @Override - public CookieSetting createEntry(String name, String value) { - return new CookieSetting(name, value); - } - - @Override - public Series createSeries(List delegate) { - return new CookieSettingSeries(delegate); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/DateUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/DateUtils.java deleted file mode 100644 index 81e8186c2d..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/DateUtils.java +++ /dev/null @@ -1,257 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -/** - * Date manipulation utilities. - * - * @author Jerome Louvel - */ -public final class DateUtils { - - /** - * Obsoleted HTTP date format (ANSI C asctime() format). Pattern: - * "EEE MMM dd HH:mm:ss yyyy". - */ - public static final List FORMAT_ASC_TIME = unmodifiableList("EEE MMM dd HH:mm:ss yyyy"); - - /** - * Obsoleted HTTP date format (RFC 1036). Pattern: - * "EEEE, dd-MMM-yy HH:mm:ss zzz". - */ - public static final List FORMAT_RFC_1036 = unmodifiableList("EEEE, dd-MMM-yy HH:mm:ss zzz"); - - /** - * Preferred HTTP date format (RFC 1123). Pattern: - * "EEE, dd MMM yyyy HH:mm:ss zzz". - */ - public static final List FORMAT_RFC_1123 = unmodifiableList("EEE, dd MMM yyyy HH:mm:ss zzz"); - - /** W3C date format (RFC 3339). Pattern: "yyyy-MM-dd'T'HH:mm:ssz". */ - public static final List FORMAT_RFC_3339 = unmodifiableList("yyyy-MM-dd'T'HH:mm:ssz"); - - /** AWS date format (ISO 8601). Pattern: "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'". */ - public static final List FORMAT_ISO_8601 = unmodifiableList("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); - - /** - * Common date format (RFC 822). Patterns: "EEE, dd MMM yy HH:mm:ss z" or - * "EEE, dd MMM yy HH:mm z", "dd MMM yy HH:mm:ss z" or "dd MMM yy HH:mm z". - */ - public static final List FORMAT_RFC_822 = unmodifiableList( - "EEE, dd MMM yy HH:mm:ss z", "EEE, dd MMM yy HH:mm z", - "dd MMM yy HH:mm:ss z", "dd MMM yy HH:mm z"); - - - private static final com.google.gwt.i18n.client.TimeZone TIMEZONE_GMT = - com.google.gwt.i18n.client.TimeZone.createTimeZone(0); - /** - * Compares two date with a precision of one second. - * - * @param baseDate - * The base date - * @param afterDate - * The date supposed to be after. - * @return True if the afterDate is indeed after the baseDate. - */ - public static boolean after(final Date baseDate, final Date afterDate) { - if ((baseDate == null) || (afterDate == null)) { - throw new IllegalArgumentException( - "Can't compare the dates, at least one of them is null"); - } - - long baseTime = baseDate.getTime() / 1000; - long afterTime = afterDate.getTime() / 1000; - return baseTime < afterTime; - } - - /** - * Compares two date with a precision of one second. - * - * @param baseDate - * The base date - * @param beforeDate - * The date supposed to be before. - * @return True if the beforeDate is indeed before the baseDate. - */ - public static boolean before(final Date baseDate, final Date beforeDate) { - if ((baseDate == null) || (beforeDate == null)) { - throw new IllegalArgumentException( - "Can't compare the dates, at least one of them is null"); - } - - long baseTime = baseDate.getTime() / 1000; - long beforeTime = beforeDate.getTime() / 1000; - return beforeTime < baseTime; - } - - /** - * Compares two date with a precision of one second. - * - * @param baseDate - * The base date - * @param otherDate - * The other date supposed to be equals. - * @return True if both dates are equals. - */ - public static boolean equals(final Date baseDate, final Date otherDate) { - if ((baseDate == null) || (otherDate == null)) { - throw new IllegalArgumentException( - "Can't compare the dates, at least one of them is null"); - } - - long baseTime = baseDate.getTime() / 1000; - long otherTime = otherDate.getTime() / 1000; - return otherTime == baseTime; - } - - /** - * Formats a Date in the default HTTP format (RFC 1123). - * - * @param date - * The date to format. - * @return The formatted date. - */ - public static String format(final Date date) { - return format(date, DateUtils.FORMAT_RFC_1123.get(0)); - } - - /** - * Formats a Date according to the first format in the array. - * - * @param date - * The date to format. - * @param formats - * The array of date formats to use. - * @return The formatted date. - */ - public static String format(final Date date, final List formats) { - return format(date, formats != null ? formats.get(0) : null); - } - - /** - * Formats a Date according to the given format. - * - * @param date - * The date to format. - * @param format - * The date format to use. - * @return The formatted date. - */ - public static String format(final Date date, final String format) { - if (date == null) { - throw new IllegalArgumentException("Date is null"); - } - - /* - * GWT difference: DateTimeFormat parser is not passed a Locale in the - * same way as SimpleDateFormat. It derives locale information from the - * GWT application's locale. - * - * Default timezone is GMT unless specified via a GMT:hhmm, GMT:+hhmm, - * or GMT:-hhmm string. - */ - final com.google.gwt.i18n.client.DateTimeFormat formatter = - com.google.gwt.i18n.client.DateTimeFormat.getFormat(format); - return formatter.format(date, TIMEZONE_GMT); - } - - /** - * Parses a formatted date into a Date object using the default HTTP format - * (RFC 1123). - * - * @param date - * The date to parse. - * @return The parsed date. - */ - public static Date parse(String date) { - return parse(date, FORMAT_RFC_1123); - } - - /** - * Parses a formatted date into a Date object. - * - * @param date - * The date to parse. - * @param formats - * The date formats to use sorted by completeness. - * @return The parsed date. - */ - public static Date parse(String date, List formats) { - if (date == null) { - throw new IllegalArgumentException("Date is null"); - } - - Date result = null; - - String format = null; - int formatsSize = formats.size(); - - for (int i = 0; (result == null) && (i < formatsSize); i++) { - format = formats.get(i); - /* - * GWT difference: DateTimeFormat parser is not passed a Locale in - * the same way as SimpleDateFormat. It derives locale information - * from the GWT application's locale. - * - * Default timezone is GMT unless specified via a GMT:hhmm, - * GMT:+hhmm, or GMT:-hhmm string. - */ - final com.google.gwt.i18n.client.DateTimeFormat parser = - com.google.gwt.i18n.client.DateTimeFormat.getFormat(format); - try { - result = parser.parse(date); - } catch (Exception e) { - // Ignores error as the next format may work better - } - } - - return result; - } - - /** - * Returns an immutable version of a given date. - * - * @param date - * The modifiable date. - * @return An immutable version of a given date. - */ - public static Date unmodifiable(Date date) { - return (date == null) ? null : new ImmutableDate(date); - } - - /** - * Helper method to help initialize this class by providing unmodifiable - * lists based on arrays. - * - * @param - * Any valid java object - * @param array - * to be converted into an unmodifiable list - * @return unmodifiable list based on the provided array - */ - @SafeVarargs - private static List unmodifiableList(final T... array) { - return Collections.unmodifiableList(Arrays.asList(array)); - } - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e. it isn't instantiable and extensible. - */ - private DateUtils() { - - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/FormReader.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/FormReader.java deleted file mode 100644 index bbf659a869..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/FormReader.java +++ /dev/null @@ -1,400 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.io.IOException; -import java.io.InputStream; -import org.restlet.client.engine.util.emul.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Form; -import org.restlet.client.data.Parameter; -import org.restlet.client.representation.Representation; -import org.restlet.client.util.Series; - -/** - * Form reader. - * - * @author Jerome Louvel - */ -public class FormReader { - /** The encoding to use, decoding is enabled, see {@link #decode}. */ - private volatile CharacterSet characterSet; - - /** Indicates if the parameters should be decoded. */ - private volatile boolean decode; - - /** The separator character used between parameters. */ - private volatile char separator; - - /** The form stream. */ - private volatile InputStream stream; - - /** - * Constructor.
- * In case the representation does not define a character set, the UTF-8 - * character set is used. - * - * @param representation - * The web form content. - * @throws IOException - * if the stream of the representation could not be opened. - */ - public FormReader(Representation representation) throws IOException { - this(representation, true); - } - - /** - * Constructor.
- * In case the representation does not define a character set, the UTF-8 - * character set is used. - * - * @param representation - * The web form content. - * @param decode - * Indicates if the parameters should be decoded using the given - * character set. - * @throws IOException - * if the stream of the representation could not be opened. - */ - public FormReader(Representation representation, boolean decode) - throws IOException { - this.decode = decode; - this.stream = representation.getStream(); - this.separator = '&'; - - if (representation.getCharacterSet() != null) { - this.characterSet = representation.getCharacterSet(); - } else { - this.characterSet = CharacterSet.UTF_8; - } - } - - /** - * Constructor. Will leave the parsed data encoded. - * - * @param parametersString - * The parameters string. - * @param separator - * The separator character used between parameters. - */ - public FormReader(String parametersString, char separator) { - this(parametersString, null, separator, false); - } - - /** - * Constructor. - * - * @param parametersString - * The parameters string. - * @param characterSet - * The supported character encoding. Set to null to leave the - * data encoded. - * @param separator - * The separator character used between parameters. - */ - public FormReader(String parametersString, CharacterSet characterSet, - char separator) { - this(parametersString, characterSet, separator, true); - } - - /** - * Constructor. - * - * @param parametersString - * The parameters string. - * @param characterSet - * The supported character encoding. Set to null to leave the - * data encoded. - * @param separator - * The separator character used between parameters. - * @param decode - * Indicates if the parameters should be decoded using the given - * character set. - */ - public FormReader(String parametersString, CharacterSet characterSet, - char separator, boolean decode) { - this.decode = decode; - this.stream = new - org.restlet.client.engine.io.StringInputStream(parametersString); - - this.characterSet = characterSet; - this.separator = separator; - } - - /** - * Adds the parameters into a given series. - * - * @param parameters - * The target parameter series. - */ - public void addParameters(Series parameters) { - boolean readNext = true; - Parameter param = null; - - if (this.stream != null) { - // Let's read all form parameters - try { - while (readNext) { - param = readNextParameter(); - - if (param != null) { - // Add parsed parameter to the form - parameters.add(param); - } else { - // Last parameter parsed - readNext = false; - } - } - } catch (IOException ioe) { - Context.getCurrentLogger() - .log(Level.WARNING, - "Unable to parse a form parameter. Skipping the remaining parameters.", - ioe); - } - - try { - this.stream.close(); - } catch (IOException ioe) { - Context.getCurrentLogger().log(Level.WARNING, - "Unable to close the form input stream", ioe); - } - } - } - - /** - * Reads all the parameters. - * - * @return The form read. - * @throws IOException - * If the parameters could not be read. - */ - public Form read() throws IOException { - Form result = new Form(); - - if (this.stream != null) { - Parameter param = readNextParameter(); - - while (param != null) { - result.add(param); - param = readNextParameter(); - } - - this.stream.close(); - } - - return result; - } - - /** - * Reads the first parameter with the given name. - * - * @param name - * The parameter name to match. - * @return The parameter value. - * @throws IOException - */ - public Parameter readFirstParameter(String name) throws IOException { - Parameter result = null; - - if (this.stream != null) { - Parameter param = readNextParameter(); - - while ((param != null) && (result == null)) { - if (param.getName().equals(name)) { - result = param; - } - - param = readNextParameter(); - } - - this.stream.close(); - } - - return result; - } - - /** - * Reads the next parameter available or null. - * - * @return The next parameter available or null. - * @throws IOException - * If the next parameter could not be read. - */ - public Parameter readNextParameter() throws IOException { - Parameter result = null; - - if (this.stream != null) { - try { - boolean readingName = true; - StringBuilder nameBuffer = new StringBuilder(); - StringBuilder valueBuffer = new StringBuilder(); - int nextChar = 0; - - while ((result == null) && (nextChar != -1)) { - nextChar = this.stream.read(); - - if (readingName) { - if (nextChar == '=') { - if (nameBuffer.length() > 0) { - readingName = false; - } else { - throw new IOException("Empty parameter name detected. Please check your form data"); - } - } else if (endOfCurrentParameterReached(nextChar)) { - if (nameBuffer.length() > 0) { - result = FormUtils.create(nameBuffer, null, this.decode, this.characterSet); - } else if (nextChar == -1) { - // Do nothing return null preference - } else { - Context.getCurrentLogger() - .fine("Empty parameter name detected. Please check your form data"); - } - } else { - nameBuffer.append((char) nextChar); - } - } else { - // reading value - if (endOfCurrentParameterReached(nextChar)) { - result = FormUtils.create(nameBuffer, valueBuffer, this.decode, this.characterSet); - } else { - valueBuffer.append((char) nextChar); - } - } - } - } catch (UnsupportedEncodingException uee) { - throw new IOException("Unsupported encoding. Please contact the administrator"); - } - } - - return result; - } - - private boolean endOfCurrentParameterReached(int nextChar) { - return (nextChar == this.separator) || (nextChar == -1); - } - - /** - * Reads the parameters with the given name. If multiple values are found, a - * list is returned created. - * - * @param name - * The parameter name to match. - * @return The parameter value or list of values. - * @throws IOException - * If the parameters could not be read. - */ - @SuppressWarnings("unchecked") - public Object readParameter(String name) throws IOException { - Object result = null; - - if (this.stream != null) { - Parameter param = readNextParameter(); - - while (param != null) { - if (param.getName().equals(name)) { - if (result != null) { - List values = null; - - if (result instanceof List) { - // Multiple values already found for this parameter - values = (List) result; - } else { - // Second value found for this parameter - // Create a list of values - values = new ArrayList(); - values.add(result); - result = values; - } - - if (param.getValue() == null) { - values.add(Series.EMPTY_VALUE); - } else { - values.add(param.getValue()); - } - } else { - if (param.getValue() == null) { - result = Series.EMPTY_VALUE; - } else { - result = param.getValue(); - } - } - } - - param = readNextParameter(); - } - - this.stream.close(); - } - - return result; - } - - /** - * Reads the parameters whose name is a key in the given map. If a matching - * parameter is found, its value is put in the map. If multiple values are - * found, a list is created and set in the map. - * - * @param parameters - * The parameters map controlling the reading. - * @throws IOException - * If the parameters could not be read. - */ - @SuppressWarnings("unchecked") - public void readParameters(Map parameters) - throws IOException { - if (this.stream != null) { - Parameter param = readNextParameter(); - Object currentValue = null; - - while (param != null) { - if (parameters.containsKey(param.getName())) { - currentValue = parameters.get(param.getName()); - - if (currentValue != null) { - List values = null; - - if (currentValue instanceof List) { - // Multiple values already found for this parameter - values = (List) currentValue; - } else { - // Second value found for this parameter - // Create a list of values - values = new ArrayList(); - values.add(currentValue); - parameters.put(param.getName(), values); - } - - if (param.getValue() == null) { - values.add(Series.EMPTY_VALUE); - } else { - values.add(param.getValue()); - } - } else { - if (param.getValue() == null) { - parameters.put(param.getName(), Series.EMPTY_VALUE); - } else { - parameters.put(param.getName(), param.getValue()); - } - } - } - - param = readNextParameter(); - } - - this.stream.close(); - } - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/FormUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/FormUtils.java deleted file mode 100644 index fee2eb9f81..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/FormUtils.java +++ /dev/null @@ -1,298 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.io.IOException; -import java.util.Iterator; -import java.util.Map; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Form; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Parameter; -import org.restlet.client.data.Reference; -import org.restlet.client.representation.Representation; - -/** - * Representation of a Web form containing submitted parameters. - * - * @author Jerome Louvel - */ -public class FormUtils { - - /** - * Creates a parameter. - * - * @param name - * The parameter name buffer. - * @param value - * The parameter value buffer (can be null). - * @param decode - * If true, the name and values are decoded with the given - * {@link CharacterSet}, if false, than nothing is decoded. - * @param characterSet - * The supported character encoding. - * @return The created parameter. - */ - public static Parameter create(CharSequence name, CharSequence value, - boolean decode, CharacterSet characterSet) { - Parameter result = null; - - if (name != null) { - String nameStr; - if (decode) { - nameStr = Reference.decode(name.toString(), characterSet); - } else { - nameStr = name.toString(); - } - if (value != null) { - String valueStr; - if (decode) { - valueStr = Reference.decode(value.toString(), characterSet); - } else { - valueStr = value.toString(); - } - result = new Parameter(nameStr, valueStr); - } else { - result = new Parameter(nameStr, null); - } - } - return result; - } - - /** - * Reads the first parameter with the given name. - * - * @param post - * The web form representation. - * @param name - * The parameter name to match. - * @return The parameter. - * @throws IOException - */ - public static Parameter getFirstParameter(Representation post, String name) - throws IOException { - if (!post.isAvailable()) { - throw new IllegalStateException( - "The Web form cannot be parsed as no fresh content is available. If this entity has been already read once, caching of the entity is required"); - } - - return new FormReader(post).readFirstParameter(name); - } - - /** - * Reads the first parameter with the given name. - * - * @param query - * The query string. - * @param name - * The parameter name to match. - * @param characterSet - * The supported character encoding. - * @param separator - * The separator character to append between parameters. - * @param decode - * Indicates if the parameters should be decoded using the given - * character set. - * @return The parameter. - * @throws IOException - */ - public static Parameter getFirstParameter(String query, String name, - CharacterSet characterSet, char separator, boolean decode) - throws IOException { - return new FormReader(query, characterSet, separator, decode) - .readFirstParameter(name); - } - - /** - * Reads the parameters with the given name.
- * If multiple values are found, a list is returned created. - * - * @param form - * The web form representation. - * @param name - * The parameter name to match. - * @return The parameter value or list of values. - * @throws IOException - * If the parameters could not be read. - */ - public static Object getParameter(Representation form, String name) - throws IOException { - if (!form.isAvailable()) { - throw new IllegalStateException( - "The Web form cannot be parsed as no fresh content is available. If this entity has been already read once, caching of the entity is required"); - } - - return new FormReader(form).readParameter(name); - } - - /** - * Reads the parameters with the given name.
- * If multiple values are found, a list is returned created. - * - * @param query - * The query string. - * @param name - * The parameter name to match. - * @param characterSet - * The supported character encoding. - * @param separator - * The separator character to append between parameters. - * @param decode - * Indicates if the parameters should be decoded using the given - * character set. s * @return The parameter value or list of - * values. - * @throws IOException - * If the parameters could not be read. - */ - public static Object getParameter(String query, String name, - CharacterSet characterSet, char separator, boolean decode) - throws IOException { - return new FormReader(query, characterSet, separator, decode) - .readParameter(name); - } - - /** - * Reads the parameters whose name is a key in the given map.
- * If a matching parameter is found, its value is put in the map.
- * If multiple values are found, a list is created and set in the map. - * - * @param post - * The web form representation. - * @param parameters - * The parameters map controlling the reading. - * @throws IOException - * If the parameters could not be read. - */ - public static void getParameters(Representation post, - Map parameters) throws IOException { - if (!post.isAvailable()) { - throw new IllegalStateException( - "The Web form cannot be parsed as no fresh content is available. If this entity has been already read once, caching of the entity is required"); - } - - new FormReader(post).readParameters(parameters); - } - - /** - * Reads the parameters whose name is a key in the given map.
- * If a matching parameter is found, its value is put in the map.
- * If multiple values are found, a list is created and set in the map. - * - * @param parametersString - * The query string. - * @param parameters - * The parameters map controlling the reading. - * @param characterSet - * The supported character encoding. - * @param separator - * The separator character to append between parameters. - * @param decode - * Indicates if the parameters should be decoded using the given - * character set. - * @throws IOException - * If the parameters could not be read. - */ - public static void getParameters(String parametersString, - Map parameters, CharacterSet characterSet, - char separator, boolean decode) throws IOException { - new FormReader(parametersString, characterSet, separator, decode) - .readParameters(parameters); - } - - /** - * Indicates if the searched parameter is specified in the given media - * range. - * - * @param searchedParam - * The searched parameter. - * @param mediaRange - * The media range to inspect. - * @return True if the searched parameter is specified in the given media - * range. - */ - public static boolean isParameterFound(Parameter searchedParam, - MediaType mediaRange) { - boolean result = false; - - for (Iterator iter = mediaRange.getParameters().iterator(); !result - && iter.hasNext();) { - result = searchedParam.equals(iter.next()); - } - - return result; - } - - /** - * Parses a post into a given form. - * - * @param form - * The target form. - * @param post - * The posted form. - * @param decode - * Indicates if the parameters should be decoded. - */ - public static void parse(Form form, Representation post, boolean decode) { - if (post != null) { - if (post.isAvailable()) { - FormReader fr = null; - - try { - fr = new FormReader(post, decode); - } catch (IOException ioe) { - Context.getCurrentLogger().log(Level.WARNING, - "Unable to create a form reader. Parsing aborted.", - ioe); - } - - if (fr != null) { - fr.addParameters(form); - } - } else { - Context.getCurrentLogger() - .log(Level.FINE, - "The form wasn't changed as the given representation isn't available."); - } - } - } - - /** - * Parses a parameters string into a given form. - * - * @param form - * The target form. - * @param parametersString - * The parameters string. - * @param characterSet - * The supported character encoding. - * @param decode - * Indicates if the parameters should be decoded using the given - * character set. - * @param separator - * The separator character to append between parameters. - */ - public static void parse(Form form, String parametersString, - CharacterSet characterSet, boolean decode, char separator) { - if ((parametersString != null) && !parametersString.isEmpty()) { - FormReader fr = new FormReader(parametersString, characterSet, separator, decode); - fr.addParameters(form); - } - } - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e., it isn't instantiable and extensible. - */ - private FormUtils() { - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/HeaderSeries.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/HeaderSeries.java deleted file mode 100644 index 7ae54fb04f..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/HeaderSeries.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.List; - -import org.restlet.client.data.Header; -import org.restlet.client.util.Series; - -/** - * Header series. - * - * @author Thierry Boileau - */ -public class HeaderSeries extends Series
{ - - /** - * Constructor. - */ - public HeaderSeries() { - super(Header.class); - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public HeaderSeries(List
delegate) { - super(Header.class, delegate); - } - - @Override - public Header createEntry(String name, String value) { - return new Header(name, value); - } - - @Override - public Series
createSeries(List
delegate) { - return new HeaderSeries(delegate); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ImmutableDate.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ImmutableDate.java deleted file mode 100644 index c1fda55d38..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ImmutableDate.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.Date; - -/** - * Class acting as an immutable date class based on the {@link Date} class. - * - * Throws {@link UnsupportedOperationException} when mutable methods are - * invoked. - * - * @author Piyush Purang (ppurang@gmail.com) - * @see java.util.Date - * @see Immutable Date - */ -public final class ImmutableDate extends Date { - - private static final long serialVersionUID = -5946186780670229206L; - - /** - * Private constructor. A factory method is provided. - * - * @param date date to be made immutable - */ - public ImmutableDate(Date date) { - super(date.getTime()); - } - - /** {@inheritDoc} */ - @Override - public Object clone() { - throw new UnsupportedOperationException("ImmutableDate is immutable"); - } - - /** - * As an ImmutableDate is immutable, this method throws an - * UnsupportedOperationException exception. - */ - @Override - public void setDate(int arg0) { - throw new UnsupportedOperationException("ImmutableDate is immutable"); - } - - /** - * As an ImmutableDate is immutable, this method throws an - * UnsupportedOperationException exception. - */ - @Override - public void setHours(int arg0) { - throw new UnsupportedOperationException("ImmutableDate is immutable"); - } - - /** - * As an ImmutableDate is immutable, this method throws an - * UnsupportedOperationException exception. - */ - @Override - public void setMinutes(int arg0) { - throw new UnsupportedOperationException("ImmutableDate is immutable"); - } - - /** - * As an ImmutableDate is immutable, this method throws an - * UnsupportedOperationException exception. - */ - @Override - public void setMonth(int arg0) { - throw new UnsupportedOperationException("ImmutableDate is immutable"); - } - - /** - * As an ImmutableDate is immutable, this method throws an - * UnsupportedOperationException exception. - */ - @Override - public void setSeconds(int arg0) { - throw new UnsupportedOperationException("ImmutableDate is immutable"); - } - - /** - * As an ImmutableDate is immutable, this method throws an - * UnsupportedOperationException exception. - */ - @Override - public void setTime(long arg0) { - throw new UnsupportedOperationException("ImmutableDate is immutable"); - } - - /** - * As an ImmutableDate is immutable, this method throws an - * UnsupportedOperationException exception. - */ - @Override - public void setYear(int arg0) { - throw new UnsupportedOperationException("ImmutableDate is immutable"); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ListUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ListUtils.java deleted file mode 100644 index beaa2eeba6..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ListUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.ArrayList; -import java.util.List; - -/** - * Emulate List functions missing from GWT port of List - * - * @author Rob Heittman - */ -public class ListUtils { - /** - * Unlike List.subList(), which returns a live view of a set of List - * elements, this method returns a new copy of the list. List.subList() is - * not available in GWT 1.5 and was removed on purpose. - * - * @param list - * The source List - * @param fromIndex - * Starting index in the source List - * @param toIndex - * Ending index in the source List - * @throws IndexOutOfBoundsException - * Call exceeds the bounds of the source List - * @throws IllegalArgumentException - * fromIndex and toIndex are not in sequence - * @return a copy of the selected range - */ - public static List copySubList(List list, int fromIndex, - int toIndex) { - if (fromIndex < 0) - throw new IndexOutOfBoundsException("fromIndex = " + fromIndex); - if (toIndex > list.size()) - throw new IndexOutOfBoundsException("toIndex = " + toIndex); - if (fromIndex > toIndex) - throw new IllegalArgumentException("fromIndex(" + fromIndex - + ") > toIndex(" + toIndex + ")"); - ArrayList subList = new ArrayList(); - for (int i = fromIndex; i <= toIndex; i++) { - subList.add(list.get(i)); - } - return subList; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ParameterSeries.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ParameterSeries.java deleted file mode 100644 index aa5f834c15..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/ParameterSeries.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.Iterator; -import java.util.List; - -import org.restlet.client.data.Parameter; -import org.restlet.client.util.Series; - -/** - * Parameter series. - * - * @author Thierry Boileau - */ -public class ParameterSeries extends Series { - - /** - * Returns an unmodifiable view of the specified series. Attempts to call a - * modification method will throw an UnsupportedOperationException. - * - * @param series - * The series for which an unmodifiable view should be returned. - * @return The unmodifiable view of the specified series. - */ - public static ParameterSeries unmodifiableSeries(final Series series) { - ParameterSeries result = new ParameterSeries(); - result.addAll(series); - return result; - } - - /** - * Constructor. - */ - public ParameterSeries() { - super(Parameter.class); - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public ParameterSeries(List delegate) { - super(Parameter.class, delegate); - } - - @Override - public Parameter createEntry(String name, String value) { - return new Parameter(name, value); - } - - @Override - public Series createSeries(List delegate) { - return new ParameterSeries(delegate); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/SetUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/SetUtils.java deleted file mode 100644 index 35ff3455f9..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/SetUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.Set; - -/** - * Utilities for manipulation of {@link Set}. - * - * @author Manuel Boillod - */ -public class SetUtils { - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/StringUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/StringUtils.java deleted file mode 100644 index 0c363a2489..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/StringUtils.java +++ /dev/null @@ -1,667 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * String manipulation utilities. - * - * @author Jerome Louvel - */ -public class StringUtils { - - /** - * Represents an XML or HTML character entity reference. - * - * @author Thierry Boileau - */ - private static class CharacterEntity { - /** - * Character reference. - */ - private String name; - - /** - * Numeric character reference. - */ - private Integer numericValue; - - /** - * Constructor. - * - * @param numericValue - * The numeric value of the entity. - * @param name - * the name of the entity. - */ - public CharacterEntity(Integer numericValue, String name) { - super(); - this.numericValue = numericValue; - this.name = name; - } - - /** - * Returns the name of the entity. - * - * @return The name of the entity. - */ - public String getName() { - return name; - } - - /** - * Returns the numeric value of the entity. - * - * @return The numeric value of the entity. - */ - public Integer getNumericValue() { - return numericValue; - } - } - - /** - * Stores a list en entities and is able to return one given its numeric - * value or name. - * - * @author Thierry Boileau - */ - private static class CharacterEntitySolver { - /** Map of names of entities according to their numeric value. */ - private String[] toName; - - /** Map of numeric values of entities according to their name. */ - private Map toValue; - - /** - * Constructor. - */ - public CharacterEntitySolver() { - toName = new String[10000]; - toValue = new HashMap(); - } - - /** - * Adds an entity to solve. - * - * @param value - * The numeric value of the entity. - * @param name - * The name of the entity. - */ - public void add(Integer value, String name) { - toName[value] = name; - toValue.put(name, value); - } - - /** - * Returns the entity name according to its numeric value. - * - * @param value - * The numeric value of the entity. - * @return The entity name according to its numeric value. - */ - public String getName(int value) { - return toName[value]; - } - - /** - * Returns the numeric value of an entity according to its name. - * - * @param name - * The name of the entity. - * @return The numeric value of an entity according to its name. - */ - public Integer getValue(String name) { - return toValue.get(name); - } - - } - - /** Entities defined for HTML 4.0. */ - private static CharacterEntitySolver html40Entities; - - /** Entities defined in http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent. */ - private static List htmlLat1; - - /** Entities defined in http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent. */ - private static List htmlSpecial; - - /** Entities defined in http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent. */ - private static List htmlSymbol; - - /** Basic entities. */ - private static List xml10; - - static { - xml10 = new ArrayList(); - xml10.add(new CharacterEntity(34, "quot")); - xml10.add(new CharacterEntity(38, "amp")); - xml10.add(new CharacterEntity(62, "gt")); - xml10.add(new CharacterEntity(60, "lt")); - htmlLat1 = new ArrayList(); - htmlLat1.add(new CharacterEntity(160, "nbsp")); - htmlLat1.add(new CharacterEntity(161, "iexcl")); - htmlLat1.add(new CharacterEntity(162, "cent")); - htmlLat1.add(new CharacterEntity(163, "pound")); - htmlLat1.add(new CharacterEntity(164, "curren")); - htmlLat1.add(new CharacterEntity(165, "yen")); - htmlLat1.add(new CharacterEntity(166, "brvbar")); - htmlLat1.add(new CharacterEntity(167, "sect")); - htmlLat1.add(new CharacterEntity(168, "uml")); - htmlLat1.add(new CharacterEntity(169, "copy")); - htmlLat1.add(new CharacterEntity(170, "ordf")); - htmlLat1.add(new CharacterEntity(171, "laquo")); - htmlLat1.add(new CharacterEntity(172, "not")); - htmlLat1.add(new CharacterEntity(173, "shy")); - htmlLat1.add(new CharacterEntity(174, "reg")); - htmlLat1.add(new CharacterEntity(175, "macr")); - htmlLat1.add(new CharacterEntity(176, "deg")); - htmlLat1.add(new CharacterEntity(177, "plusmn")); - htmlLat1.add(new CharacterEntity(178, "sup2")); - htmlLat1.add(new CharacterEntity(179, "sup3")); - htmlLat1.add(new CharacterEntity(180, "acute")); - htmlLat1.add(new CharacterEntity(181, "micro")); - htmlLat1.add(new CharacterEntity(182, "para")); - htmlLat1.add(new CharacterEntity(183, "middot")); - htmlLat1.add(new CharacterEntity(184, "cedil")); - htmlLat1.add(new CharacterEntity(185, "sup1")); - htmlLat1.add(new CharacterEntity(186, "ordm")); - htmlLat1.add(new CharacterEntity(187, "raquo")); - htmlLat1.add(new CharacterEntity(188, "frac14")); - htmlLat1.add(new CharacterEntity(189, "frac12")); - htmlLat1.add(new CharacterEntity(190, "frac34")); - htmlLat1.add(new CharacterEntity(191, "iquest")); - htmlLat1.add(new CharacterEntity(192, "Agrave")); - htmlLat1.add(new CharacterEntity(193, "Aacute")); - htmlLat1.add(new CharacterEntity(194, "Acirc")); - htmlLat1.add(new CharacterEntity(195, "Atilde")); - htmlLat1.add(new CharacterEntity(196, "Auml")); - htmlLat1.add(new CharacterEntity(197, "Aring")); - htmlLat1.add(new CharacterEntity(198, "AElig")); - htmlLat1.add(new CharacterEntity(199, "Ccedil")); - htmlLat1.add(new CharacterEntity(200, "Egrave")); - htmlLat1.add(new CharacterEntity(201, "Eacute")); - htmlLat1.add(new CharacterEntity(202, "Ecirc")); - htmlLat1.add(new CharacterEntity(203, "Euml")); - htmlLat1.add(new CharacterEntity(204, "Igrave")); - htmlLat1.add(new CharacterEntity(205, "Iacute")); - htmlLat1.add(new CharacterEntity(206, "Icirc")); - htmlLat1.add(new CharacterEntity(207, "Iuml")); - htmlLat1.add(new CharacterEntity(208, "ETH")); - htmlLat1.add(new CharacterEntity(209, "Ntilde")); - htmlLat1.add(new CharacterEntity(210, "Ograve")); - htmlLat1.add(new CharacterEntity(211, "Oacute")); - htmlLat1.add(new CharacterEntity(212, "Ocirc")); - htmlLat1.add(new CharacterEntity(213, "Otilde")); - htmlLat1.add(new CharacterEntity(214, "Ouml")); - htmlLat1.add(new CharacterEntity(215, "times")); - htmlLat1.add(new CharacterEntity(216, "Oslash")); - htmlLat1.add(new CharacterEntity(217, "Ugrave")); - htmlLat1.add(new CharacterEntity(218, "Uacute")); - htmlLat1.add(new CharacterEntity(219, "Ucirc")); - htmlLat1.add(new CharacterEntity(220, "Uuml")); - htmlLat1.add(new CharacterEntity(221, "Yacute")); - htmlLat1.add(new CharacterEntity(222, "THORN")); - htmlLat1.add(new CharacterEntity(223, "szlig")); - htmlLat1.add(new CharacterEntity(224, "agrave")); - htmlLat1.add(new CharacterEntity(225, "aacute")); - htmlLat1.add(new CharacterEntity(226, "acirc")); - htmlLat1.add(new CharacterEntity(227, "atilde")); - htmlLat1.add(new CharacterEntity(228, "auml")); - htmlLat1.add(new CharacterEntity(229, "aring")); - htmlLat1.add(new CharacterEntity(230, "aelig")); - htmlLat1.add(new CharacterEntity(231, "ccedil")); - htmlLat1.add(new CharacterEntity(232, "egrave")); - htmlLat1.add(new CharacterEntity(233, "eacute")); - htmlLat1.add(new CharacterEntity(234, "ecirc")); - htmlLat1.add(new CharacterEntity(235, "euml")); - htmlLat1.add(new CharacterEntity(236, "igrave")); - htmlLat1.add(new CharacterEntity(237, "iacute")); - htmlLat1.add(new CharacterEntity(238, "icirc")); - htmlLat1.add(new CharacterEntity(239, "iuml")); - htmlLat1.add(new CharacterEntity(240, "eth")); - htmlLat1.add(new CharacterEntity(241, "ntilde")); - htmlLat1.add(new CharacterEntity(242, "ograve")); - htmlLat1.add(new CharacterEntity(243, "oacute")); - htmlLat1.add(new CharacterEntity(244, "ocirc")); - htmlLat1.add(new CharacterEntity(245, "otilde")); - htmlLat1.add(new CharacterEntity(246, "ouml")); - htmlLat1.add(new CharacterEntity(247, "divide")); - htmlLat1.add(new CharacterEntity(248, "oslash")); - htmlLat1.add(new CharacterEntity(249, "ugrave")); - htmlLat1.add(new CharacterEntity(250, "uacute")); - htmlLat1.add(new CharacterEntity(251, "ucirc")); - htmlLat1.add(new CharacterEntity(252, "uuml")); - htmlLat1.add(new CharacterEntity(253, "yacute")); - htmlLat1.add(new CharacterEntity(254, "thorn")); - htmlLat1.add(new CharacterEntity(255, "yuml")); - htmlSymbol = new ArrayList(); - htmlSymbol.add(new CharacterEntity(402, "fnof")); - htmlSymbol.add(new CharacterEntity(913, "Alpha")); - htmlSymbol.add(new CharacterEntity(914, "Beta")); - htmlSymbol.add(new CharacterEntity(915, "Gamma")); - htmlSymbol.add(new CharacterEntity(916, "Delta")); - htmlSymbol.add(new CharacterEntity(917, "Epsilon")); - htmlSymbol.add(new CharacterEntity(918, "Zeta")); - htmlSymbol.add(new CharacterEntity(919, "Eta")); - htmlSymbol.add(new CharacterEntity(920, "Theta")); - htmlSymbol.add(new CharacterEntity(921, "Iota")); - htmlSymbol.add(new CharacterEntity(922, "Kappa")); - htmlSymbol.add(new CharacterEntity(923, "Lambda")); - htmlSymbol.add(new CharacterEntity(924, "Mu")); - htmlSymbol.add(new CharacterEntity(925, "Nu")); - htmlSymbol.add(new CharacterEntity(926, "Xi")); - htmlSymbol.add(new CharacterEntity(927, "Omicron")); - htmlSymbol.add(new CharacterEntity(928, "Pi")); - htmlSymbol.add(new CharacterEntity(929, "Rho")); - htmlSymbol.add(new CharacterEntity(931, "Sigma")); - htmlSymbol.add(new CharacterEntity(932, "Tau")); - htmlSymbol.add(new CharacterEntity(933, "Upsilon")); - htmlSymbol.add(new CharacterEntity(934, "Phi")); - htmlSymbol.add(new CharacterEntity(935, "Chi")); - htmlSymbol.add(new CharacterEntity(936, "Psi")); - htmlSymbol.add(new CharacterEntity(937, "Omega")); - htmlSymbol.add(new CharacterEntity(945, "alpha")); - htmlSymbol.add(new CharacterEntity(946, "beta")); - htmlSymbol.add(new CharacterEntity(947, "gamma")); - htmlSymbol.add(new CharacterEntity(948, "delta")); - htmlSymbol.add(new CharacterEntity(949, "epsilon")); - htmlSymbol.add(new CharacterEntity(950, "zeta")); - htmlSymbol.add(new CharacterEntity(951, "eta")); - htmlSymbol.add(new CharacterEntity(952, "theta")); - htmlSymbol.add(new CharacterEntity(953, "iota")); - htmlSymbol.add(new CharacterEntity(954, "kappa")); - htmlSymbol.add(new CharacterEntity(955, "lambda")); - htmlSymbol.add(new CharacterEntity(956, "mu")); - htmlSymbol.add(new CharacterEntity(957, "nu")); - htmlSymbol.add(new CharacterEntity(958, "xi")); - htmlSymbol.add(new CharacterEntity(959, "omicron")); - htmlSymbol.add(new CharacterEntity(960, "pi")); - htmlSymbol.add(new CharacterEntity(961, "rho")); - htmlSymbol.add(new CharacterEntity(962, "sigmaf")); - htmlSymbol.add(new CharacterEntity(963, "sigma")); - htmlSymbol.add(new CharacterEntity(964, "tau")); - htmlSymbol.add(new CharacterEntity(965, "upsilon")); - htmlSymbol.add(new CharacterEntity(966, "phi")); - htmlSymbol.add(new CharacterEntity(967, "chi")); - htmlSymbol.add(new CharacterEntity(968, "psi")); - htmlSymbol.add(new CharacterEntity(969, "omega")); - htmlSymbol.add(new CharacterEntity(977, "thetasym")); - htmlSymbol.add(new CharacterEntity(978, "upsih")); - htmlSymbol.add(new CharacterEntity(982, "piv")); - htmlSymbol.add(new CharacterEntity(8230, "hellip")); - htmlSymbol.add(new CharacterEntity(8242, "prime")); - htmlSymbol.add(new CharacterEntity(8243, "Prime")); - htmlSymbol.add(new CharacterEntity(8254, "oline")); - htmlSymbol.add(new CharacterEntity(8260, "frasl")); - htmlSymbol.add(new CharacterEntity(8465, "image")); - htmlSymbol.add(new CharacterEntity(8472, "weierp")); - htmlSymbol.add(new CharacterEntity(8476, "real")); - htmlSymbol.add(new CharacterEntity(8482, "trade")); - htmlSymbol.add(new CharacterEntity(8501, "alefsym")); - htmlSymbol.add(new CharacterEntity(8592, "larr")); - htmlSymbol.add(new CharacterEntity(8593, "uarr")); - htmlSymbol.add(new CharacterEntity(8594, "rarr")); - htmlSymbol.add(new CharacterEntity(8595, "darr")); - htmlSymbol.add(new CharacterEntity(8596, "harr")); - htmlSymbol.add(new CharacterEntity(8629, "crarr")); - htmlSymbol.add(new CharacterEntity(8656, "lArr")); - htmlSymbol.add(new CharacterEntity(8657, "uArr")); - htmlSymbol.add(new CharacterEntity(8658, "rArr")); - htmlSymbol.add(new CharacterEntity(8659, "dArr")); - htmlSymbol.add(new CharacterEntity(8660, "hArr")); - htmlSymbol.add(new CharacterEntity(8704, "forall")); - htmlSymbol.add(new CharacterEntity(8706, "part")); - htmlSymbol.add(new CharacterEntity(8707, "exist")); - htmlSymbol.add(new CharacterEntity(8709, "empty")); - htmlSymbol.add(new CharacterEntity(8711, "nabla")); - htmlSymbol.add(new CharacterEntity(8712, "isin")); - htmlSymbol.add(new CharacterEntity(8713, "notin")); - htmlSymbol.add(new CharacterEntity(8715, "ni")); - htmlSymbol.add(new CharacterEntity(8719, "prod")); - htmlSymbol.add(new CharacterEntity(8721, "sum")); - htmlSymbol.add(new CharacterEntity(8722, "minus")); - htmlSymbol.add(new CharacterEntity(8727, "lowast")); - htmlSymbol.add(new CharacterEntity(8730, "radic")); - htmlSymbol.add(new CharacterEntity(8733, "prop")); - htmlSymbol.add(new CharacterEntity(8734, "infin")); - htmlSymbol.add(new CharacterEntity(8736, "ang")); - htmlSymbol.add(new CharacterEntity(8743, "and")); - htmlSymbol.add(new CharacterEntity(8744, "or")); - htmlSymbol.add(new CharacterEntity(8745, "cap")); - htmlSymbol.add(new CharacterEntity(8746, "cup")); - htmlSymbol.add(new CharacterEntity(8747, "int")); - htmlSymbol.add(new CharacterEntity(8756, "there4")); - htmlSymbol.add(new CharacterEntity(8764, "sim")); - htmlSymbol.add(new CharacterEntity(8773, "cong")); - htmlSymbol.add(new CharacterEntity(8776, "asymp")); - htmlSymbol.add(new CharacterEntity(8800, "ne")); - htmlSymbol.add(new CharacterEntity(8801, "equiv")); - htmlSymbol.add(new CharacterEntity(8804, "le")); - htmlSymbol.add(new CharacterEntity(8805, "ge")); - htmlSymbol.add(new CharacterEntity(8834, "sub")); - htmlSymbol.add(new CharacterEntity(8835, "sup")); - htmlSymbol.add(new CharacterEntity(8836, "nsub")); - htmlSymbol.add(new CharacterEntity(8838, "sube")); - htmlSymbol.add(new CharacterEntity(8839, "supe")); - htmlSymbol.add(new CharacterEntity(8853, "oplus")); - htmlSymbol.add(new CharacterEntity(8855, "otimes")); - htmlSymbol.add(new CharacterEntity(8869, "perp")); - htmlSymbol.add(new CharacterEntity(8901, "sdot")); - htmlSymbol.add(new CharacterEntity(8968, "lceil")); - htmlSymbol.add(new CharacterEntity(8969, "rceil")); - htmlSymbol.add(new CharacterEntity(8970, "lfloor")); - htmlSymbol.add(new CharacterEntity(8971, "rfloor")); - htmlSymbol.add(new CharacterEntity(9001, "lang")); - htmlSymbol.add(new CharacterEntity(9002, "rang")); - htmlSymbol.add(new CharacterEntity(9674, "loz")); - htmlSymbol.add(new CharacterEntity(9824, "spades")); - htmlSymbol.add(new CharacterEntity(9827, "clubs")); - htmlSymbol.add(new CharacterEntity(9829, "hearts")); - htmlSymbol.add(new CharacterEntity(9830, "diams")); - htmlSpecial = new ArrayList(); - htmlSpecial.add(new CharacterEntity(34, "quot")); - htmlSpecial.add(new CharacterEntity(38, "amp")); - htmlSpecial.add(new CharacterEntity(39, "apos")); - htmlSpecial.add(new CharacterEntity(60, "lt")); - htmlSpecial.add(new CharacterEntity(62, "gt")); - htmlSpecial.add(new CharacterEntity(338, "OElig")); - htmlSpecial.add(new CharacterEntity(339, "oelig")); - htmlSpecial.add(new CharacterEntity(352, "Scaron")); - htmlSpecial.add(new CharacterEntity(353, "scaron")); - htmlSpecial.add(new CharacterEntity(376, "Yuml")); - htmlSpecial.add(new CharacterEntity(710, "circ")); - htmlSpecial.add(new CharacterEntity(732, "tilde")); - htmlSpecial.add(new CharacterEntity(8194, "ensp")); - htmlSpecial.add(new CharacterEntity(8195, "emsp")); - htmlSpecial.add(new CharacterEntity(8201, "thinsp")); - htmlSpecial.add(new CharacterEntity(8204, "zwnj")); - htmlSpecial.add(new CharacterEntity(8205, "zwj")); - htmlSpecial.add(new CharacterEntity(8206, "lrm")); - htmlSpecial.add(new CharacterEntity(8207, "rlm")); - htmlSpecial.add(new CharacterEntity(8211, "ndash")); - htmlSpecial.add(new CharacterEntity(8212, "mdash")); - htmlSpecial.add(new CharacterEntity(8216, "lsquo")); - htmlSpecial.add(new CharacterEntity(8217, "rsquo")); - htmlSpecial.add(new CharacterEntity(8218, "sbquo")); - htmlSpecial.add(new CharacterEntity(8220, "ldquo")); - htmlSpecial.add(new CharacterEntity(8221, "rdquo")); - htmlSpecial.add(new CharacterEntity(8222, "bdquo")); - htmlSpecial.add(new CharacterEntity(8224, "dagger")); - htmlSpecial.add(new CharacterEntity(8225, "Dagger")); - htmlSpecial.add(new CharacterEntity(8226, "bull")); - htmlSpecial.add(new CharacterEntity(8240, "permil")); - htmlSpecial.add(new CharacterEntity(8249, "lsaquo")); - htmlSpecial.add(new CharacterEntity(8250, "rsaquo")); - htmlSpecial.add(new CharacterEntity(8364, "euro")); - html40Entities = new CharacterEntitySolver(); - for (CharacterEntity entity : xml10) { - html40Entities.add(entity.getNumericValue(), entity.getName()); - } - for (CharacterEntity entity : htmlLat1) { - html40Entities.add(entity.getNumericValue(), entity.getName()); - } - for (CharacterEntity entity : htmlSymbol) { - html40Entities.add(entity.getNumericValue(), entity.getName()); - } - for (CharacterEntity entity : htmlSpecial) { - html40Entities.add(entity.getNumericValue(), entity.getName()); - } - } - - /** - * Returns the string with the first character capitalized. - * - * @param string - * a string reference to check - * @return the string with the first character capitalized. - */ - public static String firstLower(String string) { - if (!isNullOrEmpty(string)) { - return string.substring(0, 1).toLowerCase() + string.substring(1); - } - return string; - } - - /** - * Returns the string with the first character capitalized. - * - * @param string - * a string reference to check - * @return the string with the first character capitalized. - */ - public static String firstUpper(String string) { - if (!isNullOrEmpty(string)) { - return string.substring(0, 1).toUpperCase() + string.substring(1); - } - return string; - } - - - - /** - * Returns the given {@link String} according to the HTML 4.0 encoding - * rules. - * - * @param str - * The {@link String} to encode. - * @return The converted {@link String} according to the HTML 4.0 encoding - * rules. - */ - public static String htmlEscape(String str) { - if (str == null) { - return null; - } - int len = str.length(); - StringBuilder sb = new StringBuilder((int) (len * 1.5)); - for (int i = 0; i < len; i++) { - char c = str.charAt(i); - String entityName = html40Entities.getName(c); - if (entityName == null) { - if (c > 127) { - // Escape non ASCII characters. - sb.append("&#").append(Integer.toString(c, 10)).append(';'); - } else { - // ASCII characters are not escaped. - sb.append(c); - } - } else { - sb.append('&').append(entityName).append(';'); - } - } - return sb.toString(); - } - - /** - * Returns the given {@link String} decoded according to the HTML 4.0 - * decoding rules. - * - * @param str - * The {@link String} to decode. - * @return The given {@link String} decoded according to the HTML 4.0 - * decoding rules. - */ - public static String htmlUnescape(String str) { - if (str == null) { - return null; - } - int len = str.length(); - StringBuilder sb = new StringBuilder(len); - for (int i = 0; i < len; i++) { - char c = str.charAt(i); - if (c == '&') { - int nextIndex = i + 1; - int semicolonIndex = -1; - int ampersandIndex = -1; - boolean stop = false; - for (int j = nextIndex; !stop && j < len; j++) { - char ch = str.charAt(j); - if (';' == ch) { - semicolonIndex = j; - stop = true; - } else if ('&' == ch) { - ampersandIndex = j; - stop = true; - } - } - if (semicolonIndex != -1) { - // Entity found - if (nextIndex != semicolonIndex) { - int entityValue = -1; - String entityName = str.substring(nextIndex, - semicolonIndex); - if (entityName.charAt(0) == '#') { - // Numeric value - if (entityName.length() > 1) { - char hexChar = entityName.charAt(1); - try { - if (hexChar == 'X') { - entityValue = Integer.parseInt( - entityName.substring(2), 16); - } else if (hexChar == 'x') { - entityValue = Integer.parseInt( - entityName.substring(2), 16); - } else { - entityValue = Integer.parseInt( - entityName.substring(1), 10); - } - if (!Character - .isValidCodePoint(entityValue)) { - // Invalid Unicode character - entityValue = -1; - } - } catch (NumberFormatException e) { - entityValue = -1; - } - } - } else { - Integer val = html40Entities.getValue(entityName); - if (val != null) { - entityValue = val.intValue(); - } - } - if (entityValue == -1) { - sb.append('&').append(entityName).append(';'); - } else { - sb.append((char) entityValue); - } - } else { - sb.append("&;"); - } - i = semicolonIndex; - } else if (stop) { - // found a "&" character - sb.append(str, i, ampersandIndex).append('&'); - i = ampersandIndex; - } else { - // End of the string reached, no more entities to parse. - sb.append(str, i, len); - i = len; - } - } else { - sb.append(c); - } - } - return sb.toString(); - } - - /** - * Returns {@code true} if the given string is null or is the empty string. - * - * Consider normalizing your string references with {@link #nullToEmpty}. If - * you do, you can use {@link String#isEmpty()} instead of this method, and - * you won't need special null-safe forms of methods like - * {@link String#toUpperCase} either. - * - * @param string - * a string reference to check - * @return {@code true} if the string is null or is the empty string - */ - public static boolean isNullOrEmpty(String string) { - return string == null || string.isEmpty(); - } - - /** - * Returns the given string if it is non-null; the empty string otherwise. - * - * @param string - * the string to test and possibly return - * @return {@code string} itself if it is non-null; {@code ""} if it is null - */ - public static String nullToEmpty(String string) { - return (string == null) ? "" : string; - } - - - - /** - * Strips a delimiter character from both ends of the source string. - * - * @param source - * The source string to strip. - * @param delimiter - * The character to remove. - * @return The stripped string. - */ - public static String strip(String source, char delimiter) { - return strip(source, delimiter, true, true); - } - - /** - * Strips a delimiter character from a source string. - * - * @param source - * The source string to strip. - * @param delimiter - * The character to remove. - * @param start - * Indicates if start of source should be stripped. - * @param end - * Indicates if end of source should be stripped. - * @return The stripped source string. - */ - public static String strip(String source, char delimiter, boolean start, - boolean end) { - int beginIndex = 0; - int endIndex = source.length(); - boolean stripping = true; - - // Strip beginning - while (stripping && (beginIndex < endIndex)) { - if (source.charAt(beginIndex) == delimiter) { - beginIndex++; - } else { - stripping = false; - } - } - - // Strip end - stripping = true; - while (stripping && (beginIndex < endIndex - 1)) { - if (source.charAt(endIndex - 1) == delimiter) { - endIndex--; - } else { - stripping = false; - } - } - - return source.substring(beginIndex, endIndex); - } - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e. it isn't instantiable and extensible. - */ - private StringUtils() {} -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/SystemUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/SystemUtils.java deleted file mode 100644 index 07e9b2c113..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/SystemUtils.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util; - -/** - * System utilities. - * - * @author Jerome Louvel - */ -public class SystemUtils { - - - - - /** - * Computes the hash code of a set of objects. Follows the algorithm - * specified in List.hasCode(). - * - * @param objects - * the objects to compute the hashCode - * - * @return The hash code of a set of objects. - */ - public static int hashCode(Object... objects) { - int result = 17; - - if (objects != null) { - for (final Object obj : objects) { - result = 31 * result + (obj == null ? 0 : obj.hashCode()); - } - } - - return result; - } - - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e. it isn't instantiable and extensible. - */ - private SystemUtils() { - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/CopyOnWriteArrayList.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/CopyOnWriteArrayList.java deleted file mode 100644 index 4e3cc554b8..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/CopyOnWriteArrayList.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util.emul; - -import java.util.*; - -/** - * Emulate the CopyOnWriteArrayList class, especially for the GWT module. - * - * @author Thierry Boileau - */ -public class CopyOnWriteArrayList implements List { - - private final List list; - - public CopyOnWriteArrayList() { - super(); - list = new ArrayList(); - } - - public CopyOnWriteArrayList(Collection c) { - super(); - this.list = new ArrayList(); - this.list.addAll(c); - } - - public boolean add(E o) { - return list.add(o); - } - - public void add(int index, E element) { - list.add(index, element); - } - - public boolean addAll(Collection c) { - return list.addAll(c); - } - - public boolean addAll(int index, Collection c) { - return list.addAll(index, c); - } - - public void clear() { - list.clear(); - } - - public boolean contains(Object o) { - return list.contains(o); - } - - public boolean containsAll(Collection c) { - return new HashSet<>(list).containsAll(c); - } - - public E get(int index) { - return list.get(index); - } - - public int indexOf(Object o) { - return list.indexOf(o); - } - - public boolean isEmpty() { - return list.isEmpty(); - } - - public Iterator iterator() { - return list.iterator(); - } - - public int lastIndexOf(Object o) { - return list.lastIndexOf(o); - } - - public ListIterator listIterator() { - return list.listIterator(); - } - - public ListIterator listIterator(int index) { - return list.listIterator(index); - } - - public boolean remove(Object o) { - return list.remove(o); - } - - public E remove(int index) { - return list.remove(index); - } - - public boolean removeAll(Collection c) { - return list.removeAll(c); - } - - public boolean retainAll(Collection c) { - return list.retainAll(c); - } - - public E set(int index, E element) { - return list.set(index, element); - } - - public int size() { - return list.size(); - } - - public List subList(int fromIndex, int toIndex) { - if (fromIndex < 0) - throw new IndexOutOfBoundsException("fromIndex = " + fromIndex); - if (toIndex > list.size()) - throw new IndexOutOfBoundsException("toIndex = " + toIndex); - if (fromIndex > toIndex) - throw new IllegalArgumentException("fromIndex(" + fromIndex - + ") > toIndex(" + toIndex + ")"); - ArrayList subList = new ArrayList(); - for (int i = fromIndex; i <= toIndex; i++) { - subList.add(list.get(i)); - } - return subList; - } - - public Object[] toArray() { - return list.toArray(); - } - - public T[] toArray(T[] a) { - return list.toArray(a); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/CopyOnWriteArraySet.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/CopyOnWriteArraySet.java deleted file mode 100644 index 3b4be12d22..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/CopyOnWriteArraySet.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util.emul; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -/** - * Emulate the CopyOnWriteArraySet class, especially for the GWT module. - * - * @author Thierry Boileau - */ -public class CopyOnWriteArraySet implements Set { - - private Set set; - - public CopyOnWriteArraySet() { - super(); - this.set = new HashSet(); - } - - public boolean add(E o) { - return set.add(o); - } - - public boolean addAll(Collection c) { - return set.addAll(c); - } - - public void clear() { - set.clear(); - } - - public boolean contains(Object o) { - return set.contains(o); - } - - public boolean containsAll(Collection c) { - return set.containsAll(c); - } - - public boolean isEmpty() { - return set.isEmpty(); - } - - public Iterator iterator() { - return set.iterator(); - } - - public boolean remove(Object o) { - return set.remove(o); - } - - public boolean removeAll(Collection c) { - return set.removeAll(c); - } - - public boolean retainAll(Collection c) { - return set.retainAll(c); - } - - public int size() { - return set.size(); - } - - public Object[] toArray() { - return set.toArray(); - } - - public T[] toArray(T[] a) { - return set.toArray(a); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/StringWriter.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/StringWriter.java deleted file mode 100644 index 842b36b6d3..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/StringWriter.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util.emul; - -import java.io.IOException; - -/** - * Emulation of the {@link java.io.StringWriter} class for the GWT edition. - * - * @author Jerome Louvel - */ -public abstract class StringWriter implements Appendable { - - private StringBuilder sb; - - public StringWriter() { - super(); - this.sb = new StringBuilder(); - } - - public Appendable append(char c) { - return sb.append(c); - } - - public Appendable append(CharSequence csq, int start, int end) - throws IOException { - return sb.append(csq, start, end); - } - - public Appendable append(CharSequence csq) { - return sb.append(csq); - } - - public void close() throws IOException { - } - - @Override - public String toString() { - return sb.toString(); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/UnknownHostException.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/UnknownHostException.java deleted file mode 100644 index e932315c1e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/UnknownHostException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util.emul; - -import java.io.IOException; - -/** - * Emulation of the {@link java.io.UnknownHostException} class for the GWT - * edition. - * - * @author Thierry Boileau - */ -@SuppressWarnings("serial") -public class UnknownHostException extends IOException { - - public UnknownHostException() { - super(); - } - - public UnknownHostException(String message) { - super(message); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/UnsupportedEncodingException.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/UnsupportedEncodingException.java deleted file mode 100644 index 8657403a94..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/emul/UnsupportedEncodingException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine.util.emul; - -import java.io.IOException; - -/** - * Emulation of the {@link java.io.UnsupportedEncodingException} class for the - * GWT edition. - * - * @author Thierry Boileau - */ -@SuppressWarnings("serial") -public class UnsupportedEncodingException extends IOException { - - public UnsupportedEncodingException() { - super(); - } - - public UnsupportedEncodingException(String message) { - super(message); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/package.html deleted file mode 100644 index 4b5855ae8b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - - Core classes of the API. -

- @since Restlet 1.0 - @see REST dissertation by Roy T. Fielding - @see User Guide - Restlet API - @see User Guide - Base package - @deprecated Will be removed in the next 2.7/3.0 release. - - diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/CharacterRepresentation.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/CharacterRepresentation.java deleted file mode 100644 index 9cdb3eda66..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/CharacterRepresentation.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.MediaType; - -/** - * Representation based on a BIO character stream. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class CharacterRepresentation extends Representation { - /** - * Constructor. - * - * @param mediaType - * The media type. - */ - public CharacterRepresentation(MediaType mediaType) { - super(mediaType); - setCharacterSet(CharacterSet.UTF_8); - } - - - - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/EmptyRepresentation.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/EmptyRepresentation.java deleted file mode 100644 index 8d8af47f2a..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/EmptyRepresentation.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; - -/** - * Empty representation with no content. It is always considered available but - * calling the {@link #getText()} method for example will return an empty - * string. It can also have regular metadata available. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class EmptyRepresentation extends Representation { - - /** - * Constructor. - */ - public EmptyRepresentation() { - setAvailable(false); - setTransient(true); - setSize(0); - } - - - @Override - public StringReader getReader() throws IOException { - return null; - } - - @Override - public InputStream getStream() throws IOException { - return null; - } - - - @Override - public String getText() throws IOException { - return ""; - } - - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/InputRepresentation.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/InputRepresentation.java deleted file mode 100644 index d18feec395..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/InputRepresentation.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; - -import org.restlet.client.Context; -import org.restlet.client.data.MediaType; -import org.restlet.client.engine.io.IoUtils; - -/** - * Transient representation based on a BIO input stream. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class InputRepresentation extends StreamRepresentation { - - /** The representation's stream. */ - private volatile InputStream stream; - - /** - * Constructor. - * - * @param inputStream - * The representation's stream. - */ - public InputRepresentation(InputStream inputStream) { - this(inputStream, null); - } - - /** - * Constructor. - * - * @param inputStream - * The representation's stream. - * @param mediaType - * The representation's media type. - */ - public InputRepresentation(InputStream inputStream, MediaType mediaType) { - this(inputStream, mediaType, UNKNOWN_SIZE); - } - - /** - * Constructor. - * - * @param inputStream - * The representation's stream. - * @param mediaType - * The representation's media type. - * @param expectedSize - * The expected input stream size. - */ - public InputRepresentation(InputStream inputStream, MediaType mediaType, - long expectedSize) { - super(mediaType); - setSize(expectedSize); - setTransient(true); - setStream(inputStream); - } - - @Override - public InputStream getStream() throws IOException { - return this.stream; - } - - /** - * Note that this method relies on {@link #getStream()}. This stream is - * closed once fully read. - */ - @Override - public String getText() throws IOException { - return IoUtils.toString(getStream(), getCharacterSet()); - } - - /** - * Closes and releases the input stream. - */ - @Override - public void release() { - if (this.stream != null) { - try { - this.stream.close(); - } catch (IOException e) { - Context.getCurrentLogger().log(Level.WARNING, - "Error while releasing the representation.", e); - } - - this.stream = null; - } - - super.release(); - } - - /** - * Sets the input stream to use. - * - * @param stream - * The input stream to use. - */ - public void setStream(InputStream stream) { - this.stream = stream; - setAvailable(stream != null); - } - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/ObjectRepresentation.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/ObjectRepresentation.java deleted file mode 100644 index 88f330e0fc..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/ObjectRepresentation.java +++ /dev/null @@ -1,245 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import org.restlet.client.data.MediaType; -import org.restlet.client.resource.ClientProxy; - -import com.google.gwt.user.client.rpc.RemoteService; -import com.google.gwt.user.client.rpc.SerializationStreamFactory; -import com.google.gwt.user.client.rpc.SerializationStreamReader; -import com.google.gwt.user.client.rpc.SerializationStreamWriter; - -/** - * Representation based on a serializable Java object. This internally reuses - * the GWT-RPC serialization logic. - * - * @author Jerome Louvel - * @param - * The class to serialize. - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class ObjectRepresentation extends StringRepresentation { - - /** The wrapped object. */ - private T object; - - /** The serialization stream factory. */ - private SerializationStreamFactory serializationStreamFactory; - - /** Indicates if the serialized object is a String. */ - private boolean string; - - /** - * Constructor for serialization. - * - * @param resource - * The remote resource from which to obtain the serialization - * stream factory. - * @param object - * The object to serialize. - */ - public ObjectRepresentation(ClientProxy resource, T object) { - this((resource == null) ? null : (SerializationStreamFactory) resource, - object); - } - - /** - * Constructor for serialization. - * - * @param remoteService - * The remote service from which to obtain the serialization - * stream factory. - * @param object - * The object to serialize. - */ - public ObjectRepresentation(RemoteService remoteService, T object) { - this((SerializationStreamFactory) remoteService, object); - } - - /** - * Constructor for serialization. - * - * @param serializationStreamFactory - * The serialization stream factory. - * @param object - * The object to serialize. - */ - public ObjectRepresentation( - SerializationStreamFactory serializationStreamFactory, T object) { - super(null, MediaType.APPLICATION_JAVA_OBJECT_GWT); - this.object = object; - this.serializationStreamFactory = serializationStreamFactory; - } - - /** - * Constructor for deserialization. - * - * @param serializedObject - * The object serialization text. - * @param resource - * The remote resource from which to obtain the serialization - * stream factory. - */ - public ObjectRepresentation(String serializedObject, ClientProxy resource) { - this(serializedObject, (resource == null) ? null - : (SerializationStreamFactory) resource); - } - - /** - * Constructor for deserialization. - * - * @param serializedObject - * The object serialization text. - * @param remoteService - * The remote service from which to obtain the serialization - * stream factory. - */ - public ObjectRepresentation(String serializedObject, - RemoteService remoteService) { - this(serializedObject, (SerializationStreamFactory) remoteService); - } - - /** - * Constructor for deserialization. - * - * @param serializedObject - * The object serialization text. - * @param serializationStreamFactory - * The serialization stream factory. - */ - public ObjectRepresentation(String serializedObject, - SerializationStreamFactory serializationStreamFactory) { - this(serializedObject, serializationStreamFactory, false); - } - - /** - * Constructor for deserialization. - * - * @param serializedObject - * The object serialization text. - * @param serializationStreamFactory - * The serialization stream factory. - */ - public ObjectRepresentation(String serializedObject, - SerializationStreamFactory serializationStreamFactory, - boolean string) { - super(serializedObject, MediaType.APPLICATION_JAVA_OBJECT_GWT); - this.serializationStreamFactory = serializationStreamFactory; - this.object = null; - this.string = string; - } - - /** - * The wrapped object. Triggers the deserialization if necessary. - * - * @return The wrapped object. - */ - @SuppressWarnings("unchecked") - public T getObject() { - if ((this.object == null) && (getText() != null)) { - try { - // Create a stream reader - SerializationStreamReader streamReader = getSerializationStreamFactory() - .createStreamReader(getText()); - - // Deserialize the object - if (isString()) { - this.object = (T) streamReader.readString(); - } else { - this.object = (T) streamReader.readObject(); - } - - } catch (Exception e) { - this.object = null; - throw new RuntimeException("Unable to deserialize the representation into an object", e); - } - } - - return object; - } - - /** - * Returns the serialization stream factory. - * - * @return The serialization stream factory. - */ - public SerializationStreamFactory getSerializationStreamFactory() { - // Create the serialization stream factory - return serializationStreamFactory; - } - - @Override - public String getText() { - if ((this.object != null) && (super.getText() == null)) { - try { - // Create a stream writer - SerializationStreamWriter objectWriter = getSerializationStreamFactory() - .createStreamWriter(); - - // Serialize the object - if (this.object instanceof String) { - objectWriter.writeString((String) this.object); - } else { - objectWriter.writeObject(this.object); - } - - setText(objectWriter.toString()); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - return super.getText(); - } - - /** - * Indicates if the serialized object is a String. - * - * @return True if the serialized object is a String. - */ - public boolean isString() { - return string; - } - - /** - * Sets the wrapped object. - * - * @param object - * The wrapped object. - */ - public void setObject(T object) { - this.object = object; - } - - /** - * Sets the serialization stream factory. - * - * @param serializationStreamFactory - * The serialization stream factory. - */ - public void setSerializationStreamFactory( - SerializationStreamFactory serializationStreamFactory) { - this.serializationStreamFactory = serializationStreamFactory; - } - - /** - * Indicates if the serialized object is a String. - * - * @param string - * True if the serialized object is a String. - */ - public void setString(boolean string) { - this.string = string; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/Representation.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/Representation.java deleted file mode 100644 index 65b12d0029..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/Representation.java +++ /dev/null @@ -1,468 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.util.Date; - -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.data.Disposition; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Range; -import org.restlet.client.data.Tag; -import org.restlet.client.engine.io.IoUtils; -import org.restlet.client.engine.util.DateUtils; - -/** - * Current or intended state of a resource. The content of a representation can - * be retrieved several times if there is a stable and accessible source, like a - * local file or a string. When the representation is obtained via a temporary - * source like a network socket, its content can only be retrieved once. The - * "transient" and "available" properties are available to help you figure out - * those aspects at runtime.
- *
- * For performance purpose, it is essential that a minimal overhead occurs upon - * initialization. The main overhead must only occur during invocation of - * content processing methods (write, getStream, getChannel and toString).
- *
- * "REST components perform actions on a resource by using a representation to - * capture the current or intended state of that resource and transferring that - * representation between components. A representation is a sequence of bytes, - * plus representation metadata to describe those bytes. Other commonly used but - * less precise names for a representation include: document, file, and HTTP - * message entity, instance, or variant." Roy T. Fielding - * - * @see Source dissertation - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Representation extends RepresentationInfo { - /** - * Indicates that the size of the representation can't be known in advance. - */ - public static final long UNKNOWN_SIZE = -1L; - - /** Indicates if the representation's content is potentially available. */ - private volatile boolean available; - - - /** The disposition characteristics of the representation. */ - private volatile Disposition disposition; - - /** The expiration date. */ - private volatile Date expirationDate; - - /** Indicates if the representation's content is transient. */ - private volatile boolean isTransient; - - /** - * Indicates where in the full content the partial content available should - * be applied. - */ - private volatile Range range; - - /** - * The expected size. Dynamic representations can have any size, but - * sometimes we can know in advance the expected size. If this expected size - * is specified by the user, it has a higher priority than any size that can - * be guessed by the representation (like a file size). - */ - private volatile long size; - - /** - * Default constructor. - */ - public Representation() { - this(null); - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - */ - public Representation(MediaType mediaType) { - super(mediaType); - this.available = true; - this.disposition = null; - this.isTransient = false; - this.size = UNKNOWN_SIZE; - this.expirationDate = null; - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - * @param modificationDate - * The modification date. - */ - public Representation(MediaType mediaType, Date modificationDate) { - this(mediaType, modificationDate, null); - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - * @param modificationDate - * The modification date. - * @param tag - * The tag. - */ - public Representation(MediaType mediaType, Date modificationDate, Tag tag) { - super(mediaType, modificationDate, tag); - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - * @param tag - * The tag. - */ - public Representation(MediaType mediaType, Tag tag) { - this(mediaType, null, tag); - } - - /** - * Constructor from a variant. - * - * @param variant - * The variant to copy. - * @param modificationDate - * The modification date. - */ - public Representation(Variant variant, Date modificationDate) { - this(variant, modificationDate, null); - } - - /** - * Constructor from a variant. - * - * @param variant - * The variant to copy. - * @param modificationDate - * The modification date. - * @param tag - * The tag. - */ - public Representation(Variant variant, Date modificationDate, Tag tag) { - setCharacterSet(variant.getCharacterSet()); - setEncodings(variant.getEncodings()); - setLocationRef(variant.getLocationRef()); - setLanguages(variant.getLanguages()); - setMediaType(variant.getMediaType()); - setModificationDate(modificationDate); - setTag(tag); - } - - /** - * Constructor from a variant. - * - * @param variant - * The variant to copy. - * @param tag - * The tag. - */ - public Representation(Variant variant, Tag tag) { - this(variant, null, tag); - } - - /** - * Appends the representation to an appendable sequence of characters. This - * method is ensured to write the full content for each invocation unless it - * is a transient representation, in which case an exception is thrown.
- *
- * Note that {@link #getText()} is used by the default implementation. - * - * @param appendable - * The appendable sequence of characters. - * @throws IOException - */ - public void append(Appendable appendable) throws IOException { - appendable.append(getText()); - } - - /** - * Exhaust the content of the representation by reading it and silently - * discarding anything read. By default, it relies on {@link #getStream()} - * and closes the retrieved stream in the end. - * - * @return The number of bytes consumed or -1 if unknown. - */ - public long exhaust() throws IOException { - return -1L; - } - - /** - * Returns the size effectively available. This returns the same value as - * {@link #getSize()} if no range is defined, otherwise it returns the size - * of the range using {@link Range#getSize()}. - * - * @return The available size. - */ - public long getAvailableSize() { - return IoUtils.getAvailableSize(this); - } - - - - /** - * Returns the disposition characteristics of the representation. - * - * @return The disposition characteristics of the representation. - */ - public Disposition getDisposition() { - return disposition; - } - - /** - * Returns the future date when this representation expires. - * If this information is not known, returns null.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Expires" header. - * - * @return The expiration date. - */ - public Date getExpirationDate() { - return this.expirationDate; - } - - /** - * Returns the range where in the full content the partial content available - * should be applied.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Range" header. - * - * @return The content range or null if the full content is available. - */ - public Range getRange() { - return this.range; - } - - /** - * Returns a reader of characters with the representation's content. - * This method is ensured to return a fresh reader for each invocation unless it - * is a transient representation, in which case null is returned. - * If the representation has no character set defined, the system's default one - * will be used. - * - * @return A reader with the representation's content. - * @throws IOException - */ - public abstract StringReader getReader() throws IOException; - - - /** - * Returns the total size in bytes if known, UNKNOWN_SIZE (-1) otherwise. - * When ranges are used, this might not be the actual size available. For - * this purpose, you can use the {@link #getAvailableSize()} method.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Length" header. - * - * @return The size in bytes if known, UNKNOWN_SIZE (-1) otherwise. - * @see #isEmpty() - */ - public long getSize() { - return this.size; - } - - /** - * Returns a stream with the representation's content. This method is - * ensured to return a fresh stream for each invocation unless it is a - * transient representation, in which case null is returned. - * - * @return A stream with the representation's content. - * @throws IOException - */ - public abstract InputStream getStream() throws IOException; - - - /** - * Indicates if the size of representation is known. It basically means that - * its size is 0 or superior. - * - * @return True if the representation has content. - */ - public boolean hasKnownSize() { - return getSize() >= 0; - } - - /** - * Indicates if some fresh content is potentially available, without having - * to actually call one of the content manipulation methods like getStream() - * that would actually consume it. Note that when the size of a - * representation is 0, then it is considered as unavailable. However, sometimes the - * size isn't known until a read attempt is made, so availability doesn't - * guarantee a non-empty content.
- *
- * This is especially useful for transient representation whose content can - * only be accessed once and also when the size of the representation is not - * known in advance. - * - * @return True if some fresh content is available. - */ - public boolean isAvailable() { - return this.available && (getSize() != 0); - } - - /** - * Indicates if the representation is empty. It basically means that its - * size is 0. - * - * @return True if the representation has no content. - */ - public boolean isEmpty() { - return getSize() == 0; - } - - /** - * Converts the representation to a string value. Be careful when using - * this method as the conversion of large content to a string fully - * stored in memory can result in OutOfMemoryErrors being thrown. - * - * @return The representation as a string value. - */ - public abstract String getText() throws IOException; - - - /** - * Indicates if the representation's content is transient, which means that - * it can be obtained only once. This is often the case with representations - * transmitted via network sockets, for example. In such a case, if you need to - * read the content several times, you need to cache it first, for example, - * into memory or into a file. - * - * @return True if the representation's content is transient. - */ - public boolean isTransient() { - return this.isTransient; - } - - /** - * Releases the representation and all associated objects like streams, - * channels or files which are used to produce its content, transient or - * not. This method must be systematically called when the representation is - * no longer intended to be used. The framework automatically calls back - * this method via its connectors on the server-side when sending responses - * with an entity and on the client-side when sending a request with an - * entity. By default, it calls the {@link #setAvailable(boolean)} method - * with "false" as a value.
- *
- * Note that for transient socket-bound representations, calling this method - * after consuming the whole content shouldn't prevent the reuse of - * underlying socket via persistent connections, for example. However, if the - * content hasn't been read, or has been partially read, the impact should - * be to discard the remaining content and to close the underlying - * connections.
- *
- * Therefore, if you are not interested in the content, or in the remaining - * content, you should first call the {@link #exhaust()} method or if this - * could be too costly, you should instead explicitly abort the parent - * request and the underlying connections using the {@link Request#abort()} - * method or {@link Response#abort()}. - */ - public void release() { - setAvailable(false); - } - - /** - * Indicates if some fresh content is available. - * - * @param available - * True if some fresh content is available. - */ - public void setAvailable(boolean available) { - this.available = available; - } - - - /** - * Sets the disposition characteristics of the representation. - * - * @param disposition - * The disposition characteristics of the representation. - */ - public void setDisposition(Disposition disposition) { - this.disposition = disposition; - } - - /** - * Sets the future date when this representation expires. - * If this information is not known, pass null.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Expires" header. - * - * @param expirationDate - * The expiration date. - */ - public void setExpirationDate(Date expirationDate) { - this.expirationDate = DateUtils.unmodifiable(expirationDate); - } - - - /** - * Sets the range where in the full content the partial content available - * should be applied.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Range" header. - * - * @param range - * The content range. - */ - public void setRange(Range range) { - this.range = range; - } - - /** - * Sets the expected size in bytes if known, -1 otherwise. For this purpose, - * you can use the {@link #getAvailableSize()} method.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Length" header. - * - * @param expectedSize - * The expected size in bytes if known, -1 otherwise. - */ - public void setSize(long expectedSize) { - this.size = expectedSize; - } - - /** - * Indicates if the representation's content is transient. - * - * @param isTransient - * True if the representation's content is transient. - */ - public void setTransient(boolean isTransient) { - this.isTransient = isTransient; - } - - - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/RepresentationInfo.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/RepresentationInfo.java deleted file mode 100644 index 9a7ca1a3b2..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/RepresentationInfo.java +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import java.util.Date; - -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Tag; -import org.restlet.client.engine.util.DateUtils; - -/** - * Information about a representation. Those metadata don't belong to the parent - * {@link Variant} class, however they are important for conditional method - * processing. The advantage over the complete {@link Representation} class is - * that it is much lighter to create. - * - * @see Source dissertation - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class RepresentationInfo extends Variant { - - /** The modification date. */ - private volatile Date modificationDate; - - /** The tag. */ - private volatile Tag tag; - - /** - * Default constructor. - */ - public RepresentationInfo() { - this(null); - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - */ - public RepresentationInfo(MediaType mediaType) { - this(mediaType, null, null); - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - * @param modificationDate - * The modification date. - */ - public RepresentationInfo(MediaType mediaType, Date modificationDate) { - this(mediaType, modificationDate, null); - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - * @param modificationDate - * The modification date. - * @param tag - * The tag. - */ - public RepresentationInfo(MediaType mediaType, Date modificationDate, - Tag tag) { - super(mediaType); - this.modificationDate = modificationDate; - this.tag = tag; - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - * @param tag - * The tag. - */ - public RepresentationInfo(MediaType mediaType, Tag tag) { - this(mediaType, null, tag); - } - - /** - * Constructor from a variant. - * - * @param variant - * The variant to copy. - * @param modificationDate - * The modification date. - */ - public RepresentationInfo(Variant variant, Date modificationDate) { - this(variant, modificationDate, null); - } - - /** - * Constructor from a variant. - * - * @param variant - * The variant to copy. - * @param modificationDate - * The modification date. - * @param tag - * The tag. - */ - public RepresentationInfo(Variant variant, Date modificationDate, Tag tag) { - setCharacterSet(variant.getCharacterSet()); - setEncodings(variant.getEncodings()); - setLocationRef(variant.getLocationRef()); - setLanguages(variant.getLanguages()); - setMediaType(variant.getMediaType()); - setModificationDate(modificationDate); - setTag(tag); - } - - /** - * Constructor from a variant. - * - * @param variant - * The variant to copy. - * @param tag - * The tag. - */ - public RepresentationInfo(Variant variant, Tag tag) { - this(variant, null, tag); - } - - /** - * Returns the last date when this representation was modified. If this - * information is not known, returns null.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Last-Modified" header. - * - * @return The modification date. - */ - public Date getModificationDate() { - return this.modificationDate; - } - - /** - * Returns the tag.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "ETag" header. - * - * @return The tag. - */ - public Tag getTag() { - return this.tag; - } - - /** - * Sets the last date when this representation was modified. If this - * information is not known, pass null.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Last-Modified" header. - * - * @param modificationDate - * The modification date. - */ - public void setModificationDate(Date modificationDate) { - this.modificationDate = DateUtils.unmodifiable(modificationDate); - } - - /** - * Sets the tag.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "ETag" header. - * - * @param tag - * The tag. - */ - public void setTag(Tag tag) { - this.tag = tag; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/StreamRepresentation.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/StreamRepresentation.java deleted file mode 100644 index b358ba649e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/StreamRepresentation.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import java.io.IOException; -import java.io.StringReader; - -import org.restlet.client.data.MediaType; -import org.restlet.client.engine.io.IoUtils; - -/** - * Representation based on a BIO stream. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class StreamRepresentation extends Representation { - - /** - * Constructor. - * - * @param mediaType - * The media type. - */ - public StreamRepresentation(MediaType mediaType) { - super(mediaType); - } - - - @Override - public StringReader getReader() throws IOException { - return IoUtils.getReader(getStream(), getCharacterSet()); - } - - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/StringRepresentation.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/StringRepresentation.java deleted file mode 100644 index c3d8570418..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/StringRepresentation.java +++ /dev/null @@ -1,196 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import java.io.IOException; -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Language; -import org.restlet.client.data.MediaType; - -/** - * Represents an Unicode string that can be converted to any character set - * supported by Java. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class StringRepresentation extends CharacterRepresentation { - - /** The string value. */ - private volatile CharSequence text; - - /** - * Constructor. The following metadata are used by default: "text/plain" - * media type, no language and the UTF-8 character set. - * - * @param chars - * The characters array. - */ - public StringRepresentation(char[] chars) { - this(new String(chars), MediaType.TEXT_PLAIN); - } - - /** - * Constructor. The following metadata are used by default: "text/plain" - * media type, no language and the UTF-8 character set. - * - * @param text - * The string value. - */ - public StringRepresentation(CharSequence text) { - this(text, MediaType.TEXT_PLAIN); - } - - /** - * Constructor. The following metadata are used by default: "text/plain" - * media type, no language and the UTF-8 character set. - * - * @param text - * The string value. - * @param language - * The language. - */ - public StringRepresentation(CharSequence text, Language language) { - this(text, MediaType.TEXT_PLAIN, language); - } - - /** - * Constructor. The following metadata are used by default: no language and - * the UTF-8 character set. - * - * @param text - * The string value. - * @param mediaType - * The media type. - */ - public StringRepresentation(CharSequence text, MediaType mediaType) { - this(text, mediaType, null); - } - - /** - * Constructor. The following metadata are used by default: UTF-8 character - * set. - * - * @param text - * The string value. - * @param mediaType - * The media type. - * @param language - * The language. - */ - public StringRepresentation(CharSequence text, MediaType mediaType, - Language language) { - this(text, mediaType, language, CharacterSet.UTF_8); - } - - /** - * Constructor. - * - * @param text - * The string value. - * @param mediaType - * The media type. - * @param language - * The language. - * @param characterSet - * The character set. - */ - public StringRepresentation(CharSequence text, MediaType mediaType, - Language language, CharacterSet characterSet) { - super(mediaType); - setMediaType(mediaType); - if (language != null) { - getLanguages().add(language); - } - - setCharacterSet(characterSet); - setText(text); - } - - @Override - public StringReader getReader() throws IOException { - if (getText() != null) { - return new StringReader(getText()); - } - - return null; - } - - @Override - public InputStream getStream() throws IOException { - InputStream result = new - org.restlet.client.engine.io.StringInputStream(getText()); - return result; - } - - @Override - public String getText() { - return (this.text == null) ? null : this.text.toString(); - } - - /** - * Closes and releases the input stream. - */ - @Override - public void release() { - setText(null); - super.release(); - } - - @Override - public void setCharacterSet(CharacterSet characterSet) { - super.setCharacterSet(characterSet); - updateSize(); - } - - /** - * Sets the string value. - * - * @param text - * The string value. - */ - public void setText(CharSequence text) { - this.text = text; - updateSize(); - } - - /** - * Sets the string value. - * - * @param text - * The string value. - */ - public void setText(String text) { - setText((CharSequence) text); - } - - @Override - public String toString() { - return getText(); - } - - /** - * Updates the expected size according to the current string value. - */ - protected void updateSize() { - if (getText() != null) { - setSize(getText().length()); - } else { - setSize(UNKNOWN_SIZE); - } - } - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/Variant.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/Variant.java deleted file mode 100644 index b1638e85f9..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/Variant.java +++ /dev/null @@ -1,519 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.representation; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.ClientInfo; -import org.restlet.client.data.Encoding; -import org.restlet.client.data.Language; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Preference; -import org.restlet.client.data.Reference; -import org.restlet.client.engine.util.SystemUtils; -import org.restlet.client.util.WrapperList; - -/** - * Descriptor for available representations of a resource. It contains all the - * important metadata about a representation but is not able to actually serve - * the representation's content itself.
- *
- * For this, you need to use on of the {@link Representation} subclasses. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class Variant { - - /** The character set or null if not applicable. */ - private volatile CharacterSet characterSet; - - /** The additional content codings applied to the entity-body. */ - private volatile List encodings; - - /** The location reference. */ - private volatile Reference locationRef; - - /** The natural language(s) of the intended audience for this variant. */ - private volatile List languages; - - /** The media type. */ - private volatile MediaType mediaType; - - /** - * Default constructor. - */ - public Variant() { - this(null); - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - */ - public Variant(MediaType mediaType) { - this(mediaType, null); - } - - /** - * Constructor. - * - * @param mediaType - * The media type. - * @param language - * The language. - */ - public Variant(MediaType mediaType, Language language) { - this.characterSet = null; - this.encodings = null; - - if (language != null) { - getLanguages().add(language); - } else { - this.languages = null; - } - - this.mediaType = mediaType; - this.locationRef = null; - } - - /** - * Creates a {@link ClientInfo} instance with preferences matching exactly - * the current variant. - * - * @return The new {@link ClientInfo} instance. - */ - public ClientInfo createClientInfo() { - ClientInfo result = new ClientInfo(); - - if (getCharacterSet() != null) { - result.getAcceptedCharacterSets().add( - new Preference(getCharacterSet())); - } - - if (getEncodings() != null) { - for (Encoding encoding : getEncodings()) { - result.getAcceptedEncodings().add( - new Preference(encoding)); - } - } - - if (getLanguages() != null) { - for (Language language : getLanguages()) { - result.getAcceptedLanguages().add( - new Preference(language)); - } - } - - if (getMediaType() != null) { - result.getAcceptedMediaTypes().add( - new Preference(getMediaType())); - } - - return result; - } - - /** - * Indicates if the current variant is equal to the given variant. - * - * @param other - * The other variant. - * @return True if the current variant includes the other. - */ - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - if (!(other instanceof Variant)) { - return false; - } - - Variant that = (Variant) other; - - return Objects.equals(getCharacterSet(), that.getCharacterSet()) - && Objects.equals(getMediaType(), that.getMediaType()) - && getLanguages().equals(that.getLanguages()) - && getEncodings().equals(that.getEncodings()) - && Objects.equals(getLocationRef(), that.getLocationRef()); - } - - /** - * Returns the character set or null if not applicable. Note that when used - * with HTTP connectors, this property maps to the "Content-Type" header. - * - * @return The character set or null if not applicable. - */ - public CharacterSet getCharacterSet() { - return this.characterSet; - } - - /** - * Returns the modifiable list of encodings applied to the entity-body. - * Creates a new instance if no one has been set. An - * "IllegalArgumentException" exception is thrown when adding a null - * encoding to this list.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Encoding" header. - * - * @return The list of encodings applied to the entity-body. - */ - public List getEncodings() { - if (this.encodings == null) { - this.encodings = new WrapperList() { - - @Override - public boolean add(Encoding element) { - if (element == null) { - throw new IllegalArgumentException( - "Cannot add a null encoding."); - } - - return super.add(element); - } - - @Override - public void add(int index, Encoding element) { - if (element == null) { - throw new IllegalArgumentException( - "Cannot add a null encoding."); - } - - super.add(index, element); - } - - @Override - public boolean addAll(Collection elements) { - boolean addNull = (elements == null); - if (!addNull) { - for (final Iterator iterator = elements - .iterator(); !addNull && iterator.hasNext();) { - addNull = (iterator.next() == null); - } - } - if (addNull) { - throw new IllegalArgumentException( - "Cannot add a null encoding."); - } - - return super.addAll(elements); - } - - @Override - public boolean addAll(int index, - Collection elements) { - boolean addNull = (elements == null); - if (!addNull) { - for (final Iterator iterator = elements - .iterator(); !addNull && iterator.hasNext();) { - addNull = (iterator.next() == null); - } - } - if (addNull) { - throw new IllegalArgumentException( - "Cannot add a null encoding."); - } - - return super.addAll(index, elements); - } - }; - } - - return this.encodings; - } - - /** - * Returns the modifiable list of languages. Creates a new instance if no - * one has been set. An "IllegalArgumentException" exception is thrown when - * adding a null language to this list.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Language" header. - * - * @return The list of languages. - */ - public List getLanguages() { - if (this.languages == null) { - this.languages = new WrapperList() { - - @Override - public void add(int index, Language element) { - if (element == null) { - throw new IllegalArgumentException( - "Cannot add a null language."); - } - - super.add(index, element); - } - - @Override - public boolean add(Language element) { - if (element == null) { - throw new IllegalArgumentException( - "Cannot add a null language."); - } - - return super.add(element); - } - - @Override - public boolean addAll(Collection elements) { - boolean addNull = (elements == null); - if (!addNull) { - for (final Iterator iterator = elements - .iterator(); !addNull && iterator.hasNext();) { - addNull = (iterator.next() == null); - } - } - if (addNull) { - throw new IllegalArgumentException( - "Cannot add a null language."); - } - - return super.addAll(elements); - } - - @Override - public boolean addAll(int index, - Collection elements) { - boolean addNull = (elements == null); - if (!addNull) { - for (final Iterator iterator = elements - .iterator(); !addNull && iterator.hasNext();) { - addNull = (iterator.next() == null); - } - } - if (addNull) { - throw new IllegalArgumentException( - "Cannot add a null language."); - } - - return super.addAll(index, elements); - } - - }; - } - return this.languages; - } - - /** - * Returns an optional location reference. This is useful when the - * representation is accessible from a location separate from the - * representation's resource URI, for example when content negotiation - * occurs.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Location" header. - * - * @return The identifier. - */ - public Reference getLocationRef() { - return this.locationRef; - } - - /** - * Returns the media type.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Type" header. - * - * @return The media type. - */ - public MediaType getMediaType() { - return this.mediaType; - } - - @Override - public int hashCode() { - return SystemUtils.hashCode(super.hashCode(), characterSet, encodings, locationRef, languages, mediaType); - } - - /** - * Indicates if the current variant includes the given variant. - * - * @param other - * The other variant. - * @return True if the current variant includes the other. - */ - public boolean includes(Variant other) { - boolean result = other != null; - - // Compare the character set - if (result) { - result = (getCharacterSet() == null) - || getCharacterSet().includes(other.getCharacterSet()); - } - - // Compare the media type - if (result) { - result = (getMediaType() == null) - || getMediaType().includes(other.getMediaType()); - } - - // Compare the languages - if (result) { - result = (getLanguages().isEmpty()) - || getLanguages().contains(Language.ALL) - || getLanguages().containsAll(other.getLanguages()); - } - - // Compare the encodings - if (result) { - result = (getEncodings().isEmpty()) - || getEncodings().contains(Encoding.ALL) - || getEncodings().containsAll(other.getEncodings()); - } - - return result; - } - - /** - * Indicates if the current variant is compatible with the given variant. - * - * @param other - * The other variant. - * @return True if the current variant is compatible with the other. - */ - public boolean isCompatible(Variant other) { - return (other != null) && (includes(other) || other.includes(this)); - } - - /** - * Sets the character set or null if not applicable.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Type" header. - * - * @param characterSet - * The character set or null if not applicable. - */ - public void setCharacterSet(CharacterSet characterSet) { - this.characterSet = characterSet; - } - - /** - * Sets the list of encodings applied to the entity-body.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Encoding" header. - * - * @param encodings - * The list of encodings applied to the entity-body. - */ - public void setEncodings(List encodings) { - this.encodings = encodings; - } - - /** - * Sets the list of languages.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Language" header. - * - * @param languages - * The list of languages. - */ - public void setLanguages(List languages) { - this.languages = languages; - } - - /** - * Sets the optional identifier. This is useful when the representation is - * accessible from a location separate from the representation's resource - * URI, for example when content negotiation occurs.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Location" header. - * - * @param location - * The location reference. - */ - public void setLocationRef(Reference location) { - this.locationRef = location; - } - - /** - * Sets the identifier from a URI string.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Location" header. - * - * @param locationUri - * The location URI to parse. - */ - public void setLocationRef(String locationUri) { - setLocationRef(new Reference(locationUri)); - } - - /** - * Sets the media type.
- *
- * Note that when used with HTTP connectors, this property maps to the - * "Content-Type" header. - * - * @param mediaType - * The media type. - */ - public void setMediaType(MediaType mediaType) { - this.mediaType = mediaType; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("["); - boolean first = true; - - if (getMediaType() != null) { - first = false; - sb.append(getMediaType()); - } - - if (getCharacterSet() != null) { - if (!first) { - sb.append(","); - } else { - first = false; - } - - sb.append(getCharacterSet()); - } - - if (!getLanguages().isEmpty()) { - if (!first) { - sb.append(","); - } else { - first = false; - } - - sb.append(getLanguages()); - } - - if (!getEncodings().isEmpty()) { - if (!first) { - sb.append(","); - } else { - first = false; - } - - sb.append(getEncodings()); - } - - sb.append("]"); - return sb.toString(); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/package.html deleted file mode 100644 index 6dbe713f99..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/representation/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - Common representation data elements. -

- @since Restlet 2.0 - @see User Guide - Representation package - @deprecated Will be removed in the next 2.7/3.0 release. - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ClientProxy.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ClientProxy.java deleted file mode 100644 index 8407cd986f..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ClientProxy.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import com.google.gwt.core.client.GWT; - -/** - * Marker interface for RESTful resource proxies. This allows you to retrieve - * and manipulate the underlying {@link ClientResource} of a dynamic client - * proxy generated by the {@link GWT#create(Class)} method. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public interface ClientProxy { - - /** - * Returns the wrapped client resource. - * - * @return The wrapped client resource. - */ - ClientResource getClientResource(); - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ClientResource.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ClientResource.java deleted file mode 100644 index ba5eb32c6b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ClientResource.java +++ /dev/null @@ -1,1536 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; - -import org.restlet.client.Client; -import org.restlet.client.Context; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.Restlet; -import org.restlet.client.Uniform; -import org.restlet.client.data.ChallengeResponse; -import org.restlet.client.data.ChallengeScheme; -import org.restlet.client.data.ClientInfo; -import org.restlet.client.data.Conditions; -import org.restlet.client.data.Cookie; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Metadata; -import org.restlet.client.data.Method; -import org.restlet.client.data.Parameter; -import org.restlet.client.data.Protocol; -import org.restlet.client.data.Range; -import org.restlet.client.data.Reference; -import org.restlet.client.data.Status; -import org.restlet.client.representation.Representation; -import org.restlet.client.representation.StringRepresentation; -import org.restlet.client.util.Series; - -/** - * Client-side resource. Acts like a proxy of a target resource.
- * This class changes the semantics of the {@link Resource#getRequest()} and - * {@link Resource#getResponse()} methods. Since a clientResource may receive - * severals responses for a single request (in case of interim response), the - * {@link #getResponse()} method returns the last received response object. The - * Request object returned by the {@link #getRequest()} is actually a prototype - * which is cloned (except the representation) just before the {@link #handle()} - * method is called.
- * Users must be aware that by most representations can only be read or written - * once. Some others, such as {@link StringRepresentation} stored the entity in - * memory which can be read several times but has the drawback to consume - * memory.
- * Concurrency note: instances of the class are not designed to be shared among - * several threads. If thread-safety is necessary, consider using the - * lower-level {@link Client} class instead. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class ClientResource extends Resource { - - - - - - /** - * Indicates if maximum number of redirections that can be automatically - * followed for a single call. - */ - private volatile int maxRedirects; - - /** The next Restlet. */ - private volatile Uniform next; - - /** Indicates if the next Restlet has been created. */ - private volatile boolean nextCreated; - - - - /** Number of retry attempts before reporting an error. */ - private volatile int retryAttempts; - - /** Delay in milliseconds between two retry attempts. */ - private volatile long retryDelay; - - /** Indicates if idempotent requests should be retried on error. */ - private volatile boolean retryOnError; - - /** - * Empty constructor. - */ - protected ClientResource() { - } - - /** - * Constructor. - * - * @param resource - * The client resource to copy. - */ - public ClientResource(ClientResource resource) { - Request request = new Request(resource.getRequest()); - Response response = new Response(request); - this.next = resource.getNext(); - this.maxRedirects = resource.getMaxRedirects(); - this.retryOnError = resource.isRetryOnError(); - this.retryDelay = resource.getRetryDelay(); - this.retryAttempts = resource.getRetryAttempts(); - - init(resource.getContext(), request, response); - } - - - - /** - * Constructor. - * - * @param context - * The context. - * @param method - * The method to call. - * @param reference - * The target reference. - */ - public ClientResource(Context context, Method method, Reference reference) { - this(context, new Request(method, reference), new Response(null)); - } - - /** - * Constructor. - * - * @param context - * The context. - * @param method - * The method to call. - * @param uri - * The target URI. - */ - public ClientResource(Context context, Method method, String uri) { - this(context, method, new Reference(uri)); - } - - /** - * Constructor. - * - * @param context - * The context. - * @param reference - * The target reference. - */ - public ClientResource(Context context, Reference reference) { - this(context, Method.GET, reference); - } - - /** - * Constructor. - * - * @param context - * The current context. - * @param request - * The handled request. - */ - public ClientResource(Context context, Request request) { - this(context, request, null); - } - - /** - * Constructor. - * - * @param context - * The current context. - * @param request - * The handled request. - * @param response - * The handled response. - */ - public ClientResource(Context context, Request request, Response response) { - if (context == null) { - context = Context.getCurrent(); - } - - // Don't remove this line. - // See other constructor ClientResource(Context, Method, Reference) - response.setRequest(request); - - this.maxRedirects = 10; - this.retryOnError = true; - this.retryDelay = 2000L; - this.retryAttempts = 2; - init(context, request, response); - } - - /** - * Constructor. - * - * @param context - * The context. - * @param uri - * The target URI. - */ - public ClientResource(Context context, String uri) { - this(context, Method.GET, uri); - } - - - - /** - * Constructor. - * - * @param method - * The method to call. - * @param reference - * The target reference. - */ - public ClientResource(Method method, Reference reference) { - this(Context.getCurrent(), method, reference); - } - - /** - * Constructor. - * - * @param method - * The method to call. - * @param uri - * The target URI. - */ - public ClientResource(Method method, String uri) { - this(Context.getCurrent(), method, uri); - } - - /** - * Constructor. - * - * @param reference - * The target reference. - */ - public ClientResource(Reference reference) { - this(Context.getCurrent(), null, reference); - } - - /** - * Constructor. - * - * @param request - * The handled request. - */ - public ClientResource(Request request) { - this(request, new Response(request)); - } - - /** - * Constructor. - * - * @param request - * The handled request. - * @param response - * The handled response. - */ - public ClientResource(Request request, Response response) { - this(Context.getCurrent(), request, response); - } - - /** - * Constructor. - * - * @param uri - * The target URI. - */ - public ClientResource(String uri) { - this(Context.getCurrent(), Method.GET, uri); - } - - /** - * Updates the client preferences to accept the given metadata (media types, - * character sets, etc.) with a 1.0 quality in addition to existing ones. - * - * @param metadata - * The metadata to accept. - * @see ClientInfo#accept(Metadata...) - */ - public void accept(Metadata... metadata) { - getClientInfo().accept(metadata); - } - - /** - * Updates the client preferences to accept the given metadata (media types, - * character sets, etc.) with a given quality in addition to existing ones. - * - * @param metadata - * The metadata to accept. - * @param quality - * The quality to set. - * @see ClientInfo#accept(Metadata, float) - */ - public void accept(Metadata metadata, float quality) { - getClientInfo().accept(metadata, quality); - } - - /** - * Adds a parameter to the query component. The name and value are - * automatically encoded if necessary. - * - * @param parameter - * The parameter to add. - * @return The updated reference. - * @see Reference#addQueryParameter(Parameter) - */ - public Reference addQueryParameter(Parameter parameter) { - return getReference().addQueryParameter(parameter); - } - - /** - * Adds a parameter to the query component. The name and value are - * automatically encoded if necessary. - * - * @param name - * The parameter name. - * @param value - * The optional parameter value. - * @return The updated reference. - * @see Reference#addQueryParameter(String, String) - */ - public Reference addQueryParameter(String name, String value) { - return getReference().addQueryParameter(name, value); - } - - /** - * Adds several parameters to the query component. The name and value are - * automatically encoded if necessary. - * - * @param parameters - * The parameters to add. - * @return The updated reference. - * @see Reference#addQueryParameters(Iterable) - */ - public Reference addQueryParameters(Iterable parameters) { - return getReference().addQueryParameters(parameters); - } - - /** - * Adds a segment at the end of the path. If the current path doesn't end - * with a slash character, one is inserted before the new segment value. The - * value is automatically encoded if necessary. - * - * @param value - * The segment value to add. - * @return The updated reference. - * @see Reference#addSegment(String) - */ - public Reference addSegment(String value) { - return getReference().addSegment(value); - } - - /** - * Creates a next Restlet is no one is set. By default, it creates a new - * {@link Client} based on the protocol of the resource's URI reference. - * - * @return The created next Restlet or null. - */ - protected Uniform createNext() { - Uniform result = null; - - - if ((result == null) && (getContext() != null)) { - // Try using directly the client dispatcher - result = getContext().getClientDispatcher(); - } - - if (result == null) { - // As a final option, try creating a client connector - if (getReference().isRelative()) { - getReference().setBaseRef( - com.google.gwt.core.client.GWT.getHostPageBaseURL()); - setReference(getReference().getTargetRef()); - } - - Protocol rProtocol = getProtocol(); - Reference rReference = getReference(); - Protocol protocol = (rProtocol != null) ? rProtocol - : (rReference != null) ? rReference.getSchemeProtocol() - : null; - - if (protocol != null) { - result = new Client(protocol); - } - } - - return result; - } - - /** - * Creates a new request by cloning the one wrapped by this class. - * - * @return The new response. - * @see #getRequest() - */ - public Request createRequest() { - return new Request(getRequest()); - } - - /** - * Creates a new response for the given request. - * - * @param request - * The associated request. - * @return The new response. - */ - protected Response createResponse(Request request) { - return new Response(request); - } - - /** - * Deletes the target resource and all its representations. If a success - * status is not returned, then a resource exception is thrown. - * - * @return The optional response entity. - * @see HTTP - * DELETE method - */ - public Representation delete() throws ResourceException { - return handle(Method.DELETE); - } - - - /** - * Deletes the target resource and all its representations. If a success - * status is not returned, then a resource exception is thrown. - * - * @param mediaType - * The media type of the representation to retrieve. - * @return The representation matching the given media type. - * @throws ResourceException - * @see HTTP - * DELETE method - */ - public Representation delete(MediaType mediaType) throws ResourceException { - return handle(Method.DELETE, mediaType); - } - - /** - * By default, it throws a new resource exception. - * Call {@link #doError(org.restlet.client.data.Status, org.restlet.client.Request, org.restlet.client.Response)}. - * - * @param request - * The associated request. - * @param response - * The associated response. - */ - public void doError(Request request, Response response) { - doError(response.getStatus(), request, response); - } - - /** - * By default, it throws a new resource exception. - * Call {@link #doError(org.restlet.client.data.Status, org.restlet.client.Request, org.restlet.client.Response)}. - * - * @param errorStatus - * The error status received. - */ - @Override - public void doError(Status errorStatus) { - doError(errorStatus, getRequest(), getResponse()); - } - - /** - * By default, it throws a new resource exception. - * This can be overridden to provide a different behavior. - * - * @param errorStatus - * The error status received. - * @param request - * The associated request. - * @param response - * The associated response. - */ - public void doError(Status errorStatus, Request request, Response response) { - throw new ResourceException(errorStatus, request, response); - } - - /** - * Releases the resource by stopping any connector automatically created and - * associated to the "next" property (see {@link #getNext()} method. - */ - @Override - protected void doRelease() throws ResourceException { - if ((getNext() != null) && this.nextCreated) { - if (getNext() instanceof Restlet) { - try { - ((Restlet) getNext()).stop(); - } catch (Exception e) { - throw new ResourceException(e); - } - } - - setNext(null); - } - } - - /** - * Attempts to {@link #release()} the resource. - */ - @Override - protected void finalize() throws Throwable { - release(); - super.finalize(); - } - - /** - * Represents the resource using content negotiation to select the best - * variant based on the client preferences. Note that the client preferences - * will be automatically adjusted, but only for this request. If you want to - * change them once for all, you can use the {@link #getClientInfo()} - * method.
- *
- * If a success status is not returned, then a resource exception is thrown. - * - * @return The best representation. - * @throws ResourceException - * @see HTTP - * GET method - */ - public Representation get() throws ResourceException { - return handle(Method.GET); - } - - - /** - * Represents the resource using a given media type. Note that the client - * preferences will be automatically adjusted, but only for this request. If - * you want to change them once for all, you can use the - * {@link #getClientInfo()} method.
- *
- * If a success status is not returned, then a resource exception is thrown. - * - * @param mediaType - * The media type of the representation to retrieve. - * @return The representation matching the given media type. - * @throws ResourceException - * @see HTTP - * GET method - */ - public Representation get(MediaType mediaType) throws ResourceException { - return handle(Method.GET, mediaType); - } - - /** - * Returns the attribute value by looking up the given name in the response - * attributes maps. The toString() method is then invoked on the attribute - * value. - * - * @param name - * The attribute name. - * @return The response attribute value. - */ - public String getAttribute(String name) { - Object value = getResponseAttributes().get(name); - return (value == null) ? null : value.toString(); - } - - /** - * Returns the child resource defined by its URI relatively to the current - * resource. The child resource is defined in the sense of hierarchical - * URIs. If the resource URI is not hierarchical, then an exception is - * thrown. - * - * @param relativeRef - * The URI reference of the child resource relatively to the - * current resource seen as the parent resource. - * @return The child resource. - * @throws ResourceException - */ - public ClientResource getChild(Reference relativeRef) - throws ResourceException { - ClientResource result = null; - - if ((relativeRef != null) && relativeRef.isRelative()) { - result = new ClientResource(this); - result.setReference(new Reference(getReference().getTargetRef(), - relativeRef).getTargetRef()); - } else { - doError(Status.CLIENT_ERROR_BAD_REQUEST, "The child URI is not relative."); - } - - return result; - } - - - /** - * Returns the child resource defined by its URI relatively to the current - * resource. The child resource is defined in the sense of hierarchical - * URIs. If the resource URI is not hierarchical, then an exception is - * thrown. - * - * @param relativeUri - * The URI of the child resource relatively to the current - * resource seen as the parent resource. - * @return The child resource. - * @throws ResourceException - */ - public ClientResource getChild(String relativeUri) throws ResourceException { - return getChild(new Reference(relativeUri)); - } - - - /** - * Returns the maximum number of redirections that can be automatically - * followed for a single call. Default value is 10. - * - * @return The maximum number of redirections that can be automatically - * followed for a single call. - */ - public int getMaxRedirects() { - return maxRedirects; - } - - /** - * Returns the next Restlet. By default, it is the client dispatcher if a - * context is available. - * - * @return The next Restlet or null. - */ - public Uniform getNext() { - Uniform result = this.next; - - if (result == null) { - synchronized (this) { - if (result == null) { - result = createNext(); - - if (result != null) { - setNext(result); - this.nextCreated = true; - } - } - } - } - - return result; - } - - /** - * Returns the callback invoked on response reception. If the value is not - * null, then the associated request will be executed asynchronously. - * - * @return The callback invoked on response reception. - */ - public Uniform getOnResponse() { - return getRequest().getOnResponse(); - } - - /** - * Returns the callback invoked after sending the request. - * - * @return The callback invoked after sending the request. - */ - public Uniform getOnSent() { - return getRequest().getOnSent(); - } - - /** - * Returns the parent resource. The parent resource is defined in the sense - * of hierarchical URIs. If the resource URI is not hierarchical, then an - * exception is thrown. - * - * @return The parent resource. - */ - public ClientResource getParent() throws ResourceException { - ClientResource result = null; - - if (getReference().isHierarchical()) { - result = new ClientResource(this); - result.setReference(getReference().getParentRef()); - } else { - doError(Status.CLIENT_ERROR_BAD_REQUEST, "The resource URI is not hierarchical."); - } - - return result; - } - - - /** - * Returns the number of retry attempts before reporting an error. Default - * value is 2. - * - * @return The number of retry attempts before reporting an error. - */ - public int getRetryAttempts() { - return retryAttempts; - } - - /** - * Returns the delay in milliseconds between two retry attempts. Default - * value is 2 seconds. - * - * @return The delay in milliseconds between two retry attempts. - */ - public long getRetryDelay() { - return retryDelay; - } - - /** - * Handles the call by invoking the next handler. The prototype request is - * retrieved via {@link #getRequest()} and cloned and the response is set as - * the latest with {@link #setResponse(Response)}. If necessary the - * {@link #setNext(Uniform)} method is called as well with a {@link Client} - * instance matching the request protocol. - * - * @return The optional response entity. - * @see #getNext() - */ - @Override - public Representation handle() { - Response response = handleOutbound(createRequest()); - return (response == null) ? null : response.getEntity(); - } - - /** - * Handles the call by cloning the prototype request, setting the method and - * entity. - * - * @param method - * The request method to use. - * @return The optional response entity. - */ - protected Representation handle(Method method) { - return handle(method, (Representation) null); - } - - - /** - * Handles the call by cloning the prototype request, setting the method and - * entity. - * - * @param method - * The request method to use. - * @param mediaType - * The preferred result media type. - * @return The optional response entity. - */ - protected Representation handle(Method method, MediaType mediaType) { - return handle(method, null, mediaType); - } - - - /** - * Handles the call by cloning the prototype request, setting the method and - * entity. - * - * @param method - * The request method to use. - * @param entity - * The request entity to set. - * @return The optional response entity. - */ - protected Representation handle(Method method, Representation entity) { - return handle(method, entity, getClientInfo()); - } - - /** - * Handles the call by cloning the prototype request, setting the method and - * entity. - * - * @param method - * The request method to use. - * @param entity - * The request entity to set. - * @param clientInfo - * The client preferences. - * @return The optional response entity. - */ - protected Representation handle(Method method, Representation entity, - ClientInfo clientInfo) { - // Prepare the request by cloning the prototype request - Request request = createRequest(); - request.setMethod(method); - request.setEntity(entity); - request.setClientInfo(clientInfo); - - // Actually handle the call - Response response = handleOutbound(request); - return handleInbound(response); - } - - /** - * Handles the call by cloning the prototype request, setting the method and - * entity. - * - * @param method - * The request method to use. - * @param entity - * The request entity to set. - * @param mediaType - * The preferred result media type. - * @return The optional response entity. - */ - protected Representation handle(Method method, Representation entity, - MediaType mediaType) { - return handle(method, entity, new ClientInfo(mediaType)); - } - - /** - * Handle the call and follow redirection for safe methods. - * - * @param request - * The request to send. - * @param response - * The response to update. - * @param references - * The references that caused a redirection to prevent infinite - * loops. - * @param retryAttempt - * The number of remaining attempts. - * @param next - * The next handler handling the call. - */ - protected void handle(Request request, Response response, - List references, int retryAttempt, Uniform next) { - if (next != null) { - - // Actually handle the call - next.handle(request, response); - - if (isRetryOnError() - && response.getStatus().isRecoverableError() - && request.getMethod().isIdempotent() - && (retryAttempt < getRetryAttempts()) - && ((request.getEntity() == null) || request.getEntity() - .isAvailable())) { - retry(request, response, references, retryAttempt, next); - } - } else { - getLogger().log(Level.WARNING, - "Request ignored as no next Restlet is available"); - } - } - - /** - * Handles the inbound call. Note that only synchronous calls are processed. - * - * @param response - * @return The response's entity, if any. - */ - public Representation handleInbound(Response response) { - if (response == null) { - return null; - } - - // Verify that the request was synchronous - if (response.getRequest().isSynchronous()) { - if (response.getStatus().isError()) { - doError(response.getStatus()); - return null; - } - return response.getEntity(); - } - - return null; - } - - /** - * Handles the outbound call by invoking the next handler. - * - * @param request - * The request to handle. - * @return The response created. - * @see #getNext() - */ - public Response handleOutbound(Request request) { - Response response = createResponse(request); - Uniform next = getNext(); - - if (next != null) { - // Effectively handle the call - handle(request, response, null, 0, next); - - // Update the last received response. - setResponse(response); - } else { - getLogger() - .warning( - "Unable to process the call for a client resource. No next Restlet has been provided."); - } - - return response; - } - - /** - * Indicates if there is a next Restlet. - * - * @return True if there is a next Restlet. - */ - public boolean hasNext() { - return getNext() != null; - } - - /** - * Represents the resource using content negotiation to select the best - * variant based on the client preferences. This method is identical to - * {@link #get()} but doesn't return the actual content of the - * representation, only its metadata.
- *
- * Note that the client preferences will be automatically adjusted, but only - * for this request. If you want to change them once for all, you can use - * the {@link #getClientInfo()} method.
- *
- * If a success status is not returned, then a resource exception is thrown. - * - * @return The best representation. - * @throws ResourceException - * @see HTTP - * HEAD method - */ - public Representation head() throws ResourceException { - return handle(Method.HEAD); - } - - /** - * Represents the resource using a given media type. This method is - * identical to {@link #get(MediaType)} but doesn't return the actual - * content of the representation, only its metadata.
- *
- * Note that the client preferences will be automatically adjusted, but only - * for this request. If you want to change them once for all, you can use - * the {@link #getClientInfo()} method.
- *
- * If a success status is not returned, then a resource exception is thrown. - * - * @param mediaType - * The media type of the representation to retrieve. - * @return The representation matching the given media type. - * @throws ResourceException - * @see HTTP - * HEAD method - */ - public Representation head(MediaType mediaType) throws ResourceException { - return handle(Method.HEAD, mediaType); - } - - - - - /** - * Indicates if idempotent requests should be retried on error. Default - * value is true. - * - * @return True if idempotent requests should be retried on error. - */ - public boolean isRetryOnError() { - return retryOnError; - } - - /** - * Describes the resource using content negotiation to select the best - * variant based on the client preferences. If a success status is not - * returned, then a resource exception is thrown. - * - * @return The best description. - * @throws ResourceException - * @see HTTP - * OPTIONS method - */ - public Representation options() throws ResourceException { - return handle(Method.OPTIONS); - } - - - /** - * Describes the resource using a given media type. If a success status is - * not returned, then a resource exception is thrown. - * - * @param mediaType - * The media type of the representation to retrieve. - * @return The matched description or null. - * @throws ResourceException - * @see HTTP - * OPTIONS method - */ - public Representation options(MediaType mediaType) throws ResourceException { - return handle(Method.OPTIONS, mediaType); - } - - /** - * Patches a resource with the given object as delta state. - * - * @param entity - * The object entity containing the patch. - * @return The optional result entity. - * @throws ResourceException - * @see HTTP PATCH method - */ - public Representation patch(Object entity) throws ResourceException { - try { - return patch(toRepresentation(entity)); - } catch (IOException e) { - throw new ResourceException(e); - } - } - - - /** - * Patches a resource with the given object as delta state. - * - * @param entity - * The object entity containing the patch. - * @param mediaType - * The media type of the representation to retrieve. - * @return The response object entity. - * @throws ResourceException - * @see HTTP PATCH method - */ - public Representation patch(Object entity, MediaType mediaType) - throws ResourceException { - try { - return handle(Method.PATCH, toRepresentation(entity), mediaType); - } catch (IOException e) { - throw new ResourceException(e); - } - } - - /** - * Patches a resource with the given representation as delta state. If a - * success status is not returned, then a resource exception is thrown. - * - * @param entity - * The request entity containing the patch. - * @return The optional result entity. - * @throws ResourceException - * @see HTTP PATCH method - */ - public Representation patch(Representation entity) throws ResourceException { - return handle(Method.PATCH, entity); - } - - /** - * Posts an object entity. - * - * @param entity - * The object entity to post. - * @return The optional result entity. - * @throws ResourceException - * @see HTTP - * POST method - */ - public Representation post(Object entity) throws ResourceException { - try { - return post(toRepresentation(entity)); - } catch (IOException e) { - throw new ResourceException(e); - } - } - - - /** - * Posts an object entity. - * - * @param entity - * The object entity to post. - * @param mediaType - * The media type of the representation to retrieve. - * @return The response object entity. - * @throws ResourceException - * @see HTTP - * POST method - */ - public Representation post(Object entity, MediaType mediaType) - throws ResourceException { - try { - return handle(Method.POST, toRepresentation(entity), mediaType); - } catch (IOException e) { - throw new ResourceException(e); - } - } - - /** - * Posts a representation. If a success status is not returned, then a - * resource exception is thrown. - * - * @param entity - * The posted entity. - * @return The optional result entity. - * @throws ResourceException - * @see HTTP - * POST method - */ - public Representation post(Representation entity) throws ResourceException { - return handle(Method.POST, entity); - } - - /** - * Puts an object entity. - * - * @param entity - * The object entity to put. - * @return The optional result entity. - * @throws ResourceException - * @see HTTP - * PUT method - */ - public Representation put(Object entity) throws ResourceException { - try { - return put(toRepresentation(entity)); - } catch (IOException e) { - throw new ResourceException(e); - } - } - - - /** - * Puts an object entity. - * - * @param entity - * The object entity to post. - * @param mediaType - * The media type of the representation to retrieve. - * @return The response object entity. - * @throws ResourceException - * @see HTTP - * PUT method - */ - public Representation put(Object entity, MediaType mediaType) - throws ResourceException { - try { - return handle(Method.PUT, toRepresentation(entity), mediaType); - } catch (IOException e) { - throw new ResourceException(e); - } - } - - /** - * Creates or updates a resource with the given representation as new state - * to be stored. If a success status is not returned, then a resource - * exception is thrown. - * - * @param entity - * The request entity to store. - * @return The optional result entity. - * @throws ResourceException - * @see HTTP - * PUT method - */ - public Representation put(Representation entity) throws ResourceException { - return handle(Method.PUT, entity); - } - - /** - * Effectively redirects a client call. By default, it checks for infinite - * loops and unavailable entities, the references list is updated and the - * {@link #handle(Request, Response, List, int, Uniform)} method invoked. - * - * @param request - * The request to send. - * @param response - * The response to update. - * @param references - * The references that caused a redirection to prevent infinite - * loops. - * @param retryAttempt - * The number of remaining attempts. - * @param next - * The next handler handling the call. - */ - protected void redirect(Request request, Response response, - List references, int retryAttempt, Uniform next) { - Reference newTargetRef = response.getLocationRef(); - - if ((references != null) && references.contains(newTargetRef)) { - getLogger().warning( - "Infinite redirection loop detected with URI: " - + newTargetRef); - } else if (request.getEntity() != null && !request.isEntityAvailable()) { - getLogger() - .warning( - "Unable to follow the redirection because the request entity isn't available anymore."); - } else { - if (references == null) { - references = new ArrayList(); - } - - if (references.size() >= getMaxRedirects()) { - getLogger() - .warning( - "Unable to follow the redirection because the request the maximum number of redirections for a single call has been reached."); - } else { - // Add to the list of redirection reference - // to prevent infinite loops - references.add(request.getResourceRef()); - request.setResourceRef(newTargetRef); - handle(request, response, references, 0, next); - } - } - } - - /** - * Effectively retries a failed client call. By default, it sleeps before - * the retry attempt and increments the number of retries. - * - * @param request - * The request to send. - * @param response - * The response to update. - * @param references - * The references that caused a redirection to prevent infinite - * loops. - * @param retryAttempt - * The number of remaining attempts. - * @param next - * The next handler handling the call. - */ - protected void retry(Request request, Response response, - List references, int retryAttempt, Uniform next) { - getLogger().log( - Level.INFO, - "A recoverable error was detected (" - + response.getStatus().getCode() - + "), attempting again in " + getRetryDelay() + " ms."); - - // Wait before attempting again - if (getRetryDelay() > 0) { - com.google.gwt.user.client.Timer timer = new - com.google.gwt.user.client.Timer() { - public void run() {} - }; - timer.schedule((int) getRetryDelay()); - } - - // Retry the call - handle(request, response, references, ++retryAttempt, next); - } - - /** - * Sets the request attribute value. - * - * @param name - * The attribute name. - * @param value - * The attribute to set. - */ - public void setAttribute(String name, Object value) { - getRequestAttributes().put(name, value); - } - - /** - * Sets the authentication response sent by a client to an origin server. - * - * @param challengeResponse - * The authentication response sent by a client to an origin - * server. - * @see Request#setChallengeResponse(ChallengeResponse) - */ - public void setChallengeResponse(ChallengeResponse challengeResponse) { - getRequest().setChallengeResponse(challengeResponse); - } - - /** - * Sets the authentication response sent by a client to an origin server - * given a scheme, identifier and secret. - * - * @param scheme - * The challenge scheme. - * @param identifier - * The user identifier, such as a login name or an access key. - * @param secret - * The user secret, such as a password or a secret key. - */ - public void setChallengeResponse(ChallengeScheme scheme, - final String identifier, String secret) { - setChallengeResponse(new ChallengeResponse(scheme, identifier, secret)); - } - - /** - * Sets the client-specific information. - * - * @param clientInfo - * The client-specific information. - * @see Request#setClientInfo(ClientInfo) - */ - public void setClientInfo(ClientInfo clientInfo) { - getRequest().setClientInfo(clientInfo); - } - - /** - * Sets the conditions applying to this request. - * - * @param conditions - * The conditions applying to this request. - * @see Request#setConditions(Conditions) - */ - public void setConditions(Conditions conditions) { - getRequest().setConditions(conditions); - } - - /** - * Sets the cookies provided by the client. - * - * @param cookies - * The cookies provided by the client. - * @see Request#setCookies(Series) - */ - public void setCookies(Series cookies) { - getRequest().setCookies(cookies); - } - - - - /** - * Sets the host reference. - * - * @param hostRef - * The host reference. - * @see Request#setHostRef(Reference) - */ - public void setHostRef(Reference hostRef) { - getRequest().setHostRef(hostRef); - } - - /** - * Sets the host reference using an URI string. - * - * @param hostUri - * The host URI. - * @see Request#setHostRef(String) - */ - public void setHostRef(String hostUri) { - getRequest().setHostRef(hostUri); - } - - /** - * Indicates if the call is loggable - * - * @param loggable - * True if the call is loggable - */ - public void setLoggable(boolean loggable) { - getRequest().setLoggable(loggable); - } - - /** - * Sets the maximum number of redirections that can be automatically - * followed for a single call. - * - * @param maxRedirects - * The maximum number of redirections that can be automatically - * followed for a single call. - */ - public void setMaxRedirects(int maxRedirects) { - this.maxRedirects = maxRedirects; - } - - /** - * Sets the method called. - * - * @param method - * The method called. - * @see Request#setMethod(Method) - */ - public void setMethod(Method method) { - getRequest().setMethod(method); - } - - /** - * Sets the next handler such as a Restlet or a Filter. - * - * In addition, this method will set the context of the next Restlet if it - * is null by passing a reference to its own context. - * - * @param next - * The next handler. - */ - public void setNext(org.restlet.client.Uniform next) { - if (next instanceof Restlet) { - Restlet nextRestlet = (Restlet) next; - - if (nextRestlet.getContext() == null) { - nextRestlet.setContext(getContext()); - } - } - - this.next = next; - - // If true, it must be updated after calling this method - this.nextCreated = false; - } - - /** - * Sets the callback invoked on response reception. If the value is not - * null, then the associated request will be executed asynchronously. - * - * @param onResponseCallback - * The callback invoked on response reception. - */ - public void setOnResponse(Uniform onResponseCallback) { - getRequest().setOnResponse(onResponseCallback); - } - - /** - * Sets the callback invoked after sending the request. - * - * @param onSentCallback - * The callback invoked after sending the request. - */ - public void setOnSent(Uniform onSentCallback) { - getRequest().setOnSent(onSentCallback); - } - - /** - * Sets the original reference requested by the client. - * - * @param originalRef - * The original reference. - * @see Request#setOriginalRef(Reference) - */ - public void setOriginalRef(Reference originalRef) { - getRequest().setOriginalRef(originalRef); - } - - /** - * Sets the protocol used or to be used. - * - * @param protocol - * The protocol used or to be used. - */ - public void setProtocol(Protocol protocol) { - getRequest().setProtocol(protocol); - } - - - - /** - * Sets the ranges to return from the target resource's representation. - * - * @param ranges - * The ranges. - * @see Request#setRanges(List) - */ - public void setRanges(List ranges) { - getRequest().setRanges(ranges); - } - - /** - * Sets the resource's reference. If the reference is relative, it will be - * resolved as an absolute reference. Also, the context's base reference - * will be reset. Finally, the reference will be normalized to ensure a - * consistent handling of the call. - * - * @param reference - * The resource reference. - * @see Request#setResourceRef(Reference) - */ - public void setReference(Reference reference) { - getRequest().setResourceRef(reference); - } - - /** - * Sets the resource's reference using an URI string. Note that the URI can - * be either absolute or relative to the context's base reference. - * - * @param uri - * The resource URI. - * @see Request#setResourceRef(String) - */ - public void setReference(String uri) { - getRequest().setResourceRef(uri); - } - - /** - * Sets the referrer reference if available. - * - * @param referrerRef - * The referrer reference. - * @see Request#setReferrerRef(Reference) - */ - public void setReferrerRef(Reference referrerRef) { - getRequest().setReferrerRef(referrerRef); - } - - /** - * Sets the referrer reference if available using an URI string. - * - * @param referrerUri - * The referrer URI. - * @see Request#setReferrerRef(String) - */ - public void setReferrerRef(String referrerUri) { - getRequest().setReferrerRef(referrerUri); - } - - - - /** - * Sets the number of retry attempts before reporting an error. - * - * @param retryAttempts - * The number of retry attempts before reporting an error. - */ - public void setRetryAttempts(int retryAttempts) { - this.retryAttempts = retryAttempts; - } - - /** - * Sets the delay in milliseconds between two retry attempts. The default - * value is two seconds. - * - * @param retryDelay - * The delay in milliseconds between two retry attempts. - */ - public void setRetryDelay(long retryDelay) { - this.retryDelay = retryDelay; - } - - /** - * Indicates if idempotent requests should be retried on error. - * - * @param retryOnError - * True if idempotent requests should be retried on error. - */ - public void setRetryOnError(boolean retryOnError) { - this.retryOnError = retryOnError; - } - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Delete.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Delete.java deleted file mode 100644 index b1a6dd0375..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Delete.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.restlet.client.engine.connector.Method; -import org.restlet.client.service.MetadataService; - -/** - * Annotation for methods that remove representations. Its semantics is - * equivalent to an HTTP DELETE method.
- *
- * Example: - * - *

- * @Delete()
- * public void removeAll();
- * 
- * @Delete("xml|json")
- * public Representation removeAll();
- * 
- * @Delete("json?param=val")
- * public Representation removeAllWithParam();
- * 
- * @Delete("json?param")
- * public Representation removeAllWithParam();
- * 
- * @Delete("?param")
- * public Representation removeAllWithParam();
- * 
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Method("DELETE") -public @interface Delete { - - /** - * Specifies the media type extension of the response entity. If several - * media types are supported, their extension can be specified separated by - * "|" characters. Note that this isn't the full MIME type value, just the - * extension name declared in {@link MetadataService}. For a list of all - * predefined extensions, please check - * {@link MetadataService#addCommonExtensions()}. New extension can be - * registered using - * {@link MetadataService#addExtension(String, org.restlet.client.data.Metadata)} - * method. - * - * @return The result media types. - */ - String value() default ""; - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ExceptionHandler.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ExceptionHandler.java deleted file mode 100644 index 1af865e252..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ExceptionHandler.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -/** - * - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public interface ExceptionHandler { - void handle(E throwable); -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Get.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Get.java deleted file mode 100644 index 1c46e58df6..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Get.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.restlet.client.engine.connector.Method; -import org.restlet.client.service.MetadataService; - -/** - * Annotation for methods that retrieve a resource representation. Its semantics - * is equivalent to an HTTP GET method.
- *
- * Example: - * - *
- * @Get
- * public MyBean represent();
- * 
- * @Get("json")
- * public String toJson();
- * 
- * @Get("xml|html")
- * public Representation represent();
- * 
- * @Get("json?param=val")
- * public Representation representWithParam();
- * 
- * @Get("json?param")
- * public Representation representWithParam();
- * 
- * @Get("?param")
- * public Representation representWithParam();
- * 
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Method("GET") -public @interface Get { - - /** - * Specifies the media type extension of the response entity. If several - * media types are supported, their extension can be specified separated by - * "|" characters. Note that this isn't the full MIME type value, just the - * extension name declared in {@link MetadataService}. For a list of all - * predefined extensions, please check - * {@link MetadataService#addCommonExtensions()}. New extension can be - * registered using - * {@link MetadataService#addExtension(String, org.restlet.client.data.Metadata)} - * method. - * - * @return The result media types. - */ - String value() default ""; - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Options.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Options.java deleted file mode 100644 index 02ed7a5b3b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Options.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.restlet.client.engine.connector.Method; -import org.restlet.client.service.MetadataService; - -/** - * Annotation for methods that describe a resource. Its semantics is equivalent - * to an HTTP OPTIONS method.
- *
- * Example: - * - *
- * @Options
- * public ApplicationInfo describe();
- * 
- * @Options("wadl|html")
- * public Representation describe();
- * 
- * @Options("wadl?param=val")
- * public Representation describeWithParam();
- * 
- * @Options("wadl?param")
- * public Representation describeWithParam();
- * 
- * @Options("?param")
- * public Representation describeWithParam();
- * 
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Method("OPTIONS") -public @interface Options { - - /** - * Specifies the media type extension of the response entity. If several - * media types are supported, their extension can be specified separated by - * "|" characters. Note that this isn't the full MIME type value, just the - * extension name declared in {@link MetadataService}. For a list of all - * predefined extensions, please check - * {@link MetadataService#addCommonExtensions()}. New extension can be - * registered using - * {@link MetadataService#addExtension(String, org.restlet.client.data.Metadata)} - * method. - * - * @return The result media types. - */ - String value() default ""; - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Patch.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Patch.java deleted file mode 100644 index 788a4f17d6..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Patch.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.restlet.client.engine.connector.Method; -import org.restlet.client.service.MetadataService; - -/** - * Annotation for methods that apply submitted representations as a patch. Its - * semantics is equivalent to an HTTP PATCH method. Note that your method must - * have one input parameter if you want it to be selected for requests - * containing an entity.
- *
- * Example: - * - *
- * @Patch
- * public Representation update(Representation input);
- * 
- * @Patch("json-patch")
- * public String updateJson(String value);
- * 
- * @Patch("json-patch|xml-patch:xml|json")
- * public Representation update(Representation value);
- * 
- * @Patch("json?param=val")
- * public Representation updateWithParam(String value);
- * 
- * @Patch("json?param")
- * public Representation updateWithParam(String value);
- * 
- * @Patch("?param")
- * public Representation updateWithParam(String value);
- * 
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Method("PATCH") -public @interface Patch { - - /** - * Specifies the media type of the request and response entities as - * extensions. If only one extension is provided, the extension applies to - * both request and response entities. If two extensions are provided, - * separated by a colon, then the first one is for the request entity and - * the second one for the response entity.
- *
- * If several media types are supported, their extension can be specified - * separated by "|" characters. Note that this isn't the full MIME type - * value, just the extension name declared in {@link MetadataService}. For a - * list of all predefined extensions, please check - * {@link MetadataService#addCommonExtensions()}. New extension can be - * registered using - * {@link MetadataService#addExtension(String, org.restlet.client.data.Metadata)} - * method. - * - * @return The media types of request and/or response entities. - */ - String value() default ""; - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Post.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Post.java deleted file mode 100644 index 4f636e5be4..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Post.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.restlet.client.engine.connector.Method; -import org.restlet.client.service.MetadataService; - -/** - * Annotation for methods that accept submitted representations. Its semantics - * is equivalent to an HTTP POST method. Note that your method must have one - * input parameter if you want it to be selected for requests containing an - * entity.
- *
- * Example: - * - *
- * @Post
- * public MyOutputBean accept(MyInputBean input);
- * 
- * @Post("json")
- * public String acceptJson(String value);
- * 
- * @Post("xml|json:xml|json")
- * public Representation accept(Representation xmlValue);
- * 
- * @Post("json?param=val")
- * public Representation acceptWithParam(String value);
- * 
- * @Post("json?param")
- * public Representation acceptWithParam(String value);
- * 
- * @Post("?param")
- * public Representation acceptWithParam(String value);
- * 
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Method("POST") -public @interface Post { - - /** - * Specifies the media type of the request and response entities as - * extensions. If only one extension is provided, the extension applies to - * both request and response entities. If two extensions are provided, - * separated by a colon, then the first one is for the request entity and - * the second one for the response entity.
- *
- * If several media types are supported, their extension can be specified - * separated by "|" characters. Note that this isn't the full MIME type - * value, just the extension name declared in {@link MetadataService}. For a - * list of all predefined extensions, please check - * {@link MetadataService#addCommonExtensions()}. New extension can be - * registered using - * {@link MetadataService#addExtension(String, org.restlet.client.data.Metadata)} - * method. - * - * @return The media types of request and/or response entities. - */ - String value() default ""; - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Put.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Put.java deleted file mode 100644 index 995b6dc4f2..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Put.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.restlet.client.engine.connector.Method; -import org.restlet.client.service.MetadataService; - -/** - * Annotation for methods that store submitted representations. Its semantics is - * equivalent to an HTTP PUT method. Note that your method must have one input - * parameter if you want it to be selected for requests containing an entity.
- *
- * Example: - * - *
- * @Put
- * public MyOutputBean store(MyInputBean input);
- * 
- * @Put("json")
- * public String storeJson(String value);
- * 
- * @Put("json|xml:xml|json")
- * public Representation store(Representation value);
- * 
- * @Put("json?param=val")
- * public Representation storeWithParam(String value);
- * 
- * @Put("json?param")
- * public Representation storeWithParam(String value);
- * 
- * @Put("?param")
- * public Representation storeWithParam(String value);
- * 
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -@Method("PUT") -public @interface Put { - - /** - * Specifies the media type of the request and response entities as - * extensions. If only one extension is provided, the extension applies to - * both request and response entities. If two extensions are provided, - * separated by a colon, then the first one is for the request entity and - * the second one for the response entity.
- *
- * If several media types are supported, their extension can be specified - * separated by "|" characters. Note that this isn't the full MIME type - * value, just the extension name declared in {@link MetadataService}. For a - * list of all predefined extensions, please check - * {@link MetadataService#addCommonExtensions()}. New extension can be - * registered using - * {@link MetadataService#addExtension(String, org.restlet.client.data.Metadata)} - * method. - * - * @return The media types of request and/or response entities. - */ - String value() default ""; - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Resource.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Resource.java deleted file mode 100644 index 060f8fd828..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Resource.java +++ /dev/null @@ -1,830 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.io.IOException; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.restlet.client.Context; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.Restlet; -import org.restlet.client.data.CacheDirective; -import org.restlet.client.data.ChallengeRequest; -import org.restlet.client.data.ChallengeResponse; -import org.restlet.client.data.ClientInfo; -import org.restlet.client.data.Conditions; -import org.restlet.client.data.Cookie; -import org.restlet.client.data.CookieSetting; -import org.restlet.client.data.Dimension; -import org.restlet.client.data.Form; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Method; -import org.restlet.client.data.Protocol; -import org.restlet.client.data.Range; -import org.restlet.client.data.Reference; -import org.restlet.client.data.ServerInfo; -import org.restlet.client.data.Status; -import org.restlet.client.representation.Representation; -import org.restlet.client.representation.Variant; -import org.restlet.client.service.MetadataService; -import org.restlet.client.util.Series; - -/** - * Base resource class exposing the uniform REST interface. Intended conceptual - * target of a hypertext reference. A uniform resource encapsulates a - * {@link Context}, a {@link Request} and a {@link Response}, corresponding to a - * specific target resource.
- *
- * It also defines a precise life cycle. First, the instance is created and the - * {@link #init(Context, Request, Response)} method is invoked. If you need to - * do some additional initialization, you should override the - * {@link #doInit()} method.
- *
- * Then, the abstract {@link #handle()} method can be invoked. For concrete - * behavior, see the {@link ClientResource} - * subclasses. Note that the state of the resource can be changed several times - * and the {@link #handle()} method called more than once, but always by the - * same thread.
- *
- * Finally, the final {@link #release()} method can be called to clean up the - * resource, with a chance for the developer to do some additional cleanup by - * overriding the {@link #doRelease()} method.
- *
- * Note also that throwable raised such as {@link Error} and {@link Exception} - * can be caught in a single point by overriding the {@link #doCatch(Throwable)} - * method.
- *
- * "The central feature that distinguishes the REST architectural style from - * other network-based styles is its emphasis on a uniform interface between - * components. By applying the software engineering principle of generality to - * the component interface, the overall system architecture is simplified and - * the visibility of interactions is improved. Implementations are decoupled - * from the services they provide, which encourages independent evolvability." - * Roy T. Fielding
- *
- * Concurrency note: contrary to the {@link org.restlet.client.Uniform} class and its - * main {@link Restlet} subclass where a single instance can handle several - * calls concurrently, one instance of {@link Resource} is created for each call - * handled and accessed by only one thread at a time. - * - * @see Source - * dissertation - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Resource { - - /** - * Converts the given {@link String} value into a {@link Boolean} or null. - * - * @param value - * The value to convert or null. - * @return The converted {@link Boolean} value or null. - */ - public static Boolean toBoolean(String value) { - return (value != null) ? Boolean.valueOf(value) : null; - } - - /** - * Converts the given {@link String} value into a {@link Byte} or null. - * - * @param value - * The value to convert or null. - * @return The converted {@link Byte} value or null. - */ - public static Byte toByte(String value) { - return (value != null) ? Byte.valueOf(value) : null; - } - - /** - * Converts the given {@link String} value into an {@link Double} or null. - * - * @param value - * The value to convert or null. - * @return The converted {@link Double} value or null. - */ - public static Double toDouble(String value) { - return (value != null) ? Double.valueOf(value) : null; - } - - /** - * Converts the given {@link String} value into a {@link Float} or null. - * - * @param value - * The value to convert or null. - * @return The converted {@link Float} value or null. - */ - public static Float toFloat(String value) { - return (value != null) ? Float.valueOf(value) : null; - } - - /** - * Converts the given {@link String} value into an {@link Integer} or null. - * - * @param value - * The value to convert or null. - * @return The converted {@link Integer} value or null. - */ - public static Integer toInteger(String value) { - return (value != null) ? Integer.valueOf(value) : null; - } - - /** - * Converts the given {@link String} value into an {@link Long} or null. - * - * @param value - * The value to convert or null. - * @return The converted {@link Long} value or null. - */ - public static Long toLong(String value) { - return (value != null) ? Long.valueOf(value) : null; - } - - /** - * Converts the given {@link String} value into a {@link Short} or null. - * - * @param value - * The value to convert or null. - * @return The converted {@link Short} value or null. - */ - public static Short toShort(String value) { - return (value != null) ? Short.valueOf(value) : null; - } - - - /** The parent context. */ - private volatile Context context; - - /** The handled request. */ - private volatile Request request; - - /** The handled response. */ - private volatile Response response; - - /** - * Invoked when a {@link Throwable} is caught during initialization, - * handling or releasing. - * - * @param throwable - * The caught error or exception. - */ - protected void doCatch(Throwable throwable) { - getLogger().log(Level.INFO, "Exception or error caught in resource", - throwable); - } - - /** - * Invoked when an error response status is received. - * - * @param errorStatus - * The error status received. - */ - protected void doError(Status errorStatus) { - } - - /** - * Invoked when an error response status is received. - * - * @param errorStatus - * The error status received. - * @param errorMessage - * The custom error message. - */ - protected final void doError(Status errorStatus, String errorMessage) { - doError(new Status(errorStatus, errorMessage)); - } - - /** - * Set-up method that can be overridden in order to initialize the state of - * the resource. By default, it does nothing. - * - * @see #init(Context, Request, Response) - */ - protected void doInit() throws ResourceException { - } - - /** - * Clean-up method that can be overridden in order to release the state of - * the resource. By default, it does nothing. - * - * @see #release() - */ - protected void doRelease() throws ResourceException { - } - - /** - * Returns the set of methods allowed for the current client by the - * resource. The result can vary based on the client's user agent, - * authentication and authorization data provided by the client. - * - * @return The set of allowed methods. - */ - public Set getAllowedMethods() { - return getResponse() == null ? null : getResponse().getAllowedMethods(); - } - - - /** - * Returns the attribute value by looking up the given name in the request - * or response attributes maps. This is typically used for variables that - * are declared in the URI template used to route the call to this resource. - * - * @param name - * The attribute name. - * @return The matching request or response attribute value. - */ - public abstract String getAttribute(String name); - - /** - * Returns the list of authentication requests sent by an origin server to a - * client. If none is available, an empty list is returned. - * - * @return The list of authentication requests. - * @see Response#getChallengeRequests() - */ - public List getChallengeRequests() { - return getResponse() == null ? null : getResponse() - .getChallengeRequests(); - } - - /** - * Returns the authentication response sent by a client to an origin server. - * - * @return The authentication response sent by a client to an origin server. - * @see Request#getChallengeResponse() - */ - public ChallengeResponse getChallengeResponse() { - return getRequest() == null ? null : getRequest() - .getChallengeResponse(); - } - - /** - * Returns the client-specific information. Creates a new instance if no one - * has been set. - * - * @return The client-specific information. - * @see Request#getClientInfo() - */ - public ClientInfo getClientInfo() { - return getRequest() == null ? null : getRequest().getClientInfo(); - } - - /** - * Returns the modifiable conditions applying to this request. Creates a new - * instance if no one has been set. - * - * @return The conditions applying to this call. - * @see Request#getConditions() - */ - public Conditions getConditions() { - return getRequest() == null ? null : getRequest().getConditions(); - } - - - /** - * Returns the current context. - * - * @return The current context. - */ - public Context getContext() { - return context; - } - - - /** - * Returns the modifiable series of cookies provided by the client. Creates - * a new instance if no one has been set. - * - * @return The cookies provided by the client. - * @see Request#getCookies() - */ - public Series getCookies() { - return getRequest() == null ? null : getRequest().getCookies(); - } - - /** - * Returns the modifiable series of cookie settings provided by the server. - * Creates a new instance if no one has been set. - * - * @return The cookie settings provided by the server. - * @see Response#getCookieSettings() - */ - public Series getCookieSettings() { - return getResponse() == null ? null : getResponse().getCookieSettings(); - } - - /** - * Returns the modifiable set of selecting dimensions on which the response - * entity may vary. If some server-side content negotiation is done, this - * set should be properly updated, other it can be left empty. Create a new - * instance if no one has been set. - * - * @return The set of dimensions on which the response entity may vary. - * @see Response#getDimensions() - */ - public Set getDimensions() { - return getResponse() == null ? null : getResponse().getDimensions(); - } - - /** - * Returns the host reference. This may be different from the resourceRef's - * host, for example, for URNs and other URIs that don't contain host - * information. - * - * @return The host reference. - * @see Request#getHostRef() - */ - public Reference getHostRef() { - return getRequest() == null ? null : getRequest().getHostRef(); - } - - /** - * Returns the reference that the client should follow for redirections or - * resource creations. - * - * @return The redirection reference. - * @see Response#getLocationRef() - */ - public Reference getLocationRef() { - return getResponse() == null ? null : getResponse().getLocationRef(); - } - - /** - * Returns the logger. - * - * @return The logger. - */ - public Logger getLogger() { - return getContext() != null ? getContext().getLogger() : Context - .getCurrentLogger(); - } - - /** - * Returns the resource reference's optional matrix. - * - * @return The resource reference's optional matrix. - * @see Reference#getMatrixAsForm() - */ - public Form getMatrix() { - return getReference() == null ? null : getReference().getMatrixAsForm(); - } - - /** - * Returns the first value of the matrix parameter given its name if - * existing, or null. - * - * @param name - * The matrix parameter name. - * @return The first value of the matrix parameter. - */ - public String getMatrixValue(String name) { - String result = null; - Form matrix = getMatrix(); - - if (matrix != null) { - result = matrix.getFirstValue(name); - } - - return result; - } - - /** - * Returns the maximum number of intermediaries. - * - * @return The maximum number of intermediaries. - */ - public int getMaxForwards() { - return getRequest() == null ? null : getRequest().getMaxForwards(); - } - - /** - * Returns the application's metadata service or create a new one. - * - * @return The metadata service. - */ - public MetadataService getMetadataService() { - MetadataService result = null; - - - if (result == null) { - result = new MetadataService(); - } - - return result; - } - - /** - * Returns the method. - * - * @return The method. - * @see Request#getMethod() - */ - public Method getMethod() { - return getRequest() == null ? null : getRequest().getMethod(); - } - - /** - * Returns the original reference as requested by the client. Note that this - * property is not used during request routing. - * - * @return The original reference. - * @see Request#getOriginalRef() - */ - public Reference getOriginalRef() { - return getRequest() == null ? null : getRequest().getOriginalRef(); - } - - /** - * Returns the protocol by first returning the resourceRef.schemeProtocol - * property if it is set, or the baseRef.schemeProtocol property otherwise. - * - * @return The protocol or null if not available. - * @see Request#getProtocol() - */ - public Protocol getProtocol() { - return getRequest() == null ? null : getRequest().getProtocol(); - } - - /** - * Returns the list of proxy authentication requests sent by an origin - * server to a client. If none is available, an empty list is returned. - * - * @return The list of proxy authentication requests. - * @see Response#getProxyChallengeRequests() - */ - public List getProxyChallengeRequests() { - return getResponse() == null ? null : getResponse() - .getProxyChallengeRequests(); - } - - - /** - * Returns the resource reference's optional query. Note that modifications - * to the returned {@link Form} object aren't reported to the underlying - * reference. - * - * @return The resource reference's optional query. - * @see Reference#getQueryAsForm() - */ - public Form getQuery() { - return getReference() == null ? null : getReference().getQueryAsForm(); - } - - /** - * Returns the first value of the query parameter given its name if - * existing, or null. - * - * @param name - * The query parameter name. - * @return The first value of the query parameter. - */ - public String getQueryValue(String name) { - String result = null; - Form query = getQuery(); - - if (query != null) { - result = query.getFirstValue(name); - } - - return result; - } - - /** - * Returns the ranges to return from the target resource's representation. - * - * @return The ranges to return. - * @see Request#getRanges() - */ - public List getRanges() { - return getRequest() == null ? null : getRequest().getRanges(); - } - - /** - * Returns the URI reference. - * - * @return The URI reference. - */ - public Reference getReference() { - return getRequest() == null ? null : getRequest().getResourceRef(); - } - - /** - * Returns the referrer reference if available. - * - * @return The referrer reference. - */ - public Reference getReferrerRef() { - return getRequest() == null ? null : getRequest().getReferrerRef(); - } - - /** - * Returns the handled request. - * - * @return The handled request. - */ - public Request getRequest() { - return request; - } - - /** - * Returns the request attributes. - * - * @return The request attributes. - * @see Request#getAttributes() - */ - public Map getRequestAttributes() { - return getRequest() == null ? null : getRequest().getAttributes(); - } - - /** - * Returns the request cache directives. Note that when used with HTTP - * connectors, this property maps to the "Cache-Control" header. - * - * @return The cache directives. - */ - public List getRequestCacheDirectives() { - return getRequest() == null ? null : getRequest().getCacheDirectives(); - } - - /** - * Returns the request entity representation. - * - * @return The request entity representation. - */ - public Representation getRequestEntity() { - return getRequest() == null ? null : getRequest().getEntity(); - } - - /** - * Returns the handled response. - * - * @return The handled response. - */ - public Response getResponse() { - return response; - } - - /** - * Returns the response attributes. - * - * @return The response attributes. - * @see Response#getAttributes() - */ - public Map getResponseAttributes() { - return getResponse() == null ? null : getResponse().getAttributes(); - } - - /** - * Returns the response cache directives. Note that when used with HTTP - * connectors, this property maps to the "Cache-Control" header. - * - * @return The cache directives. - */ - public List getResponseCacheDirectives() { - return getResponse() == null ? null : getResponse() - .getCacheDirectives(); - } - - /** - * Returns the response entity representation. - * - * @return The response entity representation. - */ - public Representation getResponseEntity() { - return getResponse() == null ? null : getResponse().getEntity(); - } - - /** - * Returns the application root reference. - * - * @return The application root reference. - * @see Request#getRootRef() - */ - public Reference getRootRef() { - return getRequest() == null ? null : getRequest().getRootRef(); - } - - /** - * Returns the server-specific information. Creates a new instance if no one - * has been set. - * - * @return The server-specific information. - * @see Response#getServerInfo() - */ - public ServerInfo getServerInfo() { - return getResponse() == null ? null : getResponse().getServerInfo(); - } - - /** - * Returns the status. - * - * @return The status. - * @see Response#getStatus() - */ - public Status getStatus() { - return getResponse() == null ? null : getResponse().getStatus(); - } - - - /** - * Handles the call composed of the current context, request and response. - * - * @return The optional response entity. - */ - public abstract Representation handle(); - - /** - * Initialization method setting the environment of the current resource - * instance. It the calls the {@link #doInit()} method that can be - * overridden. - * - * @param context - * The current context. - * @param request - * The handled request. - * @param response - * The handled response. - */ - public void init(Context context, Request request, Response response) { - this.context = context; - this.request = request; - this.response = response; - - try { - doInit(); - } catch (Throwable t) { - doCatch(t); - } - } - - /** - * Indicates if the message was or will be exchanged confidentially, for - * example, via an SSL-secured connection. - * - * @return True if the message is confidential. - * @see Request#isConfidential() - */ - public boolean isConfidential() { - return getRequest() == null ? null : getRequest().isConfidential(); - } - - /** - * Indicates if the call is loggable - * - * @return True if the call is loggable - */ - public boolean isLoggable() { - return getRequest() == null ? null : getRequest().isLoggable(); - } - - /** - * Releases the resource by calling {@link #doRelease()}. - */ - public final void release() { - try { - doRelease(); - } catch (Throwable t) { - doCatch(t); - } - } - - - /** - * Sets the request or response attribute value. - * - * @param name - * The attribute name. - * @param value - * The attribute to set. - */ - public abstract void setAttribute(String name, Object value); - - /** - * Sets the query value for the named parameter. If no query is defined, it - * creates one. If the same parameter exists, it replaces it altogether. - * - * @param name - * The query parameter name. - * @param value - * The query parameter value. - */ - public void setQueryValue(String name, String value) { - Form query = getQuery(); - - if (query == null) { - query = new Form(); - } - - query.set(name, value); - - try { - getReference().setQuery(query.encode()); - } catch (IOException e) { - getLogger().fine("Unable to set the query value"); - } - } - - /** - * Sets the handled request. - * - * @param request - * The handled request. - */ - public void setRequest(Request request) { - this.request = request; - } - - /** - * Sets the handled response. - * - * @param response - * The handled response. - */ - public void setResponse(Response response) { - this.response = response; - } - - - /** - * Converts an object into a representation based on the default converter - * service variant. - * - * @param source - * The object to convert. - * @return The wrapper representation. - * @throws IOException - */ - public Representation toRepresentation(Object source) throws IOException { - return toRepresentation(source, (Variant) null); - } - - /** - * Converts an object into a representation based on a given media type. - * - * @param source - * The object to convert. - * @param target - * The target representation media type. - * @return The wrapper representation. - * @throws IOException - */ - public Representation toRepresentation(Object source, MediaType target) - throws IOException { - return toRepresentation(source, new Variant(target)); - } - - /** - * Converts an object into a representation based on client preferences. - * - * @param source - * The object to convert. - * @param target - * The target representation variant. - * @return The wrapper representation. - * @throws IOException - */ - public Representation toRepresentation(Object source, Variant target) - throws IOException { - Representation result = null; - - if (source != null) { - if (source instanceof Representation) { - result = (Representation) source; - } else { - getLogger() - .log(Level.WARNING, - "The entity has been omitted since the conversion of an instance of " - + source.getClass().getName() - + " to an instance of " - + Representation.class.getName() - + " is not supported." - + " Either provide a regular representation" - + " or use an annotated interface" - + " or use the json or xml extensions."); - } - } - - return result; - } - - @Override - public String toString() { - return (getRequest() == null ? "" : getRequest().toString()) - + (getResponse() == null ? "" : " => " - + getResponse().toString()); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ResourceException.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ResourceException.java deleted file mode 100644 index 8536b0297c..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/ResourceException.java +++ /dev/null @@ -1,301 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.data.Status; - -/** - * Encapsulates a response status and the optional cause as a checked exception. - *

- * Note that this class must implement java.io.Serializable, because it extends - * RuntimeException. To avoid warnings, it provides a serialVersionUID and has - * its non-serializable fields marked transient. The default serialization thus - * obtained is minimal, and may not be what the user expects. - *

- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class ResourceException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - /** The status associated to this exception. */ - private final transient Status status; - - /** The request associated to this exception. Could be null. */ - private final transient Request request; - - /** The response associated to this exception. Could be null. */ - private final transient Response response; - - /** - * Constructor. - * - * @param code - * The specification code of the encapsulated status. - */ - public ResourceException(int code) { - this(new Status(code)); - } - - /** - * Constructor. - * - * @param code - * The specification code of the encapsulated status. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - */ - public ResourceException(int code, String reasonPhrase) { - this(new Status(code, reasonPhrase)); - } - - /** - * Constructor. - * - * @param code - * The specification code of the encapsulated status. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The description of the encapsulated status. - */ - public ResourceException(int code, String reasonPhrase, String description) { - this(new Status(code, reasonPhrase, description)); - } - - /** - * Constructor. - * - * @param code - * The specification code of the encapsulated status. - * @param name - * The name of the encapsulated status. - * @param description - * The description of the encapsulated status. - * @param uri - * The URI of the specification describing the method. - */ - public ResourceException(int code, String name, String description, String uri) { - this(new Status(code, name, description, uri)); - } - - /** - * Constructor. - * - * @param code - * The specification code of the encapsulated status. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The description of the encapsulated status. - * @param uri - * The URI of the specification describing the method. - * @param cause - * The wrapped cause error or exception. - */ - public ResourceException(int code, String reasonPhrase, String description, String uri, Throwable cause) { - this(new Status(code, cause, reasonPhrase, description, uri), cause); - } - - /** - * Constructor. - * - * @param code - * The specification code of the encapsulated status. - * @param cause - * The wrapped cause error or exception. - */ - public ResourceException(int code, Throwable cause) { - this(new Status(code, cause), cause); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param throwable - * The related error or exception. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - */ - public ResourceException(int code, Throwable throwable, String reasonPhrase) { - this(new Status(code, throwable, reasonPhrase, null, null)); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param throwable - * The related error or exception. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The longer description. - */ - public ResourceException(int code, Throwable throwable, String reasonPhrase, String description) { - this(new Status(code, throwable, reasonPhrase, description, null)); - } - - /** - * Constructor. - * - * @param code - * The specification code. - * @param throwable - * The related error or exception. - * @param reasonPhrase - * The short reason phrase displayed next to the status code in a - * HTTP response. - * @param description - * The longer description. - * @param uri - * The URI of the specification describing the method. - */ - public ResourceException(int code, Throwable throwable, String reasonPhrase, String description, String uri) { - this(new Status(code, throwable, reasonPhrase, description, uri)); - } - - /** - * Constructor. - * - * @param status - * The status to associate. - */ - public ResourceException(Status status) { - this(status, (status == null) ? null : status.getThrowable()); - } - - /** - * Constructor. - * - * @param status - * The status to associate. - * @deprecated use constructor with status, request and response instead. - */ - @Deprecated - public ResourceException(Status status, Resource resource) { - this(status, (status == null) ? null : status.getThrowable(), resource.getRequest(), resource.getResponse()); - } - - /** - * Constructor. - * - * @param status - * The status to associate. - */ - public ResourceException(Status status, Request request, Response response) { - this(status, (status == null) ? null : status.getThrowable(), request, response); - } - - /** - * Constructor. - * - * @param status - * The status to copy. - * @param description - * The description of the encapsulated status. - */ - public ResourceException(Status status, String description) { - this(new Status(status, description)); - } - - /** - * Constructor. - * - * @param status - * The status to copy. - * @param description - * The description of the encapsulated status. - * @param cause - * The wrapped cause error or exception. - */ - public ResourceException(Status status, String description, Throwable cause) { - this(new Status(status, cause, null, description), cause); - } - - /** - * Constructor. - * - * @param status - * The status to associate. - * @param cause - * The wrapped cause error or exception. - */ - public ResourceException(Status status, Throwable cause) { - this(status, cause, null, null); - } - - /** - * Constructor. - * - * @param status - * The status to associate. - * @param cause - * The wrapped cause error or exception. - */ - public ResourceException(Status status, Throwable cause, Request request, Response response) { - super((status == null) ? null : status.toString(), cause); - this.status = status; - this.request = request; - this.response = response; - } - - /** - * Constructor that set the status to - * {@link org.restlet.client.data.Status#SERVER_ERROR_INTERNAL} including the - * related error or exception. - * - * @param cause - * The wrapped cause error or exception. - */ - public ResourceException(Throwable cause) { - this(new Status(Status.SERVER_ERROR_INTERNAL, cause), cause); - } - - /** - * Returns the request associated to this exception. - * - * @return The request associated to this exception. - */ - public Request getRequest() { - return this.request; - } - - /** - * Returns the response associated to this exception. - * - * @return The response associated to this exception. - */ - public Response getResponse() { - return this.response; - } - - /** - * Returns the status associated to this exception. - * - * @return The status associated to this exception. - */ - public Status getStatus() { - return this.status; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Result.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Result.java deleted file mode 100644 index b94f29e37b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Result.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -/** - * Callback interface for asynchronous tasks. This is an equivalent to the - * {@link com.google.gwt.user.client.rpc.AsyncCallback} interface used by the - * GWT-RPC mechanism. - * - * @param - * The class of the result object returned in case of success. - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public interface Result { - - /** - * Method called back by the associated - * {@link org.restlet.client.engine.resource.GwtClientProxy} object when a failure - * is detected. - * - * @param caught - * The exception or error caught. - */ - void onFailure(Throwable caught); - - /** - * Method called back by the associated - * {@link org.restlet.client.engine.resource.GwtClientProxy} object in case of - * success. - * - * @param result - * The result object. - */ - void onSuccess(T result); - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Status.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Status.java deleted file mode 100644 index 0b7389ebd1..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/Status.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.resource; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Annotation for {@link Throwable} that map to HTTP error statuses. Its - * semantics is equivalent to an HTTP status line plus a related HTTP entity for - * errors.
- *
- * Example: - * - *
- * @Get
- * public MyBean represent() throws MyServerError, MyNotFoundError;
- * 
- * @Status(500)
- * public class MyServerError implements Throwable{
- *    ...
- * }
- * 
- * @Status(404, serialize = false)
- * public class MyNotFoundError extends RuntimeException{
- *    ...
- * }
- * 
- * @Status(value = 400)
- * public class MyBadParameterError extends RuntimeException{
- *    public String getParameterName() {
- *        ...
- *    };
- *    ...
- * }
- * 
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Status { - - /** - * Specifies the HTTP status code associated to the annotated - * {@link Throwable}. Default is 500. - * - * @return The result HTTP status code. - */ - int value() default 500; - - /** - * Indicates if the annotated {@link Throwable} should be serialized in the - * HTTP response entity. - * - * @return True if {@link Throwable} should be serialized in the HTTP - * response entity. - */ - boolean serialize() default true; - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/package.html deleted file mode 100644 index 6333383e55..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/resource/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - Client and server resource classes. -

- @since Restlet 1.0 - @see User Guide - Resource package - @deprecated Will be removed in the next 2.7/3.0 release. - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/MetadataService.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/MetadataService.java deleted file mode 100644 index 20b24264e5..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/MetadataService.java +++ /dev/null @@ -1,698 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.service; - -import java.util.ArrayList; -import java.util.List; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Encoding; -import org.restlet.client.data.Language; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Metadata; -import org.restlet.client.engine.application.MetadataExtension; - -/** - * Application service providing access to metadata and their associated - * extension names. The list of default mappings is documented in the - * {@link #addCommonExtensions()} method.
- *
- * Internally, the mappings are stored as a list of "extension, metadata" pairs. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class MetadataService extends Service { - /** The default character set for textual representations. */ - private volatile CharacterSet defaultCharacterSet; - - /** The default encoding for representations. */ - private volatile Encoding defaultEncoding; - - /** The default language for representations. */ - private volatile Language defaultLanguage; - - /** The default media type for representations. */ - private volatile MediaType defaultMediaType; - - /** The list of mappings between extension names and metadata. */ - private final List mappings; - - /** - * Constructor. Sets the default language to {@link Language#ENGLISH_US}, - * the default encoding to {@link Encoding#IDENTITY} (no encoding) and the - * default media type to {@link MediaType#APPLICATION_JSON}. It also - * calls the {@link #addCommonExtensions()} method. - */ - public MetadataService() { - this.defaultCharacterSet = CharacterSet.DEFAULT; - this.defaultEncoding = Encoding.IDENTITY; - this.defaultLanguage = Language.DEFAULT; - this.defaultMediaType = MediaType.APPLICATION_JSON; - this.mappings = new CopyOnWriteArrayList(); - addCommonExtensions(); - } - - /** - * Adds a common list of associations from extensions to metadata.
- * - * The list of languages' extensions:
- *

    - *
  • en: English
  • - *
  • es: Spanish
  • - *
  • fr: French
  • - *
- *
- * The list of character set extensions:
- *
    - *
  • ascii: US-ASCII
  • - *
- *
- * The list of media type extensions:
- *
    - *
  • ai: PostScript document
  • - *
  • atom: Atom syndication document
  • - *
  • au: AU audio file
  • - *
  • bin: Binary file
  • - *
  • bmp: Bitmap graphics
  • - *
  • class: Java bytecode
  • - *
  • css: CSS stylesheet
  • - *
  • csv: Comma-separated Values
  • - *
  • dat: Fixed-width Values
  • - *
  • dib: Device-Independent Bitmap Graphics
  • - *
  • doc: Microsoft Word document
  • - *
  • docx: Microsoft Office Word 2007 document
  • - *
  • docm: Office Word 2007 macro-enabled document
  • - *
  • dotx: Office Word 2007 template
  • - *
  • dotm: Office Word 2007 macro-enabled document template
  • - *
  • dtd: XML Document Type Definition
  • - *
  • eps: Encapsulated PostScript
  • - *
  • exe: Executable File (Microsoft Corporation)
  • - *
  • fmt: FreeMarker encoding
  • - *
  • form: Web forms (URL encoded)
  • - *
  • ftl: FreeMarker encoding
  • - *
  • gif: GIF image
  • - *
  • gwt: Java serialized object (using GWT-RPC encoder)
  • - *
  • hqx: BinHex 4 Compressed Archive (Macintosh)
  • - *
  • htm, html: HTML document
  • - *
  • ico: Windows icon (Favicon)
  • - *
  • jad: Java Application Descriptor file
  • - *
  • jar: Java Archive
  • - *
  • java: Java source code
  • - *
  • jnlp: Java Web start launch file
  • - *
  • jpe, jpeg, jpg: JPEG image
  • - *
  • js: JavaScript document
  • - *
  • jsf: Java Server Faces file
  • - *
  • json: JavaScript Object Notation document
  • - *
  • jsonsmile: JavaScript Object Notation smile document
  • - *
  • kar: Karaoke MIDI file
  • - *
  • latex: LaTeX document
  • - *
  • man: Manual file
  • - *
  • mathml: Mathml XML document
  • - *
  • mid, midi: MIDI Audio
  • - *
  • mov, qt: QuickTime video clip (Apple Computer, Inc.)
  • - *
  • mp2, mp3: MPEG Audio Stream file
  • - *
  • mp4: MPEG-4 video file
  • - *
  • mpe, mpeg, mpg: MPEG video clip
  • - *
  • n3: RDF N3 document
  • - *
  • nt: RDF N-Triples document
  • - *
  • odb: OpenDocument Database
  • - *
  • odc: OpenDocument Chart
  • - *
  • odf: OpenDocument Formula
  • - *
  • odg: OpenDocument Drawing
  • - *
  • odi: OpenDocument Image
  • - *
  • odm: OpenDocument Master Document
  • - *
  • odp: OpenDocument Presentation
  • - *
  • ods: OpenDocument Spreadsheet
  • - *
  • odt: OpenDocument Text
  • - *
  • onetoc: Microsoft Office OneNote 2007 TOC
  • - *
  • onetoc2: Office OneNote 2007 TOC
  • - *
  • otg: OpenDocument Drawing Template
  • - *
  • oth: HTML Document Template
  • - *
  • otp: OpenDocument Presentation Template
  • - *
  • ots: OpenDocument Spreadsheet Template
  • - *
  • ott: OpenDocument Text Template
  • - *
  • oxt: OpenOffice.org extension
  • - *
  • pdf: Adobe PDF document
  • - *
  • png: PNG image
  • - *
  • potm: Office PowerPoint 2007 macro-enabled presentation template
  • - *
  • potx: Office PowerPoint 2007 template
  • - *
  • ppam: Office PowerPoint 2007 add-in
  • - *
  • pps, ppt: Microsoft Powerpoint document
  • - *
  • ppsm: Office PowerPoint 2007 macro-enabled slide show
  • - *
  • ppsx: Office PowerPoint 2007 slide show
  • - *
  • pptm: Office PowerPoint 2007 macro-enabled presentation
  • - *
  • pptx: Microsoft Office PowerPoint 2007 presentation
  • - *
  • ps: PostScript document
  • - *
  • rdf: Description Framework document
  • - *
  • rnc: Relax NG Schema document, Compact syntax
  • - *
  • rng: Relax NG Schema document, XML syntax
  • - *
  • rss: RSS file
  • - *
  • rtf: Rich Text Format document
  • - *
  • sav: SPSS Data
  • - *
  • sit: StuffIt compressed archive file
  • - *
  • sldm: Office PowerPoint 2007 macro-enabled slide
  • - *
  • sldx: Office PowerPoint 2007 slide
  • - *
  • snd: Amiga sound
  • - *
  • sps: SPSS Script Syntax
  • - *
  • sta: Stata data file
  • - *
  • svg: Scalable Vector Graphics file
  • - *
  • swf: Adobe Flash file
  • - *
  • tar: Tape Archive file
  • - *
  • tex: Tex file
  • - *
  • tif, tiff: Tagged Image Format File
  • - *
  • tsv: Tab-separated Values
  • - *
  • txt: Plain text
  • - *
  • ulw: MU-LAW (US telephony format)
  • - *
  • vm: Velocity encoding
  • - *
  • vrml: Virtual Reality Modeling Language file
  • - *
  • vxml: VoiceXML source file
  • - *
  • wadl: Web Application Description Language document
  • - *
  • wav: Waveform audio
  • - *
  • wrl: Plain text VRML file
  • - *
  • xht, xhtml: XHTML document
  • - *
  • xlam: Office Excel 2007 add-in
  • - *
  • xls: Microsoft Excel document
  • - *
  • xlsb: Office Excel 2007 binary workbook
  • - *
  • xlsm: Office Excel 2007 macro-enabled workbook
  • - *
  • xlsx: Microsoft Office Excel 2007 workbook
  • - *
  • xltm: Office Excel 2007 macro-enabled workbook template
  • - *
  • xltx: Office Excel 2007 template
  • - *
  • xmi: XMI document
  • - *
  • xml: XML document
  • - *
  • xsd: W3C XML Schema document
  • - *
  • xsl, xslt: XSL Transform file
  • - *
  • xul: XML User Interface Language file
  • - *
  • yaml: YAML text format
  • - *
  • z: UNIX compressed archive file
  • - *
  • zip: Zip archive
  • - *
- */ - public void addCommonExtensions() { - List dm = new ArrayList(); - - ext(dm, "en", Language.ENGLISH); - ext(dm, "es", Language.SPANISH); - ext(dm, "fr", Language.FRENCH); - - ext(dm, "htm", MediaType.TEXT_HTML); - ext(dm, "html", MediaType.TEXT_HTML); - ext(dm, "json", MediaType.APPLICATION_JSON); - ext(dm, "jsonsmile", MediaType.APPLICATION_JSON_SMILE); - ext(dm, "txt", MediaType.TEXT_PLAIN, true); - ext(dm, "xhtml", MediaType.APPLICATION_XHTML); - ext(dm, "xml", MediaType.TEXT_XML); - ext(dm, "xml", MediaType.APPLICATION_XML); - - // Add all those mappings - this.mappings.addAll(dm); - } - - /** - * Maps an extension to some metadata (media type, language or character - * set) to an extension. - * - * @param extension - * The extension name. - * @param metadata - * The metadata to map. - */ - public void addExtension(String extension, Metadata metadata) { - addExtension(extension, metadata, false); - } - - /** - * Maps an extension to some metadata (media type, language or character - * set) to an extension. - * - * @param extension - * The extension name. - * @param metadata - * The metadata to map. - * @param preferred - * indicates if this mapping is the preferred one. - */ - public void addExtension(String extension, Metadata metadata, - boolean preferred) { - if (preferred) { - // Add the mapping at the beginning of the list - this.mappings.add(0, new MetadataExtension(extension, metadata)); - } else { - // Add the mapping at the end of the list - this.mappings.add(new MetadataExtension(extension, metadata)); - } - } - - /** - * clears the mappings for all extensions. - */ - public void clearExtensions() { - this.mappings.clear(); - } - - /** - * Creates a new extension mapping. - * - * @param extensions - * The extensions list to update. - * @param extension - * The extension name. - * @param metadata - * The associated metadata. - * @return The new extension mapping. - */ - private void ext(List extensions, String extension, - Metadata metadata) { - ext(extensions, extension, metadata, false); - } - - /** - * Creates a new extension mapping. - * - * @param extensions - * The extensions list to update. - * @param extension - * The extension name. - * @param metadata - * The associated metadata. - * @param preferred - * indicates if this mapping is the preferred one. - * @return The new extension mapping. - */ - private void ext(List extensions, String extension, - Metadata metadata, boolean preferred) { - if (preferred) { - // Add the mapping at the beginning of the list - extensions.add(0, new MetadataExtension(extension, metadata)); - } else { - // Add the mapping at the end of the list - extensions.add(new MetadataExtension(extension, metadata)); - } - } - - /** - * Return the ordered list of extension names mapped to character sets. - * - * @return The ordered list of extension names mapped to character sets. - */ - public List getAllCharacterSetExtensionNames() { - List result = new ArrayList(); - - for (MetadataExtension mapping : this.mappings) { - if ((mapping.getMetadata() instanceof CharacterSet) - && !result.contains(mapping.getName())) { - result.add(mapping.getName()); - } - } - - return result; - } - - /** - * Returns all the character sets associated to this extension. It returns - * null if the extension was not declared. - * - * @param extension - * The extension name without any delimiter. - * @return The list of character sets associated to this extension. - */ - public List getAllCharacterSets(String extension) { - List result = null; - - if (extension != null) { - // Look for all registered convenient mapping. - for (MetadataExtension metadataExtension : this.mappings) { - if (extension.equals(metadataExtension.getName()) - && (metadataExtension.getMetadata() instanceof CharacterSet)) { - if (result == null) { - result = new ArrayList(); - } - - result.add(metadataExtension.getCharacterSet()); - } - } - } - - return result; - } - - /** - * Return the ordered list of extension names mapped to encodings. - * - * @return The ordered list of extension names mapped to encodings. - */ - public List getAllEncodingExtensionNames() { - List result = new ArrayList(); - - for (MetadataExtension mapping : this.mappings) { - if ((mapping.getMetadata() instanceof Encoding) - && !result.contains(mapping.getName())) { - result.add(mapping.getName()); - } - } - - return result; - } - - /** - * Return the ordered list of extension names. - * - * @return The ordered list of extension names. - */ - public List getAllExtensionNames() { - List result = new ArrayList(); - - for (MetadataExtension mapping : this.mappings) { - if (!result.contains(mapping.getName())) { - result.add(mapping.getName()); - } - } - - return result; - } - - /** - * Return the ordered list of extension names mapped to languages. - * - * @return The ordered list of extension names mapped to languages. - */ - public List getAllLanguageExtensionNames() { - List result = new ArrayList(); - - for (MetadataExtension mapping : this.mappings) { - if ((mapping.getMetadata() instanceof Language) - && !result.contains(mapping.getName())) { - result.add(mapping.getName()); - } - } - - return result; - } - - /** - * Returns all the languages associated to this extension. It returns null - * if the extension was not declared. - * - * @param extension - * The extension name without any delimiter. - * @return The list of languages associated to this extension. - */ - public List getAllLanguages(String extension) { - List result = null; - - if (extension != null) { - // Look for all registered convenient mapping. - for (MetadataExtension metadataExtension : this.mappings) { - if (extension.equals(metadataExtension.getName()) - && (metadataExtension.getMetadata() instanceof Language)) { - if (result == null) { - result = new ArrayList(); - } - - result.add(metadataExtension.getLanguage()); - } - } - } - - return result; - } - - /** - * Return the ordered list of extension names mapped to media types. - * - * @return The ordered list of extension names mapped to media types. - */ - public List getAllMediaTypeExtensionNames() { - List result = new ArrayList(); - - for (MetadataExtension mapping : this.mappings) { - if ((mapping.getMetadata() instanceof MediaType) - && !result.contains(mapping.getName())) { - result.add(mapping.getName()); - } - } - - return result; - } - - /** - * Returns all the media types associated to this extension. It returns null - * if the extension was not declared. - * - * @param extension - * The extension name without any delimiter. - * @return The list of media type associated to this extension. - */ - public List getAllMediaTypes(String extension) { - List result = null; - - if (extension != null) { - // Look for all registered convenient mapping. - for (MetadataExtension metadataExtension : this.mappings) { - if (extension.equals(metadataExtension.getName()) - && (metadataExtension.getMetadata() instanceof MediaType)) { - if (result == null) { - result = new ArrayList(); - } - - result.add(metadataExtension.getMediaType()); - } - } - } - - return result; - } - - /** - * Returns all the metadata associated to this extension. It returns null if - * the extension was not declared. - * - * @param extension - * The extension name without any delimiter. - * @return The list of metadata associated to this extension. - */ - public List getAllMetadata(String extension) { - List result = null; - - if (extension != null) { - // Look for all registered convenient mapping. - for (MetadataExtension metadataExtension : this.mappings) { - if (extension.equals(metadataExtension.getName())) { - if (result == null) { - result = new ArrayList(); - } - - result.add(metadataExtension.getMetadata()); - } - } - } - - return result; - } - - /** - * Returns the character set associated to this extension. It returns null - * if the extension was not declared, or it corresponds to another type of - * metadata such as a media type. If some metadata is associated with the same extension, - * then only the first matching metadata is returned. - * - * @param extension - * The extension name without any delimiter. - * @return The character set associated to this extension. - */ - public CharacterSet getCharacterSet(String extension) { - Metadata metadata = getMetadata(extension); - if (metadata instanceof CharacterSet) { - return (CharacterSet) metadata; - } else { - return null; - } - } - - /** - * Returns the default character set for textual representations. - * - * @return The default character set for textual representations. - */ - public CharacterSet getDefaultCharacterSet() { - return this.defaultCharacterSet; - } - - /** - * Returns the default encoding for representations. - * - * @return The default encoding for representations. - */ - public Encoding getDefaultEncoding() { - return this.defaultEncoding; - } - - /** - * Returns the default language for representations. - * - * @return The default language for representations. - */ - public Language getDefaultLanguage() { - return this.defaultLanguage; - } - - /** - * Returns the default media type for representations. - * - * @return The default media type for representations. - */ - public MediaType getDefaultMediaType() { - return this.defaultMediaType; - } - - /** - * Returns the encoding associated to this extension. It returns null if the - * extension was not declared, or it corresponds to another type of - * metadata such as a media type. If some metadata is associated with the same extension, - * then only the first matching metadata is returned. - * - * @param extension - * The extension name without any delimiter. - * @return The encoding associated to this extension. - */ - public Encoding getEncoding(String extension) { - Metadata metadata = getMetadata(extension); - if (metadata instanceof Encoding) { - return (Encoding) metadata; - } else { - return null; - } - } - - /** - * Returns the first extension mapping to this metadata. - * - * @param metadata - * The metadata to find. - * @return The first extension mapping to this metadata. - */ - public String getExtension(Metadata metadata) { - if (metadata != null) { - // Look for the first registered convenient mapping. - for (final MetadataExtension metadataExtension : this.mappings) { - if (metadata.equals(metadataExtension.getMetadata())) { - return metadataExtension.getName(); - } - } - } - return null; - } - - /** - * Returns the language associated to this extension. It returns null if the - * extension was not declared, or it corresponds to another type of - * metadata such as a media type. If some metadata is associated with the same extension, - * then only the first matching metadata is returned. - * - * @param extension - * The extension name without any delimiter. - * @return The language associated to this extension. - */ - public Language getLanguage(String extension) { - Metadata metadata = getMetadata(extension); - if (metadata instanceof Language) { - return (Language) metadata; - } else { - return null; - } - } - - /** - * Returns the media-type associated to this extension. It returns null if - * the extension was not declared, or it corresponds to another type of - * metadata such as a language. If some metadata is associated with the - * same extension (ex: 'xml' for both 'text/xml' and 'application/xml'), then - * only the first matching metadata is returned. - * - * @param extension - * The extension name without any delimiter. - * @return The media type associated to this extension. - */ - public MediaType getMediaType(String extension) { - Metadata metadata = getMetadata(extension); - if (metadata instanceof MediaType) { - return (MediaType) metadata; - } else { - return null; - } - } - - /** - * Returns the metadata associated to this extension. It returns null if the - * extension was not declared. If some metadata is associated with the - * same extension (ex: 'xml' for both 'text/xml' and 'application/xml'), then - * only the first matching metadata is returned. - * - * @param extension - * The extension name without any delimiter. - * @return The metadata associated to this extension. - */ - public Metadata getMetadata(String extension) { - if (extension != null) { - // Look for the first registered convenient mapping. - for (final MetadataExtension metadataExtension : this.mappings) { - if (extension.equals(metadataExtension.getName())) { - return metadataExtension.getMetadata(); - } - } - } - - return null; - } - - - /** - * Sets the default character set for local representations. - * - * @param defaultCharacterSet - * The default character set for local representations. - */ - public void setDefaultCharacterSet(CharacterSet defaultCharacterSet) { - this.defaultCharacterSet = defaultCharacterSet; - } - - /** - * Sets the default encoding for local representations. - * - * @param defaultEncoding - * The default encoding for local representations. - */ - public void setDefaultEncoding(Encoding defaultEncoding) { - this.defaultEncoding = defaultEncoding; - } - - /** - * Sets the default language for local representations. - * - * @param defaultLanguage - * The default language for local representations. - */ - public void setDefaultLanguage(Language defaultLanguage) { - this.defaultLanguage = defaultLanguage; - } - - /** - * Sets the default media type for local representations. - * - * @param defaultMediaType - * The default media type for local representations. - */ - public void setDefaultMediaType(MediaType defaultMediaType) { - this.defaultMediaType = defaultMediaType; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/Service.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/Service.java deleted file mode 100644 index fe30f899bc..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/Service.java +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.service; - -import org.restlet.client.Context; - -/** - * Generic service associated to a component or an application. The life cycle - * of a service is tightly related to the one of the associated component or - * application.
- *
- * If you want to use a specific service, you can always disable it before it is - * actually started via the {@link #setEnabled(boolean)} method. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Service { - - /** The context. */ - private volatile Context context; - - /** Indicates if the service has been enabled. */ - private volatile boolean enabled; - - /** Indicates if the service was started. */ - private volatile boolean started; - - /** - * Constructor. Enables the service by default. - */ - public Service() { - this(true); - } - - /** - * Constructor. - * - * @param enabled - * True if the service has been enabled. - */ - public Service(boolean enabled) { - this.context = null; - this.enabled = enabled; - } - - - - /** - * Returns the context. - * - * @return The context. - */ - public Context getContext() { - return this.context; - } - - /** - * Indicates if the service should be enabled. - * - * @return True if the service should be enabled. - */ - public boolean isEnabled() { - return this.enabled; - } - - /** - * Indicates if the service is started. - * - * @return True if the service is started. - */ - public boolean isStarted() { - return this.started; - } - - /** - * Indicates if the service is stopped. - * - * @return True if the service is stopped. - */ - public boolean isStopped() { - return !this.started; - } - - /** - * Sets the context. - * - * @param context - * The context. - */ - public void setContext(Context context) { - this.context = context; - } - - /** - * Indicates if the service should be enabled. - * - * @param enabled - * True if the service should be enabled. - */ - public synchronized void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - /** Starts the Restlet. */ - public synchronized void start() throws Exception { - if (isEnabled()) { - this.started = true; - } - } - - /** Stops the Restlet. */ - public synchronized void stop() throws Exception { - if (isEnabled()) { - this.started = false; - } - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/package.html deleted file mode 100644 index c2092e22be..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/service/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - Services used by applications and components. -

- @since Restlet 1.0 - @see User Guide - Service package - @deprecated Will be removed in the next 2.7/3.0 release. - - diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/ClientList.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/ClientList.java deleted file mode 100644 index 2c91750b4b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/ClientList.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -import org.restlet.client.Client; -import org.restlet.client.Context; -import org.restlet.client.data.Protocol; - -/** - * Modifiable list of client connectors. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public final class ClientList extends WrapperList { - - /** The context. */ - private volatile Context context; - - /** - * Constructor. - * - * @param context - * The context. - */ - public ClientList(Context context) { - super(new CopyOnWriteArrayList()); - this.context = context; - } - - @Override - public boolean add(Client client) { - // Set the client's context, if the client does not have already one. - if (client.getContext() == null) { - client.setContext(getContext().createChildContext()); - } - - return super.add(client); - } - - /** - * Adds a new client connector in the map supporting the given protocol. - * - * @param protocol - * The connector protocol. - * @return The added client. - */ - public Client add(Protocol protocol) { - final Client result = new Client(protocol); - result.setContext(getContext().createChildContext()); - add(result); - return result; - } - - /** - * Returns the context. - * - * @return The context. - */ - public Context getContext() { - return this.context; - } - - /** - * Sets the context. - * - * @param context - * The context. - */ - public void setContext(Context context) { - this.context = context; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/NamedValue.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/NamedValue.java deleted file mode 100644 index 3c11c72cec..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/NamedValue.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -/** - * String couple between a name and a value. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public interface NamedValue { - - /** - * Returns the name of this parameter. - * - * @return The name of this parameter. - */ - abstract String getName(); - - /** - * Returns the value. - * - * @return The value. - */ - abstract V getValue(); - - /** - * Sets the value. - * - * @param value - * The value. - */ - abstract void setValue(V value); - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/Series.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/Series.java deleted file mode 100644 index 06504e2d89..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/Series.java +++ /dev/null @@ -1,621 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Modifiable list of entries with many helper methods. Note that this class - * uses the Parameter class as the template type. This allows you to use an - * instance of this class as any other java.util.List, in particular all the - * helper methods in java.util.Collections. - * - * @author Jerome Louvel - * @param - * The contained type - * @see org.restlet.client.data.Parameter - * @see java.util.Collections - * @see java.util.List - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class Series> extends - WrapperList - { - /** - * A marker for empty values to differentiate from non existing values - * (null). - */ - public static final Object EMPTY_VALUE = new Object(); - - - /** The entry class. */ - private final Class entryClass; - - /** - * Constructor. - */ - public Series(Class entryClass) { - super(); - this.entryClass = entryClass; - } - - /** - * Constructor. - * - * @param initialCapacity - * The initial list capacity. - */ - public Series(Class entryClass, int initialCapacity) { - super(initialCapacity); - this.entryClass = entryClass; - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public Series(Class entryClass, List delegate) { - super(delegate); - this.entryClass = entryClass; - } - - /** - * Creates then adds a parameter at the end of the list. - * - * @param name - * The parameter name. - * @param value - * The parameter value. - * @return True (as per the general contract of the Collection.add method). - */ - public boolean add(String name, String value) { - return add(createEntry(name, value)); - } - - /** - * Copies the parameters whose name is a key in the given map.
- * If a matching parameter is found, its value is put in the map.
- * If multiple values are found, a list is created and set in the map. - * - * @param params - * The map controlling the copy. - */ - @SuppressWarnings("unchecked") - public void copyTo(Map params) { - NamedValue param; - Object currentValue = null; - - for (Iterator iter = iterator(); iter.hasNext();) { - param = iter.next(); - - if (params.containsKey(param.getName())) { - currentValue = params.get(param.getName()); - - if (currentValue != null) { - List values = null; - - if (currentValue instanceof List) { - // Multiple values already found for this entry - values = (List) currentValue; - } else { - // Second value found for this entry - // Create a list of values - values = new ArrayList(); - values.add(currentValue); - params.put(param.getName(), values); - } - - if (param.getValue() == null) { - values.add(Series.EMPTY_VALUE); - } else { - values.add(param.getValue()); - } - } else { - if (param.getValue() == null) { - params.put(param.getName(), Series.EMPTY_VALUE); - } else { - params.put(param.getName(), param.getValue()); - } - } - } - } - } - - - /** - * Creates a new entry. - * - * @param name - * The name of the entry. - * @param value - * The value of the entry. - * @return A new entry. - */ - public abstract T createEntry(String name, String value); - - /** - * Creates a new series. - * - * @param delegate - * Optional delegate series. - * @return A new series. - */ - public abstract Series createSeries(List delegate); - - /** - * Tests the equality of two string, potentially null, which a case - * sensitivity flag. - * - * @param value1 - * The first value. - * @param value2 - * The second value. - * @param ignoreCase - * Indicates if the test should be case insensitive. - * @return True if both values are equal. - */ - private boolean equals(String value1, String value2, boolean ignoreCase) { - boolean result = (value1 == value2); - - if (!result) { - if ((value1 != null) && (value2 != null)) { - if (ignoreCase) { - result = value1.equalsIgnoreCase(value2); - } else { - result = value1.equals(value2); - } - } - } - - return result; - } - - /** - * Returns the first parameter found with the given name. - * - * @param name - * The parameter name (case sensitive). - * @return The first parameter found with the given name. - */ - public T getFirst(String name) { - return getFirst(name, false); - } - - /** - * Returns the first parameter found with the given name. - * - * @param name - * The parameter name. - * @param ignoreCase - * Indicates if the name comparison is case insensitive. - * @return The first parameter found with the given name. - */ - public T getFirst(String name, boolean ignoreCase) { - for (T param : this) { - if (equals(param.getName(), name, ignoreCase)) { - return param; - } - } - - return null; - } - - /** - * Returns the value of the first parameter found with the given name. - * - * @param name - * The parameter name (case sensitive). - * @return The value of the first parameter found with the given name. - */ - public String getFirstValue(String name) { - return getFirstValue(name, false); - } - - /** - * Returns the value of the first parameter found with the given name. - * - * @param name - * The parameter name. - * @param ignoreCase - * Indicates if the name comparison is case sensitive. - * @return The value of the first parameter found with the given name. - */ - public String getFirstValue(String name, boolean ignoreCase) { - return getFirstValue(name, ignoreCase, null); - } - - /** - * Returns the value of the first parameter found with the given name. - * - * @param name - * The parameter name. - * @param ignoreCase - * Indicates if the name comparison is case sensitive. - * @param defaultValue - * The default value to return if no matching parameter found or - * if the parameter has a null value. - * @return The value of the first parameter found with the given name or the - * default value. - */ - public String getFirstValue(String name, boolean ignoreCase, - String defaultValue) { - String result = defaultValue; - NamedValue param = getFirst(name, ignoreCase); - - if ((param != null) && (param.getValue() != null)) { - result = param.getValue(); - } - - return result; - } - - /** - * Returns the value of the first parameter found with the given name. - * - * @param name - * The parameter name (case sensitive). - * @param defaultValue - * The default value to return if no matching parameter found or - * if the parameter has a null value. - * @return The value of the first parameter found with the given name or the - * default value. - */ - public String getFirstValue(String name, String defaultValue) { - return getFirstValue(name, false, defaultValue); - } - - /** - * Returns the set of parameter names (case sensitive). - * - * @return The set of parameter names. - */ - public Set getNames() { - Set result = new HashSet(); - - for (NamedValue param : this) { - result.add(param.getName()); - } - - return result; - } - - /** - * Returns the values of the parameters with a given name. If multiple - * parameters with the same name are found, all values are concatenated and - * separated by a comma (like for HTTP message headers). - * - * @param name - * The parameter name (case insensitive). - * @return The values of the parameters with a given name. - */ - public String getValues(String name) { - return getValues(name, ",", true); - } - - /** - * Returns the parameter values with a given name. If multiple parameters - * with the same name are found, all values are concatenated and separated - * by the given separator. - * - * @param name - * The parameter name. - * @param separator - * The separator character. - * @param ignoreCase - * Indicates if the name comparison is case sensitive. - * @return The sequence of values. - */ - public String getValues(String name, String separator, boolean ignoreCase) { - String result = null; - StringBuilder sb = null; - - for (final T param : this) { - if ((ignoreCase && param.getName().equalsIgnoreCase(name)) - || param.getName().equals(name)) { - if (sb == null) { - if (result == null) { - result = param.getValue(); - } else { - sb = new StringBuilder(); - sb.append(result).append(separator) - .append(param.getValue()); - } - } else { - sb.append(separator).append(param.getValue()); - } - } - } - - if (sb != null) { - result = sb.toString(); - } - - return result; - } - - /** - * Returns an array of all the values associated to the given parameter - * name. - * - * @param name - * The parameter name to match (case sensitive). - * @return The array of values. - */ - public String[] getValuesArray(String name) { - return getValuesArray(name, false); - } - - /** - * Returns an array of all the values associated to the given parameter - * name. - * - * @param name - * The parameter name to match. - * @param ignoreCase - * Indicates if the name comparison is case sensitive. - * @return The array of values. - */ - public String[] getValuesArray(String name, boolean ignoreCase) { - return getValuesArray(name, ignoreCase, null); - } - - /** - * Returns an array of all the values associated to the given parameter - * name. - * - * @param name - * The parameter name to match. - * @param ignoreCase - * Indicates if the name comparison is case sensitive. - * @param defaultValue - * The default value to return if no matching parameter found or - * if the parameter has a null value. - * @return The array of values. - */ - public String[] getValuesArray(String name, boolean ignoreCase, - String defaultValue) { - String[] result = null; - List params = subList(name, ignoreCase); - - if ((params.size() == 0) && (defaultValue != null)) { - result = new String[1]; - result[0] = defaultValue; - } else { - result = new String[params.size()]; - - for (int i = 0; i < params.size(); i++) { - result[i] = params.get(i).getValue(); - } - } - - return result; - } - - /** - * Returns an array of all the values associated to the given parameter - * name. - * - * @param name - * The parameter name to match. - * @param defaultValue - * The default value to return if no matching parameter found or - * if the parameter has a null value. - * @return The array of values. - */ - public String[] getValuesArray(String name, String defaultValue) { - return getValuesArray(name, false, defaultValue); - } - - /** - * Returns a map of name, value pairs. The order of the map keys is - * respected based on the series order. When a name has multiple values, - * only the first one is put in the map. - * - * @return The map of name, value pairs. - */ - public Map getValuesMap() { - Map result = new LinkedHashMap(); - - for (NamedValue param : this) { - if (!result.containsKey(param.getName())) { - result.put(param.getName(), param.getValue()); - } - } - - return result; - } - - /** - * Removes all the parameters with a given name. - * - * @param name - * The parameter name (case sensitive). - * @return True if the list changed. - */ - public boolean removeAll(String name) { - return removeAll(name, false); - } - - /** - * Removes all the parameters with a given name. - * - * @param name - * The parameter name. - * @param ignoreCase - * Indicates if the name comparison is case insensitive. - * @return True if the list changed. - */ - public boolean removeAll(String name, boolean ignoreCase) { - boolean changed = false; - NamedValue param = null; - - for (Iterator iter = iterator(); iter.hasNext();) { - param = iter.next(); - - if (equals(param.getName(), name, ignoreCase)) { - iter.remove(); - changed = true; - } - } - - return changed; - } - - /** - * Removes from this list the first entry whose name equals the specified - * name ignoring the case. - * - * @param name - * The name of the entries to be removed (case sensitive). - * @return false if no entry has been removed, true otherwise. - */ - public boolean removeFirst(String name) { - return removeFirst(name, false); - } - - /** - * Removes from this list the first entry whose name equals the specified - * name ignoring the case or not. - * - * @param name - * The name of the entries to be removed. - * @param ignoreCase - * Indicates if the name comparison is case insensitive. - * @return false if no entry has been removed, true otherwise. - */ - public boolean removeFirst(String name, boolean ignoreCase) { - boolean changed = false; - NamedValue param = null; - - for (final Iterator iter = iterator(); iter.hasNext() && !changed;) { - param = iter.next(); - if (equals(param.getName(), name, ignoreCase)) { - iter.remove(); - changed = true; - } - } - - return changed; - } - - /** - * Replaces the value of the first parameter with the given name and removes - * all other parameters with the same name. The name matching is case - * sensitive. - * - * @param name - * The parameter name. - * @param value - * The value to set. - * @return The parameter set or added. - */ - public T set(String name, String value) { - return set(name, value, false); - } - - /** - * Replaces the value of the first parameter with the given name and removes - * all other parameters with the same name. - * - * @param name - * The parameter name. - * @param value - * The value to set. - * @param ignoreCase - * Indicates if the name comparison is case insensitive. - * @return The parameter set or added. - */ - public T set(String name, String value, boolean ignoreCase) { - T result = null; - T param = null; - boolean found = false; - - for (final Iterator iter = iterator(); iter.hasNext();) { - param = iter.next(); - - if (equals(param.getName(), name, ignoreCase)) { - if (found) { - // Remove other entries with the same name - iter.remove(); - } else { - // Change the value of the first matching entry - found = true; - param.setValue(value); - result = param; - } - } - } - - if (!found) { - add(name, value); - } - - return result; - } - - /** - * Returns a view of the portion of this list between the specified - * fromIndex, inclusive, and toIndex, exclusive. - * - * @param fromIndex - * The start position. - * @param toIndex - * The end position (exclusive). - * @return The sub-list. - */ - @Override - public Series subList(int fromIndex, int toIndex) { - return - createSeries(org.restlet.client.engine.util.ListUtils.copySubList( - getDelegate(), fromIndex, toIndex)); - } - - /** - * Returns a list of all the values associated to the parameter name. - * - * @param name - * The parameter name (case sensitive). - * @return The list of values. - */ - public Series subList(String name) { - return subList(name, false); - } - - /** - * Returns a list of all the values associated to the parameter name. - * - * @param name - * The parameter name. - * @param ignoreCase - * Indicates if the name comparison is case insensitive. - * @return The list of values. - */ - public Series subList(String name, boolean ignoreCase) { - Series result = createSeries(null); - - for (T param : this) { - if (equals(param.getName(), name, ignoreCase)) { - result.add(param); - } - } - - return result; - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperList.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperList.java deleted file mode 100644 index faecce1722..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperList.java +++ /dev/null @@ -1,357 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; - -/** - * List wrapper. Modifiable list that delegates all methods to a wrapped list. - * This allows an easy sub-classing. By default, it wraps a thread-safe {@link Vector} instance. - * - * @author Jerome Louvel - * @see The decorator (aka wrapper) pattern - * @see java.util.Collections - * @see java.util.List - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class WrapperList implements List, Iterable { - /** The delegate list. */ - private final List delegate; - - /** - * Constructor. Uses a default initial capacity of 10 items. - */ - public WrapperList() { - this(10); - } - - /** - * Constructor. - * - * @param initialCapacity - * The initial list capacity. - */ - public WrapperList(int initialCapacity) { - this(new Vector(initialCapacity)); - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public WrapperList(List delegate) { - this.delegate = delegate; - } - - /** - * Adds a element at the end of the list. - * - * @return True (as per the general contract of the Collection.add method). - */ - public boolean add(E element) { - return getDelegate().add(element); - } - - /** - * Inserts the specified element at the specified position in this list. - * - * @param index - * The insertion position. - * @param element - * The element to insert. - */ - public void add(int index, E element) { - getDelegate().add(index, element); - } - - /** - * Appends all of the elements in the specified collection to the end of - * this list. - * - * @param elements - * The collection of elements to append. - */ - public boolean addAll(Collection elements) { - return getDelegate().addAll(elements); - } - - /** - * Inserts all of the elements in the specified collection into this list at - * the specified position. - * - * @param index - * The insertion position. - * @param elements - * The collection of elements to insert. - */ - public boolean addAll(int index, Collection elements) { - return getDelegate().addAll(index, elements); - } - - /** - * Removes all of the elements from this list. - */ - public void clear() { - getDelegate().clear(); - } - - /** - * Returns true if this list contains the specified element. - * - * @param element - * The element to find. - * @return True if this list contains the specified element. - */ - public boolean contains(Object element) { - return getDelegate().contains(element); - } - - /** - * Returns true if this list contains all of the elements of the specified - * collection. - * - * @param elements - * The collection of elements to find. - * @return True if this list contains all of the elements of the specified - * collection. - */ - public boolean containsAll(Collection elements) { - return getDelegate().containsAll(elements); - } - - /** - * Compares the specified object with this list for equality. - * - * @param o - * The object to be compared for equality with this list. - * @return True if the specified object is equal to this list. - */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - - if (o instanceof List) { - List that = (List) o; - return Arrays.equals(this.toArray(), that.toArray()); - } - - return false; - } - - /** - * Returns the element at the specified position in this list. - * - * @param index - * The element position. - * @return The element at the specified position in this list. - */ - public E get(int index) { - return getDelegate().get(index); - } - - /** - * Returns the delegate list. - * - * @return The delegate list. - */ - protected List getDelegate() { - return this.delegate; - } - - /** - * Returns the hash code value for this list. - * - * @return The hash code value for this list. - */ - @Override - public int hashCode() { - return getDelegate().hashCode(); - } - - /** - * Returns the index in this list of the first occurrence of the specified - * element, or -1 if this list does not contain this element. - * - * @param element - * The element to find. - * @return The index of the first occurrence. - */ - public int indexOf(Object element) { - return getDelegate().indexOf(element); - } - - /** - * Returns true if this list contains no elements. - */ - public boolean isEmpty() { - return getDelegate().isEmpty(); - } - - /** - * Returns an iterator over the elements in this list in proper sequence. - * - * @return An iterator over the elements in this list in proper sequence. - */ - public Iterator iterator() { - return getDelegate().iterator(); - } - - /** - * Returns the index in this list of the last occurrence of the specified - * element, or -1 if this list does not contain this element. - */ - public int lastIndexOf(Object element) { - return getDelegate().lastIndexOf(element); - } - - /** - * Returns a list iterator of the elements in this list (in proper - * sequence). - * - * @return A list iterator of the elements in this list (in proper - * sequence). - */ - public ListIterator listIterator() { - return getDelegate().listIterator(); - } - - /** - * Returns a list iterator of the elements in this list (in proper - * sequence), starting at the specified position in this list. - * - * @param index - * The starting position. - */ - public ListIterator listIterator(int index) { - return getDelegate().listIterator(index); - } - - /** - * Removes the element at the specified position in this list. - * - * @return The removed element. - */ - public E remove(int index) { - return getDelegate().remove(index); - } - - /** - * Removes the first occurrence in this list of the specified element. - * - * @return True if the list was changed. - */ - public boolean remove(Object element) { - return getDelegate().remove(element); - } - - /** - * Removes from this list all the elements that are contained in the - * specified collection. - * - * @param elements - * The collection of element to remove. - * @return True if the list changed. - */ - public boolean removeAll(Collection elements) { - return getDelegate().removeAll(elements); - } - - /** - * RemovesRetains only the elements in this list that are contained in the - * specified collection. - * - * @param elements - * The collection of element to retain. - * @return True if the list changed. - */ - public boolean retainAll(Collection elements) { - return getDelegate().retainAll(elements); - } - - /** - * Replaces the element at the specified position in this list with the - * specified element. - * - * @param index - * The position of the element to replace. - * @param element - * The new element. - */ - public E set(int index, E element) { - return getDelegate().set(index, element); - } - - /** - * Returns the number of elements in this list. - * - * @return The number of elements in this list. - */ - public int size() { - return getDelegate().size(); - } - - /** - * Returns a view of the portion of this list between the specified - * fromIndex, inclusive, and toIndex, exclusive. - * - * @param fromIndex - * The start position. - * @param toIndex - * The end position (exclusive). - * @return The sub-list. - */ - public List subList(int fromIndex, int toIndex) { - return org.restlet.client.engine.util.ListUtils.copySubList(this, fromIndex, - toIndex); - } - - /** - * Returns an array containing all of the elements in this list in proper - * sequence. - * - * @return An array containing all of the elements in this list in proper - * sequence. - */ - public Object[] toArray() { - return getDelegate().toArray(); - } - - /** - * Returns an array containing all of the elements in this list in proper - * sequence; the runtime type of the returned array is that of the specified - * array. - * - * @param a - * The sample array. - */ - public T[] toArray(T[] a) { - return getDelegate().toArray(a); - } - - /** - * Returns a string representation of the list. - * - * @return A string representation of the list. - */ - @Override - public String toString() { - return getDelegate().toString(); - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperMap.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperMap.java deleted file mode 100644 index 4c04e8372f..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperMap.java +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -import java.util.Collection; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -/** - * Map wrapper. Modifiable map that delegates all methods to a wrapped map. This - * allows an easy subclassing. - * - * @author Jerome Louvel - * @see The decorator (aka - * wrapper) pattern - * @see java.util.Collections - * @see java.util.List - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class WrapperMap implements Map { - /** The delegate map. */ - private final Map delegate; - - /** - * Constructor. - */ - public WrapperMap() { - this.delegate = new ConcurrentHashMap(); - } - - /** - * Constructor. - * - * @param delegate - * The delegate list. - */ - public WrapperMap(Map delegate) { - this.delegate = delegate; - } - - /** - * Removes all mappings from this Map. - */ - public void clear() { - getDelegate().clear(); - } - - /** - * Returns true if this map contains a mapping for the specified key. - * - * @param key - * The key to look up. - * @return True if this map contains a mapping for the specified key. - */ - public boolean containsKey(Object key) { - return getDelegate().containsKey(key); - } - - /** - * Returns true if this map maps one or more keys to the specified value. - * - * @param value - * The value to look up - * @return True if this map maps one or more keys to the specified value. - */ - public boolean containsValue(Object value) { - return getDelegate().containsValue(value); - } - - /** - * Returns a set view of the mappings contained in this map. - * - * @return A set view of the mappings contained in this map. - */ - public Set> entrySet() { - return getDelegate().entrySet(); - } - - /** - * Compares the specified object with this map for equality. - * - * @param o - * Object to be compared for equality with this map. - * @return True if the specified object is equal to this map. - */ - @Override - public boolean equals(Object o) { - return getDelegate().equals(o); - } - - /** - * Returns the value to which this map maps the specified key. - * - * @param key - * Key whose associated value is to be returned. - * @return The value to which this map maps the specified key, or null if - * the map contains no mapping for this key. - */ - public V get(Object key) { - return getDelegate().get(key); - } - - /** - * Returns the delegate list. - * - * @return The delegate list. - */ - protected Map getDelegate() { - return this.delegate; - } - - /** - * Returns the hash code value for this map. - * - * @return The hash code value for this map. - */ - @Override - public int hashCode() { - return getDelegate().hashCode(); - } - - /** - * Returns true if this map contains no key-value mappings. - * - * @return True if this map contains no key-value mappings. - */ - public boolean isEmpty() { - return getDelegate().isEmpty(); - } - - /** - * Returns a set view of the keys contained in this map. - * - * @return A set view of the keys contained in this map. - */ - public Set keySet() { - return getDelegate().keySet(); - } - - /** - * Associates the specified value with the specified key in this map - * (optional operation). - * - * @param key - * Key with which the specified value is to be associated. - * @param value - * Value to be associated with the specified key. - * @return The previous value associated with specified key, or null if - * there was no mapping for key. A null return can also indicate - * that the map previously associated null with the specified key, - * if the implementation supports null values. - */ - public V put(K key, V value) { - return getDelegate().put(key, value); - } - - /** - * Copies all of the mappings from the specified map to this map (optional - * operation). - * - * @param t - * Mappings to be stored in this map. - */ - public void putAll(Map t) { - getDelegate().putAll(t); - } - - /** - * Removes the mapping for this key from this map if it is present (optional - * operation). - * - * @param key - * Key whose mapping is to be removed from the map. - * @return The previous value associated with specified key, or null if - * there was no mapping for key. - */ - public V remove(Object key) { - return getDelegate().remove(key); - } - - /** - * Returns the number of key-value mappings in this map. - * - * @return The number of key-value mappings in this map. - */ - public int size() { - return getDelegate().size(); - } - - /** - * Returns a collection view of the values contained in this map. - * - * @return A collection view of the values contained in this map. - */ - public Collection values() { - return getDelegate().values(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRepresentation.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRepresentation.java deleted file mode 100644 index 039c9b989b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRepresentation.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -import java.io.IOException; -import java.io.InputStream; -import java.io.StringReader; -import java.util.Date; -import java.util.List; - -import org.restlet.client.data.CharacterSet; -import org.restlet.client.data.Disposition; -import org.restlet.client.data.Encoding; -import org.restlet.client.data.Language; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Reference; -import org.restlet.client.data.Tag; -import org.restlet.client.representation.Representation; - -/** - * Representation wrapper. Useful for application developer who need to enrich - * the representation with application related properties and behavior. - * - * @see The decorator (aka - * wrapper) pattern - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class WrapperRepresentation extends Representation { - /** The wrapped representation. */ - private final Representation wrappedRepresentation; - - /** - * Constructor. - * - * @param wrappedRepresentation - * The wrapped representation. - */ - public WrapperRepresentation(Representation wrappedRepresentation) { - this.wrappedRepresentation = wrappedRepresentation; - } - - @Override - public long exhaust() throws IOException { - return getWrappedRepresentation().exhaust(); - } - - @Override - public long getAvailableSize() { - return getWrappedRepresentation().getAvailableSize(); - } - - - @Override - public CharacterSet getCharacterSet() { - return getWrappedRepresentation().getCharacterSet(); - } - - - @Override - public Disposition getDisposition() { - return getWrappedRepresentation().getDisposition(); - } - - @Override - public List getEncodings() { - return getWrappedRepresentation().getEncodings(); - } - - @Override - public Date getExpirationDate() { - return getWrappedRepresentation().getExpirationDate(); - } - - @Override - public List getLanguages() { - return getWrappedRepresentation().getLanguages(); - } - - @Override - public Reference getLocationRef() { - return getWrappedRepresentation().getLocationRef(); - } - - @Override - public MediaType getMediaType() { - return getWrappedRepresentation().getMediaType(); - } - - @Override - public Date getModificationDate() { - return getWrappedRepresentation().getModificationDate(); - } - - - @Override - public StringReader getReader() throws IOException { - return getWrappedRepresentation().getReader(); - } - - @Override - public long getSize() { - return getWrappedRepresentation().getSize(); - } - - @Override - public InputStream getStream() throws IOException { - return getWrappedRepresentation().getStream(); - } - - @Override - public Tag getTag() { - return getWrappedRepresentation().getTag(); - } - - @Override - public String getText() throws IOException { - return getWrappedRepresentation().getText(); - } - - /** - * Returns the wrapped representation. - * - * @return The wrapped representation. - */ - public Representation getWrappedRepresentation() { - return this.wrappedRepresentation; - } - - @Override - public boolean isAvailable() { - return getWrappedRepresentation().isAvailable(); - } - - - @Override - public boolean isTransient() { - return getWrappedRepresentation().isTransient(); - } - - - @Override - public void release() { - getWrappedRepresentation().release(); - } - - @Override - public void setAvailable(boolean isAvailable) { - getWrappedRepresentation().setAvailable(isAvailable); - } - - @Override - public void setCharacterSet(CharacterSet characterSet) { - getWrappedRepresentation().setCharacterSet(characterSet); - } - - - @Override - public void setDisposition(Disposition disposition) { - getWrappedRepresentation().setDisposition(disposition); - } - - @Override - public void setEncodings(List encodings) { - getWrappedRepresentation().setEncodings(encodings); - } - - @Override - public void setExpirationDate(Date expirationDate) { - getWrappedRepresentation().setExpirationDate(expirationDate); - } - - @Override - public void setLanguages(List languages) { - getWrappedRepresentation().setLanguages(languages); - } - - @Override - public void setLocationRef(Reference location) { - getWrappedRepresentation().setLocationRef(location); - } - - @Override - public void setLocationRef(String locationUri) { - getWrappedRepresentation().setLocationRef(locationUri); - } - - @Override - public void setMediaType(MediaType mediaType) { - getWrappedRepresentation().setMediaType(mediaType); - } - - @Override - public void setModificationDate(Date modificationDate) { - getWrappedRepresentation().setModificationDate(modificationDate); - } - - - @Override - public void setSize(long expectedSize) { - getWrappedRepresentation().setSize(expectedSize); - } - - @Override - public void setTag(Tag tag) { - getWrappedRepresentation().setTag(tag); - } - - @Override - public void setTransient(boolean isTransient) { - getWrappedRepresentation().setTransient(isTransient); - } - - - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRequest.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRequest.java deleted file mode 100644 index a111b27a1b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRequest.java +++ /dev/null @@ -1,501 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentMap; - -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.Uniform; -import org.restlet.client.data.ChallengeResponse; -import org.restlet.client.data.ClientInfo; -import org.restlet.client.data.Conditions; -import org.restlet.client.data.Cookie; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Method; -import org.restlet.client.data.Protocol; -import org.restlet.client.data.Range; -import org.restlet.client.data.Reference; -import org.restlet.client.representation.Representation; - -/** - * Request wrapper. Useful for application developer who need to enrich the - * request with application related properties and behavior. - * - * @see The decorator (aka - * wrapper) pattern - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class WrapperRequest extends Request { - /** The wrapped request. */ - private final Request wrappedRequest; - - /** - * Constructor. - * - * @param wrappedRequest - * The wrapped request. - */ - public WrapperRequest(Request wrappedRequest) { - this.wrappedRequest = wrappedRequest; - } - - @Override - public boolean abort() { - return wrappedRequest.abort(); - } - - @Override - public void commit(Response response) { - wrappedRequest.commit(response); - } - - /** - * Returns a modifiable attributes map that can be used by developers to - * save information relative to the message. This is an easier alternative - * to the creation of a wrapper instance around the whole message.
- *
- * - * In addition, this map is a shared space between the developer and the - * connectors. In this case, it is used to exchange information that is not - * uniform across all protocols and couldn't therefore be directly included - * in the API. For this purpose, all attribute names starting with - * "org.restlet.client" are reserved. Currently the following attributes are used: - * - * - * - * - * - * - * - * - * - * - * - *
Attribute nameClass nameDescription
org.restlet.client.http.headersorg.restlet.client.data.FormServer HTTP connectors must provide all request headers and client - * HTTP connectors must provide all response headers, exactly as they were - * received. In addition, developers can also use this attribute to specify - * non-standard headers that should be added to the request or to the - * response.
- * Adding standard HTTP headers is forbidden because it could conflict with - * the connector's internal behavior, limit portability or prevent future - * optimizations. - * - * @return The modifiable attributes map. - */ - @Override - public ConcurrentMap getAttributes() { - return getWrappedRequest().getAttributes(); - } - - /** - * Returns the authentication response sent by a client to an origin server. - * - * @return The authentication response sent by a client to an origin server. - */ - @Override - public ChallengeResponse getChallengeResponse() { - return getWrappedRequest().getChallengeResponse(); - } - - /** - * Returns the client-specific information. - * - * @return The client-specific information. - */ - @Override - public ClientInfo getClientInfo() { - return getWrappedRequest().getClientInfo(); - } - - /** - * Returns the conditions applying to this call. - * - * @return The conditions applying to this call. - */ - @Override - public Conditions getConditions() { - return getWrappedRequest().getConditions(); - } - - /** - * Returns the cookies provided by the client. - * - * @return The cookies provided by the client. - */ - @Override - public Series getCookies() { - return getWrappedRequest().getCookies(); - } - - /** - * Returns the entity representation. - * - * @return The entity representation. - */ - @Override - public Representation getEntity() { - return getWrappedRequest().getEntity(); - } - - /** - * Returns the host reference. This may be different from the resourceRef's - * host, for example for URNs and other URIs that don't contain host - * information. - * - * @return The host reference. - */ - @Override - public Reference getHostRef() { - return getWrappedRequest().getHostRef(); - } - - @Override - public int getMaxForwards() { - return wrappedRequest.getMaxForwards(); - } - - /** - * Returns the method. - * - * @return The method. - */ - @Override - public Method getMethod() { - return getWrappedRequest().getMethod(); - } - - @Override - public Uniform getOnResponse() { - return wrappedRequest.getOnResponse(); - } - - @Override - public Reference getOriginalRef() { - return wrappedRequest.getOriginalRef(); - } - - /** - * Returns the protocol by first returning the baseRef.schemeProtocol - * property if it is set, or the resourceRef.schemeProtocol property - * otherwise. - * - * @return The protocol or null if not available. - */ - @Override - public Protocol getProtocol() { - return getWrappedRequest().getProtocol(); - } - - - @Override - public List getRanges() { - return wrappedRequest.getRanges(); - } - - /** - * Returns the referrer reference if available. - * - * @return The referrer reference. - */ - @Override - public Reference getReferrerRef() { - return getWrappedRequest().getReferrerRef(); - } - - /** - * Returns the reference of the target resource. - * - * @return The reference of the target resource. - */ - @Override - public Reference getResourceRef() { - return getWrappedRequest().getResourceRef(); - } - - /** - * Returns the application root reference. - * - * @return The application root reference. - */ - @Override - public Reference getRootRef() { - return getWrappedRequest().getRootRef(); - } - - /** - * Returns the wrapped request. - * - * @return The wrapped request. - */ - protected Request getWrappedRequest() { - return this.wrappedRequest; - } - - /** - * Returns the access control request headers of the target resource. - * - * @return The access control request headers of the target resource. - */ - @Override - public Set getAccessControlRequestHeaders() { - return wrappedRequest.getAccessControlRequestHeaders(); - } - - /** - * Returns the access control request method of the target resource. - * - * @return The access control request method of the target resource. - */ - @Override - public Method getAccessControlRequestMethod() { - return wrappedRequest.getAccessControlRequestMethod(); - } - - @Override - public boolean isAsynchronous() { - return wrappedRequest.isAsynchronous(); - } - - /** - * Indicates if the call came over a confidential channel such as an - * SSL-secured connection. - * - * @return True if the call came over a confidential channel. - */ - @Override - public boolean isConfidential() { - return getWrappedRequest().isConfidential(); - } - - /** - * Indicates if a content is available and can be sent. Several conditions - * must be met: the method must allow the sending of content, the content - * must exists and have some available data. - * - * @return True if a content is available and can be sent. - */ - @Override - public boolean isEntityAvailable() { - return getWrappedRequest().isEntityAvailable(); - } - - @Override - public boolean isExpectingResponse() { - return wrappedRequest.isExpectingResponse(); - } - - @Override - public boolean isSynchronous() { - return wrappedRequest.isSynchronous(); - } - - /** - * Sets the authentication response sent by a client to an origin server. - * - * @param response - * The authentication response sent by a client to an origin - * server. - */ - @Override - public void setChallengeResponse(ChallengeResponse response) { - getWrappedRequest().setChallengeResponse(response); - } - - @Override - public void setClientInfo(ClientInfo clientInfo) { - wrappedRequest.setClientInfo(clientInfo); - } - - @Override - public void setConditions(Conditions conditions) { - wrappedRequest.setConditions(conditions); - } - - @Override - public void setCookies(Series cookies) { - wrappedRequest.setCookies(cookies); - } - - /** - * Sets the entity representation. - * - * @param entity - * The entity representation. - */ - @Override - public void setEntity(Representation entity) { - getWrappedRequest().setEntity(entity); - } - - /** - * Sets a textual entity. - * - * @param value - * The represented string. - * @param mediaType - * The representation's media type. - */ - @Override - public void setEntity(String value, MediaType mediaType) { - getWrappedRequest().setEntity(value, mediaType); - } - - /** - * Sets the host reference. - * - * @param hostRef - * The host reference. - */ - @Override - public void setHostRef(Reference hostRef) { - getWrappedRequest().setHostRef(hostRef); - } - - /** - * Sets the host reference using an URI string. - * - * @param hostUri - * The host URI. - */ - @Override - public void setHostRef(String hostUri) { - getWrappedRequest().setHostRef(hostUri); - } - - @Override - public void setMaxForwards(int maxForwards) { - wrappedRequest.setMaxForwards(maxForwards); - } - - /** - * Sets the method called. - * - * @param method - * The method called. - */ - @Override - public void setMethod(Method method) { - getWrappedRequest().setMethod(method); - } - - @Override - public void setOnResponse(Uniform onResponseCallback) { - wrappedRequest.setOnResponse(onResponseCallback); - } - - @Override - public void setOriginalRef(Reference originalRef) { - wrappedRequest.setOriginalRef(originalRef); - } - - @Override - public void setProtocol(Protocol protocol) { - wrappedRequest.setProtocol(protocol); - } - - - @Override - public void setRanges(List ranges) { - wrappedRequest.setRanges(ranges); - } - - /** - * Sets the referrer reference if available. - * - * @param referrerRef - * The referrer reference. - */ - @Override - public void setReferrerRef(Reference referrerRef) { - getWrappedRequest().setReferrerRef(referrerRef); - } - - /** - * Sets the referrer reference if available using an URI string. - * - * @param referrerUri - * The referrer URI. - */ - @Override - public void setReferrerRef(String referrerUri) { - getWrappedRequest().setReferrerRef(referrerUri); - } - - /** - * Sets the target resource reference. If the reference is relative, it will - * be resolved as an absolute reference. Also, the context's base reference - * will be reset. Finally, the reference will be normalized to ensure a - * consistent handling of the call. - * - * @param resourceRef - * The resource reference. - */ - @Override - public void setResourceRef(Reference resourceRef) { - getWrappedRequest().setResourceRef(resourceRef); - } - - /** - * Sets the target resource reference using an URI string. Note that the URI - * can be either absolute or relative to the context's base reference. - * - * @param resourceUri - * The resource URI. - */ - @Override - public void setResourceRef(String resourceUri) { - getWrappedRequest().setResourceRef(resourceUri); - } - - /** - * Sets the application root reference. - * - * @param rootRef - * The application root reference. - */ - @Override - public void setRootRef(Reference rootRef) { - getWrappedRequest().setRootRef(rootRef); - } - - /** - * Sets the access control request headers of the target resource. - * - * @param accessControlRequestHeaders - * The access control request headers of the target resource. - */ - @Override - public void setAccessControlRequestHeaders( - Set accessControlRequestHeaders) { - super.setAccessControlRequestHeaders(accessControlRequestHeaders); - } - - /** - * Sets the access control request method of the target resource. - * - * @param accessControlRequestMethod - * The access control request method of the target resource. - */ - @Override - public void setAccessControlRequestMethod(Method accessControlRequestMethod) { - super.setAccessControlRequestMethod(accessControlRequestMethod); - } - - @Override - public String toString() { - return wrappedRequest.toString(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperResponse.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperResponse.java deleted file mode 100644 index 3fc658458a..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperResponse.java +++ /dev/null @@ -1,522 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -import java.util.Date; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ConcurrentMap; - -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.data.AuthenticationInfo; -import org.restlet.client.data.ChallengeRequest; -import org.restlet.client.data.CookieSetting; -import org.restlet.client.data.Dimension; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Method; -import org.restlet.client.data.Reference; -import org.restlet.client.data.ServerInfo; -import org.restlet.client.data.Status; -import org.restlet.client.representation.Representation; - -/** - * Request wrapper. Useful for application developer who need to enrich the - * request with application related properties and behavior. - * - * @see The decorator (aka - * wrapper) pattern - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class WrapperResponse extends Response { - /** The wrapped response. */ - private final Response wrappedResponse; - - /** - * Constructor. - * - * @param wrappedResponse - * The wrapped response. - */ - public WrapperResponse(Response wrappedResponse) { - super(null); - this.wrappedResponse = wrappedResponse; - } - - @Override - public void abort() { - wrappedResponse.abort(); - } - - @Override - public void commit() { - wrappedResponse.commit(); - } - - @Override - public int getAge() { - return wrappedResponse.getAge(); - } - - /** - * Returns the set of methods allowed on the requested resource. This - * property only has to be updated when a status - * CLIENT_ERROR_METHOD_NOT_ALLOWED is set. - * - * @return The list of allowed methods. - */ - @Override - public Set getAllowedMethods() { - return getWrappedResponse().getAllowedMethods(); - } - - /** - * Returns a modifiable attributes map that can be used by developers to - * save information relative to the message. This is an easier alternative - * to the creation of a wrapper instance around the whole message.
- *
- * - * In addition, this map is a shared space between the developer and the - * connectors. In this case, it is used to exchange information that is not - * uniform across all protocols and couldn't therefore be directly included - * in the API. For this purpose, all attribute names starting with - * "org.restlet.client" are reserved. Currently the following attributes are used: - * - * - * - * - * - * - * - * - * - * - * - *
Attribute nameClass nameDescription
org.restlet.client.http.headersorg.restlet.client.data.FormServer HTTP connectors must provide all request headers and client - * HTTP connectors must provide all response headers, exactly as they were - * received. In addition, developers can also use this attribute to specify - * non-standard headers that should be added to the request or to the - * response.
- * Adding standard HTTP headers is forbidden because it could conflict with - * the connector's internal behavior, limit portability or prevent future - * optimizations. - * - * @return The modifiable attributes map. - */ - @Override - public ConcurrentMap getAttributes() { - return getWrappedResponse().getAttributes(); - } - - @Override - public AuthenticationInfo getAuthenticationInfo() { - return wrappedResponse.getAuthenticationInfo(); - } - - /** - * Returns the list of authentication requests sent by an origin server to a - * client. - * - * @return The list of authentication requests sent by an origin server to a - * client. - */ - @Override - public List getChallengeRequests() { - return getWrappedResponse().getChallengeRequests(); - } - - /** - * Returns the cookie settings provided by the server. - * - * @return The cookie settings provided by the server. - */ - @Override - public Series getCookieSettings() { - return getWrappedResponse().getCookieSettings(); - } - - /** - * Returns the set of selecting dimensions on which the response entity may - * vary. If some server-side content negotiation is done, this set should be - * properly updated, other it can be left empty. - * - * @return The set of dimensions on which the response entity may vary. - */ - @Override - public Set getDimensions() { - return getWrappedResponse().getDimensions(); - } - - /** - * Returns the entity representation. - * - * @return The entity representation. - */ - @Override - public Representation getEntity() { - return getWrappedResponse().getEntity(); - } - - /** - * Returns the reference that the client should follow for redirections or - * resource creations. - * - * @return The redirection reference. - */ - @Override - public Reference getLocationRef() { - return getWrappedResponse().getLocationRef(); - } - - /** - * Returns the list of authentication requests sent by a proxy to a client. - * - * @return The list of authentication requests sent by a proxy to a client. - */ - @Override - public List getProxyChallengeRequests() { - return getWrappedResponse().getProxyChallengeRequests(); - } - - /** - * Returns the associated request - * - * @return The associated request - */ - @Override - public Request getRequest() { - return getWrappedResponse().getRequest(); - } - - @Override - public Date getRetryAfter() { - return wrappedResponse.getRetryAfter(); - } - - /** - * Returns the server-specific information. - * - * @return The server-specific information. - */ - @Override - public ServerInfo getServerInfo() { - return getWrappedResponse().getServerInfo(); - } - - /** - * Returns the status. - * - * @return The status. - */ - @Override - public Status getStatus() { - return getWrappedResponse().getStatus(); - } - - /** - * Returns the wrapped response. - * - * @return The wrapped response. - */ - protected Response getWrappedResponse() { - return this.wrappedResponse; - } - - @Override - public boolean isAutoCommitting() { - return wrappedResponse.isAutoCommitting(); - } - - @Override - public boolean isCommitted() { - return wrappedResponse.isCommitted(); - } - - /** - * Indicates if the call came over a confidential channel such as an - * SSL-secured connection. - * - * @return True if the call came over a confidential channel. - */ - @Override - public boolean isConfidential() { - return getWrappedResponse().isConfidential(); - } - - /** - * Indicates if a content is available and can be sent. Several conditions - * must be met: the content must exists and have some available data. - * - * @return True if a content is available and can be sent. - */ - @Override - public boolean isEntityAvailable() { - return getWrappedResponse().isEntityAvailable(); - } - - /** - * Permanently redirects the client to a target URI. The client is expected - * to reuse the same method for the new request. - * - * @param targetRef - * The target URI reference. - */ - @Override - public void redirectPermanent(Reference targetRef) { - getWrappedResponse().redirectPermanent(targetRef); - } - - /** - * Permanently redirects the client to a target URI. The client is expected - * to reuse the same method for the new request. - * - * @param targetUri - * The target URI. - */ - @Override - public void redirectPermanent(String targetUri) { - getWrappedResponse().redirectPermanent(targetUri); - } - - /** - * Redirects the client to a different URI that SHOULD be retrieved using a - * GET method on that resource. This method exists primarily to allow the - * output of a POST-activated script to redirect the user agent to a - * selected resource. The new URI is not a substitute reference for the - * originally requested resource. - * - * @param targetRef - * The target reference. - */ - @Override - public void redirectSeeOther(Reference targetRef) { - getWrappedResponse().redirectSeeOther(targetRef); - } - - /** - * Redirects the client to a different URI that SHOULD be retrieved using a - * GET method on that resource. This method exists primarily to allow the - * output of a POST-activated script to redirect the user agent to a - * selected resource. The new URI is not a substitute reference for the - * originally requested resource. - * - * @param targetUri - * The target URI. - */ - @Override - public void redirectSeeOther(String targetUri) { - getWrappedResponse().redirectSeeOther(targetUri); - } - - /** - * Temporarily redirects the client to a target URI. The client is expected - * to reuse the same method for the new request. - * - * @param targetRef - * The target reference. - */ - @Override - public void redirectTemporary(Reference targetRef) { - getWrappedResponse().redirectTemporary(targetRef); - } - - /** - * Temporarily redirects the client to a target URI. The client is expected - * to reuse the same method for the new request. - * - * @param targetUri - * The target URI. - */ - @Override - public void redirectTemporary(String targetUri) { - getWrappedResponse().redirectTemporary(targetUri); - } - - @Override - public void setAge(int age) { - wrappedResponse.setAge(age); - } - - @Override - public void setAllowedMethods(Set allowedMethods) { - wrappedResponse.setAllowedMethods(allowedMethods); - } - - @Override - public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) { - wrappedResponse.setAuthenticationInfo(authenticationInfo); - } - - @Override - public void setAutoCommitting(boolean autoCommitting) { - wrappedResponse.setAutoCommitting(autoCommitting); - } - - /** - * Sets the list of authentication requests sent by an origin server to a - * client. - * - * @param requests - * The list of authentication requests sent by an origin server - * to a client. - */ - @Override - public void setChallengeRequests(List requests) { - getWrappedResponse().setChallengeRequests(requests); - } - - @Override - public void setCommitted(boolean committed) { - wrappedResponse.setCommitted(committed); - } - - @Override - public void setCookieSettings(Series cookieSettings) { - wrappedResponse.setCookieSettings(cookieSettings); - } - - @Override - public void setDimensions(Set dimensions) { - wrappedResponse.setDimensions(dimensions); - } - - /** - * Sets the entity representation. - * - * @param entity - * The entity representation. - */ - @Override - public void setEntity(Representation entity) { - getWrappedResponse().setEntity(entity); - } - - /** - * Sets a textual entity. - * - * @param value - * The represented string. - * @param mediaType - * The representation's media type. - */ - @Override - public void setEntity(String value, MediaType mediaType) { - getWrappedResponse().setEntity(value, mediaType); - } - - /** - * Sets the reference that the client should follow for redirections or - * resource creations. - * - * @param locationRef - * The reference to set. - */ - @Override - public void setLocationRef(Reference locationRef) { - getWrappedResponse().setLocationRef(locationRef); - } - - /** - * Sets the reference that the client should follow for redirections or - * resource creations. - * - * @param locationUri - * The URI to set. - */ - @Override - public void setLocationRef(String locationUri) { - getWrappedResponse().setLocationRef(locationUri); - } - - /** - * Sets the list of authentication requests sent by a proxy to a client. - * - * @param requests - * The list of authentication requests sent by a proxy to a - * client. - */ - @Override - public void setProxyChallengeRequests(List requests) { - getWrappedResponse().setProxyChallengeRequests(requests); - } - - /** - * Sets the associated request. - * - * @param request - * The associated request - */ - @Override - public void setRequest(Request request) { - getWrappedResponse().setRequest(request); - } - - /** - * Sets the associated request. - * - * @param request - * The associated request - */ - public void setRequest(WrapperRequest request) { - getWrappedResponse().setRequest(request); - } - - @Override - public void setRetryAfter(Date retryAfter) { - wrappedResponse.setRetryAfter(retryAfter); - } - - @Override - public void setServerInfo(ServerInfo serverInfo) { - wrappedResponse.setServerInfo(serverInfo); - } - - /** - * Sets the status. - * - * @param status - * The status to set. - */ - @Override - public void setStatus(Status status) { - getWrappedResponse().setStatus(status); - } - - /** - * Sets the status. - * - * @param status - * The status to set. - * @param message - * The status message. - */ - @Override - public void setStatus(Status status, String message) { - getWrappedResponse().setStatus(status, message); - } - - @Override - public void setStatus(Status status, Throwable throwable) { - wrappedResponse.setStatus(status, throwable); - } - - @Override - public void setStatus(Status status, Throwable throwable, String message) { - wrappedResponse.setStatus(status, throwable, message); - } - - @Override - public String toString() { - return wrappedResponse.toString(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRestlet.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRestlet.java deleted file mode 100644 index 31f8a1c868..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/WrapperRestlet.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.util; - -import java.util.logging.Logger; - -import org.restlet.client.Context; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.Restlet; - -/** - * Restlet wrapper. Useful for application developer who need to wrap a Restlet - * instance. - * - * @author Thierry Boileau - * @see The decorator (aka - * wrapper) pattern - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class WrapperRestlet extends Restlet { - - /** The wrapped Restlet instance. */ - private Restlet wrappedRestlet; - - /** - * Constructor. - * - * @param wrappedRestlet - * The wrapped Restlet instance. - */ - public WrapperRestlet(Restlet wrappedRestlet) { - super(); - this.wrappedRestlet = wrappedRestlet; - } - - - @Override - public String getAuthor() { - return wrappedRestlet.getAuthor(); - } - - @Override - public Context getContext() { - return wrappedRestlet.getContext(); - } - - @Override - public String getDescription() { - return wrappedRestlet.getDescription(); - } - - @Override - public Logger getLogger() { - return wrappedRestlet.getLogger(); - } - - @Override - public String getName() { - return wrappedRestlet.getName(); - } - - @Override - public String getOwner() { - return wrappedRestlet.getOwner(); - } - - @Override - public void handle(Request request, Response response) { - wrappedRestlet.handle(request, response); - } - - @Override - public boolean isStarted() { - return wrappedRestlet.isStarted(); - } - - @Override - public boolean isStopped() { - return wrappedRestlet.isStopped(); - } - - @Override - public void setAuthor(String author) { - wrappedRestlet.setAuthor(author); - } - - @Override - public void setContext(Context context) { - wrappedRestlet.setContext(context); - } - - @Override - public void setDescription(String description) { - wrappedRestlet.setDescription(description); - } - - @Override - public void setName(String name) { - wrappedRestlet.setName(name); - } - - @Override - public void setOwner(String owner) { - wrappedRestlet.setOwner(owner); - } - - @Override - public synchronized void start() throws Exception { - wrappedRestlet.start(); - } - - @Override - public synchronized void stop() throws Exception { - wrappedRestlet.stop(); - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/package.html deleted file mode 100644 index 325e5faa6f..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/util/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - - Various utility classes. -

- @since Restlet 1.0 - @see User Guide - Util package - @deprecated Will be removed in the next 2.7/3.0 release. - - diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/AnnotationInfo.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/AnnotationInfo.java deleted file mode 100644 index 7f9d21602b..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/AnnotationInfo.java +++ /dev/null @@ -1,142 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.rebind; - -import java.util.ArrayList; -import java.util.List; - -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Method; -import org.restlet.client.representation.Variant; -import org.restlet.client.service.MetadataService; - -/** - * Descriptor for method annotations. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class AnnotationInfo { - /** The annotated Java method. */ - private final java.lang.reflect.Method javaMethod; - - /** The matching Restlet method. */ - private final Method restletMethod; - - /** The annotation value. */ - private final String value; - - /** - * Constructor. - * - * @param restletMethod - * The matching Restlet method. - * @param javaMethod - * The annotated Java method. - * @param value - * The annotation value. - */ - public AnnotationInfo(Method restletMethod, - java.lang.reflect.Method javaMethod, String value) { - super(); - this.restletMethod = restletMethod; - this.javaMethod = javaMethod; - this.value = value; - } - - /** - * Returns the input types of the Java method. - * - * @return The input types of the Java method. - */ - public Class[] getJavaInputTypes() { - return getJavaMethod().getParameterTypes(); - } - - /** - * Returns the annotated Java method. - * - * @return The annotated Java method. - */ - public java.lang.reflect.Method getJavaMethod() { - return javaMethod; - } - - /** - * Returns the output type of the Java method. - * - * @return The output type of the Java method. - */ - public Class getJavaOutputType() { - return getJavaMethod().getReturnType(); - } - - /** - * Returns a list of request variants based on the annotation value. - * - * @param metadataService - * The metadata service to use. - * @return A list of response variants. - */ - public List getRequestVariants(MetadataService metadataService) { - List result = null; - String value = getValue(); - - if (value != null) { - int colonIndex = value.indexOf(':'); - - if (colonIndex != -1) { - value = getValue().substring(0, colonIndex); - } - - if (value != null) { - String[] extensions = value.split("\\|"); - - if (extensions != null) { - for (String extension : extensions) { - List mediaTypes = metadataService - .getAllMediaTypes(extension); - - if (mediaTypes != null) { - if (result == null) { - result = new ArrayList(); - } - - for (MediaType mediaType : mediaTypes) { - result.add(new Variant(mediaType)); - } - } - } - } - } - } - - return result; - } - - /** - * Returns the matching Restlet method. - * - * @return The matching Restlet method. - */ - public Method getRestletMethod() { - return restletMethod; - } - - /** - * Returns the annotation value. - * - * @return The annotation value. - */ - private String getValue() { - return value; - } -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/AnnotationUtils.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/AnnotationUtils.java deleted file mode 100644 index d0b120eb12..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/AnnotationUtils.java +++ /dev/null @@ -1,212 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.rebind; - -import java.lang.annotation.Annotation; -import java.util.List; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import org.restlet.client.engine.util.emul.CopyOnWriteArrayList; - -import org.restlet.client.data.Method; - -/** - * Utilities to manipulate Restlet annotations. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class AnnotationUtils { - - /** Annotation info cache. */ - private static final ConcurrentMap, List> cache = new ConcurrentHashMap, List>(); - - /** - * Computes the annotation descriptors for the given class or interface. - * - * @param clazz - * The class or interface to introspect. - * @return The annotation descriptors. - */ - private static List addAnnotations( - List descriptors, Class clazz) { - List result = descriptors; - - // Add the annotation descriptor - if (result == null) { - result = new CopyOnWriteArrayList(); - } - - AnnotationInfo anno = null; - for (java.lang.reflect.Method javaMethod : clazz.getMethods()) { - anno = getAnnotation(javaMethod); - - if (anno != null) { - result.add(anno); - } - } - - return result; - } - - /** - * Clears the annotation descriptors cache. - */ - public static void clearCache() { - cache.clear(); - } - - /** - * Returns the annotation descriptor for the given resource class. - * - * @param javaMethod - * The Java method. - * @return The annotation descriptor. - */ - public static AnnotationInfo getAnnotation( - java.lang.reflect.Method javaMethod) { - AnnotationInfo result = null; - - if (javaMethod != null) { - for (Annotation annotation : javaMethod.getAnnotations()) { - org.restlet.client.engine.connector.Method methodAnnotation = annotation.annotationType() - .getAnnotation(org.restlet.client.engine.connector.Method.class); - - if (methodAnnotation != null) { - Method restletMethod = Method.valueOf(methodAnnotation.value()); - - String value = extractAnnotationValue(annotation); - - result = new AnnotationInfo(restletMethod, javaMethod, - value); - } - } - } - - return result; - } - - /** - * Returns the annotation value. - * @param annotation The annotation - * @return the annotation value - */ - private static String extractAnnotationValue(final Annotation annotation) { - final String annotationCanonicalName = annotation.annotationType().getCanonicalName(); - final String annotationStringRepresentation = annotation.toString(); - - // Drop the annotation canonical name - final int index = annotationStringRepresentation.indexOf(annotationCanonicalName); - final String annotationValueStringRepresentation = annotationStringRepresentation.substring(index + annotationCanonicalName.length()); - - // Then extract the value, if any. - final String result; - if (annotationValueStringRepresentation.startsWith(("(value="))) { // (value=blabla) format: JDK 1.8 and below - result = annotationValueStringRepresentation.substring("(value=".length(), annotationValueStringRepresentation.length() - 1); - } else if (annotationValueStringRepresentation.startsWith(("(\""))) { - result = annotationValueStringRepresentation.substring("(\"".length(), annotationValueStringRepresentation.length() - 2); - } else if (annotationValueStringRepresentation.startsWith(("("))) { - result = annotationValueStringRepresentation.substring("(".length(), annotationValueStringRepresentation.length() - 1); - } else { - result = annotationValueStringRepresentation; - } - - return result.isEmpty() - ? null - : result; - } - - - /** - * Returns the first annotation descriptor matching the given Java method. - * - * @param annotations - * The list of annotations. - * @param javaMethod - * The method to match. - * @return The annotation descriptor. - */ - public static AnnotationInfo getAnnotation( - List annotations, - java.lang.reflect.Method javaMethod) { - if (annotations != null) { - for (AnnotationInfo annotationInfo : annotations) { - if (annotationInfo.getJavaMethod().equals(javaMethod)) { - return annotationInfo; - } - } - } - - return null; - } - - /** - * Returns the first annotation descriptor matching the given Restlet - * method. - * - * @param annotations - * The list of annotations. - * @param restletMethod - * The method to match. - * @return The annotation descriptor. - */ - public static AnnotationInfo getAnnotation( - List annotations, Method restletMethod) { - if (annotations != null) { - for (AnnotationInfo annotationInfo : annotations) { - if (annotationInfo.getRestletMethod().equals(restletMethod)) { - return annotationInfo; - } - } - } - - return null; - } - - /** - * Returns the annotation descriptors for the given resource class. - * - * @param clazz - * The resource class to introspect. - * @return The list of annotation descriptors. - */ - public static List getAnnotations(Class clazz) { - List result = cache.get(clazz); - - if (result == null) { - result = addAnnotations(result, clazz); - List prev = cache.putIfAbsent(clazz, result); - - if (prev != null) { - result = prev; - } - - // Inspect the implemented interfaces for annotations - Class[] interfaces = clazz.getInterfaces(); - - if (interfaces != null) { - for (Class interfaceClass : interfaces) { - result = addAnnotations(result, interfaceClass); - } - } - } - - return result; - } - - /** - * Private constructor to ensure that the class acts as a true utility class - * i.e. it isn't instantiable and extensible. - */ - private AnnotationUtils() { - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/ClientProxyGenerator.java b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/ClientProxyGenerator.java deleted file mode 100644 index fe916f842e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/ClientProxyGenerator.java +++ /dev/null @@ -1,1071 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.rebind; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.lang.annotation.Annotation; -import java.lang.reflect.Constructor; -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.util.Arrays; -import java.util.List; - -import org.restlet.client.Client; -import org.restlet.client.Request; -import org.restlet.client.Response; -import org.restlet.client.Uniform; -import org.restlet.client.data.Form; -import org.restlet.client.data.MediaType; -import org.restlet.client.data.Method; -import org.restlet.client.data.Preference; -import org.restlet.client.data.Protocol; -import org.restlet.client.engine.resource.GwtClientProxy; -import org.restlet.client.representation.ObjectRepresentation; -import org.restlet.client.representation.Representation; -import org.restlet.client.resource.ClientProxy; -import org.restlet.client.resource.ClientResource; -import org.restlet.client.resource.Delete; -import org.restlet.client.resource.ExceptionHandler; -import org.restlet.client.resource.Get; -import org.restlet.client.resource.Post; -import org.restlet.client.resource.Put; -import org.restlet.client.resource.ResourceException; -import org.restlet.client.resource.Result; -import org.restlet.client.resource.Status; - -import com.google.gwt.core.client.GWT; -import com.google.gwt.core.ext.GeneratorContext; -import com.google.gwt.core.ext.PropertyOracle; -import com.google.gwt.core.ext.TreeLogger; -import com.google.gwt.core.ext.TreeLogger.Type; -import com.google.gwt.core.ext.UnableToCompleteException; -import com.google.gwt.core.ext.typeinfo.JClassType; -import com.google.gwt.core.ext.typeinfo.JMethod; -import com.google.gwt.core.ext.typeinfo.JParameter; -import com.google.gwt.core.ext.typeinfo.JParameterizedType; -import com.google.gwt.core.ext.typeinfo.JPrimitiveType; -import com.google.gwt.core.ext.typeinfo.JType; -import com.google.gwt.core.ext.typeinfo.NotFoundException; -import com.google.gwt.core.ext.typeinfo.TypeOracle; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.rpc.SerializationStreamFactory; -import com.google.gwt.user.rebind.ClassSourceFileComposerFactory; -import com.google.gwt.user.rebind.SourceWriter; -import com.google.gwt.user.rebind.rpc.SerializableTypeOracle; -import com.google.gwt.user.rebind.rpc.SerializableTypeOracleBuilder; -import com.google.gwt.user.rebind.rpc.TypeSerializerCreator; - -/** - * Deferred binding generator capable of creating a subclass of - * {@link ClientProxy} implementing a custom Java interface, extending the - * marker {@link ClientProxy} interface, and annotated with Restlet annotations - * such as {@link Get}, {@link Post}, {@link Put} or {@link Delete}. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class ClientProxyGenerator extends com.google.gwt.core.ext.Generator { - - /** The name of the proxy class that will be generated. */ - private String className; - - /** The parent type. */ - private JClassType classType; - - /** Provides metadata to defered binding generators. */ - private GeneratorContext context; - - /** The logger used by the deferred binding generators. */ - private TreeLogger logger; - - /** The package name of the parent type. */ - private String packageName; - - /** Used to write the content of the proxy class. */ - private SourceWriter sourceWriter; - - /** Represents the serializer class. */ - private SerializableTypeOracle sto; - - /** The builder of the serializer class. */ - private SerializableTypeOracleBuilder stob; - - /** The type oracle for the current generator context. */ - private TypeOracle typeOracle; - - /** - * The parent type for which a default constructible subclass will be generated. - */ - private String typeQName; - - /** - * Default constructor. - */ - public ClientProxyGenerator() { - this.logger = null; - this.classType = null; - this.context = null; - this.className = null; - this.packageName = null; - this.typeQName = null; - this.sourceWriter = null; - this.typeOracle = null; - this.stob = null; - this.sto = null; - } - - /** - * Add a new type to be serialized. - * - * @param type - * The type to add. - */ - private void addRootType(JType type) { - try { - if (!(type.isClass() != null - && (getTypeOracle().getType(Representation.class.getName()).isAssignableFrom(type.isClass()) - || getTypeOracle().getType(Form.class.getName()).isAssignableFrom(type.isClass())))) { - // Do not render Representation and Form instances - getStob().addRootType(getLogger(), type); - } - } catch (Exception e) { - getStob().addRootType(getLogger(), type); - } - } - - /** - * Generates the name of the given parameter type. - * - * @param parameterType - * the Java parameter type. - * @param genericParameterType - * the Java formal parameter type - * @return - */ - private static String buildParameterTypeName(Class parameterType, java.lang.reflect.Type genericParameterType) { - java.lang.reflect.Type type = (genericParameterType instanceof ParameterizedType) - ? ((ParameterizedType) genericParameterType).getActualTypeArguments()[0] - : null; - - return getTypeName(type == null ? parameterType : genericParameterType); - } - - /** - * Generates the name of the given type into the given StringBuilder. - * - * @param type - * The type. - * @param sb - * The stringBuilder to complete. - */ - private static void buildTypeName(java.lang.reflect.Type type, StringBuilder sb) { - if (type instanceof Class) { - if (((Class) type).isArray()) { - buildTypeName(((Class) type).getComponentType(), sb); - sb.append("[]"); - } else { - sb.append(((Class) type).getName()); - } - } else if (type instanceof GenericArrayType) { - buildTypeName(((GenericArrayType) type).getGenericComponentType(), sb); - sb.append("[]"); - } else if (type instanceof ParameterizedType) { - ParameterizedType t = (ParameterizedType) type; - buildTypeName(t.getRawType(), sb); - sb.append("<"); - - if (t.getActualTypeArguments().length >= 1) { - buildTypeName(t.getActualTypeArguments()[0], sb); - - for (int i = 1; i < t.getActualTypeArguments().length; i++) { - sb.append(", "); - buildTypeName(t.getActualTypeArguments()[i], sb); - } - } - - sb.append(">"); - } else { - sb.append(type.toString()); - } - } - - private static String getTypeName(java.lang.reflect.Type type) { - StringBuilder sb = new StringBuilder(); - buildTypeName(type, sb); - return sb.toString(); - } - - @Override - public String generate(TreeLogger logger, GeneratorContext context, String typeQName) - throws UnableToCompleteException { - String result = null; - - try { - this.logger = logger; - this.context = context; - this.typeQName = typeQName; - this.sourceWriter = null; - this.typeOracle = context.getTypeOracle(); - this.classType = typeOracle.getType(typeQName); - this.packageName = getClassType().getPackage().getName(); - this.className = getClassType().getSimpleSourceName() + "Impl"; - generateProxy(); - result = getPackageName() + "." + getClassName(); - } catch (Exception e) { - e.printStackTrace(); - UnableToCompleteException utce = new UnableToCompleteException(); - utce.initCause(e); - throw utce; - } - - return result; - } - - /** - * Generates the default constructor. - */ - protected void generateContructor() { - println("public " + getClassName() + "() {"); - indent(); - println("super(GWT.getModuleBaseURL(),"); - indent(); - println("SERIALIZATION_POLICY, "); - println("SERIALIZER);"); - outdent(); - outdent(); - println("}"); - } - - /** - * Generates the private members of the proxy class. - * - * @param serializableTypeOracle - * The type of the object serializer/deserializer. - */ - protected void generateFields(SerializableTypeOracle serializableTypeOracle) { - String tsn = getTypeSerializerQualifiedName(getClassType()); - - println("private static final String SERIALIZATION_POLICY =\"null\";"); - println("private static final " + tsn + " SERIALIZER = new " + tsn + "();"); - } - - /** - * Generates the code of a given Java method (must be correctly annotated using - * Restlet annotation). - * - * @param method - * The Java method. - * @throws Exception - */ - protected void generateMethod(java.lang.reflect.Method method) throws Exception { - AnnotationInfo info = AnnotationUtils.getAnnotation(method); - - if (info == null) { - if (method.getAnnotations() != null && method.getAnnotations().length > 0) { - // Try to detect anomalies in the annotations definition - for (Annotation annotation : method.getAnnotations()) { - if (annotation.annotationType().getName().startsWith("org.restlet.client.resource")) { - throw new IllegalArgumentException("The " + getTypeQName() + " interface contains a \"" - + method.getName() - + "\" method that refers to an annotation that does not come from the Restlet edition for GWT: " - + annotation.annotationType().getName() - + ". The correct package name must be \"org.restlet.client.resource\"."); - } - } - } - getLogger().log(Type.WARN, "The " + getTypeQName() + " interface contains a \"" + method.getName() - + "\" method without a proper annotation taken from the Restlet edition for GWT."); - } else { - int modifiers = method.getModifiers(); - if (Modifier.isPublic(modifiers)) { - print("public "); - } else if (Modifier.isPrivate(modifiers)) { - print("private "); - } else if (Modifier.isProtected(modifiers)) { - print("protected "); - } - - print("void " + method.getName() + "("); - - Class[] parameterTypes = method.getParameterTypes(); - java.lang.reflect.Type[] genericParameterTypes = method.getGenericParameterTypes(); - - ParameterType callbackParameterType = null; - ParameterType requestEntityParameterType = null; - java.util.Map exceptionHandlerParameterByStatusCode = new java.util.HashMap<>(); - - // write the list of parameters - for (int i = 0; i < parameterTypes.length; i++) { - ParameterType parameterType = new ParameterType(parameterTypes[i], genericParameterTypes[i]); - - if (i > 0) { - print(", "); - } - if (parameterType.isA(AsyncCallback.class) || parameterType.isA(Result.class)) { - callbackParameterType = parameterType; - print("final " + parameterType.asString + " callback"); - - } else if (parameterType.isA(ExceptionHandler.class)) { - if (parameterType.genericType instanceof ParameterizedType) { - java.lang.reflect.Type exceptionType = ((ParameterizedType) parameterType.genericType) - .getActualTypeArguments()[0]; - Class exceptionClass = Class.forName(getTypeName(exceptionType)); - Status statusAnnotation = exceptionClass.getAnnotation(Status.class); - - String parameterName = "exceptionHandler" + i; - if (statusAnnotation != null) { - int code = statusAnnotation.value(); - exceptionHandlerParameterByStatusCode.put(code, - new ExceptionHandlerParameter(getTypeName(exceptionType), parameterName)); - } - - print("final " + parameterType.asString + " " + parameterName); - - } else { - getLogger().log(Type.WARN, - "The " + getTypeQName() + " interface contains a \"" + method.getName() - + "\" method that declares an exception handler without Exception: " - + parameterType.asString); - print("final " + parameterType.asString + " param" + i); - } - } else if (i == 0) { - // By convention, only the first parameter can be passed as single parameter of - // the callback method. - requestEntityParameterType = parameterType; - print("final " + parameterType.asString + " requestEntity"); - - } else { - print("final " + parameterType.asString + " param" + i); - } - } - - println(") {"); - indent(); - - println("final SerializationStreamFactory serializationStreamFactory = (SerializationStreamFactory) " - + getClassName() + ".this;"); - println("final ClientResource clientResource = getClientResource();"); - - if (requestEntityParameterType != null) { - - if (requestEntityParameterType.isA(Representation.class)) { - println("clientResource.getRequest().setEntity(requestEntity);"); - } else if (requestEntityParameterType.isA(Form.class)) { - println("clientResource.getRequest().setEntity((requestEntity == null) ? null : requestEntity.getWebRepresentation());"); - } else { - println("Representation requestRepresentation = new ObjectRepresentation<" - + requestEntityParameterType.asString + ">(serializationStreamFactory, requestEntity);"); - println("clientResource.getRequest().setEntity(requestRepresentation);"); - } - } else { - println("clientResource.getRequest().setEntity(null);"); - } - - println(); - println("if (clientResource.getClientInfo().getAcceptedMediaTypes().isEmpty()) {"); - indent(); - println("clientResource.getClientInfo().getAcceptedMediaTypes().add(new Preference(MediaType.APPLICATION_JAVA_OBJECT_GWT));"); - outdent(); - println("}"); - println(); - println("clientResource.setMethod(Method." + info.getRestletMethod().toString() + ");"); - - // Generate the callback - println("clientResource.setOnResponse(new Uniform() {"); - indent(); - println("@Override"); - println("public void handle(final Request request, final Response response) {"); - indent(); - println("if (clientResource.getStatus().isError()) {"); - indent(); - generateErrorResponseCallback(exceptionHandlerParameterByStatusCode); - outdent(); - println("} else {"); - indent(); - - if (callbackParameterType != null) { - generateSuccessResponseCallback(callbackParameterType); - } else { - getLogger().log(Type.WARN, "The " + getTypeQName() + " interface contains a \"" + method.getName() - + "\" method without a callback."); - } - - outdent(); - println("}"); - outdent(); - println("}"); - outdent(); - println("});"); - - println("clientResource.handle();"); - - outdent(); - println("}"); - - } - } - - private void generateSuccessResponseCallback(ParameterType callbackParameterType) { - java.lang.reflect.Type callbackType = (callbackParameterType.genericType instanceof ParameterizedType) - ? ((ParameterizedType) callbackParameterType.genericType).getActualTypeArguments()[0] - : null; - - if (callbackType == null || Void.class.equals(callbackType)) { - println("callback.onSuccess(null);"); - } else { - String callbackTypeAsString = getTypeName(callbackType); - boolean callbackHandlesAString = String.class.getName().equals(callbackTypeAsString); - - println(callbackTypeAsString + " result = null;"); - println("boolean serializationError = false;"); - println(); - println("try {"); - indent(); - println("if(response.isEntityAvailable()){"); - indent(); - println("if (MediaType.APPLICATION_JAVA_OBJECT_GWT.equals(response.getEntity().getMediaType())) {"); - indent(); - println("result = new ObjectRepresentation<" + callbackTypeAsString + ">("); - indent(); - println("response.getEntity().getText(), serializationStreamFactory, " + callbackHandlesAString + ")"); - println(".getObject();"); - outdent(); - outdent(); - println("} else {"); - indent(); - if (callbackHandlesAString) { - println("result = response.getEntity().getText();"); - } else { - println("callback.onFailure(new ResourceException(new IOException(\"Can't parse the enclosed entity because of its media type. Expected <\" + MediaType.APPLICATION_JAVA_OBJECT_GWT + \"> but was <\" + response.getEntity().getMediaType() + \">. Make sure you have added the org.restlet.client.ext.gwt.jar file to your server.\")));"); - } - outdent(); - println("}"); - outdent(); - println("}"); - outdent(); - println("} catch (Throwable e) {"); - indent(); - println("// Serialization error, considered as a communication error."); - println("serializationError = true;"); - println("callback.onFailure(new ResourceException(e));"); - outdent(); - println("}"); - println(); - println("if (!serializationError) {"); - indent(); - println("callback.onSuccess(result);"); - outdent(); - println("}"); - } - } - - private void generateErrorResponseCallback( - java.util.Map exceptionHandlerParameterByStatusCode) { - println("if (!response.isEntityAvailable()) {"); - indent(); - println("callback.onFailure(new ResourceException(getClientResource().getStatus()));"); - outdent(); - println("} else {"); - indent(); - println("Representation lRepresentation = response.getEntity();"); - println("MediaType lMediaType = lRepresentation.getMediaType();"); - - println("if (!MediaType.APPLICATION_JAVA_OBJECT_GWT.equals(lMediaType)) {"); - indent(); - println("callback.onFailure(new IOException(\"Can't parse the enclosed entity because of its media type. Expected <\" + MediaType.APPLICATION_JAVA_OBJECT_GWT + \"> but was <\" + response.getEntity().getMediaType() + \">. Make sure you have added the org.restlet.client.ext.gwt.jar file to your server.\"));"); - outdent(); - println("} else {"); - indent(); - println("try {"); - indent(); - for (int code : exceptionHandlerParameterByStatusCode.keySet()) { - ExceptionHandlerParameter exceptionHandlerParameter = exceptionHandlerParameterByStatusCode.get(code); - - println("if (" + code + " == clientResource.getStatus().getCode()) {"); - indent(); - println("ObjectRepresentation<" + exceptionHandlerParameter.handledExceptionTypeName - + "> lExceptionRepresentation = new ObjectRepresentation<>(lRepresentation.getText(), serializationStreamFactory, false);"); - println(exceptionHandlerParameter.handlerParameterName + ".handle(lExceptionRepresentation.getObject());"); - println("return;"); - outdent(); - println("}"); - } - println("callback.onFailure(new ResourceException(getClientResource().getStatus()));"); - outdent(); - println("} catch (Throwable e) {"); - indent(); - println("com.google.gwt.core.client.GWT.log(\"representation => \", e);"); - println("callback.onFailure(new ResourceException(e));"); - outdent(); - println("}"); - outdent(); - println("}"); - outdent(); - println("}"); - } - - /** - * Generates the code of the proxy class. - * - * @throws Exception - */ - protected void generateProxy() throws Exception { - PrintWriter printWriter = getContext().tryCreate(getLogger(), getPackageName(), getClassName()); - - if (printWriter != null) { - generateSerializers(); - - ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(getPackageName(), - getClassName()); - composer.setSuperclass(GwtClientProxy.class.getCanonicalName()); - composer.addImplementedInterface(getTypeQName()); - composer.addImport(GWT.class.getCanonicalName()); - composer.addImport(IOException.class.getCanonicalName()); - composer.addImport(Client.class.getCanonicalName()); - composer.addImport(Protocol.class.getCanonicalName()); - composer.addImport(Preference.class.getCanonicalName()); - composer.addImport(Request.class.getCanonicalName()); - composer.addImport(Response.class.getCanonicalName()); - composer.addImport(Uniform.class.getCanonicalName()); - composer.addImport(Method.class.getCanonicalName()); - composer.addImport(Representation.class.getCanonicalName()); - composer.addImport(ObjectRepresentation.class.getCanonicalName()); - composer.addImport(ResourceException.class.getCanonicalName()); - composer.addImport(AsyncCallback.class.getCanonicalName()); - composer.addImport(Result.class.getCanonicalName()); - composer.addImport(SerializationStreamFactory.class.getCanonicalName()); - composer.addImport(MediaType.class.getCanonicalName()); - composer.addImport(GwtClientProxy.class.getCanonicalName()); - composer.addImport(ClientResource.class.getCanonicalName()); - composer.addImport(ExceptionHandler.class.getCanonicalName()); - - this.sourceWriter = composer.createSourceWriter(getContext(), printWriter); - println(); - generateFields(getSto()); - println(); - generateContructor(); - println(); - - // Generate the proxy methods - Class interfaceClass = Class.forName(getTypeQName()); - - for (java.lang.reflect.Method method : interfaceClass.getMethods()) { - if ("getClientResource".equals(method.getName())) { - continue; - } - if ("void".equals(method.getReturnType().getName())) { - generateMethod(method); - println(); - } else { - getLogger().log(Type.WARN, "The " + getTypeQName() + " interface contains a \"" + method.getName() - + "\" method without a void return type."); - } - } - - outdent(); - println("}"); - getContext().commit(getLogger(), printWriter); - } - } - - /** - * Generates the code of the necessary object serializers. - * - * @throws UnableToCompleteException - */ - protected void generateSerializers() throws UnableToCompleteException { - try { - try { - this.stob = getSerializableTypeOracleBuilder2_7(); - } catch (Exception e2_7) { - try { - this.stob = getSerializableTypeOracleBuilder2_5(); - } catch (Exception e2_5) { - try { - this.stob = getSerializableTypeOracleBuilder2_3(); - } catch (Exception e2_3) { - try { - this.stob = getSerializableTypeOracleBuilder2_2(); - } catch (Exception e2_2) { - getLogger().log(TreeLogger.ERROR, "", e2_2); - throw new UnableToCompleteException(); - } - } - } - } - - //this.stob.setTypeFilter(new RestletBlackListTypeFilter(getLogger(), getContext().getPropertyOracle())); - - // Discover and add serializable types - getStob().addRootType(getLogger(), getTypeOracle().getType(String.class.getName())); - JMethod[] methods = getClassType().getOverridableMethods(); - JClassType exceptionClass = getTypeOracle().getType(Exception.class.getName()); - - List undiscoveredTypes = Arrays.asList(getTypeOracle().getType(AsyncCallback.class.getName()), - getTypeOracle().getType(Result.class.getName()), - getTypeOracle().getType(ExceptionHandler.class.getName())); - - for (JMethod method : methods) { - if ("getClientResource".equals(method.getName())) { - continue; - } - - JType returnType = method.getReturnType(); - - if (returnType != JPrimitiveType.VOID) { - getStob().addRootType(getLogger(), returnType); - } - - JParameter[] parameters = method.getParameters(); - for (JParameter parameter : parameters) { - JType parameterType = parameter.getType(); - JParameterizedType parameterizedType = parameterType.isParameterized(); - if (parameterizedType == null) { - // Non generic type. - addRootType(parameterType); - } else if (!undiscoveredTypes.contains(parameterizedType.getBaseType())) { - // Generic type but not a callback. - addRootType(parameterType); - } else { - // Callback type, inspect the "inner" type. - if (parameterizedType.getTypeArgs().length > 0) { - JClassType t = parameterizedType.getTypeArgs()[0]; - // Add the enclosed type if it is not equals to java.lang.Void. - if (t != null - && !("Void".equals(t.getName()) && "java.lang".equals(t.getPackage().getName()))) { - addRootType(t); - } - } - } - } - - JType[] exceptions = method.getThrows(); - for (JType exception : exceptions) { - if (!exceptionClass.isAssignableFrom(exception.isClass())) { - getLogger().log(Type.WARN, "Only checked exceptions are supported"); - } - addRootType(exception); - } - } - - // Log serialization information - OutputStream los = getContext().tryCreateResource(getLogger(), - getClassType().getQualifiedSourceName() + ".restlet.log"); - java.lang.reflect.Method setLogOs = null; - Object setLogOsParameter = null; - try { - setLogOs = getStob().getClass().getDeclaredMethod("setLogOutputStream", OutputStream.class); - setLogOsParameter = los; - } catch (SecurityException e1) { - } catch (NoSuchMethodException e) { - try { - setLogOs = getStob().getClass().getDeclaredMethod("setLogOutputWriter", PrintWriter.class); - setLogOsParameter = new PrintWriter(los); - } catch (SecurityException e1) { - } catch (NoSuchMethodException e1) { - } - } - if (setLogOs != null) { - try { - setLogOs.invoke(getStob(), setLogOsParameter); - } catch (Throwable e) { - getLogger().log(Type.WARN, "Cannot set the log writer " + setLogOs.getName()); - } - } else { - getLogger().log(Type.WARN, "Cannot set the log writer for the compilation phase."); - } - this.sto = getStob().build(getLogger()); - - if (los != null) { - getContext().commitResource(getLogger(), los).setVisibility(com.google.gwt.core.ext.linker.EmittedArtifact.Visibility.Private); - } - - TypeSerializerCreator tsc = null; - try { - tsc = getTypeSerializerCreatorGwt2_1(); - } catch (Exception e2_1) { - try { - tsc = getTypeSerializerCreatorGwt2_2(); - } catch (Exception e2_2) { - try { - tsc = getTypeSerializerCreatorGwt2_0(); - } catch (Exception e2_0) { - try { - tsc = getTypeSerializerCreatorGwt1_7(); - } catch (Exception e1_7) { - getLogger().log(TreeLogger.ERROR, "", e1_7); - throw new UnableToCompleteException(); - } - } - } - } - if (tsc != null) { - tsc.realize(getLogger()); - } else { - getLogger().log(TreeLogger.ERROR, "Cannot create a TypeSerializerCreator instance."); - throw new UnableToCompleteException(); - } - } catch (NotFoundException e) { - getLogger().log(TreeLogger.ERROR, "", e); - throw new UnableToCompleteException(); - } - } - - /** - * Returns the name of the proxy class that will be generated. - * - * @return The name of the proxy class that will be generated. - */ - protected String getClassName() { - return className; - } - - /** - * Returns the parent type. - * - * @return The parent type. - */ - protected JClassType getClassType() { - return classType; - } - - /** - * Returns the context object that provides metadata to defered binding - * generators. - * - * @return The context object that provides metadata to defered binding - * generators. - */ - protected GeneratorContext getContext() { - return context; - } - - /** - * Returns the logger used by the deferred binding generator. - * - * @return The logger used by the deferred binding generator. - */ - protected TreeLogger getLogger() { - return logger; - } - - /** - * Returns the package name of the parent type. - * - * @return The package name of the parent type. - */ - protected String getPackageName() { - return packageName; - } - - /** - * Instantiates a SerializableTypeOracleBuilder instance using the GWT2.2 and - * before constructor. - * - * @return An instance of a {@link SerializableTypeOracleBuilder}. - * @throws Exception - */ - private SerializableTypeOracleBuilder getSerializableTypeOracleBuilder2_2() throws Exception { - SerializableTypeOracleBuilder result = null; - - Constructor c = null; - c = SerializableTypeOracleBuilder.class.getDeclaredConstructor(TreeLogger.class, PropertyOracle.class, - TypeOracle.class); - result = c.newInstance(getLogger(), getContext().getPropertyOracle(), getTypeOracle()); - - return result; - } - - /** - * Instantiates a SerializableTypeOracleBuilder instance using the GWT2.3 - * constructor. - * - * @return An instance of a {@link SerializableTypeOracleBuilder}. - * @throws Exception - */ - private SerializableTypeOracleBuilder getSerializableTypeOracleBuilder2_3() throws Exception { - SerializableTypeOracleBuilder result = null; - - // At the date of 04 may 2011, the GWT GeneratorContextExt class - // is considered as experimental and surely to be removed from gwt - // package. - Class genClass = Class.forName("com.google.gwt.core.ext.GeneratorContextExt"); - - Constructor c = null; - c = SerializableTypeOracleBuilder.class.getDeclaredConstructor(TreeLogger.class, PropertyOracle.class, - genClass); - result = c.newInstance(getLogger(), getContext().getPropertyOracle(), getContext()); - - return result; - } - - /** - * Instantiates a SerializableTypeOracleBuilder instance using the GWT2.5 - * constructor. - * - * @return An instance of a {@link SerializableTypeOracleBuilder}. - * @throws Exception - */ - private SerializableTypeOracleBuilder getSerializableTypeOracleBuilder2_5() throws Exception { - SerializableTypeOracleBuilder result = null; - - Constructor c = null; - c = SerializableTypeOracleBuilder.class.getDeclaredConstructor(TreeLogger.class, PropertyOracle.class, - GeneratorContext.class); - result = c.newInstance(getLogger(), getContext().getPropertyOracle(), getContext()); - - return result; - } - - /** - * Instantiates a SerializableTypeOracleBuilder instance using the GWT2.7 - * constructor. - * - * @return An instance of a {@link SerializableTypeOracleBuilder}. - * @throws Exception - */ - private SerializableTypeOracleBuilder getSerializableTypeOracleBuilder2_7() throws Exception { - SerializableTypeOracleBuilder result = null; - Constructor c = null; - c = SerializableTypeOracleBuilder.class.getDeclaredConstructor(TreeLogger.class, GeneratorContext.class); - result = c.newInstance(getLogger(), getContext()); - return result; - } - - /** - * Returns the writer used for the content of the proxy class. - * - * @return The writer used for the content of the proxy class. - */ - protected SourceWriter getSourceWriter() { - return sourceWriter; - } - - /** - * Returns the serializer class. - * - * @return The serializer class. - */ - protected SerializableTypeOracle getSto() { - return sto; - } - - /** - * Returns the builder of the serializer class. - * - * @return The builder of the serializer class. - */ - protected SerializableTypeOracleBuilder getStob() { - return stob; - } - - /** - * Returns the type oracle for the current generator context. - * - * @return The type oracle for the current generator context. - */ - protected TypeOracle getTypeOracle() { - return typeOracle; - } - - /** - * Returns the parent type for which a default constructible subclass will be - * generated. - * - * @return The parent type for which a default constructible subclass will be - * generated. - */ - protected String getTypeQName() { - return typeQName; - } - - /** - * Instantiates a TypeSerializerCreator instance using the GWT1.7 constructor. - * - * @return An instance of a TypeSerializerCreator. - * @throws Exception - */ - private TypeSerializerCreator getTypeSerializerCreatorGwt1_7() throws Exception { - Constructor c = TypeSerializerCreator.class.getDeclaredConstructor(TreeLogger.class, - SerializableTypeOracle.class, GeneratorContext.class, String.class); - - return c.newInstance(getLogger(), getSto(), getContext(), getTypeSerializerQualifiedName(getClassType())); - } - - /** - * Instantiates a TypeSerializerCreator instance using the GWT2.0 constructor. - * - * @return An instance of a TypeSerializerCreator. - * @throws Exception - */ - private TypeSerializerCreator getTypeSerializerCreatorGwt2_0() throws Exception { - Constructor c = TypeSerializerCreator.class.getDeclaredConstructor(TreeLogger.class, - SerializableTypeOracle.class, SerializableTypeOracle.class, GeneratorContext.class, String.class); - - return c.newInstance(getLogger(), getSto(), getSto(), getContext(), - getTypeSerializerQualifiedName(getClassType())); - } - - /** - * Instantiates a TypeSerializerCreator instance using the GWT2.1 constructor. - * - * @return An instance of a TypeSerializerCreator. - * @throws Exception - */ - private TypeSerializerCreator getTypeSerializerCreatorGwt2_1() throws Exception { - Constructor c = TypeSerializerCreator.class.getDeclaredConstructor(TreeLogger.class, - SerializableTypeOracle.class, SerializableTypeOracle.class, GeneratorContext.class, String.class, - String.class); - - return c.newInstance(getLogger(), getSto(), getSto(), getContext(), - getTypeSerializerQualifiedName(getClassType()), getTypeSerializerSimpleName(getClassType())); - } - - /** - * Instantiates a TypeSerializerCreator instance using the GWT2.2 constructor. - * - * @return An instance of a TypeSerializerCreator. - * @throws Exception - */ - private TypeSerializerCreator getTypeSerializerCreatorGwt2_2() throws Exception { - // At the date of 14 february 2011, the GWT GeneratorContextExt class - // is considered as experimental and surely to be removed from gwt - // package. - - try { - Class genClass = Class.forName("com.google.gwt.core.ext.GeneratorContextExt"); - Constructor c = TypeSerializerCreator.class.getDeclaredConstructor(TreeLogger.class, - SerializableTypeOracle.class, SerializableTypeOracle.class, genClass, String.class, String.class); - return c.newInstance(getLogger(), getSto(), getSto(), genClass.cast(getContext()), - getTypeSerializerQualifiedName(getClassType()), getTypeSerializerSimpleName(getClassType())); - } catch (ClassNotFoundException e) { - Constructor c = TypeSerializerCreator.class.getDeclaredConstructor(TreeLogger.class, - SerializableTypeOracle.class, SerializableTypeOracle.class, GeneratorContext.class, String.class, - String.class); - return c.newInstance(getLogger(), getSto(), getSto(), getContext(), - getTypeSerializerQualifiedName(getClassType()), getTypeSerializerSimpleName(getClassType())); - } - } - - /** - * Returns the qualified name of the given type serializer. - * - * @param type - * The type serializer's type object. - * @return The qualified name of the given type serializer. - */ - private String getTypeSerializerQualifiedName(JClassType type) { - StringBuilder sb = new StringBuilder(); - - JType leafType = type.getLeafType(); - JClassType classOrInterface = leafType.isClassOrInterface(); - // Add the package name. - String packageName = classOrInterface.getPackage().getName(); - if (packageName != null && packageName.length() > 0) { - sb.append(packageName).append("."); - } - // Add the class name - String className = classOrInterface.getName(); - className = className.replace('.', '_'); - sb.append(className).append("_TypeSerializer"); - return sb.toString(); - } - - /** - * Returns the simple name of the given type serializer. - * - * @param type - * The type serializer's type object. - * @return The simple name of the given type serializer. - */ - private String getTypeSerializerSimpleName(JClassType type) { - StringBuilder sb = new StringBuilder(); - JType leafType = type.getLeafType(); - JClassType classOrInterface = leafType.isClassOrInterface(); - // Add the class name - String className = classOrInterface.getName(); - className = className.replace('.', '_'); - sb.append(className).append("_TypeSerializer"); - return sb.toString(); - } - - /** - * Increments the indentation of the generated source code. - */ - protected void indent() { - getSourceWriter().indent(); - } - - /** - * Decrements the indentation of the generated source code. - */ - protected void outdent() { - getSourceWriter().outdent(); - } - - /** - * Prints the given value in the generated source code. - * - * @param value - * The value to write. - */ - protected void print(String value) { - getSourceWriter().print(value); - } - - /** - * Terminates the current line with a new line separator. - */ - protected void println() { - getSourceWriter().println(); - } - - /** - * Prints the given value in the generated source code and terminates the - * current line with a new line separator. - * - * @param value - * The value to write. - */ - protected void println(String value) { - getSourceWriter().println(value); - } - - private static class ParameterType { - final Class type; - final java.lang.reflect.Type genericType; - final String asString; - - ParameterType(final Class type, final java.lang.reflect.Type genericType) { - this.type = type; - this.genericType = genericType; - asString = buildParameterTypeName(type, genericType); - } - - boolean isA(Class clazz) { - return clazz.isAssignableFrom(type); - } - } - - private static class ExceptionHandlerParameter { - final String handledExceptionTypeName; - final String handlerParameterName; - - ExceptionHandlerParameter(final String handledExceptionTypeName, final String handlerParameterName) { - this.handledExceptionTypeName = handledExceptionTypeName; - this.handlerParameterName = handlerParameterName; - } - } - -} diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/package.html b/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/package.html deleted file mode 100644 index ab9277b510..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/rebind/package.html +++ /dev/null @@ -1,8 +0,0 @@ - - - Deferred binding logic for transparent serialization. -

- @since Restlet 2.0 - @deprecated Will be removed in the next 2.7/3.0 release. - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/resources/org/restlet/Restlet.gwt.xml b/org.restlet.gwt/org.restlet.gwt/src/main/resources/org/restlet/Restlet.gwt.xml deleted file mode 100644 index 9b655ad73e..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/main/resources/org/restlet/Restlet.gwt.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/org.restlet.gwt/org.restlet.gwt/src/test/java/org/restlet/client/engine/EngineTest.java b/org.restlet.gwt/org.restlet.gwt/src/test/java/org/restlet/client/engine/EngineTest.java deleted file mode 100644 index 43ad23024d..0000000000 --- a/org.restlet.gwt/org.restlet.gwt/src/test/java/org/restlet/client/engine/EngineTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.client.engine; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class EngineTest { - - @Test - public void engineVersionShouldBeEqualToMavenProjectVersion() { - // When I retrieve the Maven project's version as stated in the pom file. - Properties properties = new Properties(); - try (InputStream resourceAsStream = EngineTest.class.getClassLoader().getResourceAsStream("maven-version.properties")) { - properties.load(resourceAsStream); - } catch (IOException e) { - Assertions.fail("Can't load the properties file that contain the Maven's project version"); - } - - // Then the Maven project's version should be equal to the Engine's version. - assertEquals(Engine.VERSION, properties.getProperty("maven.version")); - } -} \ No newline at end of file diff --git a/org.restlet.gwt/pom.xml b/org.restlet.gwt/pom.xml deleted file mode 100644 index 51737e28dd..0000000000 --- a/org.restlet.gwt/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../pom.xml - - - org.restlet.gwt - org.restlet.gwt.parent - pom - Restlet Framework - GWT edition - The first REST API framework for GWT - - - org.restlet.gwt - org.restlet.gwt.ext.json - org.restlet.gwt.ext.xml - - - - - - - net.ltgt.gwt.maven - gwt-maven-plugin - 1.1.0 - - - - - - - org.gwtproject - gwt-user - ${lib-gwt-version} - - - org.gwtproject - gwt-dev - ${lib-gwt-version} - - - - - - dev - - - publish - dev - - - - - - maven-source-plugin - - - attach-sources - - jar-no-fork - - - - - - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - - - - - diff --git a/org.restlet.java/org.restlet.ext.atom/pom.xml b/org.restlet.java/org.restlet.ext.atom/pom.xml deleted file mode 100644 index a1d8ca59a2..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/pom.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../../pom.xml - - - org.restlet.ext.atom - bundle - Restlet Framework - Atom extension - Support for the Atom syndication and the AtomPub (Atom Publication Protocol) standards in their 1.0 version. - - - - org.restlet - org.restlet - ${project.version} - - - org.restlet - org.restlet.ext.xml - ${project.version} - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/AtomConverter.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/AtomConverter.java deleted file mode 100644 index 8e2d23dbf1..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/AtomConverter.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import java.io.IOException; -import java.util.List; - -import org.restlet.data.MediaType; -import org.restlet.data.Preference; -import org.restlet.engine.converter.ConverterHelper; -import org.restlet.engine.resource.VariantInfo; -import org.restlet.representation.Representation; -import org.restlet.representation.Variant; -import org.restlet.resource.Resource; - -/** - * Converter between the Atom API and Representation classes. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class AtomConverter extends ConverterHelper { - - private static final VariantInfo VARIANT_ATOM = new VariantInfo( - MediaType.APPLICATION_ATOM); - - private static final VariantInfo VARIANT_ATOMPUB_SERVICE = new VariantInfo( - MediaType.APPLICATION_ATOMPUB_SERVICE); - - // private static final Variant VARIANT_ATOMPUB_CATEGORY = new Variant( - // MediaType.APPLICATION_ATOMPUB_CATEGORY); - - @Override - public List> getObjectClasses(Variant source) { - List> result = null; - - if (VARIANT_ATOM.isCompatible(source)) { - result = addObjectClass(result, Feed.class); - } else if (VARIANT_ATOMPUB_SERVICE.isCompatible(source)) { - result = addObjectClass(result, Service.class); - } - - return result; - } - - @Override - public List getVariants(Class source) { - List result = null; - - if (Feed.class.isAssignableFrom(source)) { - result = addVariant(result, VARIANT_ATOM); - } else if (Service.class.isAssignableFrom(source)) { - result = addVariant(result, VARIANT_ATOMPUB_SERVICE); - } - - return result; - } - - @Override - public float score(Object source, Variant target, Resource resource) { - float result = -1.0F; - - if (source instanceof Feed) { - if (target == null) { - result = 0.5F; - } else if (MediaType.APPLICATION_ATOM.isCompatible(target - .getMediaType())) { - result = 1.0F; - } else { - result = 0.5F; - } - } else if (source instanceof Service) { - if ((target != null) - && MediaType.APPLICATION_ATOMPUB_SERVICE - .isCompatible(target.getMediaType())) { - result = 1.0F; - } else { - result = 0.5F; - } - } - - return result; - } - - @Override - public float score(Representation source, Class target, - Resource resource) { - float result = -1.0F; - - if (target != null) { - if (Feed.class.isAssignableFrom(target)) { - if (MediaType.APPLICATION_ATOM.isCompatible(source - .getMediaType())) { - result = 1.0F; - } else { - result = 0.5F; - } - } else if (Service.class.isAssignableFrom(target)) { - if (MediaType.APPLICATION_ATOMPUB_SERVICE.isCompatible(source - .getMediaType())) { - result = 1.0F; - } else { - result = 0.5F; - } - } - } - - return result; - } - - @SuppressWarnings("unchecked") - @Override - public T toObject(Representation source, Class target, - Resource resource) throws IOException { - Object result = null; - - if (Feed.class.isAssignableFrom(target)) { - result = new Feed(source); - } else if (Service.class.isAssignableFrom(target)) { - result = new Service(source); - } - - return (T) result; - } - - @Override - public Representation toRepresentation(Object source, Variant target, - Resource resource) { - Representation result = null; - - if (source instanceof Representation) { - result = (Representation) source; - } - - return result; - } - - @Override - public void updatePreferences(List> preferences, - Class entity) { - if (Feed.class.isAssignableFrom(entity)) { - updatePreferences(preferences, MediaType.APPLICATION_ATOM, 1.0F); - } else if (Service.class.isAssignableFrom(entity)) { - updatePreferences(preferences, - MediaType.APPLICATION_ATOMPUB_SERVICE, 1.0F); - } - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Categories.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Categories.java deleted file mode 100644 index 7f836f768c..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Categories.java +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; -import static org.restlet.ext.atom.Service.APP_NAMESPACE; - -import java.io.IOException; -import java.util.List; - -import org.restlet.Client; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.data.Method; -import org.restlet.data.Reference; -import org.restlet.ext.atom.internal.CategoriesContentReader; -import org.restlet.ext.xml.SaxRepresentation; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.Representation; -import org.xml.sax.SAXException; - -/** - * Collection of {@link Category} entries. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Categories extends SaxRepresentation { - - /** - * The base reference used to resolve relative references found within the - * scope of the xml:base attribute. - */ - private volatile Reference baseReference; - - /** - * The list of entries. - */ - private volatile List entries; - - /** Indicates if the list is fixed. */ - private boolean fixed; - - /** */ - private Reference scheme; - - /** - * Constructor. - * - * @param clientDispatcher - * The client HTTP dispatcher. - * @param categoriesUri - * The feed URI. - * @throws IOException - */ - public Categories(Client clientDispatcher, String categoriesUri) - throws IOException { - this(clientDispatcher.handle(new Request(Method.GET, categoriesUri)) - .getEntity()); - } - - /** - * Constructor. - * - * @param context - * The context from which the client dispatcher will be - * retrieved. - * @param categoriesUri - * The feed URI. - * @throws IOException - */ - public Categories(Context context, String categoriesUri) throws IOException { - this(context.getClientDispatcher() - .handle(new Request(Method.GET, categoriesUri)).getEntity()); - } - - /** - * Constructor. - * - * @param categoriesFeed - * The XML entries document. - * @throws IOException - */ - public Categories(Representation categoriesFeed) throws IOException { - super(categoriesFeed); - setNamespaceAware(true); - parse(new CategoriesContentReader(this)); - } - - /** - * Constructor. - * - * @param categoriesUri - * The feed URI. - * @throws IOException - */ - public Categories(String categoriesUri) throws IOException { - this(new Client(new Reference(categoriesUri).getSchemeProtocol()), - categoriesUri); - - } - - /** - * Returns the base reference used to resolve relative references found - * within the scope of the xml:base attribute. - * - * @return The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public Reference getBaseReference() { - return baseReference; - } - - /** - * Returns the list of entries. - * - * @return The list of entries. - */ - public List getEntries() { - return entries; - } - - /** - * Returns the scheme. - * - * @return The scheme. - */ - public Reference getScheme() { - return this.scheme; - } - - /** - * Indicates if the list is fixed. - * - * @return True if the list is fixed. - */ - public boolean isFixed() { - return fixed; - } - - /** - * Sets the base reference used to resolve relative references found within - * the scope of the xml:base attribute. - * - * @param baseReference - * The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public void setBaseReference(Reference baseReference) { - this.baseReference = baseReference; - } - - /** - * Sets the list of entries. - * - * @param entries - * The list of entries. - */ - public void setEntries(List entries) { - this.entries = entries; - } - - /** - * Indicates if the list is fixed. - * - * @param fixed - * True if the list is fixed. - */ - public void setFixed(boolean fixed) { - this.fixed = fixed; - } - - /** - * Sets the scheme. - * - * @param scheme - * The scheme. - */ - public void setScheme(Reference scheme) { - this.scheme = scheme; - } - - /** - * Writes the representation to a XML writer. - * - * @param writer - * The XML writer to write to. - * @throws IOException - */ - @Override - public void write(XmlWriter writer) throws IOException { - try { - writer.setPrefix(APP_NAMESPACE, ""); - writer.setPrefix(ATOM_NAMESPACE, "atom"); - writer.setDataFormat(true); - writer.setIndentStep(3); - writer.startDocument(); - writeElement(writer); - writer.endDocument(); - } catch (SAXException e) { - IOException ioe = new IOException( - "Unable to write the AtomPub categories document."); - ioe.initCause(e); - throw ioe; - } - } - - /** - * Writes the representation to a XML writer. - * - * @param writer - * The XML writer to write to. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - writer.startElement(APP_NAMESPACE, "categories"); - - for (final Category entry : getEntries()) { - entry.writeElement(writer); - } - - writer.endElement(APP_NAMESPACE, "categories"); - writer.endDocument(); - } -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Category.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Category.java deleted file mode 100644 index 6154139e2d..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Category.java +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import org.restlet.data.Reference; -import org.restlet.ext.xml.XmlWriter; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * Conveys information about a category associated with an entry or feed. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Category { - /** The human-readable label for display in end-user applications. */ - private volatile String label; - - /** The IRI that identifies a categorization scheme. */ - private volatile Reference scheme; - - /** The identifier term. */ - private volatile String term; - - /** - * Constructor. - */ - public Category() { - this(null, null, null); - } - - /** - * Constructor. - * - * @param label - * The identifier term. - * @param scheme - * The IRI that identifies a categorization scheme. - * @param term - * The human-readable label for display in end-user applications. - */ - public Category(String label, Reference scheme, String term) { - this.label = label; - this.scheme = scheme; - this.term = term; - } - - /** - * Returns the label. - * - * @return The label. - */ - public String getLabel() { - return this.label; - } - - /** - * Returns the scheme. - * - * @return The scheme. - */ - public Reference getScheme() { - return this.scheme; - } - - /** - * Returns the term. - * - * @return The term. - */ - public String getTerm() { - return this.term; - } - - /** - * Sets the label. - * - * @param label - * The label. - */ - public void setLabel(String label) { - this.label = label; - } - - /** - * Sets the scheme. - * - * @param scheme - * The scheme. - */ - public void setScheme(Reference scheme) { - this.scheme = scheme; - } - - /** - * Sets the term. - * - * @param term - * The term. - */ - public void setTerm(String term) { - this.term = term; - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - final AttributesImpl attributes = new AttributesImpl(); - if (getLabel() != null) { - attributes.addAttribute("", "label", null, "text", getLabel()); - } - - if ((getScheme() != null) && (getScheme().toString() != null)) { - attributes.addAttribute("", "scheme", null, "atomURI", getScheme() - .toString()); - } - - if (getTerm() != null) { - attributes.addAttribute("", "term", null, "text", getTerm()); - } - - writer.emptyElement(ATOM_NAMESPACE, "category", null, attributes); - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Collection.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Collection.java deleted file mode 100644 index 36800a74d7..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Collection.java +++ /dev/null @@ -1,296 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; -import static org.restlet.ext.atom.Service.APP_NAMESPACE; - -import java.util.List; - -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.data.MediaType; -import org.restlet.data.Method; -import org.restlet.data.Reference; -import org.restlet.data.Status; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.Representation; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * Atom Protocol collection, part of a workspace. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Collection { - - /** - * The accepted media types. - */ - private volatile List accept; - - /** - * The base reference used to resolve relative references found within the - * scope of the xml:base attribute. - */ - private volatile Reference baseReference; - - /** The categories. */ - private volatile Categories categories; - - /** - * The hypertext reference. - */ - private volatile Reference href; - - /** - * The title. - */ - private volatile String title; - - /** - * The parent workspace. - */ - private volatile Workspace workspace; - - /** - * Constructor. - * - * @param workspace - * The parent workspace. - * @param title - * The title. - * @param href - * The hypertext reference. - */ - public Collection(Workspace workspace, String title, String href) { - this.workspace = workspace; - this.title = title; - this.href = new Reference(href); - this.accept = null; - this.categories = null; - } - - /** - * Returns the accepted media types. - * - * @return The accepted media types. - */ - public List getAccept() { - return this.accept; - } - - /** - * Returns the base reference used to resolve relative references found - * within the scope of the xml:base attribute. - * - * @return The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public Reference getBaseReference() { - return baseReference; - } - - /** - * Returns the categories. - * - * @return The categories. - */ - public Categories getCategories() { - return categories; - } - - /** - * Returns the feed representation. - * - * @return The feed representation. - * @throws Exception - */ - public Feed getFeed() throws Exception { - final Reference feedRef = getHref(); - - if (feedRef.isRelative()) { - feedRef.setBaseRef(getWorkspace().getService().getReference()); - } - - final Request request = new Request(Method.GET, feedRef.getTargetRef()); - final Response response = getWorkspace().getService() - .getClientDispatcher().handle(request); - - if (response.getStatus().equals(Status.SUCCESS_OK)) { - return new Feed(response.getEntity()); - } - - throw new Exception( - "Couldn't get the feed representation. Status returned: " - + response.getStatus()); - } - - /** - * Returns the hypertext reference. - * - * @return The hypertext reference. - */ - public Reference getHref() { - return this.href; - } - - /** - * Returns the title. - * - * @return The title. - */ - public String getTitle() { - return this.title; - } - - /** - * Returns the parent workspace. - * - * @return The parent workspace. - */ - public Workspace getWorkspace() { - return this.workspace; - } - - /** - * Posts a member to the collection resulting in the creation of a new - * resource. - * - * @param member - * The member representation to post. - * @return The reference of the new resource. - * @throws Exception - */ - public Reference postMember(Representation member) throws Exception { - final Request request = new Request(Method.POST, getHref(), member); - final Response response = getWorkspace().getService() - .getClientDispatcher().handle(request); - - if (response.getStatus().equals(Status.SUCCESS_CREATED)) { - return response.getLocationRef(); - } - - throw new Exception( - "Couldn't post the member representation. Status returned: " - + response.getStatus()); - } - - /** - * Sets the accepted media types. - * - * @param accept - * The accepted media types. - */ - public void setAccept(List accept) { - this.accept = accept; - } - - /** - * Sets the base reference used to resolve relative references found within - * the scope of the xml:base attribute. - * - * @param baseReference - * The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public void setBaseReference(Reference baseReference) { - this.baseReference = baseReference; - } - - /** - * Sets the categories. - * - * @param categories - * The categories. - */ - public void setCategories(Categories categories) { - this.categories = categories; - } - - /** - * Sets the hypertext reference. - * - * @param href - * The hypertext reference. - */ - public void setHref(Reference href) { - this.href = href; - } - - /** - * Sets the title. - * - * @param title - * The title. - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Sets the parent workspace. - * - * @param workspace - * The parent workspace. - */ - public void setWorkspace(Workspace workspace) { - this.workspace = workspace; - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - - final AttributesImpl attributes = new AttributesImpl(); - if ((getHref() != null) && (getHref().toString() != null)) { - attributes.addAttribute("", "href", null, "atomURI", getHref() - .toString()); - } - - writer.startElement(APP_NAMESPACE, "collection", null, attributes); - - if (getTitle() != null) { - writer.dataElement(ATOM_NAMESPACE, "title", getTitle()); - } - - if (getAccept() != null) { - StringBuilder sb = new StringBuilder(); - for (MediaType mediaType : getAccept()) { - if (sb.length() > 0) { - sb.append(", "); - } - - sb.append(mediaType.toString()); - } - - writer.dataElement(APP_NAMESPACE, "accept", sb.toString()); - } - - try { - if (getCategories() != null) { - getCategories().writeElement(writer); - } - } catch (Exception e) { - e.printStackTrace(); - } - - writer.endElement(APP_NAMESPACE, "collection"); - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Content.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Content.java deleted file mode 100644 index 09236126f6..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Content.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import java.io.IOException; - -import org.restlet.data.MediaType; -import org.restlet.data.Reference; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.Representation; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * Either contains or links to the content of the entry. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Content { - - /** Reference to the external representation. */ - private volatile Reference externalRef; - - /** Expected media type of the external content. */ - private volatile MediaType externalType; - - /** Representation for inline content. */ - private volatile Representation inlineContent; - - /** Must the content be encoded or not? */ - private boolean toEncode; - - /** - * Constructor. - */ - public Content() { - this.inlineContent = null; - this.externalRef = null; - this.externalType = null; - this.toEncode = true; - } - - /** - * Returns the reference to the external representation. - * - * @return The reference to the external representation. - */ - public Reference getExternalRef() { - return this.externalRef; - } - - /** - * Returns the expected media type of the external content. - * - * @return The expected media type of the external content. - */ - public MediaType getExternalType() { - return this.externalType; - } - - /** - * Returns the representation for inline content. - * - * @return The representation for inline content. - */ - public Representation getInlineContent() { - return this.inlineContent; - } - - /** - * Indicates if the content is available externally. - * - * @return True if the content is available externally. - */ - public boolean isExternal() { - return (this.externalRef != null); - } - - /** - * Indicates if the content is available inline. - * - * @return True if the content is available inline. - */ - public boolean isInline() { - return (this.inlineContent != null); - } - - /** - * Returns true if the content is to be encoded. - * - * @return True if the content is to be encoded. - */ - public boolean isToEncode() { - return toEncode; - } - - /** - * Sets the reference to the external representation. - * - * @param externalRef - * The reference to the external representation. - */ - public void setExternalRef(Reference externalRef) { - this.externalRef = externalRef; - } - - /** - * Sets the expected media type of the external content. - * - * @param externalType - * The expected media type of the external content. - */ - public void setExternalType(MediaType externalType) { - this.externalType = externalType; - } - - /** - * Sets the representation for inline content. - * - * @param inlineContent - * The representation for inline content. - */ - public void setInlineContent(Representation inlineContent) { - this.inlineContent = inlineContent; - } - - /** - * Indicates if the content is to be encoded. - * - * @param toEncode - * True if the content is to be encoded. - */ - public void setToEncode(boolean toEncode) { - this.toEncode = toEncode; - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - final AttributesImpl attributes = new AttributesImpl(); - String strContent = null; - - if (getInlineContent() != null) { - final MediaType mediaType = getInlineContent().getMediaType(); - String type = null; - - if ((mediaType != null) && (mediaType.getSubType() != null)) { - if (mediaType.getSubType().contains("xhtml")) { - type = "xhtml"; - } else if (mediaType.getSubType().contains("html")) { - type = "html"; - } else { - type = mediaType.getName(); - } - } - - if (type == null) { - type = "text"; - } - - attributes.addAttribute("", "type", null, "text", type); - - try { - strContent = getInlineContent().getText(); - } catch (IOException e) { - e.printStackTrace(); - } - } else { - if ((getExternalType() != null) - && (getExternalType().toString() != null)) { - attributes.addAttribute("", "type", null, "atomMediaType", - getExternalType().toString()); - } - - if ((getExternalRef() != null) - && (getExternalRef().toString() != null)) { - attributes.addAttribute("", "src", null, "atomURI", - getExternalRef().toString()); - } - } - - if (strContent == null) { - writer.emptyElement(ATOM_NAMESPACE, "content", null, attributes); - } else { - if (isToEncode()) { - writer.dataElement(ATOM_NAMESPACE, "content", null, attributes, - strContent); - } else { - writer.startElement(ATOM_NAMESPACE, "content", null, attributes); - try { - writer.getWriter().write(strContent); - } catch (IOException e) { - throw new SAXException(e); - } - writer.endElement(ATOM_NAMESPACE, "content", null); - } - } - } -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Entry.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Entry.java deleted file mode 100644 index f38b034343..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Entry.java +++ /dev/null @@ -1,547 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.restlet.Client; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.data.MediaType; -import org.restlet.data.Method; -import org.restlet.data.Reference; -import org.restlet.engine.util.DateUtils; -import org.restlet.ext.atom.internal.EntryContentReader; -import org.restlet.ext.xml.SaxRepresentation; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.Representation; -import org.xml.sax.SAXException; - -/** - * Represents an individual entry, acting as a component for metadata and data - * associated with the entry. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Entry extends SaxRepresentation { - - /** The authors of the entry. */ - private volatile List authors; - - /** The categories associated with the entry. */ - private volatile List categories; - - /** Contains or links to the content of the entry. */ - private volatile Content content; - - /** The contributors to the entry. */ - private volatile List contributors; - - /** Permanent, universally unique identifier for the entry. */ - private volatile String id; - - /** The references from the entry to Web resources. */ - private volatile List links; - - /** Moment associated with an event early in the life cycle of the entry. */ - private volatile Date published; - - /** Information about rights held in and over an entry. */ - private volatile Text rights; - - /** Source feed's metadata if the entry was copied from another feed. */ - private volatile Source source; - - /** Short summary, abstract, or excerpt of the entry. */ - private volatile String summary; - - /** The human-readable title for the entry. */ - private volatile Text title; - - /** Most recent moment when the entry was modified in a significant way. */ - private volatile Date updated; - - /** - * Constructor. - */ - public Entry() { - super(MediaType.APPLICATION_ATOM); - setNamespaceAware(true); - this.authors = null; - this.categories = null; - this.content = null; - this.contributors = null; - this.id = null; - this.links = null; - this.published = null; - this.rights = null; - this.source = null; - this.summary = null; - this.title = null; - this.updated = null; - } - - /** - * Constructor. - * - * @param clientDispatcher - * The client HTTP dispatcher. - * @param entryUri - * The entry URI. - * @throws IOException - */ - public Entry(Client clientDispatcher, String entryUri) throws IOException { - this(clientDispatcher.handle(new Request(Method.GET, entryUri)) - .getEntity()); - } - - /** - * Constructor. - * - * @param context - * The context from which the client dispatcher will be - * retrieved. - * @param entryUri - * The entry URI. - * @throws IOException - */ - public Entry(Context context, String entryUri) throws IOException { - this(context.getClientDispatcher() - .handle(new Request(Method.GET, entryUri)).getEntity()); - } - - /** - * Constructor. - * - * @param xmlEntry - * The XML entry document. - * @throws IOException - */ - public Entry(Representation xmlEntry) throws IOException { - super(xmlEntry); - setNamespaceAware(true); - parse(new EntryContentReader(this)); - } - - /** - * Constructor. - * - * @param xmlEntry - * The XML entry document. - * @param entryReader - * Custom entry reader. - * @throws IOException - */ - public Entry(Representation xmlEntry, EntryReader entryReader) - throws IOException { - super(xmlEntry); - setNamespaceAware(true); - parse(new EntryContentReader(this, entryReader)); - } - - /** - * Constructor. - * - * @param entryUri - * The entry URI. - * @throws IOException - */ - public Entry(String entryUri) throws IOException { - this(new Client(new Reference(entryUri).getSchemeProtocol()), entryUri); - } - - /** - * Returns the authors of the entry. - * - * @return The authors of the entry. - */ - public List getAuthors() { - // Lazy initialization with double-check. - List a = this.authors; - if (a == null) { - synchronized (this) { - a = this.authors; - if (a == null) { - this.authors = a = new ArrayList(); - } - } - } - return a; - } - - /** - * Returns the categories associated with the entry. - * - * @return The categories associated with the entry. - */ - public List getCategories() { - // Lazy initialization with double-check. - List c = this.categories; - if (c == null) { - synchronized (this) { - c = this.categories; - if (c == null) { - this.categories = c = new ArrayList(); - } - } - } - return c; - } - - /** - * Returns the content of the entry or links to it. - * - * @return The content of the entry or links to it. - */ - public Content getContent() { - return this.content; - } - - /** - * Returns the contributors to the entry. - * - * @return The contributors to the entry. - */ - public List getContributors() { - // Lazy initialization with double-check. - List c = this.contributors; - if (c == null) { - synchronized (this) { - c = this.contributors; - if (c == null) { - this.contributors = c = new ArrayList(); - } - } - } - return c; - } - - /** - * Returns the permanent, universally unique identifier for the entry. - * - * @return The permanent, universally unique identifier for the entry. - */ - public String getId() { - return this.id; - } - - /** - * Returns the first available link with a given relation type. - * - * @param rel - * The relation type to match. - * @return The first available link with a given relation type. - */ - public Link getLink(Relation rel) { - Link result = null; - Link current = null; - - for (final Iterator iter = getLinks().iterator(); (result == null) - && iter.hasNext();) { - current = iter.next(); - - if (current.getRel() == rel) { - result = current; - } - } - - return result; - } - - /** - * Returns the references from the entry to Web resources. - * - * @return The references from the entry to Web resources. - */ - public List getLinks() { - // Lazy initialization with double-check. - List l = this.links; - if (l == null) { - synchronized (this) { - l = this.links; - if (l == null) { - this.links = l = new ArrayList(); - } - } - } - return l; - } - - /** - * Returns the moment associated with an event early in the life cycle of - * the entry. - * - * @return The moment associated with an event early in the life cycle of - * the entry. - */ - public Date getPublished() { - return this.published; - } - - /** - * Returns the information about rights held in and over an entry. - * - * @return The information about rights held in and over an entry. - */ - public Text getRights() { - return this.rights; - } - - /** - * Returns the source feed's metadata if the entry was copied from another - * feed. - * - * @return The source feed's metadata if the entry was copied from another - * feed. - */ - public Source getSource() { - return this.source; - } - - /** - * Returns the short summary, abstract, or excerpt of the entry. - * - * @return The short summary, abstract, or excerpt of the entry. - */ - public String getSummary() { - return this.summary; - } - - /** - * Returns the human-readable title for the entry. - * - * @return The human-readable title for the entry. - */ - public Text getTitle() { - return this.title; - } - - /** - * Returns the most recent moment when the entry was modified in a - * significant way. - * - * @return The most recent moment when the entry was modified in a - * significant way. - */ - public Date getUpdated() { - return this.updated; - } - - /** - * Sets the content of the entry or links to it. - * - * @param content - * The content of the entry or links to it. - */ - public void setContent(Content content) { - this.content = content; - } - - /** - * Sets the permanent, universally unique identifier for the entry. - * - * @param id - * The permanent, universally unique identifier for the entry. - */ - public void setId(String id) { - this.id = id; - } - - /** - * Sets the moment associated with an event early in the life cycle of the - * entry. - * - * @param published - * The moment associated with an event early in the life cycle of - * the entry. - */ - public void setPublished(Date published) { - this.published = DateUtils.unmodifiable(published); - } - - /** - * Sets the information about rights held in and over an entry. - * - * @param rights - * The information about rights held in and over an entry. - */ - public void setRights(Text rights) { - this.rights = rights; - } - - /** - * Sets the source feed's metadata if the entry was copied from another - * feed. - * - * @param source - * The source feed's metadata if the entry was copied from - * another feed. - */ - public void setSource(Source source) { - this.source = source; - } - - /** - * Sets the short summary, abstract, or excerpt of the entry. - * - * @param summary - * The short summary, abstract, or excerpt of the entry. - */ - public void setSummary(String summary) { - this.summary = summary; - } - - /** - * Sets the human-readable title for the entry. - * - * @param title - * The human-readable title for the entry. - */ - public void setTitle(String title) { - setTitle(new Text(title)); - } - - /** - * Sets the human-readable title for the entry. - * - * @param title - * The human-readable title for the entry. - */ - public void setTitle(Text title) { - this.title = title; - } - - /** - * Sets the most recent moment when the entry was modified in a significant - * way. - * - * @param updated - * The most recent moment when the entry was modified in a - * significant way. - */ - public void setUpdated(Date updated) { - this.updated = DateUtils.unmodifiable(updated); - } - - /** - * Writes the representation to a XML writer. - * - * @param writer - * The XML writer to write to. - * @throws IOException - */ - @Override - public void write(XmlWriter writer) throws IOException { - try { - writer.setPrefix(ATOM_NAMESPACE, ""); - writer.setDataFormat(true); - writer.setIndentStep(3); - writer.startDocument(); - writeElement(writer); - writer.endDocument(); - } catch (SAXException e) { - IOException ioe = new IOException( - "Unable to write the Atom entry document."); - ioe.initCause(e); - throw ioe; - } - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - writer.startElement(ATOM_NAMESPACE, "entry"); - - if (getAuthors() != null) { - for (final Person person : getAuthors()) { - person.writeElement(writer, "author"); - } - } - - if (getCategories() != null) { - for (final Category category : getCategories()) { - category.writeElement(writer); - } - } - - if (getContent() != null) { - getContent().writeElement(writer); - } - - if (getContributors() != null) { - for (final Person person : getContributors()) { - person.writeElement(writer, "contributor"); - } - } - - if (getId() != null) { - writer.dataElement(ATOM_NAMESPACE, "id", getId()); - } - - if (getLinks() != null) { - for (final Link link : getLinks()) { - link.writeElement(writer); - } - } - if (getPublished() != null) { - Text.writeElement(writer, getPublished(), ATOM_NAMESPACE, - "published"); - } - - if (getRights() != null) { - getRights().writeElement(writer, "rights"); - } - - if (getSource() != null) { - getSource().writeElement(writer); - } - - if (getSummary() != null) { - writer.dataElement(ATOM_NAMESPACE, "summary", getSummary()); - } - - if (getTitle() != null) { - getTitle().writeElement(writer, "title"); - } - - if (getUpdated() != null) { - Text.writeElement(writer, getUpdated(), ATOM_NAMESPACE, "updated"); - } - - writeInlineContent(writer); - - writer.endElement(ATOM_NAMESPACE, "entry"); - } - - /** - * Allow to write extra content inside the entry. The default implementation - * does nothing and is intended to be overridden. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeInlineContent(XmlWriter writer) throws SAXException { - // Do nothing by default. - } -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/EntryReader.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/EntryReader.java deleted file mode 100644 index 7e8b586f7d..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/EntryReader.java +++ /dev/null @@ -1,277 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import java.io.IOException; - -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Content reader for entries that is able to transmit events to another - * EntryReader. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class EntryReader extends DefaultHandler { - - /** Extra entry reader. */ - private EntryReader entryReader; - - /** - * Constructor. - */ - public EntryReader() { - super(); - } - - /** - * Constructor. - * - * @param entryReader - * Additional feed reader that will receive all events. - */ - public EntryReader(EntryReader entryReader) { - super(); - this.entryReader = entryReader; - } - - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.characters(ch, start, length); - } - } - - /** - * Called at the end of the XML block that defines the given content - * element. By default, it relays the event to the extra handler. - * - * @param content - * The current content element. - */ - public void endContent(Content content) { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.endContent(content); - } - } - - @Override - public void endDocument() throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.endDocument(); - } - } - - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.endElement(uri, localName, qName); - } - } - - /** - * Called at the end of the XML block that defines the given entry. - * - * @param entry - * The current entry. - */ - public void endEntry(Entry entry) { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.endEntry(entry); - } - } - - /** - * Called at the end of the XML block that defines the given link. - * - * @param link - * The current link. - */ - public void endLink(Link link) { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.endLink(link); - } - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.endPrefixMapping(prefix); - } - } - - @Override - public void error(SAXParseException e) throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.error(e); - } - } - - @Override - public void fatalError(SAXParseException e) throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.fatalError(e); - } - } - - @Override - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.ignorableWhitespace(ch, start, length); - } - } - - @Override - public void notationDecl(String name, String publicId, String systemId) - throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.notationDecl(name, publicId, systemId); - } - } - - @Override - public void processingInstruction(String target, String data) - throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.processingInstruction(target, data); - } - } - - @Override - public InputSource resolveEntity(String publicId, String systemId) - throws IOException, SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - return this.entryReader.resolveEntity(publicId, systemId); - } - return null; - } - - @Override - public void setDocumentLocator(Locator locator) { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.setDocumentLocator(locator); - } - } - - @Override - public void skippedEntity(String name) throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.skippedEntity(name); - } - } - - /** - * Called when a new content element has been detected in the Atom document. - * - * @param content - * The current content element. - */ - public void startContent(Content content) { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.startContent(content); - } - } - - @Override - public void startDocument() throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.startDocument(); - } - } - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.startElement(uri, localName, qName, attributes); - } - } - - /** - * Called when a new entry has been detected in the Atom document. - * - * @param entry - * The current entry. - */ - public void startEntry(Entry entry) { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.startEntry(entry); - } - } - - /** - * Called when a new link has been detected in the Atom document. - * - * @param link - * The current link. - */ - public void startLink(Link link) { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.startLink(link); - } - } - - @Override - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.startPrefixMapping(prefix, uri); - } - } - - @Override - public void unparsedEntityDecl(String name, String publicId, - String systemId, String notationName) throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.unparsedEntityDecl(name, publicId, systemId, - notationName); - } - } - - @Override - public void warning(SAXParseException e) throws SAXException { - // Send the event to the extra handler. - if (this.entryReader != null) { - this.entryReader.warning(e); - } - } -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Feed.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Feed.java deleted file mode 100644 index 57ba5fcd24..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Feed.java +++ /dev/null @@ -1,602 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.restlet.Client; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.data.MediaType; -import org.restlet.data.Method; -import org.restlet.data.Reference; -import org.restlet.engine.util.DateUtils; -import org.restlet.ext.atom.internal.FeedContentReader; -import org.restlet.ext.xml.SaxRepresentation; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.Representation; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * Atom Feed Document, acting as a component for metadata and data associated - * with the feed. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Feed extends SaxRepresentation { - /** Atom Syndication Format namespace. */ - public final static String ATOM_NAMESPACE = "http://www.w3.org/2005/Atom"; - - /** XHTML namespace. */ - public final static String XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; - - /** The authors of the feed. */ - private volatile List authors; - - /** - * The base reference used to resolve relative references found within the - * scope of the xml:base attribute. - */ - private volatile Reference baseReference; - - /** The categories associated with the feed. */ - private volatile List categories; - - /** The contributors to the feed. */ - private volatile List contributors; - - /** - * Individual entries, acting as a components for associated metadata and - * data. - */ - private List entries; - - /** The agent used to generate a feed. */ - private volatile Generator generator; - - /** Image that provides iconic visual identification for a feed. */ - private volatile Reference icon; - - /** Permanent, universally unique identifier for the feed. */ - private volatile String id; - - /** The references from the entry to Web resources. */ - private volatile List links; - - /** Image that provides visual identification for a feed. */ - private volatile Reference logo; - - /** Information about rights held in and over an feed. */ - private volatile Text rights; - - /** Short summary, abstract, or excerpt of an feed. */ - private volatile Text subtitle; - - /** The human-readable title for the feed. */ - private volatile Text title; - - /** Most recent moment when the entry was modified in a significant way. */ - private volatile Date updated; - - /** - * Constructor. - */ - public Feed() { - super(MediaType.APPLICATION_ATOM); - setNamespaceAware(true); - this.authors = null; - this.categories = null; - this.contributors = null; - this.generator = null; - this.icon = null; - this.id = null; - this.links = null; - this.logo = null; - this.rights = null; - this.subtitle = null; - this.title = null; - this.updated = null; - this.entries = null; - } - - /** - * Constructor. - * - * @param clientDispatcher - * The client HTTP dispatcher. - * @param feedUri - * The feed URI. - * @throws IOException - */ - public Feed(Client clientDispatcher, String feedUri) throws IOException { - this(clientDispatcher.handle(new Request(Method.GET, feedUri)) - .getEntity()); - } - - /** - * Constructor. - * - * @param context - * The context from which the client dispatcher will be - * retrieved. - * @param feedUri - * The feed URI. - * @throws IOException - */ - public Feed(Context context, String feedUri) throws IOException { - this(context.getClientDispatcher() - .handle(new Request(Method.GET, feedUri)).getEntity()); - } - - /** - * Constructor. - * - * @param xmlFeed - * The XML feed document. - * @throws IOException - */ - public Feed(Representation xmlFeed) throws IOException { - super(xmlFeed); - setNamespaceAware(true); - parse(new FeedContentReader(this)); - } - - /** - * Constructor. - * - * @param xmlFeed - * The XML feed document. - * @param feedReader - * Custom feed reader. - * @throws IOException - */ - public Feed(Representation xmlFeed, FeedReader feedReader) - throws IOException { - super(xmlFeed); - setNamespaceAware(true); - parse(new FeedContentReader(this, feedReader)); - } - - /** - * Constructor. - * - * @param feedUri - * The feed URI. - * @throws IOException - */ - public Feed(String feedUri) throws IOException { - this(new Client(new Reference(feedUri).getSchemeProtocol()), feedUri); - } - - /** - * Returns the authors of the feed. - * - * @return The authors of the feed. - */ - public List getAuthors() { - // Lazy initialization with double-check. - List a = this.authors; - if (a == null) { - synchronized (this) { - a = this.authors; - if (a == null) { - this.authors = a = new ArrayList(); - } - } - } - return a; - } - - /** - * Returns the base reference used to resolve relative references found - * within the scope of the xml:base attribute. - * - * @return The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public Reference getBaseReference() { - return baseReference; - } - - /** - * Returns the categories associated with the feed. - * - * @return The categories associated with the feed. - */ - public List getCategories() { - // Lazy initialization with double-check. - List c = this.categories; - if (c == null) { - synchronized (this) { - c = this.categories; - if (c == null) { - this.categories = c = new ArrayList(); - } - } - } - return c; - } - - /** - * Returns the contributors to the feed. - * - * @return The contributors to the feed. - */ - public List getContributors() { - // Lazy initialization with double-check. - List c = this.contributors; - if (c == null) { - synchronized (this) { - c = this.contributors; - if (c == null) { - this.contributors = c = new ArrayList(); - } - } - } - return c; - } - - /** - * Returns the individual entries, acting as a components for associated - * metadata and data. - * - * @return The individual entries, acting as a components for associated - * metadata and data. - */ - public List getEntries() { - // Lazy initialization with double-check. - List e = this.entries; - if (e == null) { - synchronized (this) { - e = this.entries; - if (e == null) { - this.entries = e = new ArrayList(); - } - } - } - return e; - } - - /** - * Returns the agent used to generate a feed. - * - * @return The agent used to generate a feed. - */ - public Generator getGenerator() { - return this.generator; - } - - /** - * Returns the image that provides iconic visual identification for a feed. - * - * @return The image that provides iconic visual identification for a feed. - */ - public Reference getIcon() { - return this.icon; - } - - /** - * Returns the permanent, universally unique identifier for the feed. - * - * @return The permanent, universally unique identifier for the feed. - */ - public String getId() { - return this.id; - } - - /** - * Returns the references from the entry to Web resources. - * - * @return The references from the entry to Web resources. - */ - public List getLinks() { - // Lazy initialization with double-check. - List l = this.links; - if (l == null) { - synchronized (this) { - l = this.links; - if (l == null) { - this.links = l = new ArrayList(); - } - } - } - return l; - } - - /** - * Returns the image that provides visual identification for a feed. - * - * @return The image that provides visual identification for a feed. - */ - public Reference getLogo() { - return this.logo; - } - - /** - * Returns the information about rights held in and over an feed. - * - * @return The information about rights held in and over an feed. - */ - public Text getRights() { - return this.rights; - } - - /** - * Returns the short summary, abstract, or excerpt of an feed. - * - * @return The short summary, abstract, or excerpt of an feed. - */ - public Text getSubtitle() { - return this.subtitle; - } - - /** - * Returns the human-readable title for the feed. - * - * @return The human-readable title for the feed. - */ - public Text getTitle() { - return this.title; - } - - /** - * Returns the most recent moment when the entry was modified in a - * significant way. - * - * @return The most recent moment when the entry was modified in a - * significant way. - */ - public Date getUpdated() { - return this.updated; - } - - /** - * Sets the base reference used to resolve relative references found within - * the scope of the xml:base attribute. - * - * @param baseReference - * The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public void setBaseReference(Reference baseReference) { - this.baseReference = baseReference; - } - - /** - * Sets the base URI used to resolve relative references found within the - * scope of the xml:base attribute. - * - * @param baseUri - * The base URI used to resolve relative references found within - * the scope of the xml:base attribute. - */ - public void setBaseReference(String baseUri) { - setBaseReference(new Reference(baseUri)); - } - - /** - * Sets the agent used to generate a feed. - * - * @param generator - * The agent used to generate a feed. - */ - public void setGenerator(Generator generator) { - this.generator = generator; - } - - /** - * Sets the image that provides iconic visual identification for a feed. - * - * @param icon - * The image that provides iconic visual identification for a - * feed. - */ - public void setIcon(Reference icon) { - this.icon = icon; - } - - /** - * Sets the permanent, universally unique identifier for the feed. - * - * @param id - * The permanent, universally unique identifier for the feed. - */ - public void setId(String id) { - this.id = id; - } - - /** - * Sets the image that provides visual identification for a feed. - * - * @param logo - * The image that provides visual identification for a feed. - */ - public void setLogo(Reference logo) { - this.logo = logo; - } - - /** - * Sets the information about rights held in and over an feed. - * - * @param rights - * The information about rights held in and over an feed. - */ - public void setRights(String rights) { - setRights(new Text(rights)); - } - - /** - * Sets the information about rights held in and over an feed. - * - * @param rights - * The information about rights held in and over an feed. - */ - public void setRights(Text rights) { - this.rights = rights; - } - - /** - * Sets the short summary, abstract, or excerpt of an feed. - * - * @param subtitle - * The short summary, abstract, or excerpt of an feed. - */ - public void setSubtitle(String subtitle) { - setSubtitle(new Text(subtitle)); - } - - /** - * Sets the short summary, abstract, or excerpt of an feed. - * - * @param subtitle - * The short summary, abstract, or excerpt of an feed. - */ - public void setSubtitle(Text subtitle) { - this.subtitle = subtitle; - } - - /** - * Sets the human-readable title for the feed. - * - * @param title - * The human-readable title for the feed. - */ - public void setTitle(String title) { - setTitle(new Text(title)); - } - - /** - * Sets the human-readable title for the feed. - * - * @param title - * The human-readable title for the feed. - */ - public void setTitle(Text title) { - this.title = title; - } - - /** - * Sets the most recent moment when the feed was modified in a significant - * way. - * - * @param updated - * The most recent moment when the feed was modified in a - * significant way. - */ - public void setUpdated(Date updated) { - this.updated = DateUtils.unmodifiable(updated); - } - - /** - * Writes the representation to a XML writer. - * - * @param writer - * The XML writer to write to. - * @throws IOException - */ - @Override - public void write(XmlWriter writer) throws IOException { - try { - writer.setPrefix(ATOM_NAMESPACE, ""); - writer.setDataFormat(true); - writer.setIndentStep(3); - writer.startDocument(); - writeElement(writer); - writer.endDocument(); - } catch (SAXException e) { - IOException ioe = new IOException( - "Unable to write the Atom feed document."); - ioe.initCause(e); - throw ioe; - } - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - writer.startElement(ATOM_NAMESPACE, "feed"); - - if (getAuthors() != null) { - for (final Person person : getAuthors()) { - person.writeElement(writer, "author"); - } - } - - if (getCategories() != null) { - for (final Category category : getCategories()) { - category.writeElement(writer); - } - } - if (getContributors() != null) { - for (final Person person : getContributors()) { - person.writeElement(writer, "contributor"); - } - } - - if (getGenerator() != null) { - getGenerator().writeElement(writer); - } - - if (getIcon() != null) { - writer.dataElement(ATOM_NAMESPACE, "icon", getIcon().toString()); - } - - if (getId() != null) { - writer.dataElement(ATOM_NAMESPACE, "id", null, - new AttributesImpl(), getId()); - } - - if (getLinks() != null) { - for (final Link link : getLinks()) { - link.writeElement(writer); - } - } - - if ((getLogo() != null) && (getLogo().toString() != null)) { - writer.dataElement(ATOM_NAMESPACE, "logo", getLogo().toString()); - } - - if (getRights() != null) { - getRights().writeElement(writer, "rights"); - } - - if (getSubtitle() != null) { - getSubtitle().writeElement(writer, "subtitle"); - } - - if (getTitle() != null) { - getTitle().writeElement(writer, "title"); - } - - if (getUpdated() != null) { - Text.writeElement(writer, getUpdated(), ATOM_NAMESPACE, "updated"); - } - - if (getEntries() != null) { - for (final Entry entry : getEntries()) { - entry.writeElement(writer); - } - } - - writer.endElement(ATOM_NAMESPACE, "feed"); - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/FeedReader.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/FeedReader.java deleted file mode 100644 index 4903ef3071..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/FeedReader.java +++ /dev/null @@ -1,304 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import java.io.IOException; - -import org.xml.sax.Attributes; -import org.xml.sax.InputSource; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Content reader for feeds that is able to transmit events to another - * FeedReader. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class FeedReader extends DefaultHandler { - - /** Extra feed reader. */ - private FeedReader feedReader; - - /** - * Constructor. - */ - public FeedReader() { - super(); - } - - /** - * Constructor. - * - * @param feedReader - * Additional feed reader that will receive all events. - */ - public FeedReader(FeedReader feedReader) { - super(); - this.feedReader = feedReader; - } - - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.characters(ch, start, length); - } - } - - /** - * Called at the end of the XML block that defines the given content - * element. By default, it relays the event to the extra handler. - * - * @param content - * The current content element. - */ - public void endContent(Content content) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.endContent(content); - } - } - - @Override - public void endDocument() throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.endDocument(); - } - } - - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.endElement(uri, localName, qName); - } - } - - /** - * Called at the end of the XML block that defines the given entry. - * - * @param entry - * The current entry. - */ - public void endEntry(Entry entry) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.endEntry(entry); - } - } - - /** - * Called at the end of the XML block that defines the given feed. - * - * @param feed - * The current feed. - */ - public void endFeed(Feed feed) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.endFeed(feed); - } - } - - /** - * Called at the end of the XML block that defines the given link. - * - * @param link - * The current link. - */ - public void endLink(Link link) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.endLink(link); - } - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.endPrefixMapping(prefix); - } - } - - @Override - public void error(SAXParseException e) throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.error(e); - } - } - - @Override - public void fatalError(SAXParseException e) throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.fatalError(e); - } - } - - @Override - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.ignorableWhitespace(ch, start, length); - } - } - - @Override - public void notationDecl(String name, String publicId, String systemId) - throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.notationDecl(name, publicId, systemId); - } - } - - @Override - public void processingInstruction(String target, String data) - throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.processingInstruction(target, data); - } - } - - @Override - public InputSource resolveEntity(String publicId, String systemId) - throws IOException, SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - return this.feedReader.resolveEntity(publicId, systemId); - } - return null; - } - - @Override - public void setDocumentLocator(Locator locator) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.setDocumentLocator(locator); - } - } - - @Override - public void skippedEntity(String name) throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.skippedEntity(name); - } - } - - /** - * Called when a new content element has been detected in the Atom document. - * - * @param content - * The current content element. - */ - public void startContent(Content content) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.startContent(content); - } - } - - @Override - public void startDocument() throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.startDocument(); - } - } - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attributes) throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.startElement(uri, localName, qName, attributes); - } - } - - /** - * Called when a new entry has been detected in the Atom document. - * - * @param entry - * The current entry. - */ - public void startEntry(Entry entry) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.startEntry(entry); - } - } - - /** - * Called when a new feed has been detected in the Atom document. - * - * @param feed - * The current feed. - */ - public void startFeed(Feed feed) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.startFeed(feed); - } - } - - /** - * Called when a new link has been detected in the Atom document. - * - * @param link - * The current link. - */ - public void startLink(Link link) { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.startLink(link); - } - } - - @Override - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.startPrefixMapping(prefix, uri); - } - } - - @Override - public void unparsedEntityDecl(String name, String publicId, - String systemId, String notationName) throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.unparsedEntityDecl(name, publicId, systemId, - notationName); - } - } - - @Override - public void warning(SAXParseException e) throws SAXException { - // Send the event to the extra handler. - if (this.feedReader != null) { - this.feedReader.warning(e); - } - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Generator.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Generator.java deleted file mode 100644 index f97e7727c1..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Generator.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import org.restlet.data.Reference; -import org.restlet.ext.xml.XmlWriter; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * Identifies the agent used to generate a feed, for debugging and other - * purposes. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Generator { - - /** Human-readable name for the generating agent. */ - private volatile String name; - - /** Reference of the generating agent. */ - private volatile Reference uri; - - /** Version of the generating agent. */ - private volatile String version; - - /** - * Constructor. - */ - public Generator() { - this(null, null, null); - } - - /** - * Constructor. - * - * @param name - * Human-readable name for the generating agent. - * @param uri - * Reference of the generating agent. - * @param version - * Version of the generating agent. - */ - public Generator(String name, Reference uri, String version) { - this.uri = uri; - this.version = version; - this.name = name; - } - - /** - * Returns the human-readable name for the generating agent. - * - * @return The human-readable name for the generating agent. - */ - public String getName() { - return this.name; - } - - /** - * Returns the reference of the generating agent. - * - * @return The reference of the generating agent. - */ - public Reference getUri() { - return this.uri; - } - - /** - * Returns the version of the generating agent. - * - * @return The version of the generating agent. - */ - public String getVersion() { - return this.version; - } - - /** - * Sets the human-readable name for the generating agent. - * - * @param name - * The human-readable name for the generating agent. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the reference of the generating agent. - * - * @param uri - * The reference of the generating agent. - */ - public void setUri(Reference uri) { - this.uri = uri; - } - - /** - * Sets the version of the generating agent. - * - * @param version - * The version of the generating agent. - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - final AttributesImpl attributes = new AttributesImpl(); - - if ((getUri() != null) && (getUri().toString() != null)) { - attributes.addAttribute("", "uri", null, "atomURI", getUri() - .toString()); - } - - if (getVersion() != null) { - attributes.addAttribute("", "version", null, "text", getVersion()); - } - - if (getName() != null) { - writer.dataElement(ATOM_NAMESPACE, "generator", null, attributes, - getName()); - } else { - writer.emptyElement(ATOM_NAMESPACE, "generator", null, attributes); - } - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Link.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Link.java deleted file mode 100644 index 16201b160d..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Link.java +++ /dev/null @@ -1,261 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import org.restlet.data.Language; -import org.restlet.data.MediaType; -import org.restlet.data.Reference; -import org.restlet.ext.xml.XmlWriter; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * Defines a reference from an entry or feed to a Web resource. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Link { - - /** Contains or links to the content of the entry. */ - private volatile Content content; - - /** The link's IRI. */ - private volatile Reference href; - - /** Language of the resource pointed to by the href attribute. */ - private volatile Language hrefLang; - - /** Advisory length of the linked content in octets. */ - private volatile long length; - - /** The link's relation type. */ - private volatile Relation rel; - - /** Human-readable information about the link. */ - private volatile String title; - - /** Advisory media type. */ - private volatile MediaType type; - - /** - * Constructor. - */ - public Link() { - this.content = null; - this.href = null; - this.rel = null; - this.type = null; - this.hrefLang = null; - this.title = null; - this.length = -1; - } - - /** - * Constructor. - * - * @param href - * The link's IRI. - * @param rel - * The link's relation type. - * @param type - * Advisory media type. - */ - public Link(Reference href, Relation rel, MediaType type) { - super(); - this.href = href; - this.rel = rel; - this.type = type; - } - - /** - * Returns the content of the entry or links to it. - * - * @return The content of the entry or links to it. - */ - public Content getContent() { - return this.content; - } - - /** - * Returns the link's IRI. - * - * @return The link's IRI. - */ - public Reference getHref() { - return this.href; - } - - /** - * Returns the language of the resource pointed to by the href attribute. - * - * @return The language of the resource pointed to by the href attribute. - */ - public Language getHrefLang() { - return this.hrefLang; - } - - /** - * Returns the advisory length of the linked content in octets. - * - * @return The advisory length of the linked content in octets. - */ - public long getLength() { - return this.length; - } - - /** - * Returns the link's relation type. - * - * @return The link's relation type. - */ - public Relation getRel() { - return this.rel; - } - - /** - * Returns the human-readable information about the link. - * - * @return The human-readable information about the link. - */ - public String getTitle() { - return this.title; - } - - /** - * Returns the advisoty media type. - * - * @return The advisoty media type. - */ - public MediaType getType() { - return this.type; - } - - /** - * Sets the content of the entry or links to it. - * - * @param content - * The content of the entry or links to it. - */ - public void setContent(Content content) { - this.content = content; - } - - /** - * Sets the link's IRI. - * - * @param href - * The link's IRI. - */ - public void setHref(Reference href) { - this.href = href; - } - - /** - * Sets the language of the resource pointed to by the href attribute. - * - * @param hrefLang - * The language of the resource pointed to by the href attribute. - */ - public void setHrefLang(Language hrefLang) { - this.hrefLang = hrefLang; - } - - /** - * Sets the advisory length of the linked content in octets. - * - * @param length - * The advisory length of the linked content in octets. - */ - public void setLength(long length) { - this.length = length; - } - - /** - * Sets the link's relation type. - * - * @param rel - * The link's relation type. - */ - public void setRel(Relation rel) { - this.rel = rel; - } - - /** - * Sets the human-readable information about the link. - * - * @param title - * The human-readable information about the link. - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Sets the advisoty media type. - * - * @param type - * The advisoty media type. - */ - public void setType(MediaType type) { - this.type = type; - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - AttributesImpl attributes = new AttributesImpl(); - - if ((getHref() != null) && (getHref().toString() != null)) { - attributes.addAttribute("", "href", null, "atomURI", getHref() - .toString()); - } - - if ((getHrefLang() != null) && (getHrefLang().toString() != null)) { - attributes.addAttribute("", "hreflang", null, "atomLanguageTag", - getHrefLang().toString()); - } - - if (getLength() > 0) { - attributes.addAttribute("", "length", null, "text", - Long.toString(getLength())); - } - - attributes.addAttribute("", "rel", null, "text", - Relation.toString(getRel())); - - if (getTitle() != null) { - attributes.addAttribute("", "title", null, "text", getTitle()); - } - - if (getType() != null) { - attributes.addAttribute("", "type", null, "atomMediaType", - getType().toString()); - } - - if (getContent() != null) { - writer.startElement(ATOM_NAMESPACE, "link", null, attributes); - getContent().writeElement(writer); - writer.endElement(ATOM_NAMESPACE, "link"); - } else { - writer.emptyElement(ATOM_NAMESPACE, "link", null, attributes); - } - - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Person.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Person.java deleted file mode 100644 index 38136a8d5b..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Person.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import org.restlet.data.Reference; -import org.restlet.ext.xml.XmlWriter; -import org.xml.sax.SAXException; - -/** - * Element that describes a person, corporation, or similar entity (hereafter, - * 'person'). - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Person { - - /** - * Email address associated with the person. - */ - private volatile String email; - - /** - * Human-readable name. - */ - private volatile String name; - - /** - * IRI associated with the person. - */ - private volatile Reference uri; - - /** - * Constructor. - */ - public Person() { - this(null, null, null); - } - - /** - * Constructor. - * - * @param name - * The name. - * @param uri - * The URI reference. - * @param email - * The email address. - */ - public Person(String name, Reference uri, String email) { - this.name = name; - this.uri = uri; - this.email = email; - } - - /** - * Returns the email address associated with the person. - * - * @return The email address associated with the person. - */ - public String getEmail() { - return this.email; - } - - /** - * Returns the human-readable name. - * - * @return The human-readable name. - */ - public String getName() { - return this.name; - } - - /** - * Returns the IRI associated with the person. - * - * @return The IRI associated with the person. - */ - public Reference getUri() { - return this.uri; - } - - /** - * Sets the email address. - * - * @param email - * The email address. - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * Sets the human-readable name. - * - * @param name - * The human-readable name. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the IRI associated with the person. - * - * @param uri - * The IRI associated with the person. - */ - public void setUri(Reference uri) { - this.uri = uri; - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @param localName - * The local name of the element. - * @throws SAXException - */ - public void writeElement(XmlWriter writer, String localName) - throws SAXException { - writer.startElement(ATOM_NAMESPACE, localName); - - if (getEmail() != null) { - writer.dataElement(ATOM_NAMESPACE, "email", getEmail()); - } - if (getName() != null) { - writer.dataElement(ATOM_NAMESPACE, "name", getName()); - } - if ((getUri() != null) && (getUri().toString() != null)) { - writer.dataElement(ATOM_NAMESPACE, "uri", getUri().toString()); - } - - writer.endElement(ATOM_NAMESPACE, localName); - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Relation.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Relation.java deleted file mode 100644 index bca77d3141..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Relation.java +++ /dev/null @@ -1,329 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import org.restlet.engine.util.SystemUtils; - -/** - * Enumeration of relation types. - * - * @author Jerome Louvel - * @see IANA - * Atom relations - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Relation { - /** - * Signifies that the IRI in the value of the href attribute identifies an - * alternate version of the resource described by the containing element. - */ - public static final Relation ALTERNATE = new Relation("alternate"); - - /** - * Signifies that the IRI returns a feed document containing the most recent - * entries in the feed. - */ - public static final Relation CURRENT = new Relation("current"); - - /** - * Relationship that asserts that resource B provides a description of - * resource A. There are no constraints on the format or representation of - * either A or B, neither are there any further constraints on either - * resource. - */ - public static final Relation DESCRIBED_BY = new Relation("describedby"); - - /** - * Signifies that the IRI in the value of the href attribute identifies a - * resource that is able to edit the current resource. - */ - public static final Relation EDIT = new Relation("edit"); - - /** - * An IRI of an editable Media Resource. When appearing within an - * atom:entry, the href IRI can be used to retrieve, update and delete the - * Media Resource associated with that Entry. - */ - public static final Relation EDIT_MEDIA = new Relation("edit-media"); - - /** - * Signifies that the IRI in the value of the href attribute identifies a - * related resource that is potentially large in size and might require - * special handling. For atom:link elements with rel="enclosure", the length - * attribute SHOULD be provided. - */ - public static final Relation ENCLOSURE = new Relation("enclosure"); - - /** - * Signifies that the IRI in the value of the href attribute identifies the - * first resource in a series including the current resource. - */ - public static final Relation FIRST = new Relation("first"); - - /** - * A URI for a hub that enables registration for real-time updates to the - * resource. - */ - public static final Relation HUB = new Relation("hub"); - - /** - * Signifies that the IRI in the value of the href attribute identifies the - * last resource in a series including the current resource. - */ - public static final Relation LAST = new Relation("last"); - - /** - * When included on a versioned resource, this link points to a resource - * containing the latest (e.g., current) version. The latest version is - * defined by the system. For linear versioning systems, this is probably - * the latest version by timestamp. For systems that support branching, - * there will be multiple latest versions, one for each branch in the - * version history. Some systems may allow multiple of these link relations. - */ - public static final Relation LAST_VERSION = new Relation("latest-version"); - - /** - * Signifies that the IRI in the value of the href attribute identifies the - * resource describing the license. - */ - public static final Relation LICENSE = new Relation("license"); - - /** - * Signifies that the IRI in the value of the href attribute identifies the - * next resource in a series including the current resource. - */ - public static final Relation NEXT = new Relation("next"); - - /** - * Signifies that the IRI in the value of the href attribute identifies the - * immediately following archive document. - */ - public static final Relation NEXT_ARCHIVE = new Relation("next-archive"); - - /** - * Signifies that the IRI in the value of the href attribute identifies - * where payment is accepted. - */ - public static final Relation PAYMENT = new Relation("payment"); - - /** - * When included on a versioned resource, this link points to a resource - * containing the predecessor version in the version history. Some systems - * may allow multiple of these link relations in the case of a multiple - * branches merging. - */ - public static final Relation PREDECESSOR_VERSION = new Relation( - "predecessor-version"); - - /** - * Signifies that the IRI in the value of the href attribute identifies the - * previous resource in a series including the current resource. - */ - public static final Relation PREVIOUS = new Relation("previous"); - - /** - * A URI that refers to the immediately preceding archive document. - */ - public static final Relation PREVIOUS_ARCHIVE = new Relation("prev-archive"); - - /** - * Signifies that the IRI in the value of the href attribute identifies a - * resource related to the resource described by the containing element. - */ - public static final Relation RELATED = new Relation("related"); - - /** - * Signifies that the IRI in the value of the href attribute identifies a - * resource where responses to an entry may be found. - */ - public static final Relation REPLIES = new Relation("replies"); - - /** - * Signifies that the IRI in the value of the href attribute identifies a - * resource equivalent to the containing element. - */ - public static final Relation SELF = new Relation("self"); - - /** - * Signifies that the IRI in the value of the href attribute identifies a - * resource that can be used to retrieve an Atom Publishing Protocol Service - * Document as defined by RFC 5023. - */ - public static final Relation SERVICE = new Relation("service"); - - /** - * When included on a versioned resource, this link points to a resource - * containing the successor version in the version history. Some systems may - * allow multiple of these link relations in order to support branching. - */ - public static final Relation SUCCESSOR_VERSION = new Relation( - "successor-version"); - - /** - * A URI that refers to a parent document in a hierarchy of documents. - */ - public static final Relation UP = new Relation("up"); - - /** - * When included on a versioned resource, this link points to a resource - * containing the version history for this resource. - */ - public static final Relation VERSION_HISTORY = new Relation( - "version-history"); - - /** - * Signifies that the IRI in the value of the href attribute identifies a - * resource that is the source of the information provided in the containing - * element. - */ - public static final Relation VIA = new Relation("via"); - - /** - * When included on a versioned resource, this link points to a working copy - * for this resource. Some systems may allow multiple of these link - * relations. - */ - public static final Relation WORKING_COPY = new Relation("working-copy"); - - /** - * When included on a working copy, this link points to the versioned - * resource from which this working copy was obtained. - */ - public static final Relation WORKING_COPY_OF = new Relation( - "working-copy-of"); - - /** - * Return a String object representing the specified Relation. - * - * @param rel - * The relation to be converted. - * @return The String representation of the argument. - */ - public static String toString(Relation rel) { - return rel.name; - } - - /** - * Parses a relation name into the equivalent item. - * - * @param rel - * The relation name to parse. - * @return The equivalent item. - */ - public static Relation valueOf(String rel) { - Relation result = ALTERNATE; - - if (rel != null) { - if (rel.equalsIgnoreCase("alternate")) { - result = ALTERNATE; - } else if (rel.equalsIgnoreCase("current")) { - result = CURRENT; - } else if (rel.equalsIgnoreCase("describedby")) { - result = DESCRIBED_BY; - } else if (rel.equalsIgnoreCase("edit")) { - result = EDIT; - } else if (rel.equalsIgnoreCase("edit-media")) { - result = EDIT_MEDIA; - } else if (rel.equalsIgnoreCase("enclosure")) { - result = ENCLOSURE; - } else if (rel.equalsIgnoreCase("first")) { - result = FIRST; - } else if (rel.equalsIgnoreCase("hub")) { - result = HUB; - } else if (rel.equalsIgnoreCase("last")) { - result = LAST; - } else if (rel.equalsIgnoreCase("latest-version")) { - result = LAST_VERSION; - } else if (rel.equalsIgnoreCase("license")) { - result = LICENSE; - } else if (rel.equalsIgnoreCase("next")) { - result = NEXT; - } else if (rel.equalsIgnoreCase("next-archive")) { - result = NEXT_ARCHIVE; - } else if (rel.equalsIgnoreCase("payment")) { - result = PAYMENT; - } else if (rel.equalsIgnoreCase("predecessor-version")) { - result = PREDECESSOR_VERSION; - } else if (rel.equalsIgnoreCase("previous")) { - result = PREVIOUS; - } else if (rel.equalsIgnoreCase("prev-archive")) { - result = PREVIOUS_ARCHIVE; - } else if (rel.equalsIgnoreCase("related")) { - result = RELATED; - } else if (rel.equalsIgnoreCase("replies")) { - result = REPLIES; - } else if (rel.equalsIgnoreCase("self")) { - result = SELF; - } else if (rel.equalsIgnoreCase("service")) { - result = SERVICE; - } else if (rel.equalsIgnoreCase("successor-version")) { - result = SUCCESSOR_VERSION; - } else if (rel.equalsIgnoreCase("up")) { - result = UP; - } else if (rel.equalsIgnoreCase("version-history")) { - result = VERSION_HISTORY; - } else if (rel.equalsIgnoreCase("via")) { - result = VIA; - } else if (rel.equalsIgnoreCase("working-copy")) { - result = WORKING_COPY; - } else if (rel.equalsIgnoreCase("working-copy-of")) { - result = WORKING_COPY_OF; - } else { - result = new Relation(rel); - } - } - - return result; - } - - /** The name of the relation. */ - private String name; - - /** - * Constructor. - * - * @param name - * The name of the relation. - */ - public Relation(String name) { - super(); - this.name = name; - } - - /** {@inheritDoc} */ - @Override - public boolean equals(Object object) { - return (object instanceof Relation) - && name.equalsIgnoreCase(((Relation) object).getName()); - } - - /** - * Returns the name of the relation. - * - * @return The name of the relation. - */ - public String getName() { - return name; - } - - /** {@inheritDoc} */ - @Override - public int hashCode() { - return SystemUtils.hashCode(getName()); - } - - @Override - public String toString() { - return name; - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Service.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Service.java deleted file mode 100644 index e097eb2b49..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Service.java +++ /dev/null @@ -1,307 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.restlet.Client; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.Restlet; -import org.restlet.data.MediaType; -import org.restlet.data.Method; -import org.restlet.data.Reference; -import org.restlet.data.Status; -import org.restlet.ext.atom.internal.ServiceContentReader; -import org.restlet.ext.xml.SaxRepresentation; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.Representation; -import org.xml.sax.SAXException; - -/** - * Represents an Atom introspection document. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Service extends SaxRepresentation { - /** Atom Publishing Protocol namespace. */ - public static final String APP_NAMESPACE = "http://www.w3.org/2007/app"; - - /** - * The base reference used to resolve relative references found within the - * scope of the xml:base attribute. - */ - private volatile Reference baseReference; - - /** - * The client HTTP dispatcher. - */ - private volatile Restlet clientDispatcher; - - /** - * The reference. - */ - private volatile Reference reference; - - /** - * The list of workspaces. - */ - private volatile List workspaces; - - /** - * Constructor. - * - * @param clientDispatcher - * The client HTTP dispatcher. - */ - public Service(Client clientDispatcher) { - super(new MediaType("***")); - setNamespaceAware(true); - this.clientDispatcher = clientDispatcher; - } - - /** - * Constructor. - * - * @param clientDispatcher - * The client HTTP dispatcher. - * @param serviceUri - * The service URI. - * @throws IOException - */ - public Service(Client clientDispatcher, String serviceUri) - throws IOException { - this(clientDispatcher, serviceUri, clientDispatcher.handle( - new Request(Method.GET, serviceUri)).getEntity()); - } - - /** - * Constructor. - * - * @param context - * The context from which the client dispatcher will be - * retrieved. - * @param serviceUri - * The service URI. - * @throws IOException - */ - public Service(Context context, String serviceUri) throws IOException { - this(context.getClientDispatcher(), serviceUri, context - .getClientDispatcher() - .handle(new Request(Method.GET, serviceUri)).getEntity()); - } - - /** - * Constructor. - * - * @param xmlService - * The XML introspection document. - * @throws IOException - */ - public Service(Representation xmlService) throws IOException { - this(null, null, xmlService); - } - - /** - * Constructor. - * - * @param clientDispatcher - * The client HTTP dispatcher. - * @param serviceUri - * The service URI. - * @param xmlService - * The XML introspection document. - * @throws IOException - */ - public Service(Restlet clientDispatcher, String serviceUri, - Representation xmlService) throws IOException { - super(xmlService); - setNamespaceAware(true); - this.clientDispatcher = clientDispatcher; - this.reference = (serviceUri == null) ? null - : new Reference(serviceUri); - parse(new ServiceContentReader(this)); - } - - /** - * Constructor. - * - * @param serviceUri - * The service URI. - * @throws IOException - */ - public Service(String serviceUri) throws IOException { - this(new Client(new Reference(serviceUri).getSchemeProtocol()), - serviceUri); - } - - /** - * Constructor. - * - * @param serviceUri - * The service URI. - * @param xmlService - * The XML introspection document. - * @throws IOException - */ - public Service(String serviceUri, Representation xmlService) - throws IOException { - this(new Client(new Reference(serviceUri).getSchemeProtocol()), - serviceUri, xmlService); - } - - /** - * Deletes a resource. - * - * @param uri - * The resource URI. - * @return The result status. - */ - public Status deleteResource(String uri) { - return getClientDispatcher().handle(new Request(Method.DELETE, uri)) - .getStatus(); - } - - /** - * Returns the base reference used to resolve relative references found - * within the scope of the xml:base attribute. - * - * @return The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public Reference getBaseReference() { - return baseReference; - } - - /** - * Returns the client HTTP dispatcher. - * - * @return The client HTTP dispatcher. - */ - public Restlet getClientDispatcher() { - return this.clientDispatcher; - } - - /** - * Returns the hypertext reference. - * - * @return The hypertext reference. - */ - public Reference getReference() { - return this.reference; - } - - /** - * Retrieves a resource representation. - * - * @param uri - * The resource URI. - * @return The resource representation. - */ - public Representation getResource(String uri) { - return getClientDispatcher().handle(new Request(Method.GET, uri)) - .getEntity(); - } - - /** - * Returns the list of workspaces. - * - * @return The list of workspaces. - */ - public List getWorkspaces() { - if (this.workspaces == null) { - this.workspaces = new ArrayList(); - } - - return this.workspaces; - } - - /** - * Sets the base reference used to resolve relative references found within - * the scope of the xml:base attribute. - * - * @param baseReference - * The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public void setBaseReference(Reference baseReference) { - this.baseReference = baseReference; - } - - /** - * Sets the client HTTP dispatcher. - * - * @param clientDispatcher - * The client HTTP dispatcher. - */ - public void setClientDispatcher(Client clientDispatcher) { - this.clientDispatcher = clientDispatcher; - } - - /** - * Sets the hypertext reference. - * - * @param ref - * The hypertext reference. - */ - public void setReference(Reference ref) { - this.reference = ref; - } - - /** - * Updates a resource representation. - * - * @param uri - * The resource URI. - * @return The resource representation. - */ - public Status updateResource(String uri, - Representation updatedRepresentation) { - return getClientDispatcher().handle( - new Request(Method.PUT, uri, updatedRepresentation)) - .getStatus(); - } - - /** - * Writes the representation to a XML writer. - * - * @param writer - * The XML writer to write to. - * @throws IOException - */ - @Override - public void write(XmlWriter writer) throws IOException { - try { - writer.forceNSDecl(APP_NAMESPACE, ""); - writer.forceNSDecl(ATOM_NAMESPACE, "atom"); - writer.setDataFormat(true); - writer.setIndentStep(3); - writer.startDocument(); - writer.startElement(APP_NAMESPACE, "service"); - - for (final Workspace workspace : getWorkspaces()) { - workspace.writeElement(writer); - } - - writer.endElement(APP_NAMESPACE, "service"); - writer.endDocument(); - } catch (SAXException se) { - throw new IOException("Couldn't write the service representation: " - + se.getMessage()); - } - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Source.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Source.java deleted file mode 100644 index 60f9323f92..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Source.java +++ /dev/null @@ -1,384 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.restlet.data.Reference; -import org.restlet.engine.util.DateUtils; -import org.restlet.ext.xml.XmlWriter; -import org.xml.sax.SAXException; - -/** - * Source feed's metadata for entries copied from another feed. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Source { - - /** The authors of the entry. */ - private volatile List authors; - - /** The categories associated with the entry. */ - private volatile List categories; - - /** The contributors to the entry. */ - private volatile List contributors; - - /** The agent used to generate a feed. */ - private volatile Generator generator; - - /** Image that provides iconic visual identification for a feed. */ - private volatile Reference icon; - - /** Permanent, universally unique identifier for the entry. */ - private volatile String id; - - /** The references from the entry to Web resources. */ - private volatile List links; - - /** Image that provides visual identification for a feed. */ - private volatile Reference logo; - - /** Information about rights held in and over an entry. */ - private volatile Text rights; - - /** Short summary, abstract, or excerpt of an entry. */ - private volatile Text subtitle; - - /** The human-readable title for the entry. */ - private volatile Text title; - - /** Most recent moment when the entry was modified in a significant way. */ - private volatile Date updated; - - /** - * Constructor. - */ - public Source() { - this.authors = null; - this.categories = null; - this.contributors = null; - this.generator = null; - this.icon = null; - this.id = null; - this.links = null; - this.logo = null; - this.rights = null; - this.subtitle = null; - this.title = null; - this.updated = null; - } - - /** - * Returns the authors of the entry. - * - * @return The authors of the entry. - */ - public List getAuthors() { - // Lazy initialization with double-check. - List a = this.authors; - if (a == null) { - synchronized (this) { - a = this.authors; - if (a == null) { - this.authors = a = new ArrayList(); - } - } - } - return a; - } - - /** - * Returns the categories associated with the entry. - * - * @return The categories associated with the entry. - */ - public List getCategories() { - // Lazy initialization with double-check. - List c = this.categories; - if (c == null) { - synchronized (this) { - c = this.categories; - if (c == null) { - this.categories = c = new ArrayList(); - } - } - } - return c; - } - - /** - * Returns the contributors to the entry. - * - * @return The contributors to the entry. - */ - public List getContributors() { - // Lazy initialization with double-check. - List c = this.contributors; - if (c == null) { - synchronized (this) { - c = this.contributors; - if (c == null) { - this.contributors = c = new ArrayList(); - } - } - } - return c; - } - - /** - * Returns the agent used to generate a feed. - * - * @return The agent used to generate a feed. - */ - public Generator getGenerator() { - return this.generator; - } - - /** - * Returns the image that provides iconic visual identification for a feed. - * - * @return The image that provides iconic visual identification for a feed. - */ - public Reference getIcon() { - return this.icon; - } - - /** - * Returns the permanent, universally unique identifier for the entry. - * - * @return The permanent, universally unique identifier for the entry. - */ - public String getId() { - return this.id; - } - - /** - * Returns the references from the entry to Web resources. - * - * @return The references from the entry to Web resources. - */ - public List getLinks() { - // Lazy initialization with double-check. - List l = this.links; - if (l == null) { - synchronized (this) { - l = this.links; - if (l == null) { - this.links = l = new ArrayList(); - } - } - } - return l; - } - - /** - * Returns the image that provides visual identification for a feed. - * - * @return The image that provides visual identification for a feed. - */ - public Reference getLogo() { - return this.logo; - } - - /** - * Returns the information about rights held in and over an entry. - * - * @return The information about rights held in and over an entry. - */ - public Text getRights() { - return this.rights; - } - - /** - * Returns the short summary, abstract, or excerpt of an entry. - * - * @return The short summary, abstract, or excerpt of an entry. - */ - public Text getSubtitle() { - return this.subtitle; - } - - /** - * Returns the human-readable title for the entry. - * - * @return The human-readable title for the entry. - */ - public Text getTitle() { - return this.title; - } - - /** - * Returns the most recent moment when the entry was modified in a - * significant way. - * - * @return The most recent moment when the entry was modified in a - * significant way. - */ - public Date getUpdated() { - return this.updated; - } - - /** - * Sets the agent used to generate a feed. - * - * @param generator - * The agent used to generate a feed. - */ - public void setGenerator(Generator generator) { - this.generator = generator; - } - - /** - * Sets the image that provides iconic visual identification for a feed. - * - * @param icon - * The image that provides iconic visual identification for a - * feed. - */ - public void setIcon(Reference icon) { - this.icon = icon; - } - - /** - * Sets the permanent, universally unique identifier for the entry. - * - * @param id - * The permanent, universally unique identifier for the entry. - */ - public void setId(String id) { - this.id = id; - } - - /** - * Sets the image that provides visual identification for a feed. - * - * @param logo - * The image that provides visual identification for a feed. - */ - public void setLogo(Reference logo) { - this.logo = logo; - } - - /** - * Sets the information about rights held in and over an entry. - * - * @param rights - * The information about rights held in and over an entry. - */ - public void setRights(Text rights) { - this.rights = rights; - } - - /** - * Sets the short summary, abstract, or excerpt of an entry. - * - * @param subtitle - * The short summary, abstract, or excerpt of an entry. - */ - public void setSubtitle(Text subtitle) { - this.subtitle = subtitle; - } - - /** - * Sets the human-readable title for the entry. - * - * @param title - * The human-readable title for the entry. - */ - public void setTitle(Text title) { - this.title = title; - } - - /** - * Sets the most recent moment when the entry was modified in a significant - * way. - * - * @param updated - * The most recent moment when the entry was modified in a - * significant way. - */ - public void setUpdated(Date updated) { - this.updated = DateUtils.unmodifiable(updated); - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - writer.startElement(ATOM_NAMESPACE, "source"); - if (getAuthors() != null) { - for (final Person person : getAuthors()) { - person.writeElement(writer, "author"); - } - } - - if (getCategories() != null) { - for (final Category category : getCategories()) { - category.writeElement(writer); - } - } - if (getContributors() != null) { - for (final Person person : getContributors()) { - person.writeElement(writer, "contributor"); - } - } - - if (getGenerator() != null) { - getGenerator().writeElement(writer); - } - - if ((getIcon() != null) && (getIcon().toString() != null)) { - writer.dataElement(ATOM_NAMESPACE, "icon", getIcon().toString()); - } - if (getId() != null) { - writer.dataElement(ATOM_NAMESPACE, "id", getId()); - } - - if (getLinks() != null) { - for (final Link link : getLinks()) { - link.writeElement(writer); - } - } - if ((getLogo() != null) && (getLogo().toString() != null)) { - writer.dataElement(ATOM_NAMESPACE, "logo", getLogo().toString()); - } - - if (getRights() != null) { - getRights().writeElement(writer, "rights"); - } - - if (getSubtitle() != null) { - getSubtitle().writeElement(writer, "subtitle"); - } - - if (getTitle() != null) { - getTitle().writeElement(writer, "title"); - } - - if (getUpdated() != null) { - Text.writeElement(writer, getUpdated(), ATOM_NAMESPACE, "updated"); - } - - writer.endElement(ATOM_NAMESPACE, "source"); - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Text.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Text.java deleted file mode 100644 index a72a5b0515..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Text.java +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; - -import java.util.Date; - -import org.restlet.data.MediaType; -import org.restlet.engine.util.DateUtils; -import org.restlet.ext.xml.XmlWriter; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * A Text construct contains human-readable text, usually in small quantities. - * The content of Text constructs is Language-Sensitive. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Text { - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @param namespace - * The element namespace URI. - * @param localName - * The local name of the element. - * @throws SAXException - */ - public static void writeElement(XmlWriter writer, Date date, - String namespace, String localName) throws SAXException { - if (date != null) { - writer.startElement(namespace, localName); - writer.characters(DateUtils.format(date, - DateUtils.FORMAT_RFC_3339.get(0))); - writer.endElement(namespace, localName); - } else { - writer.emptyElement(namespace, localName); - } - } - - /** - * The content. - */ - private volatile String content; - - /** - * The content type. - */ - private volatile MediaType type; - - /** - * Constructor. - * - * @param type - * The content type. - */ - public Text(MediaType type) { - this(type, null); - } - - /** - * Constructor. - * - * @param type - * The content type. - * @param content - * The content. - */ - public Text(MediaType type, String content) { - this.type = type; - this.content = content; - } - - /** - * Constructor. - * - * @param content - * The content. - */ - public Text(String content) { - this(null, content); - } - - /** - * Returns the content. - * - * @return The content. - */ - public String getContent() { - return this.content; - } - - /** - * Returns the content type. - * - * @return The content type. - */ - public MediaType getType() { - return this.type; - } - - /** - * Sets the content. - * - * @param content - * The content. - */ - public void setContent(String content) { - this.content = content; - } - - /** - * Sets the content type. - * - * @param type - * The content type. - */ - public void setType(MediaType type) { - this.type = type; - } - - @Override - public String toString() { - return getContent(); - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @param localName - * The local name of the element. - * @throws SAXException - */ - public void writeElement(XmlWriter writer, String localName) - throws SAXException { - final AttributesImpl attributes = new AttributesImpl(); - String type = null; - - if ((getType() != null) && (getType().getSubType() != null)) { - if (getType().getSubType().contains("xhtml")) { - type = "xhtml"; - } else if (getType().getSubType().contains("html")) { - type = "html"; - } - } - - if (type == null) { - type = "text"; - } - - attributes.addAttribute("", "type", null, "text", type); - - if (getContent() != null) { - writer.dataElement(ATOM_NAMESPACE, localName, null, attributes, - getContent()); - } else { - writer.emptyElement(ATOM_NAMESPACE, localName, null, attributes); - } - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Workspace.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Workspace.java deleted file mode 100644 index e08ebe3e74..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/Workspace.java +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom; - -import static org.restlet.ext.atom.Feed.ATOM_NAMESPACE; -import static org.restlet.ext.atom.Service.APP_NAMESPACE; - -import java.util.ArrayList; -import java.util.List; - -import org.restlet.data.Reference; -import org.restlet.ext.xml.XmlWriter; -import org.xml.sax.SAXException; - -/** - * Workspace containing collections of members entries. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Workspace { - - /** - * The base reference used to resolve relative references found within the - * scope of the xml:base attribute. - */ - private volatile Reference baseReference; - - /** - * The list of collections. - */ - private volatile List collections; - - /** - * The parent service. - */ - private volatile Service service; - - /** - * The title. - */ - private volatile String title; - - /** - * Constructor. - * - * @param service - * The parent service. - */ - public Workspace(Service service) { - this(service, null); - } - - /** - * Constructor. - * - * @param service - * The parent service. - * @param title - * The title. - */ - public Workspace(Service service, String title) { - this.service = service; - this.title = title; - } - - /** - * Returns the base reference used to resolve relative references found - * within the scope of the xml:base attribute. - * - * @return The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public Reference getBaseReference() { - return baseReference; - } - - /** - * Returns the list of collections. - * - * @return The list of collections. - */ - public List getCollections() { - if (this.collections == null) { - this.collections = new ArrayList(); - } - - return this.collections; - } - - /** - * Returns the parent service. - * - * @return The parent service. - */ - public Service getService() { - return this.service; - } - - /** - * Returns the title. - * - * @return The title. - */ - public String getTitle() { - return this.title; - } - - /** - * Sets the base reference used to resolve relative references found within - * the scope of the xml:base attribute. - * - * @param baseReference - * The base reference used to resolve relative references found - * within the scope of the xml:base attribute. - */ - public void setBaseReference(Reference baseReference) { - this.baseReference = baseReference; - } - - /** - * Sets the parent service. - * - * @param service - * The parent service. - */ - public void setService(Service service) { - this.service = service; - } - - /** - * Sets the title. - * - * @param title - * The title. - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Writes the current object as an XML element using the given SAX writer. - * - * @param writer - * The SAX writer. - * @throws SAXException - */ - public void writeElement(XmlWriter writer) throws SAXException { - writer.startElement(APP_NAMESPACE, "workspace"); - - if (getTitle() != null) { - writer.dataElement(ATOM_NAMESPACE, "title", getTitle()); - } - - for (final Collection collection : getCollections()) { - collection.writeElement(writer); - } - - writer.endElement(APP_NAMESPACE, "workspace"); - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/CategoriesContentReader.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/CategoriesContentReader.java deleted file mode 100644 index dd13e0e41b..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/CategoriesContentReader.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom.internal; - -import java.util.ArrayList; - -import org.restlet.data.Reference; -import org.restlet.ext.atom.Categories; -import org.restlet.ext.atom.Category; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.atom.Service; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Content reader for categories. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class CategoriesContentReader extends DefaultHandler { - - private Categories categories = null; - - /** - * Constructor. - * - * @param categories - * The parent categories. - */ - public CategoriesContentReader(Categories categories) { - this.categories = categories; - } - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attrs) throws SAXException { - if (uri.equalsIgnoreCase(Service.APP_NAMESPACE)) { - if (localName.equalsIgnoreCase("categories")) { - String attr = attrs.getValue("", "fixed"); - this.categories.setFixed((attr == null) ? false : Boolean - .parseBoolean(attr)); - attr = attrs.getValue("", "scheme"); - this.categories.setScheme((attr == null) ? null - : new Reference(attr)); - } - } else if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equalsIgnoreCase("category")) { - Category category = new Category(); - - if (this.categories.getEntries() == null) { - this.categories.setEntries(new ArrayList()); - } - this.categories.getEntries().add(category); - - String attr = attrs.getValue("", "term"); - category.setTerm((attr == null) ? null : attr); - attr = attrs.getValue("", "label"); - category.setLabel((attr == null) ? null : attr); - attr = attrs.getValue("", "scheme"); - category.setScheme((attr == null) ? null : new Reference(attr)); - - if (category.getScheme() == null) { - category.setScheme(this.categories.getScheme()); - } - } - } - } -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/EntryContentReader.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/EntryContentReader.java deleted file mode 100644 index 8d86de1e4e..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/EntryContentReader.java +++ /dev/null @@ -1,482 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom.internal; - -import java.io.StringWriter; -import java.util.Date; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.restlet.data.Language; -import org.restlet.data.MediaType; -import org.restlet.data.Reference; -import org.restlet.engine.util.DateUtils; -import org.restlet.ext.atom.Category; -import org.restlet.ext.atom.Content; -import org.restlet.ext.atom.Entry; -import org.restlet.ext.atom.EntryReader; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.atom.Link; -import org.restlet.ext.atom.Person; -import org.restlet.ext.atom.Relation; -import org.restlet.ext.atom.Text; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.StringRepresentation; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Content reader for entries. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class EntryContentReader extends EntryReader { - private enum State { - FEED_ENTRY, FEED_ENTRY_AUTHOR, FEED_ENTRY_AUTHOR_EMAIL, FEED_ENTRY_AUTHOR_NAME, FEED_ENTRY_AUTHOR_URI, FEED_ENTRY_CATEGORY, FEED_ENTRY_CONTENT, FEED_ENTRY_CONTRIBUTOR, FEED_ENTRY_ID, FEED_ENTRY_LINK, FEED_ENTRY_PUBLISHED, FEED_ENTRY_RIGHTS, FEED_ENTRY_SOURCE, FEED_ENTRY_SOURCE_AUTHOR, FEED_ENTRY_SOURCE_AUTHOR_EMAIL, FEED_ENTRY_SOURCE_AUTHOR_NAME, FEED_ENTRY_SOURCE_AUTHOR_URI, FEED_ENTRY_SOURCE_CATEGORY, FEED_ENTRY_SOURCE_CONTRIBUTOR, FEED_ENTRY_SOURCE_GENERATOR, FEED_ENTRY_SOURCE_ICON, FEED_ENTRY_SOURCE_ID, FEED_ENTRY_SOURCE_LINK, FEED_ENTRY_SOURCE_LOGO, FEED_ENTRY_SOURCE_RIGHTS, FEED_ENTRY_SOURCE_SUBTITLE, FEED_ENTRY_SOURCE_TITLE, FEED_ENTRY_SOURCE_UPDATED, FEED_ENTRY_SUMMARY, FEED_ENTRY_TITLE, FEED_ENTRY_UPDATED, NONE - } - - /** Buffer for the current text content of the current tag. */ - private StringBuilder contentBuffer; - - /** Mark the Content depth. */ - private int contentDepth; - - /** The media type of the Content (for inline cases). */ - private MediaType contentType; - - /** The currently parsed Category. */ - private Category currentCategory; - - /** The currently parsed Content. */ - private Content currentContent; - - /** The currently parsed XML content writer. */ - private XmlWriter currentContentWriter; - - /** The currently date parsed from the current text content. */ - private Date currentDate; - - /** The currently parsed Entry. */ - private Entry currentEntry; - - /** The currently parsed Link. */ - private Link currentLink; - - /** The currently parsed Person. */ - private Person currentPerson; - - /** The currently parsed Text. */ - private Text currentText; - - /** The current list of prefix mappings. */ - private Map prefixMappings; - - /** The currently state. */ - private EntryContentReader.State state; - - /** - * Constructor. - * - * @param entry - * The entry object to update during the parsing. - */ - public EntryContentReader(Entry entry) { - this(entry, null); - } - - /** - * Constructor. - * - * @param entry - * The entry object to update during the parsing. - * @param extraEntryHandler - * Custom handler of all events. - */ - public EntryContentReader(Entry entry, EntryReader extraEntryHandler) { - super(extraEntryHandler); - this.state = State.NONE; - this.contentDepth = -1; - this.currentEntry = entry; - this.currentText = null; - this.currentDate = null; - this.currentLink = null; - this.currentPerson = null; - this.contentBuffer = null; - this.currentCategory = null; - this.currentContent = null; - this.prefixMappings = new ConcurrentHashMap(); - } - - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - if (this.contentDepth >= 0) { - // The content might embed XML elements from various namespaces - if (this.currentContentWriter != null) { - this.currentContentWriter.characters(ch, start, length); - } - } else { - this.contentBuffer.append(ch, start, length); - } - - super.characters(ch, start, length); - } - - @Override - public void endDocument() throws SAXException { - this.state = State.NONE; - this.contentBuffer = null; - - super.endDocument(); - } - - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - if (this.currentText != null) { - this.currentText.setContent(this.contentBuffer.toString()); - } - - if (this.currentDate != null) { - final String formattedDate = this.contentBuffer.toString(); - final Date parsedDate = DateUtils.parse(formattedDate.trim(), - DateUtils.FORMAT_RFC_3339); - - if (parsedDate != null) { - this.currentDate.setTime(parsedDate.getTime()); - } else { - this.currentDate = null; - } - } - - if (contentDepth > 0) { - // The content might embed XML elements from various namespaces - if (this.currentContentWriter != null) { - this.currentContentWriter.endElement(uri, localName, qName); - } - contentDepth--; - } else if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equals("feed")) { - this.state = State.NONE; - } else if (localName.equals("title")) { - if (this.state == State.FEED_ENTRY_TITLE) { - this.currentEntry.setTitle(this.currentText); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_TITLE) { - this.currentEntry.getSource().setTitle(this.currentText); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equals("updated")) { - if (this.state == State.FEED_ENTRY_UPDATED) { - this.currentEntry.setUpdated(this.currentDate); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_UPDATED) { - this.currentEntry.getSource().setUpdated(this.currentDate); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equals("published")) { - if (this.state == State.FEED_ENTRY_PUBLISHED) { - this.currentEntry.setPublished(this.currentDate); - this.state = State.FEED_ENTRY; - } - } else if (localName.equals("author")) { - if (this.state == State.FEED_ENTRY_AUTHOR) { - this.currentEntry.getAuthors().add(this.currentPerson); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_AUTHOR) { - this.currentEntry.getSource().getAuthors() - .add(this.currentPerson); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equals("name")) { - this.currentPerson.setName(this.contentBuffer.toString()); - - if (this.state == State.FEED_ENTRY_AUTHOR_NAME) { - this.state = State.FEED_ENTRY_AUTHOR; - } else if (this.state == State.FEED_ENTRY_SOURCE_AUTHOR_NAME) { - this.state = State.FEED_ENTRY_SOURCE_AUTHOR; - } - } else if (localName.equals("id")) { - if (this.state == State.FEED_ENTRY_ID) { - this.currentEntry.setId(this.contentBuffer.toString()); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_ID) { - this.currentEntry.getSource().setId( - this.contentBuffer.toString()); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equals("link")) { - if (this.state == State.FEED_ENTRY_LINK) { - this.currentEntry.getLinks().add(this.currentLink); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_LINK) { - this.currentEntry.getSource().getLinks() - .add(this.currentLink); - this.state = State.FEED_ENTRY_SOURCE; - } - // Set the inline content, if any - if (this.currentContentWriter != null) { - String content = this.currentContentWriter.getWriter() - .toString().trim(); - contentDepth = -1; - - if (content.isEmpty()) { - this.currentLink.setContent(null); - } else { - if (this.currentLink.getType() != null) { - currentContent - .setInlineContent(new StringRepresentation( - content, this.currentLink.getType())); - } else { - currentContent - .setInlineContent(new StringRepresentation( - content, contentType)); - } - } - this.currentContentWriter = null; - } - endLink(this.currentLink); - } else if (localName.equalsIgnoreCase("entry")) { - this.state = State.NONE; - endEntry(this.currentEntry); - } else if (localName.equals("category")) { - if (this.state == State.FEED_ENTRY_CATEGORY) { - this.currentEntry.getCategories().add(this.currentCategory); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_CATEGORY) { - this.currentEntry.getSource().getCategories() - .add(this.currentCategory); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equalsIgnoreCase("content")) { - if (this.state == State.FEED_ENTRY_CONTENT) { - if (!this.currentEntry.getContent().isExternal()) { - String content = this.currentContentWriter.getWriter() - .toString().trim(); - contentDepth = -1; - - if (content.isEmpty()) { - this.currentEntry.setContent(null); - } else { - currentContent - .setInlineContent(new StringRepresentation( - content)); - } - } - - this.state = State.FEED_ENTRY; - } - - this.currentContentWriter = null; - endContent(this.currentContent); - } - } - - this.currentText = null; - this.currentDate = null; - super.endElement(uri, localName, qName); - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - this.prefixMappings.remove(prefix); - super.endPrefixMapping(prefix); - } - - /** - * Returns a media type from an Atom type attribute. - * - * @param type - * The Atom type attribute. - * @return The media type. - */ - private MediaType getMediaType(String type) { - MediaType result = null; - - if (type == null) { - // No type defined - } else if (type.equals("text")) { - result = MediaType.TEXT_PLAIN; - } else if (type.equals("html")) { - result = MediaType.TEXT_HTML; - } else if (type.equals("xhtml")) { - result = MediaType.APPLICATION_XHTML; - } else { - result = new MediaType(type); - } - - return result; - } - - /** - * Initiates the parsing of a mixed content part of the current document. - */ - private void initiateInlineMixedContent() { - this.contentDepth = 0; - StringWriter sw = new StringWriter(); - currentContentWriter = new XmlWriter(sw); - - for (String prefix : this.prefixMappings.keySet()) { - currentContentWriter.forceNSDecl(this.prefixMappings.get(prefix), - prefix); - } - } - - @Override - public void startDocument() throws SAXException { - this.contentBuffer = new StringBuilder(); - super.startDocument(); - } - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attrs) throws SAXException { - this.contentBuffer.delete(0, this.contentBuffer.length() + 1); - - if (this.contentDepth >= 0) { - // The content might embed XML elements from various namespaces - if (this.currentContentWriter != null) { - this.currentContentWriter.startElement(uri, localName, qName, - attrs); - } - this.contentDepth++; - } else if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equals("title")) { - startTextElement(attrs); - - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_TITLE; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_TITLE; - } - } else if (localName.equals("updated")) { - this.currentDate = new Date(); - - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_UPDATED; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_UPDATED; - } - } else if (localName.equals("published")) { - this.currentDate = new Date(); - - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_PUBLISHED; - } - } else if (localName.equals("author")) { - this.currentPerson = new Person(); - - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_AUTHOR; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_AUTHOR; - } - } else if (localName.equals("name")) { - if (this.state == State.FEED_ENTRY_AUTHOR) { - this.state = State.FEED_ENTRY_AUTHOR_NAME; - } else if (this.state == State.FEED_ENTRY_SOURCE_AUTHOR) { - this.state = State.FEED_ENTRY_SOURCE_AUTHOR_NAME; - } - } else if (localName.equals("id")) { - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_ID; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_ID; - } - } else if (localName.equals("link")) { - this.currentLink = new Link(); - this.currentLink.setHref(new Reference(attrs.getValue("", - "href"))); - this.currentLink.setRel(Relation.valueOf(attrs.getValue("", - "rel"))); - String type = attrs.getValue("", "type"); - if (type != null && type.length() > 0) { - this.currentLink.setType(new MediaType(type)); - } - this.currentLink.setHrefLang(new Language(attrs.getValue("", - "hreflang"))); - this.currentLink.setTitle(attrs.getValue("", "title")); - final String attr = attrs.getValue("", "length"); - this.currentLink.setLength((attr == null) ? -1L : Long - .parseLong(attr)); - - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_LINK; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_LINK; - } - // Glean the content - this.currentContent = new Content(); - // Content available inline - initiateInlineMixedContent(); - this.currentLink.setContent(currentContent); - startLink(this.currentLink); - } else if (localName.equalsIgnoreCase("entry")) { - this.state = State.FEED_ENTRY; - startEntry(this.currentEntry); - } else if (localName.equals("category")) { - this.currentCategory = new Category(); - this.currentCategory.setTerm(attrs.getValue("", "term")); - this.currentCategory.setScheme(new Reference(attrs.getValue("", - "scheme"))); - this.currentCategory.setLabel(attrs.getValue("", "label")); - - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_CATEGORY; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_CATEGORY; - } - } else if (localName.equalsIgnoreCase("content")) { - if (this.state == State.FEED_ENTRY) { - contentType = getMediaType(attrs.getValue("", "type")); - String srcAttr = attrs.getValue("", "src"); - this.currentContent = new Content(); - - if (srcAttr == null) { - // Content available inline - initiateInlineMixedContent(); - } else { - // Content available externally - this.currentContent.setExternalRef(new Reference( - srcAttr)); - this.currentContent.setExternalType(contentType); - } - - this.currentEntry.setContent(currentContent); - this.state = State.FEED_ENTRY_CONTENT; - } - - startContent(this.currentContent); - } - } - - super.startElement(uri, localName, qName, attrs); - } - - @Override - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - this.prefixMappings.put(prefix, uri); - - super.startPrefixMapping(prefix, uri); - } - - /** - * Receive notification of the beginning of a text element. - * - * @param attrs - * The attributes attached to the element. - */ - public void startTextElement(Attributes attrs) { - this.currentText = new Text(getMediaType(attrs.getValue("", "type"))); - } -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/FeedContentReader.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/FeedContentReader.java deleted file mode 100644 index 02b49b6b6a..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/FeedContentReader.java +++ /dev/null @@ -1,553 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom.internal; - -import java.io.StringWriter; -import java.util.Date; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import org.restlet.data.Language; -import org.restlet.data.MediaType; -import org.restlet.data.Reference; -import org.restlet.engine.util.DateUtils; -import org.restlet.ext.atom.Category; -import org.restlet.ext.atom.Content; -import org.restlet.ext.atom.Entry; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.atom.FeedReader; -import org.restlet.ext.atom.Link; -import org.restlet.ext.atom.Person; -import org.restlet.ext.atom.Relation; -import org.restlet.ext.atom.Text; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.StringRepresentation; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Content reader for feeds. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class FeedContentReader extends FeedReader { - private enum State { - FEED, FEED_AUTHOR, FEED_AUTHOR_EMAIL, FEED_AUTHOR_NAME, FEED_AUTHOR_URI, FEED_CATEGORY, FEED_CONTRIBUTOR, FEED_CONTRIBUTOR_EMAIL, FEED_CONTRIBUTOR_NAME, FEED_CONTRIBUTOR_URI, FEED_ENTRY, FEED_ENTRY_AUTHOR, FEED_ENTRY_AUTHOR_EMAIL, FEED_ENTRY_AUTHOR_NAME, FEED_ENTRY_AUTHOR_URI, FEED_ENTRY_CATEGORY, FEED_ENTRY_CONTENT, FEED_ENTRY_CONTRIBUTOR, FEED_ENTRY_ID, FEED_ENTRY_LINK, FEED_ENTRY_PUBLISHED, FEED_ENTRY_RIGHTS, FEED_ENTRY_SOURCE, FEED_ENTRY_SOURCE_AUTHOR, FEED_ENTRY_SOURCE_AUTHOR_EMAIL, FEED_ENTRY_SOURCE_AUTHOR_NAME, FEED_ENTRY_SOURCE_AUTHOR_URI, FEED_ENTRY_SOURCE_CATEGORY, FEED_ENTRY_SOURCE_CONTRIBUTOR, FEED_ENTRY_SOURCE_GENERATOR, FEED_ENTRY_SOURCE_ICON, FEED_ENTRY_SOURCE_ID, FEED_ENTRY_SOURCE_LINK, FEED_ENTRY_SOURCE_LOGO, FEED_ENTRY_SOURCE_RIGHTS, FEED_ENTRY_SOURCE_SUBTITLE, FEED_ENTRY_SOURCE_TITLE, FEED_ENTRY_SOURCE_UPDATED, FEED_ENTRY_SUMMARY, FEED_ENTRY_TITLE, FEED_ENTRY_UPDATED, FEED_GENERATOR, FEED_ICON, FEED_ID, FEED_LINK, FEED_LOGO, FEED_RIGHTS, FEED_SUBTITLE, FEED_TITLE, FEED_UPDATED, NONE - } - - /** Buffer for the current text content of the current tag. */ - private StringBuilder contentBuffer; - - /** Mark the Content depth. */ - private int contentDepth; - - /** The media type of the Content (for inline cases). */ - private MediaType contentType; - - /** The currently parsed Category. */ - private Category currentCategory; - - /** The currently parsed Content. */ - private Content currentContent; - - /** The currently parsed XML content writer. */ - private XmlWriter currentContentWriter; - - /** The currently date parsed from the current text content. */ - private Date currentDate; - - /** The currently parsed Entry. */ - private Entry currentEntry; - - /** The currently parsed Feed. */ - private final Feed currentFeed; - - /** The currently parsed Link. */ - private Link currentLink; - - /** The currently parsed Person. */ - private Person currentPerson; - - /** The currently parsed Text. */ - private Text currentText; - - /** The current list of prefix mappings. */ - private Map prefixMappings; - - /** The current state. */ - private FeedContentReader.State state; - - /** - * Constructor. - * - * @param feed - * The feed object to update during the parsing. - */ - public FeedContentReader(Feed feed) { - this(feed, null); - } - - /** - * Constructor. - * - * @param feed - * The feed object to update during the parsing. - * @param extraFeedReader - * Custom handler of all events. - */ - public FeedContentReader(Feed feed, FeedReader extraFeedReader) { - super(extraFeedReader); - this.state = State.NONE; - this.currentFeed = feed; - this.currentEntry = null; - this.currentText = null; - this.currentDate = null; - this.currentLink = null; - this.currentPerson = null; - this.contentBuffer = null; - this.currentCategory = null; - this.currentContent = null; - this.prefixMappings = new ConcurrentHashMap(); - this.contentDepth = -1; - } - - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - if (this.contentDepth >= 0) { - // The content might embed XML elements from various namespaces - if (this.currentContentWriter != null) { - this.currentContentWriter.characters(ch, start, length); - } - } else { - this.contentBuffer.append(ch, start, length); - } - super.characters(ch, start, length); - } - - @Override - public void endDocument() throws SAXException { - this.state = State.NONE; - this.currentEntry = null; - this.contentBuffer = null; - - super.endDocument(); - } - - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - if (this.currentText != null) { - this.currentText.setContent(this.contentBuffer.toString()); - } - - if (this.currentDate != null) { - final String formattedDate = this.contentBuffer.toString(); - final Date parsedDate = DateUtils.parse(formattedDate.trim(), - DateUtils.FORMAT_RFC_3339); - - if (parsedDate != null) { - this.currentDate.setTime(parsedDate.getTime()); - } else { - this.currentDate = null; - } - } - - if (contentDepth > 0) { - // The content might embed XML elements from various namespaces - if (this.currentContentWriter != null) { - this.currentContentWriter.endElement(uri, localName, qName); - } - - contentDepth--; - } else if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equals("feed")) { - this.state = State.NONE; - endFeed(this.currentFeed); - } else if (localName.equals("title")) { - if (this.state == State.FEED_TITLE) { - this.currentFeed.setTitle(this.currentText); - this.state = State.FEED; - } else if (this.state == State.FEED_ENTRY_TITLE) { - this.currentEntry.setTitle(this.currentText); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_TITLE) { - this.currentEntry.getSource().setTitle(this.currentText); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equals("summary")) { - if (this.state == State.FEED_ENTRY_SUMMARY) { - if (this.currentText != null) { - this.currentEntry.setSummary(this.currentText - .getContent()); - } - - this.state = State.FEED_ENTRY; - } - } else if (localName.equals("updated")) { - if (this.state == State.FEED_UPDATED) { - this.currentFeed.setUpdated(this.currentDate); - this.state = State.FEED; - } else if (this.state == State.FEED_ENTRY_UPDATED) { - this.currentEntry.setUpdated(this.currentDate); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_UPDATED) { - this.currentEntry.getSource().setUpdated(this.currentDate); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equals("published")) { - if (this.state == State.FEED_ENTRY_PUBLISHED) { - this.currentEntry.setPublished(this.currentDate); - this.state = State.FEED_ENTRY; - } - } else if (localName.equals("author")) { - if (this.state == State.FEED_AUTHOR) { - this.currentFeed.getAuthors().add(this.currentPerson); - this.state = State.FEED; - } else if (this.state == State.FEED_ENTRY_AUTHOR) { - this.currentEntry.getAuthors().add(this.currentPerson); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_AUTHOR) { - this.currentEntry.getSource().getAuthors() - .add(this.currentPerson); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equals("name")) { - this.currentPerson.setName(this.contentBuffer.toString()); - - if (this.state == State.FEED_AUTHOR_NAME) { - this.state = State.FEED_AUTHOR; - } else if (this.state == State.FEED_ENTRY_AUTHOR_NAME) { - this.state = State.FEED_ENTRY_AUTHOR; - } else if (this.state == State.FEED_ENTRY_SOURCE_AUTHOR_NAME) { - this.state = State.FEED_ENTRY_SOURCE_AUTHOR; - } - } else if (localName.equals("id")) { - if (this.state == State.FEED_ID) { - this.currentFeed.setId(this.contentBuffer.toString()); - this.state = State.FEED; - } else if (this.state == State.FEED_ENTRY_ID) { - this.currentEntry.setId(this.contentBuffer.toString()); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_ID) { - this.currentEntry.getSource().setId( - this.contentBuffer.toString()); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equals("link")) { - if (this.state == State.FEED_LINK) { - this.currentFeed.getLinks().add(this.currentLink); - this.state = State.FEED; - } else if (this.state == State.FEED_ENTRY_LINK) { - this.currentEntry.getLinks().add(this.currentLink); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_LINK) { - this.currentEntry.getSource().getLinks() - .add(this.currentLink); - this.state = State.FEED_ENTRY_SOURCE; - } - - // Set the inline content, if any - if (this.currentContentWriter != null) { - String content = this.currentContentWriter.getWriter() - .toString().trim(); - contentDepth = -1; - if (content.isEmpty()) { - this.currentLink.setContent(null); - } else { - if (this.currentLink.getType() != null) { - currentContent - .setInlineContent(new StringRepresentation( - content, this.currentLink.getType())); - } else { - currentContent - .setInlineContent(new StringRepresentation( - content)); - } - } - this.currentContentWriter = null; - } - - endLink(this.currentLink); - } else if (localName.equalsIgnoreCase("entry")) { - if (this.state == State.FEED_ENTRY) { - this.currentFeed.getEntries().add(this.currentEntry); - this.state = State.FEED; - } - - endEntry(this.currentEntry); - } else if (localName.equals("category")) { - if (this.state == State.FEED_CATEGORY) { - this.currentFeed.getCategories().add(this.currentCategory); - this.state = State.FEED; - } else if (this.state == State.FEED_ENTRY_CATEGORY) { - this.currentEntry.getCategories().add(this.currentCategory); - this.state = State.FEED_ENTRY; - } else if (this.state == State.FEED_ENTRY_SOURCE_CATEGORY) { - this.currentEntry.getSource().getCategories() - .add(this.currentCategory); - this.state = State.FEED_ENTRY_SOURCE; - } - } else if (localName.equalsIgnoreCase("content")) { - if (this.state == State.FEED_ENTRY_CONTENT) { - if (!this.currentEntry.getContent().isExternal()) { - String content = this.currentContentWriter.getWriter() - .toString().trim(); - contentDepth = -1; - if (content.isEmpty()) { - this.currentEntry.setContent(null); - } else { - currentContent - .setInlineContent(new StringRepresentation( - content, contentType)); - } - } - - this.state = State.FEED_ENTRY; - } - this.currentContentWriter = null; - endContent(this.currentContent); - } - } - - this.currentText = null; - this.currentDate = null; - super.endElement(uri, localName, qName); - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - this.prefixMappings.remove(prefix); - - // Send the event to the right extra handler. - super.endPrefixMapping(prefix); - } - - /** - * Returns a media type from an Atom type attribute. - * - * @param type - * The Atom type attribute. - * @return The media type. - */ - private MediaType getMediaType(String type) { - MediaType result = null; - - if (type == null) { - // No type defined - } else if (type.equals("text")) { - result = MediaType.TEXT_PLAIN; - } else if (type.equals("html")) { - result = MediaType.TEXT_HTML; - } else if (type.equals("xhtml")) { - result = MediaType.APPLICATION_XHTML; - } else { - result = new MediaType(type); - } - - return result; - } - - /** - * Initiates the parsing of a mixed content part of the current document. - */ - private void initiateInlineMixedContent() { - this.contentDepth = 0; - StringWriter sw = new StringWriter(); - currentContentWriter = new XmlWriter(sw); - - for (String prefix : this.prefixMappings.keySet()) { - currentContentWriter.forceNSDecl(this.prefixMappings.get(prefix), - prefix); - } - } - - @Override - public void startDocument() throws SAXException { - this.contentBuffer = new StringBuilder(); - super.startDocument(); - } - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attrs) throws SAXException { - this.contentBuffer.delete(0, this.contentBuffer.length() + 1); - - if (this.contentDepth >= 0) { - // The content might embed XML elements from various namespaces - if (this.currentContentWriter != null) { - this.currentContentWriter.startElement(uri, localName, qName, - attrs); - } - this.contentDepth++; - } else if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equals("feed")) { - String attr = attrs.getValue("xml:base"); - if (attr != null) { - this.currentFeed.setBaseReference(new Reference(attr)); - } - this.state = State.FEED; - startFeed(this.currentFeed); - } else if (localName.equals("title")) { - startTextElement(attrs); - - if (this.state == State.FEED) { - this.state = State.FEED_TITLE; - } else if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_TITLE; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_TITLE; - } - } else if (localName.equals("summary")) { - startTextElement(attrs); - - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_SUMMARY; - } - } else if (localName.equals("updated")) { - this.currentDate = new Date(); - - if (this.state == State.FEED) { - this.state = State.FEED_UPDATED; - } else if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_UPDATED; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_UPDATED; - } - } else if (localName.equals("published")) { - this.currentDate = new Date(); - - if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_PUBLISHED; - } - } else if (localName.equals("author")) { - this.currentPerson = new Person(); - - if (this.state == State.FEED) { - this.state = State.FEED_AUTHOR; - } else if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_AUTHOR; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_AUTHOR; - } - } else if (localName.equals("name")) { - if (this.state == State.FEED_AUTHOR) { - this.state = State.FEED_AUTHOR_NAME; - } else if (this.state == State.FEED_ENTRY_AUTHOR) { - this.state = State.FEED_ENTRY_AUTHOR_NAME; - } else if (this.state == State.FEED_ENTRY_SOURCE_AUTHOR) { - this.state = State.FEED_ENTRY_SOURCE_AUTHOR_NAME; - } - } else if (localName.equals("id")) { - if (this.state == State.FEED) { - this.state = State.FEED_ID; - } else if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_ID; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_ID; - } - } else if (localName.equals("link")) { - this.currentLink = new Link(); - this.currentLink.setHref(new Reference(attrs.getValue("", - "href"))); - this.currentLink.setRel(Relation.valueOf(attrs.getValue("", - "rel"))); - String type = attrs.getValue("", "type"); - if (type != null && type.length() > 0) { - this.currentLink.setType(new MediaType(type)); - } - - this.currentLink.setHrefLang(new Language(attrs.getValue("", - "hreflang"))); - this.currentLink.setTitle(attrs.getValue("", "title")); - final String attr = attrs.getValue("", "length"); - this.currentLink.setLength((attr == null) ? -1L : Long - .parseLong(attr)); - - if (this.state == State.FEED) { - this.state = State.FEED_LINK; - } else if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_LINK; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_LINK; - } - // Glean the content - this.currentContent = new Content(); - // Content available inline - initiateInlineMixedContent(); - this.currentLink.setContent(currentContent); - startLink(this.currentLink); - } else if (localName.equalsIgnoreCase("entry")) { - if (this.state == State.FEED) { - this.currentEntry = new Entry(); - this.state = State.FEED_ENTRY; - } - startEntry(this.currentEntry); - } else if (localName.equals("category")) { - this.currentCategory = new Category(); - this.currentCategory.setTerm(attrs.getValue("", "term")); - this.currentCategory.setScheme(new Reference(attrs.getValue("", - "scheme"))); - this.currentCategory.setLabel(attrs.getValue("", "label")); - - if (this.state == State.FEED) { - this.state = State.FEED_CATEGORY; - } else if (this.state == State.FEED_ENTRY) { - this.state = State.FEED_ENTRY_CATEGORY; - } else if (this.state == State.FEED_ENTRY_SOURCE) { - this.state = State.FEED_ENTRY_SOURCE_CATEGORY; - } - } else if (localName.equalsIgnoreCase("content")) { - if (this.state == State.FEED_ENTRY) { - contentType = getMediaType(attrs.getValue("", "type")); - String srcAttr = attrs.getValue("", "src"); - this.currentContent = new Content(); - - if (srcAttr == null) { - // Content available inline - initiateInlineMixedContent(); - } else { - // Content available externally - this.currentContent.setExternalRef(new Reference( - srcAttr)); - this.currentContent.setExternalType(contentType); - } - - this.currentEntry.setContent(currentContent); - this.state = State.FEED_ENTRY_CONTENT; - } - startContent(this.currentContent); - } - } - - super.startElement(uri, localName, qName, attrs); - } - - @Override - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - this.prefixMappings.put(prefix, uri); - - super.startPrefixMapping(prefix, uri); - } - - /** - * Receives notification of the beginning of a text element. - * - * @param attrs - * The attributes attached to the element. - */ - public void startTextElement(Attributes attrs) { - this.currentText = new Text(getMediaType(attrs.getValue("", "type"))); - } - -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/ServiceContentReader.java b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/ServiceContentReader.java deleted file mode 100644 index 3e0f92a8e1..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/internal/ServiceContentReader.java +++ /dev/null @@ -1,196 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.atom.internal; - -import java.util.ArrayList; -import java.util.List; - -import org.restlet.data.MediaType; -import org.restlet.data.Reference; -import org.restlet.ext.atom.Collection; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.atom.Service; -import org.restlet.ext.atom.Workspace; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Content reader for services. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServiceContentReader extends DefaultHandler { - - private final static int IN_ACCEPT = 1; - - private final static int IN_COLLECTION = 2; - - private final static int IN_COLLECTION_TITLE = 3; - - private final static int IN_NONE = 0; - - private final static int IN_SERVICE = 4; - - private final static int IN_WORKSPACE = 5; - - private final static int IN_WORKSPACE_TITLE = 6; - - private StringBuilder contentBuffer = null; - - private Collection currentCollection = null; - - private Service currentService = null; - - private Workspace currentWorkspace = null; - - private int state = IN_NONE; - - /** - * Constructor. - * - * @param service - * The parent service. - */ - public ServiceContentReader(Service service) { - this.currentService = service; - } - - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - if ((this.state == IN_ACCEPT) || (this.state == IN_COLLECTION_TITLE) - || (this.state == IN_WORKSPACE_TITLE)) { - this.contentBuffer.append(ch, start, length); - } - } - - @Override - public void endDocument() throws SAXException { - this.state = IN_NONE; - this.currentWorkspace = null; - this.currentCollection = null; - this.contentBuffer = null; - } - - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - if (uri.equalsIgnoreCase(Service.APP_NAMESPACE)) { - if (localName.equalsIgnoreCase("service")) { - this.state = IN_NONE; - } else if (localName.equalsIgnoreCase("workspace")) { - if (this.state == IN_WORKSPACE) { - currentService.getWorkspaces().add(this.currentWorkspace); - this.currentWorkspace = null; - this.state = IN_SERVICE; - } - } else if (localName.equalsIgnoreCase("collection")) { - if (this.state == IN_COLLECTION) { - this.currentWorkspace.getCollections().add( - this.currentCollection); - this.currentCollection = null; - this.state = IN_WORKSPACE; - } - } else if (localName.equalsIgnoreCase("accept")) { - if (this.state == IN_ACCEPT) { - List mediaTypes = null; - String accept = this.contentBuffer.toString(); - - if ((accept != null) && (accept.length() > 0)) { - String[] acceptTokens = accept.split(","); - mediaTypes = new ArrayList(); - - for (String acceptToken : acceptTokens) { - mediaTypes.add(MediaType.valueOf(acceptToken)); - } - } - - this.currentCollection.setAccept(mediaTypes); - this.state = IN_COLLECTION; - } - } - } else if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equalsIgnoreCase("title")) { - if (this.state == IN_COLLECTION_TITLE) { - String title = this.contentBuffer.toString(); - this.currentCollection.setTitle(title); - this.state = IN_COLLECTION; - } else if (this.state == IN_WORKSPACE_TITLE) { - String title = this.contentBuffer.toString(); - this.currentWorkspace.setTitle(title); - this.state = IN_WORKSPACE; - } - } - } - } - - @Override - public void startDocument() throws SAXException { - this.state = IN_NONE; - this.currentWorkspace = null; - this.currentCollection = null; - this.contentBuffer = null; - } - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attrs) throws SAXException { - if (uri.equalsIgnoreCase(Service.APP_NAMESPACE)) { - if (localName.equalsIgnoreCase("service")) { - String attr = attrs.getValue("xml:base"); - if (attr != null) { - this.currentService.setBaseReference(new Reference(attr)); - } - this.state = IN_SERVICE; - } else if (localName.equalsIgnoreCase("workspace")) { - if (this.state == IN_SERVICE) { - this.currentWorkspace = new Workspace(this.currentService); - String attr = attrs.getValue("xml:base"); - if (attr != null) { - this.currentWorkspace.setBaseReference(new Reference( - attr)); - } - this.state = IN_WORKSPACE; - } - } else if (localName.equalsIgnoreCase("collection")) { - if (this.state == IN_WORKSPACE) { - this.currentCollection = new Collection( - this.currentWorkspace, attrs.getValue("title"), - attrs.getValue("href")); - String attr = attrs.getValue("xml:base"); - if (attr != null) { - this.currentCollection.setBaseReference(new Reference( - attr)); - } - - this.state = IN_COLLECTION; - } - } else if (localName.equalsIgnoreCase("accept")) { - if (this.state == IN_COLLECTION) { - this.contentBuffer = new StringBuilder(); - this.state = IN_ACCEPT; - } - } - } else if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equalsIgnoreCase("title")) { - if (this.state == IN_COLLECTION) { - this.contentBuffer = new StringBuilder(); - this.state = IN_COLLECTION_TITLE; - } else if (this.state == IN_WORKSPACE) { - this.contentBuffer = new StringBuilder(); - this.state = IN_WORKSPACE_TITLE; - } - } - } - } -} diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/package.html b/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/package.html deleted file mode 100644 index 5e4d0a2410..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/java/org/restlet/ext/atom/package.html +++ /dev/null @@ -1,10 +0,0 @@ - - -Support for the Atom syndication and the AtomPub (Atom Publication Protocol) standards in their 1.0 version. - -@since Restlet 1.1 -@see Atom Enabled consortium -@see User Guide - Atom extension -@deprecated Will be removed in next major release. - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.atom/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.java/org.restlet.ext.atom/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper deleted file mode 100644 index de0aa0a607..0000000000 --- a/org.restlet.java/org.restlet.ext.atom/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper +++ /dev/null @@ -1 +0,0 @@ -org.restlet.ext.atom.AtomConverter \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.guice/README.md b/org.restlet.java/org.restlet.ext.guice/README.md deleted file mode 100644 index 325e2a6e5f..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Restlet Guice extension - -This extension provides tools for dependency-injecting Restlet -ServerResource instances using Guice or in some cases other -JSR-330-compliant DI frameworks. - -Details are in the `org.restlet.ext.guice` package doc. diff --git a/org.restlet.java/org.restlet.ext.guice/pom.xml b/org.restlet.java/org.restlet.ext.guice/pom.xml deleted file mode 100644 index 18211cab99..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../../pom.xml - - - org.restlet.ext.guice - bundle - Restlet Framework - Guice extension - Integration with Google Guice. - - - - com.google.inject - guice - ${lib-guice-version} - - - org.restlet - org.restlet - ${project.version} - - - org.junit.jupiter - junit-jupiter-api - ${lib-junit-version} - test - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - diff --git a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/FinderFactory.java b/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/FinderFactory.java deleted file mode 100644 index a19fb7bd8a..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/FinderFactory.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.guice; - -import java.lang.annotation.Annotation; - -import org.restlet.resource.Finder; -import org.restlet.resource.ServerResource; - -import com.google.inject.ProvisionException; - -/** - * Factory for dependency-injecting Finders. - * - * @author Tim Peierls - * @deprecated Will be removed in next major release. - */ -@Deprecated -public interface FinderFactory { - - /** - * Returns a {@link Finder} that will obtain a dependency-injected instance - * of the ServerResource subtype bound to the type associated with the given - * class. - * - * @param cls - * The class to instantiate. - * @return An instance of {@link Finder}. - * @throws ProvisionException - * if {@code cls} is not bound to {@link ServerResource} or a - * subclass. - */ - Finder finder(Class cls); - - /** - * Returns a {@link Finder} that will obtain a dependency-injected instance - * of the ServerResource subtype bound to the type and qualifier associated - * with the given class. - * - * @param cls - * The class to instantiate. - * @param qualifier - * The qualifier associated with the given class. - * @return An instance of {@link Finder}. - * @throws ProvisionException - * if {@code cls} qualified by {@code qualifier} is not bound to - * {@link ServerResource} or a subclass. - */ - Finder finder(Class cls, Class qualifier); -} diff --git a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/ResourceInjectingApplication.java b/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/ResourceInjectingApplication.java deleted file mode 100644 index 7e99148c05..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/ResourceInjectingApplication.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.guice; - -import jakarta.inject.Inject; - -import org.restlet.Application; -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.resource.Finder; -import org.restlet.resource.ServerResource; -import org.restlet.routing.Router; - -import com.google.inject.MembersInjector; - -/** - * Application with support for creating Router instances that arrange for - * member injection of resource instances. - * - * @author Tim Peierls - * @deprecated Will be removed in next major release. - */ -@Deprecated -public abstract class ResourceInjectingApplication extends Application { - - /** - * Wraps a {@link Finder} returned by {@link #createFinder(Class)} to do - * member injection using the passed in {@link MembersInjector}. - * - * @param finder - * The finder. - * @param membersInjector - * The instance of {@link MembersInjector}. - * @return A wrapped {@link Finder}. - */ - public static Finder wrapFinderWithMemberInjection(final Finder finder, - final SelfInjectingServerResource.MembersInjector membersInjector) { - return new Finder(finder.getContext(), finder.getTargetClass()) { - @Override - public ServerResource find(Request request, Response response) { - ServerResource res = finder.find(request, response); - if (res instanceof SelfInjectingServerResource) { - SelfInjectingServerResource tmp = (SelfInjectingServerResource) res; - tmp.ensureInjected(membersInjector); - } else { - membersInjector.injectMembers(res); - } - return res; - } - }; - } - - /** The members injector. */ - @Inject - private volatile SelfInjectingServerResource.MembersInjector membersInjector; - - @Override - public Finder createFinder(Class targetClass) { - Finder finder = super.createFinder(targetClass); - return wrapFinderWithMemberInjection(finder, membersInjector); - } - - /** - * Returns a new instance of {@link Router} linked to this application. - * - * @return A new instance of {@link Router}. - */ - public Router newRouter() { - final Application app = this; - return new Router(getContext()) { - @Override - public Application getApplication() { - return app; - } - }; - } -} diff --git a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/RestletGuice.java b/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/RestletGuice.java deleted file mode 100644 index b09c81a4e9..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/RestletGuice.java +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.guice; - -import static java.util.Arrays.asList; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; - -import org.restlet.Application; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.resource.Finder; -import org.restlet.resource.ServerResource; - -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.google.inject.Key; -import com.google.inject.Provider; -import com.google.inject.ProvisionException; -import com.google.inject.Stage; - -/** - * Guice dependency injection for Restlet. - * - * @author Tim Peierls - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class RestletGuice { - - /** - * A Guice module that implements {@link FinderFactory}. On first use of the - * methods of this facility, if the module hasn't been used to create an - * {@link Injector}, this module creates its own Injector. - */ - public static class Module extends AbstractModule implements FinderFactory { - - class KeyFinder extends Finder { - private final Class targetClass; - - KeyFinder(Type type) { - this.targetClass = (Class) type; - } - - @Override - public final Context getContext() { - return getInjector().getInstance(Context.class); - } - - protected final Injector getInjector() { - Injector inj = injector; - if (inj == null) { - synchronized (RestletGuice.Module.this) { - inj = injector; - if (inj == null) { - injector = inj = Guice - .createInjector(RestletGuice.Module.this); - } - } - } - return inj; - } - - public final Class getTargetClass() { - - // If the key type is a subtype of ServerResource, return it. - Class src = ServerResource.class; - if (src != null && targetClass != null - && src.isAssignableFrom(targetClass)) { - @SuppressWarnings("unchecked") - Class result = (Class) targetClass; - return result; - } - - // Otherwise, we can't in general determine the true target - // type, so we revert to the superclass implementation. - // Since we used the no-arg Finder constructor, it will return - // null unless someone has explicitly set a target class. This - // is only relevant to the use of the Router.detach(Class - // targetClass) method; it implies that we cannot detach routes - // that target dependency-injected resources attached as - // non-ServerResource types without explicitly setting a target - // class type. This seems like a *very* minor restriction. - return super.getTargetClass(); - } - } - - class ServerResourceKeyFinder extends KeyFinder { - private final Key serverResourceKey; - - ServerResourceKeyFinder(Key serverResourceKey) { - super(serverResourceKey.getTypeLiteral().getType()); - this.serverResourceKey = serverResourceKey; - } - - @Override - public ServerResource create(Request request, Response response) { - try { - return ServerResource.class.cast(getInjector().getInstance( - serverResourceKey)); - } catch (ClassCastException ex) { - String msg = String.format( - "Must bind %s to ServerResource (or subclass)", - serverResourceKey); - throw new ProvisionException(msg, ex); - } - } - } - - // - // FinderFactory methods - // - - private static ThreadLocal alreadyBound = new ThreadLocal() { - @Override - protected Boolean initialValue() { - return false; - } - }; - - @Inject - private volatile Injector injector; - - private final Iterable modules; - - /** - * Creates a RestletGuice.Module that will install the given modules. - */ - public Module(com.google.inject.Module... modules) { - this.modules = asList(modules); - } - - /** - * Creates a RestletGuice.Module that will install the given modules. - */ - public Module(Iterable modules) { - this.modules = modules; - } - - /** - * If this module is used in more than one injector, we clear the - * thread-local boolean that prevents binding more than once in the same - * thread. - */ - @Inject - private void clearAlreadyBound() { - alreadyBound.set(false); - } - - @Override - protected final void configure() { - - if (injector != null) { - throw new IllegalStateException( - "can't reconfigure with existing Injector"); - } - - if (!alreadyBound.get()) { - alreadyBound.set(true); - - bind(FinderFactory.class).toInstance(this); - - bind(Application.class).toProvider(newApplicationProvider()); - bind(Context.class).toProvider(newContextProvider()); - bind(Request.class).toProvider(newRequestProvider()); - bind(Response.class).toProvider(newResponseProvider()); - } - - for (com.google.inject.Module module : modules) { - install(module); - } - } - - public Finder finder(Class cls) { - return new ServerResourceKeyFinder(Key.get(cls)); - } - - public Finder finder(Class cls, Class qualifier) { - return new ServerResourceKeyFinder(Key.get(cls, qualifier)); - } - - /** - * Creates a {@link Provider}r for the current {@link Application}. - * Override to use a custom Application provider. - * - * @return A {@link Provider} for the current {@link Application}. - */ - protected Provider newApplicationProvider() { - return new Provider() { - public Application get() { - return Application.getCurrent(); - } - }; - } - - /** - * Creates a {@link Provider} for the current {@link Context}. Override - * to use a custom Context provider. - * - * @return A {@link Provider} for the current {@link Context}. - */ - protected Provider newContextProvider() { - return new Provider() { - public Context get() { - return Context.getCurrent(); - } - }; - } - - /** - * Creates a {@link Provider} for the current {@link Request}. Override - * to use a custom Request provider. - * - * @return A {@link Provider} for the current {@link Request}. - */ - protected Provider newRequestProvider() { - return new Provider() { - public Request get() { - return Request.getCurrent(); - } - }; - } - - /** - * Creates a {@link Provider} for the current {@link Response}. Override - * to use a custom Response provider. - * - * @return A {@link Provider} for the current {@link Response}. - */ - protected Provider newResponseProvider() { - return new Provider() { - public Response get() { - return Response.getCurrent(); - } - }; - } - } - - /** - * Creates an instance of {@link Injector} from the given modules with - * {@link FinderFactory} bound to an implementation that uses the injector's - * bindings to create Finder instances. - * - * @param modules - * The list of modules. - * @return The injector for the list of modules. - */ - public static Injector createInjector(com.google.inject.Module... modules) { - return injectorFor(null, new Module(modules)); - } - - /** - * Creates an instance of {@link Injector} from the given modules with - * {@link FinderFactory} bound to an implementation that uses the injector's - * bindings to create Finder instances. - * - * @param modules - * The collection of modules. - * @return The injector for the list of modules. - */ - public static Injector createInjector( - Iterable modules) { - return injectorFor(null, new Module(modules)); - } - - /** - * Creates an instance of {@link Injector} in the given {@link Stage} from - * the given modules with {@link FinderFactory} bound to an implementation - * that uses the injector's bindings to create {@link Finder} instances. - * - * @param stage - * The {@link Stage}. - * @param modules - * The list of modules. - * @return The injector for the list of modules in the given stage. - */ - public static Injector createInjector(Stage stage, - com.google.inject.Module... modules) { - return injectorFor(stage, new Module(modules)); - } - - /** - * Creates an instance of {@link Injector} in the given {@link Stage} from - * the given modules with {@link FinderFactory} bound to an implementation - * that uses the injector's bindings to create {@link Finder} instances. - * - * @param stage - * The {@link Stage}. - * @param modules - * The list of modules. - * @return The injector for the list of modules in the given stage. - */ - - public static Injector createInjector(Stage stage, - Iterable modules) { - return injectorFor(stage, new Module(modules)); - } - - private static Injector injectorFor(Stage stage, Module rootModule) { - if (stage == null) { - return Guice.createInjector(rootModule); - } else { - return Guice.createInjector(stage, rootModule); - } - } -} diff --git a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/SelfInjectingServerResource.java b/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/SelfInjectingServerResource.java deleted file mode 100644 index 66f5ecc0ad..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/SelfInjectingServerResource.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.guice; - -import java.util.concurrent.atomic.AtomicBoolean; - -import jakarta.inject.Inject; - -import org.restlet.resource.ServerResource; - -/** - * Base class for ServerResources that do their own member injection. - * - * @author Tim Peierls - * @deprecated Will be removed in next major release. - */ -@Deprecated -public abstract class SelfInjectingServerResource extends ServerResource { - - /** - * Implemented by DI framework-specific code. For example, with Guice, the - * statically-injected MembersInjector just calls - * {@code injector.injectMembers(object)}. - */ - interface MembersInjector { - void injectMembers(Object object); - } - - /** Must be statically injected by DI framework. */ - @Inject - private static volatile MembersInjector theMembersInjector; - - /** - * Whether we've been injected yet. This protects against multiple injection - * of a subclass that gets injected before {@link #doInit()} is called. - */ - private final AtomicBoolean injected = new AtomicBoolean(false); - - /** - * Subclasseses overriding this method must call {@code super.doInit()} - * first. - */ - protected void doInit() { - ensureInjected(theMembersInjector); - } - - void ensureInjected(MembersInjector membersInjector) { - if (membersInjector != null && injected.compareAndSet(false, true)) { - membersInjector.injectMembers(this); - } - } - - @Inject - private void injected() { // NOPMD - injected.set(true); - } -} diff --git a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/SelfInjectingServerResourceModule.java b/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/SelfInjectingServerResourceModule.java deleted file mode 100644 index 542a4d342d..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/SelfInjectingServerResourceModule.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.guice; - -import org.restlet.ext.guice.SelfInjectingServerResource.MembersInjector; - -import com.google.inject.AbstractModule; -import com.google.inject.Injector; -import com.google.inject.Provides; - -/** - * Install this module to arrange for {@link SelfInjectingServerResource} - * instances to have their members injected (idempotently) by the - * {@link SelfInjectingServerResource#doInit()} method (which is called - * automatically after construction). - * - * @author Tim Peierls - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class SelfInjectingServerResourceModule extends AbstractModule { - - @Override - protected final void configure() { - requestStaticInjection(SelfInjectingServerResource.class); - } - - @Provides - MembersInjector membersInjector(final Injector injector) { - return injector::injectMembers; - } -} diff --git a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/package-info.java b/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/package-info.java deleted file mode 100644 index ef5bef15c7..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/src/main/java/org/restlet/ext/guice/package-info.java +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Integration with Google Guice 7.0. - * - *

- * Tools for dependency injection (DI) of Restlet - * {@link org.restlet.resource.ServerResource ServerResource} types that have - * {@code jakarta.inject}-annotated members. Although the extension has "guice" in - * the package name and contains direct support for Google Guice version 3.0 or - * later, the tools here can be adapted for use with any DI framework that - * complies with JSR-330. - *

- *

- * This extension provides three independent approaches for dependency-injecting - * Restlet server resources, the self-injection approach, the - * Finder factory approach, and the - * resource-injecting application approach. - *

- *

- * Note that the extension is limited to injection of server resources, and not - * other Restlet types, because server resources are constructed by the Restlet - * framework, not by the user. The last section below describes how to use a - * JSR-330 DI framework to inject other Restlet types, without needing the tools - * in this extension. - *

- * - *

Self-injection

- *

- * When using this approach: - *

- *
    - *
  • DI framework must support static field injection (Guice does).
  • - *
  • No constructor injection for resources; only field and method injection - * will work.
  • - *
- *

- * In the self-injection approach, extend - * {@link org.restlet.ext.guice.SelfInjectingServerResource - * SelfInjectingServerResource} and annotate fields and methods to be injected - * with {@code @Inject}. - *

- *

- * To inject resources with Guice, install a - * {@link org.restlet.ext.guice.SelfInjectingServerResourceModule - * SelfInjectingServerResourceModule} when creating the {@code Injector}. - *

- * - *

Finder factory

- *

- * When using this approach: - *

- *
    - *
  • DI framework does not need to support static field injection.
  • - *
  • All forms of injection are allowed: constructor, field, method.
  • - *
  • - * Target resource can be specified by type alone or by type and JSR-330 - * {@code Qualifier}.
  • - *
- *

- * In the {@link org.restlet.resource.Finder Finder} factory approach, inject - * {@link org.restlet.ext.guice.FinderFactory FinderFactory} into contexts where - * routing to resources is initialized, e.g., - * {@link org.restlet.Application#createInboundRoot createInboundRoot()}, and - * use {@link org.restlet.ext.guice.FinderFactory#finder - * FinderFactory.finder(Class)} in calls to - * {@link org.restlet.routing.Router#attach Router.attach()} instead of the - * plain server resource class name. For example: - *

- * - *
- *   // Binding in Guice:
- *   bind(ServerResource.class)
- *       .annotatedWith(Hello.class)
- *       .to(HelloServerResource.class);
- * 
- *   // In createInboundRoot():
- *   FinderFactory finderFactory = ... injected somehow ...;
- * 
- *   // Attachment with no coupling to concrete resource type:
- *   router.attach("/hello", finderFactory.finder(ServerResource.class, Hello.class);
- * 
- *   // Attachment with direct knowledge of concrete resource type:
- *   router.attach("/bye", finderFactory.finder(ByeServerResource.class);
- * 
- *

- * To use a Guice-enabled {@code FinderFactory}, install a - * {@link org.restlet.ext.guice.RestletGuice.Module RestletGuice.Module} when - * creating the {@code Injector}. ({@link org.restlet.ext.guice.RestletGuice - * RestletGuice} has convenience methods to install such a module that parallel - * those in the {@code Guice} class.) - *

- *

- * Alternatively, for standalone Applications, create a single - * {@code RestletGuice.Module} instance, possibly passing other Guice modules to - * the constructor, and use it as the {@code FinderFactory} in - * {@code createInboundRoot()}. - *

- * - *

Resource-injecting application

- *

- * When using this approach: - *

- *
    - *
  • DI framework does not need to support static field injection.
  • - *
  • No constructor injection for resources; only field and method injection - * will work.
  • - *
  • Application instance must itself be injected.
  • - *
- *

- * In the resource-injecting application approach, extend - * {@link org.restlet.ext.guice.ResourceInjectingApplication - * ResourceInjectingApplication} and use - * {@link org.restlet.ext.guice.ResourceInjectingApplication#newRouter - * newRouter()} instead of {@code new Router(...)}. The overridden - * {@code createFinder} will produce Finders that inject the server resources - * they create. - *

- *

- * To work with Guice, install a - * {@link org.restlet.ext.guice.SelfInjectingServerResourceModule - * SelfInjectingServerResourceModule} when creating the {@code Injector} that - * injects the application. To work with another JSR-330-compliant framework, - * bind - * {@link org.restlet.ext.guice.SelfInjectingServerResource.MembersInjector - * SelfInjectingServerResource.MembersInjector} to a framework-specific - * implementation. - *

- * - *

Injecting other Restlet types

- *

- * Instead of calling {@code new FooApplication(...)} when attaching an - * application in setting up a component, inject that application beforehand: - *

- * - *
- * public class MyComponent extends Component {
- * 
- *     public static void main(String... args) {
- *           // Run as standalone component:
- *           Injector injector = <em>... create injector ...</em>;
- *           MyComponent comp = injector.getInstance(MyComponent.class);
- *           // <em>... shutdown hooks, etc. ...</em>
- *           comp.start();
- *       }
- * 
- *     @Inject
- *     MyComponent(FooApplication fooApp, BarApplication barApp) {
- *         // ...
- *         getDefaultHost().attach("/foo", fooApp);
- *         getDefaultHost().attach("/bar", barApp);
- *     }
- * }
- * 
- *

- * To avoid coupling a knowledge of a specific application subtype in this - * setting, use qualifiers: - *

- * - *
- * @Inject
- * MyComponent(@Foo
- * Application fooApp, @Bar
- * Application barApp) {
- *     // ...
- *     getDefaultHost().attach("/foo", fooApp);
- *     getDefaultHost().attach("/bar", barApp);
- * }
- * 
- * // With the qualifiers defined elsewhere:
- * 
- * @java.lang.annotation.Retention(RUNTIME)
- * @javax.inject.Qualifier
- * public @interface Foo {
- * }
- * 
- *

- * Using the {@code @Named} qualifier trades some type-safety for convenience: - *

- * - *
- *   @Inject
- *   MyComponent(@Named(FOO) Application fooApp, @Named(BAR) Application barApp) ...
- * 
- * - * @since Restlet 2.2 - * @see Google Guice project - * @see User Guide - * - Guice extension - * @deprecated Will be removed in next major release. - */ -@Deprecated -package org.restlet.ext.guice; - diff --git a/org.restlet.java/org.restlet.ext.guice/src/test/java/org/restlet/ext/guice/GuiceSelfInjectingServerResourceModuleTestCase.java b/org.restlet.java/org.restlet.ext.guice/src/test/java/org/restlet/ext/guice/GuiceSelfInjectingServerResourceModuleTestCase.java deleted file mode 100644 index b28d6d6617..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/src/test/java/org/restlet/ext/guice/GuiceSelfInjectingServerResourceModuleTestCase.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.guice; - -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Provides; -import jakarta.inject.Inject; -import jakarta.inject.Named; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.restlet.*; -import org.restlet.data.MediaType; -import org.restlet.data.Protocol; -import org.restlet.resource.ClientResource; -import org.restlet.resource.Get; -import org.restlet.routing.Router; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class GuiceSelfInjectingServerResourceModuleTestCase { - - public interface HelloResource { - @Get - String getMessage(); - } - - public static class HelloServerResource extends SelfInjectingServerResource - implements HelloResource { - @Inject - @Named(HELLO_KEY) - private String msg; - - @Override - protected void doInit() { - System.out.println("before doInit: msg=" + msg); - try { - super.doInit(); - } finally { - System.out.println("after doInit: msg=" + msg); - } - } - - @Override - public String getMessage() { - return msg; - } - } - - private static class TestApplication extends Application { - @Override - public Restlet createInboundRoot() { - Router router = new Router(getContext()); - router.attach("/hello", HelloServerResource.class); - return router; - } - - } - - static class TestModule extends AbstractModule { - protected void configure() { - } - - @Provides - @Named(HELLO_KEY) - String helloMessage() { - return HELLO_MSG; - } - } - - static final String HELLO_KEY = "hello.message"; - - static final String HELLO_MSG = "This resource was injected by Guice!"; - - private volatile Client client; - - private volatile Component component; - private volatile Application application; - - private int testPort; - - @BeforeEach - protected void setUpEach() throws Exception { - Guice.createInjector(new TestModule(), new SelfInjectingServerResourceModule()); - - this.client = new Client(Protocol.HTTP); - - application = new TestApplication(); - component = new Component(); - Server server = component.getServers().add(Protocol.HTTP, 0); - component.getDefaultHost().attachDefault(application); - - this.component.start(); - testPort = server.getActualPort(); - } - - @AfterEach - public void tearDownEach() throws Exception { - this.client.stop(); - this.component.stop(); - this.component = null; - } - - @Test - public void testReturnsMessage() { - ClientResource client = new ClientResource("http://localhost:" + testPort); - client.accept(MediaType.TEXT_PLAIN); - String msg = client.getChild("/hello", HelloResource.class).getMessage(); - assertEquals(HELLO_MSG, msg); - } -} diff --git a/org.restlet.java/org.restlet.ext.guice/src/test/java/org/restlet/ext/guice/GuiceWrappedFinderTestCase.java b/org.restlet.java/org.restlet.ext.guice/src/test/java/org/restlet/ext/guice/GuiceWrappedFinderTestCase.java deleted file mode 100644 index e1831c8d7d..0000000000 --- a/org.restlet.java/org.restlet.ext.guice/src/test/java/org/restlet/ext/guice/GuiceWrappedFinderTestCase.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.guice; - -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.Provides; -import jakarta.inject.Inject; -import jakarta.inject.Named; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.restlet.Client; -import org.restlet.Component; -import org.restlet.Restlet; -import org.restlet.Server; -import org.restlet.data.MediaType; -import org.restlet.data.Protocol; -import org.restlet.resource.ClientResource; -import org.restlet.resource.Get; -import org.restlet.resource.ServerResource; -import org.restlet.routing.Router; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class GuiceWrappedFinderTestCase { - - public interface HelloResource { - @Get - String getMessage(); - } - - public static class HelloServerResource extends SelfInjectingServerResource - implements HelloResource { - - @Inject - @Named(HELLO_KEY) - private String msg; - - @Override - protected void doInit() { - System.out.println("Hello: before doInit: msg=" + msg); - try { - super.doInit(); - } finally { - System.out.println("Hello: after doInit: msg=" + msg); - } - } - - @Override - public String getMessage() { - return msg; - } - } - - public static class HiServerResource extends ServerResource implements - HelloResource { - @Inject - @Named(HELLO_KEY) - private String msg; - - @Override - protected void doInit() { - System.out.println("Hi: before doInit: msg=" + msg); - try { - super.doInit(); - } finally { - System.out.println("Hi: after doInit: msg=" + msg); - } - } - - @Override - public String getMessage() { - return _HI_PREFIX + msg; - } - } - - public static final class MyApp extends ResourceInjectingApplication { - @Override - public Restlet createInboundRoot() { - Router router = newRouter(); - router.setFinderClass(null); - router.attach("/hello", HelloServerResource.class); - router.attach("/hi", HiServerResource.class); - return router; - } - } - - public static final class MyComponent extends Component { - private final Server server; - - @Inject - MyComponent(MyApp myApp) { - server = getServers().add(Protocol.HTTP, 0); - getDefaultHost().attachDefault(myApp); - } - - int getActualHttpServerPort() { - return server.getActualPort(); - } - } - - static class TestModule extends AbstractModule { - protected void configure() { - } - - @Provides - @Named(HELLO_KEY) - String helloMessage() { - return HELLO_MSG; - } - } - - static final String _HI_PREFIX = "Hi, there: "; - - static final String HELLO_KEY = "hello.message"; - - static final String HELLO_MSG = "This resource was injected by Guice!"; - - static final String HI_MSG = _HI_PREFIX + HELLO_MSG; - - private volatile Client client; - - private volatile MyComponent component; - private volatile int testPort; - - @BeforeEach - protected void setUpEach() throws Exception { - Injector injector = Guice.createInjector(new TestModule(), - new SelfInjectingServerResourceModule()); - - this.client = new Client(Protocol.HTTP); - - if (component == null) { - component = injector.getInstance(MyComponent.class); - } - - this.component.start(); - testPort = component.getActualHttpServerPort(); - } - - @AfterEach - public void tearDownEach() throws Exception { - this.client.stop(); - this.component.stop(); - this.component = null; - } - - @Test - public void testHiReturnsMessage() { - ClientResource client = new ClientResource("http://localhost:" + testPort); - client.accept(MediaType.TEXT_PLAIN); - String msg = client.getChild("/hi", HelloResource.class).getMessage(); - assertEquals(HI_MSG, msg); - } - - @Test - public void testReturnsMessage() { - ClientResource client = new ClientResource("http://localhost:" + testPort); - client.accept(MediaType.TEXT_PLAIN); - String msg = client.getChild("/hello", HelloResource.class).getMessage(); - assertEquals(HELLO_MSG, msg); - } -} diff --git a/org.restlet.java/org.restlet.ext.gwt/pom.xml b/org.restlet.java/org.restlet.ext.gwt/pom.xml deleted file mode 100644 index 6d9200cd03..0000000000 --- a/org.restlet.java/org.restlet.ext.gwt/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../../pom.xml - - - org.restlet.ext.gwt - bundle - Restlet Framework - GWT extension - Server-side integration with GWT. - - - - org.gwtproject - gwt-servlet - ${lib-gwt-server-version} - - - jakarta.servlet - jakarta.servlet-api - ${lib-servlet-version} - provided - - - org.restlet - org.restlet - ${project.version} - - - org.restlet - org.restlet.ext.servlet - ${project.version} - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - diff --git a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/GwtConverter.java b/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/GwtConverter.java deleted file mode 100644 index fe7904abaf..0000000000 --- a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/GwtConverter.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.gwt; - -import static org.restlet.data.MediaType.APPLICATION_JAVA_OBJECT_GWT; - -import java.io.IOException; -import java.io.Serializable; -import java.util.List; - -import org.restlet.data.MediaType; -import org.restlet.data.Preference; -import org.restlet.engine.converter.ConverterHelper; -import org.restlet.engine.resource.VariantInfo; -import org.restlet.representation.Representation; -import org.restlet.representation.Variant; -import org.restlet.resource.Resource; - -import com.google.gwt.user.client.rpc.IsSerializable; - -/** - * Converter between Object instances and Representations based on GWT - * serialization format. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class GwtConverter extends ConverterHelper { - - /** GWT variant. */ - private static final VariantInfo VARIANT_GWT = new VariantInfo(APPLICATION_JAVA_OBJECT_GWT); - - @Override - public List> getObjectClasses(Variant source) { - List> result = null; - - if (VARIANT_GWT.isCompatible(source)) { - result = addObjectClass(result, Serializable.class); - result = addObjectClass(result, ObjectRepresentation.class); - } - - return result; - } - - @Override - public List getVariants(Class source) { - List result = null; - - if (Serializable.class.isAssignableFrom(source) - || IsSerializable.class.isAssignableFrom(source) - || ObjectRepresentation.class.isAssignableFrom(source)) { - result = addVariant(result, VARIANT_GWT); - } - - return result; - } - - @Override - public float score(Object source, Variant target, Resource resource) { - - if (source instanceof Serializable || source instanceof IsSerializable) { - if (target == null) { - return 0.5F; - } - if (APPLICATION_JAVA_OBJECT_GWT.equals(target.getMediaType())) { - return 1.0F; - } - if (APPLICATION_JAVA_OBJECT_GWT.isCompatible(target.getMediaType())) { - return 0.6F; - } - return 0.5F; - } - - return -1.0F; - } - - @Override - public float score(Representation source, Class target, Resource resource) { - if (source instanceof ObjectRepresentation) { - return 1.0F; - } - - if (target != null) { - if (ObjectRepresentation.class.isAssignableFrom(target)) { - return 1.0F; - } - if (Serializable.class.isAssignableFrom(target) - || IsSerializable.class.isAssignableFrom(target)) { - if (APPLICATION_JAVA_OBJECT_GWT.equals(source.getMediaType())) { - return 1.0F; - } - if (APPLICATION_JAVA_OBJECT_GWT.isCompatible(source.getMediaType())) { - return 0.6F; - } - } - } - - return -1.0F; - } - - @SuppressWarnings("unchecked") - @Override - public T toObject(Representation source, Class target, Resource resource) throws IOException { - ObjectRepresentation gwtSource = (source instanceof ObjectRepresentation) ? - (ObjectRepresentation) source : - new ObjectRepresentation(source.getText(), target); - - if (target == null) { - return (T) gwtSource.getObject(); - } - if (ObjectRepresentation.class.isAssignableFrom(target)) { - return (T) gwtSource; - } - if (Serializable.class.isAssignableFrom(target) - || IsSerializable.class.isAssignableFrom(target)) { - return (T) gwtSource.getObject(); - } - - return null; - } - - @Override - public Representation toRepresentation(Object source, Variant target, Resource resource) { - if (source instanceof Serializable) { - return new ObjectRepresentation((Serializable) source); - } - if (source instanceof IsSerializable) { - return new ObjectRepresentation((IsSerializable) source); - } - if (source instanceof Representation) { - return (Representation) source; - } - - return null; - } - - @Override - public void updatePreferences(List> preferences, - Class entity) { - if (Serializable.class.isAssignableFrom(entity) - || IsSerializable.class.isAssignableFrom(entity) - || ObjectRepresentation.class.isAssignableFrom(entity)) { - updatePreferences(preferences, APPLICATION_JAVA_OBJECT_GWT, 1.0F); - } - } - -} diff --git a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/ObjectRepresentation.java b/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/ObjectRepresentation.java deleted file mode 100644 index b13ca8ef20..0000000000 --- a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/ObjectRepresentation.java +++ /dev/null @@ -1,182 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.gwt; - -import java.io.IOException; - -import org.restlet.data.MediaType; -import org.restlet.engine.Engine; -import org.restlet.representation.StringRepresentation; - -import com.google.gwt.user.client.rpc.impl.AbstractSerializationStream; -import com.google.gwt.user.server.rpc.SerializationPolicy; -import com.google.gwt.user.server.rpc.SerializationPolicyProvider; -import com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader; -import com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter; - -/** - * Representation based on a serializable Java object. This internally reuses - * the GWT-RPC serialization logic. - * - * @author Jerome Louvel - * @param - * The class to serialize. - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ObjectRepresentation extends StringRepresentation { - - /** The wrapped object. */ - private T object; - - /** The GWT-RPC serialization policy. */ - private SerializationPolicy serializationPolicy; - - /** The GWT-RPC serialization policy provider. */ - private SerializationPolicyProvider serializationPolicyProvider; - - /** The target object class. */ - private Class targetClass; - - /** - * Constructor for deserialization. - * - * @param serializedObject - * The object serialization text. - * @param targetClass - * The target object class. - */ - public ObjectRepresentation(String serializedObject, Class targetClass) { - super(serializedObject, MediaType.APPLICATION_JAVA_OBJECT_GWT); - this.targetClass = targetClass; - this.object = null; - this.serializationPolicy = SimpleSerializationPolicy.getInstance(); - this.serializationPolicyProvider = new SimpleSerializationPolicyProvider(); - } - - /** - * Constructor for serialization. - * - * @param object - * The object to serialize. - */ - @SuppressWarnings("unchecked") - public ObjectRepresentation(T object) { - super(null, MediaType.APPLICATION_JAVA_OBJECT_GWT); - this.object = object; - this.targetClass = (Class) object.getClass(); - this.serializationPolicy = SimpleSerializationPolicy.getInstance(); - this.serializationPolicyProvider = new SimpleSerializationPolicyProvider(); - } - - /** - * The wrapped object. Triggers the deserialization if necessary. - * - * @return The wrapped object. - * @throws IOException - */ - @SuppressWarnings("unchecked") - public T getObject() throws IOException { - if ((this.object == null) && (getText() != null)) { - try { - ServerSerializationStreamReader objectReader = new ServerSerializationStreamReader( - Engine.getInstance().getClassLoader(), - new SimpleSerializationPolicyProvider()); - String encodedString = getText(); - - if (encodedString.indexOf('|') == -1) { - encodedString = AbstractSerializationStream.SERIALIZATION_STREAM_VERSION - + "|1|0|0|0|" + getText() + '|'; - } - - objectReader.prepareToRead(encodedString); - this.object = (T) objectReader - .deserializeValue(this.targetClass); - } catch (Exception e) { - this.object = null; - IOException ioe = new IOException( - "Couldn't read the GWT object representation: " - + e.getMessage()); - ioe.initCause(e); - throw ioe; - } - - } - - return object; - } - - /** - * Returns the GWT-RPC serialization policy. - * - * @return The GWT-RPC serialization policy. - */ - public SerializationPolicy getSerializationPolicy() { - return serializationPolicy; - } - - /** - * Returns the GWT-RPC serialization policy provider. - * - * @return The GWT-RPC serialization policy provider. - */ - public SerializationPolicyProvider getSerializationPolicyProvider() { - return serializationPolicyProvider; - } - - @Override - public String getText() { - if ((this.object != null) && (super.getText() == null)) { - try { - ServerSerializationStreamWriter objectWriter = new ServerSerializationStreamWriter( - getSerializationPolicy()); - objectWriter.serializeValue(this.object, this.targetClass); - setText("//OK" + objectWriter.toString()); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - return super.getText(); - } - - /** - * Sets the wrapped object. - * - * @param object - * The wrapped object. - */ - public void setObject(T object) { - this.object = object; - } - - /** - * Sets the GWT-RPC serialization policy. - * - * @param serializationPolicy - * The GWT-RPC serialization policy. - */ - public void setSerializationPolicy(SerializationPolicy serializationPolicy) { - this.serializationPolicy = serializationPolicy; - } - - /** - * Sets the GWT-RPC serialization policy provider. - * - * @param serializationPolicyProvider - * The GWT-RPC serialization policy provider. - */ - public void setSerializationPolicyProvider( - SerializationPolicyProvider serializationPolicyProvider) { - this.serializationPolicyProvider = serializationPolicyProvider; - } - -} diff --git a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/SimpleSerializationPolicy.java b/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/SimpleSerializationPolicy.java deleted file mode 100644 index 84f30cf82c..0000000000 --- a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/SimpleSerializationPolicy.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.gwt; - -import com.google.gwt.user.client.rpc.SerializationException; -import com.google.gwt.user.server.rpc.SerializationPolicy; - -/** - * Serialization policy that allows the serialization of all the classes and - * fields. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class SimpleSerializationPolicy extends SerializationPolicy { - - private static final SimpleSerializationPolicy instance = new SimpleSerializationPolicy(); - - /** - * Returns the common instance of this simple policy file. - * - * @return The common instance of this simple policy file. - */ - public static SerializationPolicy getInstance() { - return instance; - } - - @Override - public boolean shouldDeserializeFields(Class clazz) { - return (clazz != null); - } - - @Override - public boolean shouldSerializeFields(Class clazz) { - return (clazz != null); - } - - @Override - public void validateDeserialize(Class clazz) - throws SerializationException { - // No validation - } - - @Override - public void validateSerialize(Class clazz) throws SerializationException { - // No validation - } - -} diff --git a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/SimpleSerializationPolicyProvider.java b/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/SimpleSerializationPolicyProvider.java deleted file mode 100644 index 06a579a36f..0000000000 --- a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/SimpleSerializationPolicyProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.gwt; - -import com.google.gwt.user.server.rpc.SerializationPolicy; -import com.google.gwt.user.server.rpc.SerializationPolicyProvider; - -/** - * Serialization policy provider that return the - * {@link SimpleSerializationPolicy} default instance all the time. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class SimpleSerializationPolicyProvider implements - SerializationPolicyProvider { - - /** - * Simple policy provider that always returns - * {@link SimpleSerializationPolicy#getInstance()}. - */ - public SerializationPolicy getSerializationPolicy(String moduleBaseURL, - String serializationPolicyStrongName) { - return SimpleSerializationPolicy.getInstance(); - } - -} diff --git a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/package.html b/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/package.html deleted file mode 100644 index 27b35a1f5f..0000000000 --- a/org.restlet.java/org.restlet.ext.gwt/src/main/java/org/restlet/ext/gwt/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - -Server-side integration with GWT. - -@since Restlet 1.1 -@see Google Web Toolkit -@see User Guide - GWT extension - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.gwt/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.java/org.restlet.ext.gwt/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper deleted file mode 100644 index ae05252356..0000000000 --- a/org.restlet.java/org.restlet.ext.gwt/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper +++ /dev/null @@ -1 +0,0 @@ -org.restlet.ext.gwt.GwtConverter \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.jaxb/pom.xml b/org.restlet.java/org.restlet.ext.jaxb/pom.xml deleted file mode 100644 index 53da22739c..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../../pom.xml - - - org.restlet.ext.jaxb - bundle - Restlet Framework - JAXB extension - Integration with Java XML Binding. - - - - jakarta.xml.bind - jakarta.xml.bind-api - ${lib-jaxb-api-version} - - - org.glassfish.jaxb - jaxb-runtime - ${lib-jaxb-ri-version} - - - org.restlet - org.restlet - ${project.version} - - - org.junit.jupiter - junit-jupiter-params - ${lib-junit-version} - test - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java deleted file mode 100644 index 7947d2e090..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbConverter.java +++ /dev/null @@ -1,205 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.jaxb; - -import java.io.IOException; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlRootElement; -import org.restlet.data.MediaType; -import org.restlet.data.Preference; -import org.restlet.engine.converter.ConverterHelper; -import org.restlet.engine.resource.VariantInfo; -import org.restlet.representation.Representation; -import org.restlet.representation.Variant; -import org.restlet.resource.Resource; - -/** - * A JAXB Converter Helper to convert from JAXB objects to JaxbRepresentations - * and vice versa. - * - * @author Sanjay Acharya - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class JaxbConverter extends ConverterHelper { - private static final VariantInfo VARIANT_APPLICATION_ALL_XML = new VariantInfo( - MediaType.APPLICATION_ALL_XML); - - private static final VariantInfo VARIANT_APPLICATION_XML = new VariantInfo( - MediaType.APPLICATION_XML); - - private static final VariantInfo VARIANT_TEXT_XML = new VariantInfo( - MediaType.TEXT_XML); - - @Override - public List> getObjectClasses(Variant source) { - List> result = null; - - if (isCompatible(source)) { - result = addObjectClass(result, JaxbRepresentation.class); - } - - return result; - } - - @Override - public List getVariants(Class source) { - List result = null; - - if (isJaxbRootElementClass(source) - || JaxbRepresentation.class.isAssignableFrom(source)) { - result = addVariant(result, VARIANT_APPLICATION_ALL_XML); - result = addVariant(result, VARIANT_APPLICATION_XML); - result = addVariant(result, VARIANT_TEXT_XML); - } - - return result; - } - - /** - * Indicates if the given mediaType is compatible with the media types - * supported by this converter. - * - * @param mediaType - * The mediaType. - * @return True if the given mediaType is compatible with the media types - * supported by this converter. - */ - protected boolean isCompatible(MediaType mediaType) { - return (mediaType != null) - && (MediaType.APPLICATION_ALL_XML.isCompatible(mediaType) - || MediaType.APPLICATION_XML.isCompatible(mediaType) || MediaType.TEXT_XML - .isCompatible(mediaType)); - } - - /** - * Indicates if the given variant is compatible with the media types - * supported by this converter. - * - * @param variant - * The variant. - * @return True if the given variant is compatible with the media types - * supported by this converter. - */ - protected boolean isCompatible(Variant variant) { - return (variant != null) - && (VARIANT_APPLICATION_ALL_XML.isCompatible(variant) - || VARIANT_APPLICATION_XML.isCompatible(variant) || VARIANT_TEXT_XML - .isCompatible(variant)); - } - - /** - * Indicates if the class has JAXB annotations. - * - * @param source - * The class to test. - * @return True if the class has JAXB annotations. - */ - private boolean isJaxbRootElementClass(Class source) { - return source != null - && source.isAnnotationPresent(XmlRootElement.class); - } - - @Override - public float score(Object source, Variant target, Resource resource) { - float result = -1.0F; - - if (source != null - && (source instanceof JaxbRepresentation || isJaxbRootElementClass(source - .getClass()))) { - if (target == null) { - result = 0.8F; - } else if (isCompatible(target.getMediaType())) { - result = 1.0F; - } else { - // Allow for JAXB object to be used for JSON and other - // representations - result = 0.7F; - } - } - - return result; - } - - @Override - public float score(Representation source, Class target, - Resource resource) { - float result = -1.0F; - - if (source != null) { - if (source instanceof JaxbRepresentation) { - result = 1.0F; - } else if (JaxbRepresentation.class.isAssignableFrom(source - .getClass())) { - result = 1.0F; - } else if (isJaxbRootElementClass(target) - || JaxbRepresentation.class.isAssignableFrom(target)) { - if (isCompatible(source.getMediaType())) { - result = 1.0F; - } else { - // Allow for JAXB object to be used for JSON and other - // representations - result = 0.7F; - } - } - } - - return result; - } - - @SuppressWarnings("unchecked") - @Override - public T toObject(Representation source, Class target, - Resource resource) throws IOException { - JaxbRepresentation jaxbSource = null; - if (source instanceof JaxbRepresentation) { - jaxbSource = (JaxbRepresentation) source; - } else { - jaxbSource = new JaxbRepresentation(source, target); - } - - T result = null; - if (target == null) { - result = (T) jaxbSource.getObject(); - } else if (JaxbRepresentation.class.isAssignableFrom(target)) { - result = target.cast(jaxbSource); - } else if (isJaxbRootElementClass(target)) { - result = target.cast(jaxbSource.getObject()); - } - - return result; - } - - @Override - public Representation toRepresentation(Object source, Variant target, - Resource resource) { - Representation result = null; - - if (isJaxbRootElementClass(source.getClass())) { - result = new JaxbRepresentation(source); - } else if (source instanceof JaxbRepresentation) { - result = (Representation) source; - } - - return result; - } - - @Override - public void updatePreferences(List> preferences, - Class entity) { - if (JaxbRepresentation.class.isAssignableFrom(entity) - || isJaxbRootElementClass(entity)) { - updatePreferences(preferences, MediaType.APPLICATION_ALL_XML, 1.0F); - updatePreferences(preferences, MediaType.APPLICATION_XML, 1.0F); - updatePreferences(preferences, MediaType.TEXT_XML, 1.0F); - } - } -} diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java deleted file mode 100644 index a72835c967..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/JaxbRepresentation.java +++ /dev/null @@ -1,669 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.jaxb; - -import java.io.IOException; -import java.io.Writer; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Level; - -import jakarta.xml.bind.JAXBContext; -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.ValidationEventHandler; -import jakarta.xml.bind.util.JAXBSource; - -import org.glassfish.jaxb.runtime.marshaller.NamespacePrefixMapper; -import org.restlet.Context; -import org.restlet.data.MediaType; -import org.restlet.ext.jaxb.internal.Marshaller; -import org.restlet.ext.jaxb.internal.Unmarshaller; -import org.restlet.representation.Representation; -import org.restlet.representation.WriterRepresentation; - -/** - * An XML representation based on JAXB that provides easy translation between - * XML and JAXB element class trees. - * - * @author Overstock.com - * @author Jerome Louvel - * @param - * The type to wrap. - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class JaxbRepresentation extends WriterRepresentation { - - /** Improves performance by caching contexts which are expensive to create. */ - private final static Map contexts = new ConcurrentHashMap(); - - /** - * Returns the JAXB context, if possible from the cached contexts. - * - * @param contextPath - * The JAXB context path. - * - * @return The JAXB context. - * @throws JAXBException - */ - public static synchronized JAXBContext getContext(String contextPath) - throws JAXBException { - return getContext(contextPath, null); - } - - /** - * Returns the JAXB context, if possible from the cached contexts. - * - * @param contextPath - * The JAXB context path. - * - * @param classLoader - * The JAXB classloader to use for annotated JAXB classes. - * - * @return The JAXB context. - * @throws JAXBException - */ - public static synchronized JAXBContext getContext(String contextPath, - ClassLoader classLoader) throws JAXBException { - // Contexts are thread-safe so reuse those. - JAXBContext result = contexts.get(contextPath); - - if (result == null) { - result = (classLoader == null) ? JAXBContext - .newInstance(contextPath) : JAXBContext.newInstance( - contextPath, classLoader); - contexts.put(contextPath, result); - } - - return result; - } - - /** - * The classloader to use for JAXB annotated classes. - */ - private volatile ClassLoader classLoader; - - /** - * The list of Java package names that contain schema derived class and/or - * Java to schema (JAXB-annotated) mapped classes. - */ - private volatile String contextPath; - - /** - * Specifies that the parser will expand entity reference nodes. By default - * the value of this is set to true. - */ - private volatile boolean expandingEntityRefs; - - /** - * Indicates if the resulting XML data should be formatted with line breaks - * and indentation. Defaults to false. - */ - private volatile boolean formattedOutput; - - /** - * Indicates whether the Marshaller will generate document level events. - */ - private volatile boolean fragment; - - /** An optional namespace prefix mapper for marshalling. */ - private volatile NamespacePrefixMapper namespacePrefixMapper; - - /** The "xsi:noNamespaceSchemaLocation" attribute in the generated XML data. */ - private volatile String noNamespaceSchemaLocation; - - /** The wrapped Java object. */ - private volatile T object; - - /** The "xsi:schemaLocation" attribute in the generated XML data */ - private volatile String schemaLocation; - - /** Limits potential XML overflow attacks. */ - private boolean secureProcessing; - - /** - * Indicates the desire for validating this type of XML representations - * against a DTD. Note that for XML schema or Relax NG validation, use the - * "schema" property instead. - */ - private volatile boolean validatingDtd; - - /** The JAXB validation event handler. */ - private volatile ValidationEventHandler validationEventHandler; - - /** - * Indicates the desire for processing XInclude if found in this - * type of XML representations. By default, the value of this is set to - * false. - * - * @see javax.xml.parsers.DocumentBuilderFactory#setXIncludeAware(boolean) - */ - private volatile boolean xIncludeAware; - - /** The source XML representation. */ - private volatile Representation xmlRepresentation; - - /** - * Creates a JAXB representation from an existing JAXB content tree. - * - * @param mediaType - * The representation's media type. - * @param object - * The Java object. - */ - public JaxbRepresentation(MediaType mediaType, T object) { - this(mediaType, object, (object != null) ? object.getClass() - .getClassLoader() : null); - } - - /** - * Creates a JAXB representation from an existing JAXB content tree. - * - * @param mediaType - * The representation's media type. - * @param object - * The Java object. - * @param classloader - * The classloader to use for JAXB annotated classes. - */ - public JaxbRepresentation(MediaType mediaType, T object, - ClassLoader classloader) { - super(mediaType); - this.classLoader = classloader; - this.contextPath = (object != null) ? object.getClass().getPackage() - .getName() : null; - this.object = object; - this.validationEventHandler = null; - this.xmlRepresentation = null; - this.expandingEntityRefs = false; - this.formattedOutput = false; - this.fragment = false; - this.namespacePrefixMapper = null; - this.noNamespaceSchemaLocation = null; - this.schemaLocation = null; - this.secureProcessing = true; - this.validatingDtd = false; - this.xIncludeAware = false; - } - - /** - * Creates a new JAXB representation, converting the input XML into a Java - * content tree. The XML is validated. - * - * @param xmlRepresentation - * The XML wrapped in a representation. - * @param type - * The type to convert to. - * - * @throws JAXBException - * If the incoming XML does not validate against the schema. - * @throws IOException - * If unmarshalling XML fails. - */ - public JaxbRepresentation(Representation xmlRepresentation, Class type) { - this(xmlRepresentation, type.getPackage().getName(), null, type - .getClassLoader()); - } - - /** - * Creates a new JAXB representation, converting the input XML into a Java - * content tree. The XML is validated. - * - * @param xmlRepresentation - * The XML wrapped in a representation. - * @param type - * The type to convert to. - * @param validationHandler - * A handler for dealing with validation failures. - * - * @throws JAXBException - * If the incoming XML does not validate against the schema. - * @throws IOException - * If unmarshalling XML fails. - */ - public JaxbRepresentation(Representation xmlRepresentation, Class type, - ValidationEventHandler validationHandler) { - this(xmlRepresentation, type.getPackage().getName(), validationHandler, - type.getClassLoader()); - } - - /** - * Creates a new JAXB representation, converting the input XML into a Java - * content tree. The XML is validated. - * - * @param xmlRepresentation - * The XML wrapped in a representation. - * @param contextPath - * The list of Java package names for JAXB. - * - * @throws JAXBException - * If the incoming XML does not validate against the schema. - * @throws IOException - * If unmarshalling XML fails. - */ - public JaxbRepresentation(Representation xmlRepresentation, - String contextPath) { - this(xmlRepresentation, contextPath, null, null); - } - - /** - * Creates a new JAXB representation, converting the input XML into a Java - * content tree. The XML is validated. - * - * @param xmlRepresentation - * The XML wrapped in a representation. - * @param contextPath - * The list of Java package names for JAXB. - * @param validationHandler - * A handler for dealing with validation failures. - * - * @throws JAXBException - * If the incoming XML does not validate against the schema. - * @throws IOException - * If unmarshalling XML fails. - */ - public JaxbRepresentation(Representation xmlRepresentation, - String contextPath, ValidationEventHandler validationHandler) { - this(xmlRepresentation, contextPath, validationHandler, null); - } - - /** - * Creates a new JAXB representation, converting the input XML into a Java - * content tree. The XML is validated. - * - * @param xmlRepresentation - * The XML wrapped in a representation. - * @param contextPath - * The list of Java package names for JAXB. - * @param validationHandler - * A handler for dealing with validation failures. - * @param classLoader - * The classloader to use for JAXB annotated classes. - * @throws JAXBException - * If the incoming XML does not validate against the schema. - * @throws IOException - * If unmarshalling XML fails. - */ - public JaxbRepresentation(Representation xmlRepresentation, - String contextPath, ValidationEventHandler validationHandler, - ClassLoader classLoader) { - super((xmlRepresentation == null) ? null : xmlRepresentation - .getMediaType()); - this.classLoader = classLoader; - this.contextPath = contextPath; - this.object = null; - this.secureProcessing = true; - this.validationEventHandler = validationHandler; - this.xmlRepresentation = xmlRepresentation; - } - - /** - * Creates a JAXB representation from an existing JAXB content tree with - * {@link MediaType#APPLICATION_XML}. - * - * @param object - * The Java object. - */ - public JaxbRepresentation(T object) { - this(MediaType.APPLICATION_XML, object); - } - - /** - * Returns the classloader to use for JAXB annotated classes. - * - * @return The classloader to use for JAXB annotated classes. - */ - public ClassLoader getClassLoader() { - return this.classLoader; - } - - /** - * Returns the JAXB context. - * - * @return The JAXB context. - * @throws JAXBException - */ - public JAXBContext getContext() throws JAXBException { - return getContext(getContextPath(), getClassLoader()); - } - - /** - * Returns the list of Java package names that contain schema derived class - * and/or Java to schema (JAXB-annotated) mapped classes - * - * @return The list of Java package names. - */ - public String getContextPath() { - return this.contextPath; - } - - /** - * Returns a JAXB SAX source. - * - * @return A JAXB SAX source. - * @throws IOException - */ - public JAXBSource getJaxbSource() throws IOException { - try { - return new JAXBSource(getContext(), getObject()); - } catch (JAXBException e) { - throw new IOException( - "JAXBException while creating the JAXBSource: " - + e.getMessage()); - } - } - - /** - * Returns the optional namespace prefix mapper for marshalling. - * - * @return The optional namespace prefix mapper for marshalling. - */ - public NamespacePrefixMapper getNamespacePrefixMapper() { - return namespacePrefixMapper; - } - - /** - * Returns the "xsi:noNamespaceSchemaLocation" attribute in the generated - * XML data. - * - * @return The "xsi:noNamespaceSchemaLocation" attribute in the generated - * XML data. - */ - public String getNoNamespaceSchemaLocation() { - return noNamespaceSchemaLocation; - } - - /** - * Returns the wrapped Java object. - * - * @return The wrapped Java object. - * @throws IOException - */ - @SuppressWarnings("unchecked") - public T getObject() throws IOException { - if ((this.object == null) && (this.xmlRepresentation != null)) { - // Try to unmarshal the wrapped XML representation - final Unmarshaller u = new Unmarshaller(this.contextPath, - this.classLoader); - if (getValidationEventHandler() != null) { - try { - u.setEventHandler(getValidationEventHandler()); - } catch (JAXBException e) { - Context.getCurrentLogger().log(Level.WARNING, - "Unable to set the event handler", e); - throw new IOException("Unable to set the event handler." - + e.getMessage()); - } - } - - try { - this.object = (T) u.unmarshal(this, - this.xmlRepresentation.getReader()); - } catch (JAXBException e) { - Context.getCurrentLogger().log(Level.WARNING, - "Unable to unmarshal the XML representation", e); - throw new IOException( - "Unable to unmarshal the XML representation." - + e.getMessage()); - } - } - return this.object; - } - - /** - * Returns the "xsi:schemaLocation" attribute in the generated XML data. - * - * @return The "xsi:schemaLocation" attribute in the generated XML data. - */ - public String getSchemaLocation() { - return schemaLocation; - } - - /** - * Returns the optional validation event handler. - * - * @return The optional validation event handler. - */ - public ValidationEventHandler getValidationEventHandler() { - return this.validationEventHandler; - } - - /** - * Indicates if the parser expands entity reference nodes. By default, - * the value of this is set to true. - * - * @return True if the parser expands entity reference nodes. - */ - public boolean isExpandingEntityRefs() { - return expandingEntityRefs; - } - - /** - * Indicates if the resulting XML data should be formatted with line breaks - * and indentation. Defaults to false. - * - * @return the formattedOutput - */ - public boolean isFormattedOutput() { - return this.formattedOutput; - } - - /** - * Indicates whether the Marshaller will generate document level events. - * - * @return True if the Marshaller generates the document level events. - */ - public boolean isFragment() { - return fragment; - } - - /** - * Indicates if it limits potential XML overflow attacks. - * - * @return True if it limits potential XML overflow attacks. - */ - public boolean isSecureProcessing() { - return secureProcessing; - } - - /** - * Indicates the desire for validating this type of XML representations - * against an XML schema if one is referenced within the contents. - * - * @return True if the schema-based validation is enabled. - */ - public boolean isValidatingDtd() { - return validatingDtd; - } - - /** - * Indicates the desire for processing XInclude if found in this - * type of XML representations. By default, the value of this is set to - * false. - * - * @return The current value of the xIncludeAware flag. - */ - public boolean isXIncludeAware() { - return xIncludeAware; - } - - /** - * Sets the classloader to use for JAXB annotated classes. - * - * @param classLoader - * The classloader to use for JAXB annotated classes. - */ - public void setClassLoader(ClassLoader classLoader) { - this.classLoader = classLoader; - } - - /** - * Sets the list of Java package names that contain schema derived class - * and/or Java to schema (JAXB-annotated) mapped classes. - * - * @param contextPath - * The JAXB context path. - */ - public void setContextPath(String contextPath) { - this.contextPath = contextPath; - } - - /** - * Indicates if the parser expands entity reference nodes. By default, - * the value of this is set to true. - * - * @param expandEntityRefs - * True if the parser expands entity reference nodes. - */ - public void setExpandingEntityRefs(boolean expandEntityRefs) { - this.expandingEntityRefs = expandEntityRefs; - } - - /** - * Indicates if the resulting XML data should be formatted with line breaks - * and indentation. - * - * @param formattedOutput - * True if the resulting XML data should be formatted. - */ - public void setFormattedOutput(boolean formattedOutput) { - this.formattedOutput = formattedOutput; - } - - /** - * Indicates whether or not document level events will be generated by the - * Marshaller. - * - * @param fragment - * True if the document level events are generated by the - * Marshaller. - */ - public void setFragment(boolean fragment) { - this.fragment = fragment; - } - - /** - * Sets the optional namespace prefix mapper for marshalling. - * - * @param namespacePrefixMapper - * The optional namespace prefix mapper for marshalling. - */ - public void setNamespacePrefixMapper( - NamespacePrefixMapper namespacePrefixMapper) { - this.namespacePrefixMapper = namespacePrefixMapper; - } - - /** - * Sets the "xsi:noNamespaceSchemaLocation" attribute in the generated XML - * data. - * - * @param noNamespaceSchemaLocation - * The "xsi:noNamespaceSchemaLocation" attribute in the generated - * XML data. - */ - public void setNoNamespaceSchemaLocation(String noNamespaceSchemaLocation) { - this.noNamespaceSchemaLocation = noNamespaceSchemaLocation; - } - - /** - * Sets the wrapped Java object. - * - * @param object - * The Java object to set. - */ - public void setObject(T object) { - this.object = object; - } - - /** - * Sets the "xsi:schemaLocation" attribute in the generated XML data. - * - * @param schemaLocation - * The "xsi:noNamespaceSchemaLocation" attribute in the generated - * XML data. - */ - public void setSchemaLocation(String schemaLocation) { - this.schemaLocation = schemaLocation; - } - - /** - * Indicates if it limits potential XML overflow attacks. - * - * @param secureProcessing - * True if it limits potential XML overflow attacks. - */ - public void setSecureProcessing(boolean secureProcessing) { - this.secureProcessing = secureProcessing; - } - - /** - * Indicates the desire for validating this type of XML representations - * against an XML schema if one is referenced within the contents. - * - * @param validating - * The new validation flag to set. - */ - public void setValidatingDtd(boolean validating) { - this.validatingDtd = validating; - } - - /** - * Sets the validation event handler. - * - * @param validationEventHandler - * The optional validation event handler. - */ - public void setValidationEventHandler( - ValidationEventHandler validationEventHandler) { - this.validationEventHandler = validationEventHandler; - } - - /** - * Indicates the desire for processing XInclude if found in this - * type of XML representations. By default, the value of this is set to - * false. - * - * @param includeAware - * The new value of the xIncludeAware flag. - */ - public void setXIncludeAware(boolean includeAware) { - xIncludeAware = includeAware; - } - - /** - * Writes the representation to a stream of characters. - * - * @param writer - * The writer to use when writing. - * - * @throws IOException - * If any error occurs, attempting to write the stream. - */ - @Override - public void write(Writer writer) throws IOException { - try { - new Marshaller(this, this.contextPath, getClassLoader()) - .marshal(getObject(), writer); - } catch (JAXBException e) { - Context.getCurrentLogger().log(Level.WARNING, - "JAXB marshalling error caught.", e); - - // Maybe the tree represents a failure, try that. - try { - new Marshaller(this, "failure", getClassLoader()).marshal( - getObject(), writer); - } catch (JAXBException e2) { - // We don't know what package this tree is from. - throw new IOException(e.getMessage()); - } - } - } - -} diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java deleted file mode 100644 index 75c8a07a52..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Marshaller.java +++ /dev/null @@ -1,187 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.jaxb.internal; - -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.logging.Level; - -import jakarta.xml.bind.JAXBException; -import org.restlet.Context; -import org.restlet.ext.jaxb.JaxbRepresentation; - -/** - * This is a utility class to assist in marshaling Java content trees into XML. - * Each {@code marshal} method takes a different target for the XML. - * - * This class is a factory that constructs an instance of itself for multiple - * uses. The created instance is thread safe and is optimized to be used for - * multiple, possibly concurrent calls. - * - * @author Overstock.com - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Marshaller { - - /** The JAXB classloader. */ - private final ClassLoader classLoader; - - /** The JAXB context path. */ - private final String contextPath; - - /** The parent JAXB representation. */ - private final JaxbRepresentation jaxbRepresentation; - - /** Use thread identity to preserve the safety of access to marshalers. */ - private final ThreadLocal marshaller = new ThreadLocal<>() { - - @Override - protected synchronized jakarta.xml.bind.Marshaller initialValue() { - jakarta.xml.bind.Marshaller m = null; - - try { - m = JaxbRepresentation.getContext(getContextPath(), - getClassLoader()).createMarshaller(); - - m.setProperty(jakarta.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, getJaxbRepresentation() - .isFormattedOutput()); - - if (getJaxbRepresentation().getSchemaLocation() != null) { - m.setProperty(jakarta.xml.bind.Marshaller.JAXB_SCHEMA_LOCATION, - getJaxbRepresentation().getSchemaLocation()); - } - if (getJaxbRepresentation().getNoNamespaceSchemaLocation() != null) { - m.setProperty(jakarta.xml.bind.Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION, - getJaxbRepresentation() - .getNoNamespaceSchemaLocation()); - } - - if (Marshaller.this.jaxbRepresentation.getCharacterSet() != null) { - m.setProperty(jakarta.xml.bind.Marshaller.JAXB_ENCODING, - Marshaller.this.jaxbRepresentation - .getCharacterSet().getName()); - } - - if (getJaxbRepresentation().getNamespacePrefixMapper() != null) { - m.setProperty("com.sun.xml.bind.namespacePrefixMapper", - getJaxbRepresentation().getNamespacePrefixMapper()); - } - - m.setProperty(jakarta.xml.bind.Marshaller.JAXB_FRAGMENT, getJaxbRepresentation() - .isFragment()); - } catch (Exception e) { - Context.getCurrentLogger().log(Level.WARNING, - "Problem creating Marshaller", e); - return null; - } - - return m; - } - }; - - // This is a factory class. - public Marshaller(JaxbRepresentation jaxbRepresentation) { - this(jaxbRepresentation, null, null); - } - - /** - * Constructor. - * - * @param jaxbRepresentation - * The JAXB representation to marshal. - * @param contextPath - * The JAXB context path. - * @param classLoader - * The JAXB classloader. - */ - public Marshaller(JaxbRepresentation jaxbRepresentation, - String contextPath, ClassLoader classLoader) { - this.jaxbRepresentation = jaxbRepresentation; - this.contextPath = contextPath; - this.classLoader = classLoader; - } - - /** - * Returns the JAXB classloader. - * - * @return The JAXB classloader. - */ - public ClassLoader getClassLoader() { - return this.classLoader; - } - - /** - * Returns the JAXB context path. - * - * @return The JAXB context path. - */ - public String getContextPath() { - return this.contextPath; - } - - /** - * Returns the parent JAXB representation. - * - * @return The parent JAXB representation. - */ - public JaxbRepresentation getJaxbRepresentation() { - return jaxbRepresentation; - } - - /** - * Returns the JAXB marshaller. - * - * @return The JAXB marshaller. - * @throws JAXBException - */ - private jakarta.xml.bind.Marshaller getMarshaller() throws JAXBException { - final jakarta.xml.bind.Marshaller m = this.marshaller.get(); - if (m == null) { - Context.getCurrentLogger().warning("Unable to locate marshaller."); - throw new JAXBException("Unable to locate marshaller."); - } - return m; - } - - /** - * Marshals the content tree rooted at {@code jaxbElement} into an output - * stream. - * - * @param jaxbElement - * The root of the content tree to be marshaled. - * @param stream - * The target output stream writes the XML to. - * @throws JAXBException - * If any unexpected problem occurs during marshaling. - */ - public void marshal(Object jaxbElement, OutputStream stream) - throws JAXBException { - marshal(jaxbElement, new OutputStreamWriter(stream)); - } - - /** - * Marshal the content tree rooted at {@code jaxbElement} into a writer. - * - * @param jaxbElement - * The root of the content tree to be marshaled. - * @param writer - * The target writer to write the XML to. - * @throws JAXBException - * If any unexpected problem occurs during marshaling. - */ - public void marshal(Object jaxbElement, Writer writer) throws JAXBException { - getMarshaller().setEventHandler( - getJaxbRepresentation().getValidationEventHandler()); - getMarshaller().marshal(jaxbElement, writer); - } - -} diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java deleted file mode 100644 index 54c192ea39..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/internal/Unmarshaller.java +++ /dev/null @@ -1,201 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.jaxb.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.util.logging.Level; - -import jakarta.xml.bind.JAXBException; -import jakarta.xml.bind.ValidationEventHandler; -import org.restlet.Context; -import org.restlet.ext.jaxb.JaxbRepresentation; -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; - -import javax.xml.XMLConstants; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.sax.SAXSource; - -/** - * This is a utility class to assist in unmarshaling XML into a new Java content - * tree. - * - * Each {@code unmarshal} method takes a different source for the XML. This - * class caches information to improve unmarshaling performance across calls - * using the same schema (package). - * - * @author Overstock.com - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Unmarshaller { - - /** The JAXB classloader. */ - private final ClassLoader classLoader; - - /** The JAXB context path. */ - private final String contextPath; - - /** - * Use thread identity to preserve the safety of access to unmarshallers. - */ - private final ThreadLocal unmarshaller = new ThreadLocal<>() { - @Override - protected synchronized jakarta.xml.bind.Unmarshaller initialValue() { - jakarta.xml.bind.Unmarshaller m = null; - try { - m = JaxbRepresentation.getContext(getContextPath(), getClassLoader()).createUnmarshaller(); - } catch (Exception e) { - Context.getCurrentLogger().log(Level.WARNING, - "Problem creating Unmarshaller", e); - return null; - } - return m; - } - }; - - /** - * Constructor. - * - * @param contextPath - * The JAXB context path. - * @param classloader - * The JAXB classloader. - */ - public Unmarshaller(String contextPath, ClassLoader classloader) { - this.contextPath = contextPath; - this.classLoader = classloader; - } - - /** - * Returns the JAXB classloader. - * - * @return The JAXB classloader. - */ - public ClassLoader getClassLoader() { - return this.classLoader; - } - - /** - * Returns the JAXB context path. - * - * @return The JAXB context path. - */ - public String getContextPath() { - return this.contextPath; - } - - /** - * Returns the JAXB unmarshaller. - * - * @return The JAXB unmarshaller. - * @throws JAXBException - */ - private jakarta.xml.bind.Unmarshaller getUnmarshaller() throws JAXBException { - final jakarta.xml.bind.Unmarshaller m = this.unmarshaller.get(); - if (m == null) { - Context.getCurrentLogger() - .warning("Unable to locate unmarshaller."); - throw new JAXBException("Unable to locate unmarshaller."); - } - return m; - } - - /** - * Sets the validation handler for this unmarshaller. - * - * @param handler - * A validation handler. - * @throws JAXBException - * If an error was encountered while setting the event handler. - */ - public void setEventHandler(ValidationEventHandler handler) - throws JAXBException { - getUnmarshaller().setEventHandler(handler); - } - - /** - * Unmarshal XML data from the specified Restlet string representation and - * return the resulting Java content tree. - * - * @param jaxbRep - * The source JAXB representation. - * @return The newly created root object of the Java content tree. - * @throws JAXBException - * If any unexpected problem occurs during unmarshaling. - * @throws IOException - * If an error occurs accessing the string representation. - */ - public Object unmarshal(JaxbRepresentation jaxbRep) - throws JAXBException, IOException { - return unmarshal(jaxbRep, jaxbRep.getReader()); - } - - /** - * Unmarshal XML data from the specified input stream and return the - * resulting Java content tree. - * - * @param stream - * The source input stream. - * @return The newly created root object of the Java content tree. - * @throws JAXBException - * If any unexpected problem occurs during unmarshaling. - * @throws IOException - * If an error occurs accessing the string representation. - */ - public Object unmarshal(JaxbRepresentation jaxbRep, InputStream stream) - throws JAXBException { - return unmarshal(jaxbRep, new InputStreamReader(stream)); - } - - /** - * Unmarshal XML data from the specified reader and return the resulting - * Java content tree. - * - * @param reader - * The source reader. - * @return The newly created root object of the Java content tree. - * @throws JAXBException - * If any unexpected problem occurs during unmarshaling. - * @throws IOException - * If an error occurs accessing the string representation. - */ - public Object unmarshal(JaxbRepresentation jaxbRep, Reader reader) - throws JAXBException { - SAXSource ss = null; - - try { - SAXParserFactory spf = SAXParserFactory.newInstance(); - - // Keep before the external entity preferences - spf.setNamespaceAware(true); - spf.setValidating(jaxbRep.isValidatingDtd()); - spf.setXIncludeAware(jaxbRep.isXIncludeAware()); - spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, - jaxbRep.isSecureProcessing()); - spf.setFeature( - "http://xml.org/sax/features/external-general-entities", - jaxbRep.isExpandingEntityRefs()); - spf.setFeature( - "http://xml.org/sax/features/external-parameter-entities", - jaxbRep.isExpandingEntityRefs()); - XMLReader xmlReader = spf.newSAXParser().getXMLReader(); - ss = new SAXSource(xmlReader, new InputSource(reader)); - } catch (Exception e) { - throw new JAXBException("Unable to create customized SAX source", e); - } - - getUnmarshaller().setEventHandler(jaxbRep.getValidationEventHandler()); - return getUnmarshaller().unmarshal(ss); - } -} diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/package.html b/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/package.html deleted file mode 100644 index b99d25edaf..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/java/org/restlet/ext/jaxb/package.html +++ /dev/null @@ -1,12 +0,0 @@ - - -Integration with Java XML Binding (JAXB) 2.4. JAXB provides a convenient -way to process XML content using Java objects by binding it's XML schema -to Java representation. - -@since Restlet 1.1 -@see JAXB Web site -@see User Guide - JAXB extension -@deprecated Will be removed in next major release. - - diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper b/org.restlet.java/org.restlet.ext.jaxb/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper deleted file mode 100644 index 97b8faf704..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/main/resources/META-INF/services/org.restlet.engine.converter.ConverterHelper +++ /dev/null @@ -1 +0,0 @@ -org.restlet.ext.jaxb.JaxbConverter \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/JaxbBasicConverterTestCase.java b/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/JaxbBasicConverterTestCase.java deleted file mode 100644 index 82c2248505..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/JaxbBasicConverterTestCase.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.jaxb; - -import org.junit.jupiter.api.Test; -import org.restlet.data.MediaType; -import org.restlet.representation.Representation; -import org.restlet.representation.Variant; - -import java.io.IOException; - -import static org.junit.jupiter.api.Assertions.assertInstanceOf; - -/** - * Tests basic Conversion using the JaxbConverter - * - * @author Sanjay Acharya - */ -public class JaxbBasicConverterTestCase { - - @Test - public void testObjectionToRepresentation() { - Representation rep = new JaxbConverter().toRepresentation(new Sample(), new Variant( - MediaType.APPLICATION_XML), null); - assertInstanceOf(JaxbRepresentation.class, rep); - } - - @Test - public void testRepresentationToObject() throws IOException { - JaxbRepresentation sampleRep = new JaxbRepresentation<>( - MediaType.APPLICATION_XML, new Sample()); - Object rep = new JaxbConverter().toObject(sampleRep, Sample.class, null); - assertInstanceOf(Sample.class, rep); - } -} diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/JaxbIntegrationConverterTestCase.java b/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/JaxbIntegrationConverterTestCase.java deleted file mode 100644 index 08bd4b6dbe..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/JaxbIntegrationConverterTestCase.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.jaxb; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; -import org.restlet.*; -import org.restlet.data.MediaType; -import org.restlet.data.Method; -import org.restlet.data.Preference; -import org.restlet.data.Protocol; -import org.restlet.engine.Engine; -import org.restlet.resource.*; -import org.restlet.routing.Router; - -import java.util.List; -import java.util.stream.Stream; - -import static org.junit.jupiter.api.Assertions.*; - -/** - * Simple Integration Tests that uses the JAXB Converter to perform POST, PUT - * and GET operations. - * - * Note: You must have registered the JaxbConverter in - * META-INF/services/org.restlet.engine.converter.ConverterHelper - * - * @author Sanjay Acharya - */ -public class JaxbIntegrationConverterTestCase { - - private static final String IN_STRING = "foo"; - - private static final String HELLO_OUT_STRING = "Hello World " + IN_STRING; - - private Component component; - - private String uri; - - @BeforeEach - public void setUpEach() throws Exception { - // make sure the jaxb converter is registered - Engine.getInstance().getRegisteredConverters().add(new JaxbConverter()); - this.component = new Component(); - final Server server = this.component.getServers().add(Protocol.HTTP, 0); - final Application application = createApplication(); - this.component.getDefaultHost().attach(application); - this.component.start(); - uri = "http://localhost:" + server.getEphemeralPort() + "/test"; - } - - @AfterEach - public void tearDownEach() throws Exception { - if (component != null) { - component.stop(); - } - - this.component = null; - } - - protected Application createApplication() { - return new Application() { - @Override - public Restlet createInboundRoot() { - final Router router = new Router(getContext()); - router.attach("/test", SampleResource.class); - return router; - } - }; - } - - @ParameterizedTest - @MethodSource("integrationTestCases") - public void testIntegration(final Method method, final String input, final String expectedResponse) throws Exception { - Client client = new Client(Protocol.HTTP); - Request request = new Request(method, uri); - request.setEntity(new JaxbRepresentation<>(new Sample(input))); - - Response response = client.handle(request); - - JaxbRepresentation resultRepresentation = new JaxbRepresentation<>(response.getEntity(), Sample.class); - Sample sample = resultRepresentation.getObject(); - assertEquals(expectedResponse, sample.getVal()); - } - - public static Stream integrationTestCases() { - return Stream.of( - Arguments.of(Method.POST, IN_STRING, HELLO_OUT_STRING), - Arguments.of(Method.PUT, IN_STRING, HELLO_OUT_STRING), - Arguments.of(Method.GET, null, IN_STRING) - ); - } - - /** - * Test POST, PUT and GET using the ClientResource class - * - */ - @Test - public void testWithClientResource() { - ClientResource sampleResource = new ClientResource(uri); - List> m = List.of(new Preference<>(MediaType.APPLICATION_XML)); - sampleResource.getClientInfo().setAcceptedMediaTypes(m); - - Sample sample = new Sample(IN_STRING); - sample = sampleResource.post(sample, Sample.class); - assertEquals(HELLO_OUT_STRING, sample.getVal()); - - sampleResource.put(sample); - assertTrue(sampleResource.getStatus().isSuccess()); - - sample = sampleResource.put(sample, Sample.class); - assertEquals(HELLO_OUT_STRING, sample.getVal()); - - sample = sampleResource.get(Sample.class); - assertEquals(IN_STRING, sample.getVal()); - } - - public static class SampleResource extends ServerResource { - @Post("xml") - public Sample post(Sample sample) { - assertNotNull(sample); - return new Sample(HELLO_OUT_STRING); - } - - @Get("xml") - public Sample getSample() { - return new Sample(IN_STRING); - } - - @Put("xml:xml") - public JaxbRepresentation putSample(Sample sample) { - assertNotNull(sample); - return new JaxbRepresentation<>(new Sample(HELLO_OUT_STRING)); - } - } -} diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java b/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java deleted file mode 100644 index a1b9e4759a..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/ObjectFactory.java +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.jaxb; - -import jakarta.xml.bind.annotation.XmlRegistry; - -@XmlRegistry -public class ObjectFactory { - public Sample createSample() { - return new Sample(); - } -} diff --git a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java b/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java deleted file mode 100644 index ea6dc7b52d..0000000000 --- a/org.restlet.java/org.restlet.ext.jaxb/src/test/java/org/restlet/ext/jaxb/Sample.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.jaxb; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlRootElement -public class Sample { - @XmlElement(name = "value") - private String val; - - public Sample() { - } - - public Sample(String val) { - this.val = val; - } - - public String getVal() { - return val; - } - - public void setVal(String val) { - this.val = val; - } - - @Override - public String toString() { - return "Sample [val=" + val + "]"; - } -} diff --git a/org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/JSON.gwt.xml b/org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/JSON.gwt.xml deleted file mode 100644 index 5497a3ccb7..0000000000 --- a/org.restlet.java/org.restlet.ext.json/src/main/java/org/restlet/JSON.gwt.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/org.restlet.java/org.restlet.ext.odata/pom.xml b/org.restlet.java/org.restlet.ext.odata/pom.xml deleted file mode 100644 index 45de52f382..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/pom.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../../pom.xml - - - org.restlet.ext.odata - bundle - Restlet Framework - OData extension - Integration with OData services. - - - - org.freemarker - freemarker - ${lib-freemarker-version} - - - org.restlet - org.restlet - ${project.version} - - - org.restlet - org.restlet.ext.atom - ${project.version} - - - org.restlet - org.restlet.ext.freemarker - ${project.version} - - - org.restlet - org.restlet.ext.xml - ${project.version} - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Generator.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Generator.java deleted file mode 100644 index 0326b86a32..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Generator.java +++ /dev/null @@ -1,353 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.HashMap; -import java.util.Map; - -import org.restlet.data.CharacterSet; -import org.restlet.data.MediaType; -import org.restlet.data.Reference; -import org.restlet.ext.freemarker.TemplateRepresentation; -import org.restlet.ext.odata.internal.edm.ComplexType; -import org.restlet.ext.odata.internal.edm.EntityContainer; -import org.restlet.ext.odata.internal.edm.EntityType; -import org.restlet.ext.odata.internal.edm.Metadata; -import org.restlet.ext.odata.internal.edm.Schema; -import org.restlet.ext.odata.internal.edm.TypeUtils; -import org.restlet.ext.odata.internal.reflect.ReflectUtils; -import org.restlet.representation.Representation; -import org.restlet.representation.StringRepresentation; -import org.restlet.resource.ClientResource; - -import freemarker.template.Configuration; - -/** - * Code generator for accessing OData services. The generator use metadata - * exposed by an online service to generate client-side artifacts facilitating - * the execution of queries on the available entities. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Generator { - - /** - * Takes two (or three) parameters:
- *
    - *
  1. The URI of the OData service
  2. - *
  3. The output directory (optional, used the current directory by - * default)
  4. - *
  5. The name of the generated service class name (optional)
  6. - *
- * - * @param args - * The list of arguments. - */ - public static void main(String[] args) { - System.out.println("---------------------------"); - System.out.println("OData client code generator"); - System.out.println("---------------------------"); - System.out.println("step 1 - check parameters"); - - String errorMessage = null; - - if (args == null || args.length == 0) { - errorMessage = "Missing mandatory argument: URI of the OData service."; - } - - File outputDir = null; - - if (errorMessage == null) { - if (args.length > 1) { - outputDir = new File(args[1]); - } else { - try { - outputDir = new File(".").getCanonicalFile(); - if (outputDir.exists()) { - System.out.println("step 2 - check the ouput directory"); - if (!outputDir.isDirectory()) { - errorMessage = outputDir.getPath() - + " is not a valid directory."; - } - - } else { - try { - System.out.println("step 2 - create the ouput directory"); - outputDir.mkdirs(); - } catch (Throwable e) { - errorMessage = "Cannot create " + outputDir.getPath() - + " due to: " + e.getMessage(); - } - } - } catch (IOException e) { - errorMessage = "Unable to get the target directory. " - + e.getMessage(); - } - } - } - if (errorMessage == null) { - System.out.println("step 3 - get the metadata descriptor"); - String dataServiceUri = null; - - if (args[0].endsWith("$metadata")) { - dataServiceUri = args[0].substring(0, args[0].length() - 10); - } else if (args[0].endsWith("/")) { - dataServiceUri = args[0].substring(0, args[0].length() - 1); - } else { - dataServiceUri = args[0]; - } - - Service service = new Service(dataServiceUri); - if (service.getMetadata() == null) { - errorMessage = "Cannot retrieve the metadata."; - } else { - System.out.println("step 4 - generate source code"); - Generator svcUtil = null; - if (args.length == 3) { - svcUtil = new Generator(service.getServiceRef(), args[2]); - } else { - svcUtil = new Generator(service.getServiceRef()); - } - - try { - svcUtil.generate(outputDir); - System.out - .print("The source code has been generated in directory: "); - System.out.println(outputDir.getPath()); - } catch (Exception e) { - errorMessage = "Cannot generate the source code in directory: " - + outputDir.getPath(); - } - } - } - - if (errorMessage != null) { - System.out.println("An error occurred: "); - System.out.println(errorMessage); - System.out.println(); - System.out - .println("Please check that you provide the following parameters:"); - System.out.println(" - Valid URI for the remote service"); - System.out - .println(" - Valid directory path where to generate the files"); - System.out - .println(" - Valid name for the generated service class (optional)"); - } - } - - /** The name of the service class (in case there is only one in the schema). */ - private String serviceClassName; - - /** The URI of the target data service. */ - private Reference serviceRef; - - /** - * Constructor. - * - * @param serviceRef - * The URI of the OData service. - */ - public Generator(Reference serviceRef) { - this(serviceRef, null); - } - - /** - * Constructor. The name of the service class can be provided if there is - * only one service defined in the metadata. - * - * @param serviceRef - * The URI of the OData service. - * @param serviceClassName - * The name of the service class (in case there is only one in - * the metadata). - */ - public Generator(Reference serviceRef, String serviceClassName) { - super(); - this.serviceRef = serviceRef; - if (serviceClassName != null) { - this.serviceClassName = ReflectUtils.normalize(serviceClassName); - this.serviceClassName = this.serviceClassName.substring(0, 1) - .toUpperCase() + this.serviceClassName.substring(1); - } - - } - - /** - * Constructor. - * - * @param serviceUri - * The URI of the OData service. - */ - public Generator(String serviceUri) { - this(serviceUri, null); - } - - /** - * Constructor. The name of the service class can be provided if there is - * only one service defined in the metadata. - * - * @param serviceUri - * The URI of the OData service. - * @param serviceClassName - * The name of the service class (in case there is only one in - * the metadata). - */ - public Generator(String serviceUri, String serviceClassName) { - this(new Reference(serviceUri), serviceClassName); - } - - /** - * Generates the client code to the given output directory. - * - * @param outputDir - * The output directory. - * @throws Exception - */ - public void generate(File outputDir) throws Exception { - Service service = new Service(serviceRef); - Metadata metadata = (Metadata) service.getMetadata(); - if (metadata == null) { - throw new Exception("Can't get the metadata for this service: " - + serviceRef); - } - - Configuration fmc = new Configuration(); - fmc.setDefaultEncoding(CharacterSet.UTF_8.getName()); - - // Generate classes - String rootTemplates = "clap://class/org/restlet/ext/odata/internal/templates"; - Representation complexTmpl = new StringRepresentation( - new ClientResource(rootTemplates + "/complexType.ftl").get() - .getText()); - Representation entityTmpl = new StringRepresentation( - new ClientResource(rootTemplates + "/entityType.ftl").get() - .getText()); - Representation serviceTmpl = new StringRepresentation( - new ClientResource(rootTemplates + "/service.ftl").get() - .getText()); - - for (Schema schema : metadata.getSchemas()) { - if ((schema.getEntityTypes() != null && !schema.getEntityTypes() - .isEmpty()) - || (schema.getComplexTypes() != null && !schema - .getComplexTypes().isEmpty())) { - String packageName = TypeUtils.getPackageName(schema); - File packageDir = new File(outputDir, packageName.replace(".", - System.getProperty("file.separator"))); - packageDir.mkdirs(); - - // For each entity type - for (EntityType type : schema.getEntityTypes()) { - String className = type.getClassName(); - Map dataModel = new HashMap(); - dataModel.put("type", type); - dataModel.put("schema", schema); - dataModel.put("metadata", metadata); - dataModel.put("className", className); - dataModel.put("packageName", packageName); - - TemplateRepresentation templateRepresentation = new TemplateRepresentation( - entityTmpl, fmc, dataModel, MediaType.TEXT_PLAIN); - templateRepresentation.setCharacterSet(CharacterSet.UTF_8); - - // Write the template representation as a Java class - OutputStream fos = new FileOutputStream(new File( - packageDir, type.getClassName() + ".java")); - templateRepresentation.write(fos); - fos.flush(); - } - - for (ComplexType type : schema.getComplexTypes()) { - String className = type.getClassName(); - Map dataModel = new HashMap(); - dataModel.put("type", type); - dataModel.put("schema", schema); - dataModel.put("metadata", metadata); - dataModel.put("className", className); - dataModel.put("packageName", packageName); - - TemplateRepresentation templateRepresentation = new TemplateRepresentation( - complexTmpl, fmc, dataModel, MediaType.TEXT_PLAIN); - templateRepresentation.setCharacterSet(CharacterSet.UTF_8); - - // Write the template representation as a Java class - OutputStream fos = new FileOutputStream(new File( - packageDir, type.getClassName() + ".java")); - templateRepresentation.write(fos); - fos.flush(); - } - } - } - if (metadata.getContainers() != null - && !metadata.getContainers().isEmpty()) { - for (EntityContainer entityContainer : metadata.getContainers()) { - Schema schema = entityContainer.getSchema(); - // Generate Service subclass - StringBuffer className = new StringBuffer(); - - if (serviceClassName != null) { - // Try to use the Client preference - if (entityContainer.isDefaultEntityContainer()) { - className.append(serviceClassName); - } else if (metadata.getContainers().size() == 1) { - className.append(serviceClassName); - } else { - className.append(schema.getNamespace() - .getNormalizedName().substring(0, 1) - .toUpperCase()); - className.append(schema.getNamespace() - .getNormalizedName().substring(1)); - className.append("Service"); - } - } else { - className.append(schema.getNamespace().getNormalizedName() - .substring(0, 1).toUpperCase()); - className.append(schema.getNamespace().getNormalizedName() - .substring(1)); - className.append("Service"); - } - - Map dataModel = new HashMap(); - dataModel.put("schema", schema); - dataModel.put("metadata", metadata); - dataModel.put("className", className); - dataModel.put("dataServiceUri", this.serviceRef.getTargetRef()); - dataModel.put("entityContainer", entityContainer); - - TemplateRepresentation templateRepresentation = new TemplateRepresentation( - serviceTmpl, fmc, dataModel, MediaType.TEXT_PLAIN); - templateRepresentation.setCharacterSet(CharacterSet.UTF_8); - - // Write the template representation as a Java class - OutputStream fos = new FileOutputStream(new File(outputDir, - className + ".java")); - templateRepresentation.write(fos); - fos.flush(); - } - } - } - - /** - * Generates the client code to the given output directory. - * - * @param outputDir - * The output directory. - * @throws Exception - */ - public void generate(String outputDir) throws Exception { - generate(new File(outputDir)); - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Query.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Query.java deleted file mode 100644 index 393f23409a..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Query.java +++ /dev/null @@ -1,764 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.restlet.Context; -import org.restlet.data.MediaType; -import org.restlet.data.Parameter; -import org.restlet.data.Reference; -import org.restlet.ext.atom.Entry; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.atom.Link; -import org.restlet.ext.atom.Relation; -import org.restlet.ext.odata.internal.EntryContentHandler; -import org.restlet.ext.odata.internal.FeedContentHandler; -import org.restlet.ext.odata.internal.edm.EntityType; -import org.restlet.ext.odata.internal.edm.Metadata; -import org.restlet.representation.Representation; -import org.restlet.representation.StringRepresentation; -import org.restlet.resource.ClientResource; -import org.restlet.resource.ResourceException; -import org.restlet.routing.Template; -import org.restlet.routing.Variable; -import org.restlet.util.Series; - -/** - * Specific query to a OData service, represents a particular HTTP request to a - * data service. This Java class is more or less equivalent to the WCF - * DataServiceQuery class. - * - * @author Jerome Louvel - * @see - * @param - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Query implements Iterable { - - /** - * Iterator that transparently supports sever-side paging. - * - * @author Thierry Boileau - * - * @param - */ - private static class EntryIterator implements Iterator { - - /** The class of the listed objects. */ - private Class entityClass; - - /** The inner iterator. */ - private Iterator iterator; - - /** The reference to the next page. */ - private Reference nextPage; - - /** The underlying service. */ - private Service service; - - /** - * Constructor. - * - * @param service - * The underlying service. - * @param iterator - * The inner iterator. - * @param nextPage - * The reference to the next page. - * @param entityClass - * The class of the listed objects. - */ - public EntryIterator(Service service, Iterator iterator, - Reference nextPage, Class entityClass) { - super(); - this.iterator = iterator; - this.nextPage = nextPage; - this.service = service; - this.entityClass = entityClass; - } - - @SuppressWarnings("unchecked") - public boolean hasNext() { - boolean result = false; - - if (iterator != null) { - result = iterator.hasNext(); - } - - if (!result && nextPage != null) { - // Get the next page. - Query query = service.createQuery(nextPage.toString(), - (Class) entityClass); - iterator = query.iterator(); - if (iterator != null) { - result = iterator.hasNext(); - } - // Set the reference to the next page - nextPage = null; - } - - return result; - } - - public E next() { - E result = null; - if (iterator != null) { - if (iterator.hasNext()) { - result = iterator.next(); - } - } - return result; - } - - public void remove() { - if (iterator != null) { - iterator.remove(); - } - } - } - - // Defines the type of the current query. It has an impact on how to parse - // the result. - /** Type of query: complex type or property. */ - public static final int TYPE_COMPLEX_TYPE_OR_PROPERTY = 3; - - /** Type of query: property. */ - public static final int TYPE_COMPLEX_TYPE_PROPERTY = 4; - - /** Type of query: property bis?? */ - public static final int TYPE_COMPLEX_TYPE_PROPERTY5 = 5; - - /** Type of query: entity. */ - public static final int TYPE_ENTITY = 2; - - /** Type of query: entity set. */ - public static final int TYPE_ENTITY_SET = 1; - - /** Type of query: links. */ - public static final int TYPE_LINKS = 7; - - /** Type of query: property value. */ - public static final int TYPE_PROPERTY_VALUE = 6; - - /** Type of query: unknown. */ - public static final int TYPE_UNKNOWN = 0; - - /** The number of entities. */ - private int count; - - private List entities; - - /** Class of the entities targeted by this query. */ - private Class entityClass; - - /** The entity type of the entities targeted by this query. */ - private EntityType entityType; - - /** Has the query been executed? */ - private boolean executed; - - /** The atom feed object that wraps the data. */ - private Feed feed; - - /** Is the inline asked for? */ - private boolean inlineCount; - - /** Internal logger. */ - private Logger logger; - - /** The reference to the next page (used in server-paging mode). */ - private Reference nextPage; - - /** The query string. */ - private String query; - - /** The parent client service. */ - private Service service; - - /** The path of the targeted entity relatively to the data service URI. */ - private String subpath; - - /** - * Constructor. - * - * @param service - * The data service requested by the query. - * @param subpath - * The path of the targeted entity relatively to the data service - * URI. - * @param entityClass - * The class of the target entity. - */ - public Query(Service service, String subpath, Class entityClass) { - this.count = -1; - this.executed = false; - this.entityClass = entityClass; - if (service.getMetadata() != null) { - this.entityType = ((Metadata) service.getMetadata()) - .getEntityType(entityClass); - } else { - this.entityType = null; - } - this.service = service; - Reference ref = new Reference(subpath); - if (ref.isAbsolute()) { - this.subpath = ref.getRelativeRef(service.getServiceRef()) - .toString(true, true); - } else { - this.subpath = subpath; - } - } - - /** - * Creates a new Query with the query parameter set in the URI generated - * by the returned query. - * - * @param name - * The string value that contains the name of the query string - * option to add. - * @param value - * The value of the query string option. - * @return A new Query with the query parameter set in the URI generated - * by the returned query. - */ - @SuppressWarnings("unchecked") - public Query addParameter(String name, String value) { - Query result = new Query(this.getService(), this.getSubpath(), - (Class) this.entityClass); - if (getQuery() == null || getQuery().isEmpty()) { - result.setQuery(name + "=" + value); - } else { - result.setQuery(getQuery() + "&" + name + "=" + value); - } - - return result; - } - - /** - * Creates a new Query with the query parameter set in the URI generated - * by the returned query. - * - * @param params - * the set of name/value pairs to add to the query string - * @return A new Query with the query parameter set in the URI generated - * by the returned query. - */ - @SuppressWarnings("unchecked") - public Query addParameters(Series params) { - Query result = new Query(this.getService(), this.getSubpath(), - (Class) this.entityClass); - StringBuilder builder = new StringBuilder(); - - if (params != null) { - for (int i = 0; i < params.size(); i++) { - Parameter param = params.get(i); - - if (i == 0) { - builder.append(param.getName()); - builder.append("="); - builder.append(param.getValue()); - } - } - } - - if (getQuery() == null || getQuery().isEmpty()) { - result.setQuery(builder.toString()); - } else { - result.setQuery(getQuery() + "&" + builder.toString()); - } - - return result; - } - - /** - * Returns the complete target URI reference for this query. It is composed - * of the data service base URI, the sub-path and the query string. - * - * @return The complete target URI reference. - */ - protected String createTargetUri() { - String service = getService().getServiceRef().toString(); - StringBuilder result = new StringBuilder(); - String subpath = (getSubpath() == null) ? "" : getSubpath(); - Reference ref = new Reference(subpath); - if (ref.isAbsolute()) { - result = new StringBuilder(subpath); - } else { - result = new StringBuilder(service); - if (service.endsWith("/")) { - if (subpath.startsWith("/")) { - result.append(subpath.substring(1)); - } else { - result.append(subpath); - } - } else { - if (subpath.startsWith("/")) { - result.append(subpath); - } else { - result.append("/").append(subpath); - } - } - } - if (getQuery() != null) { - result.append("?").append(getQuery()); - } - - return result.toString(); - } - - /** - * Executes the query. - * - * @throws Exception - */ - public void execute() throws Exception { - if (!isExecuted()) { - String targetUri = createTargetUri(); - - ClientResource resource = service.createResource(new Reference( - targetUri)); - - Metadata metadata = (Metadata) service.getMetadata(); - if (metadata == null) { - throw new Exception( - "Can't execute the query without the service's metadata."); - } - - Representation result = null; - try { - result = resource.get(MediaType.APPLICATION_ATOM); - } catch (ResourceException e) { - getLogger().warning( - "Can't execute the query for the following reference: " - + targetUri + " due to " + e.getMessage()); - throw e; - } - - if (resource.getStatus().isSuccess()) { - // Guess the type of query based on the URI structure - switch (guessType(targetUri)) { - case TYPE_ENTITY_SET: - FeedContentHandler feedContentHandler = new FeedContentHandler( - entityClass, entityType, metadata, getLogger()); - setFeed(new Feed(result, feedContentHandler)); - this.count = feedContentHandler.getCount(); - this.entities = feedContentHandler.getEntities(); - break; - case TYPE_ENTITY: - EntryContentHandler entryContentHandler = new EntryContentHandler( - entityClass, entityType, metadata, getLogger()); - Feed feed = new Feed(); - feed.getEntries().add( - new Entry(result, entryContentHandler)); - setFeed(feed); - entities = new ArrayList(); - if (entryContentHandler.getEntity() != null) { - entities.add(entryContentHandler.getEntity()); - } - break; - case TYPE_UNKNOWN: - // Guess the type of query based on the returned - // representation - Representation rep = new StringRepresentation( - result.getText()); - String string = rep.getText().substring(0, - Math.min(100, rep.getText().length())); - if (string.contains("( - entityClass, entityType, metadata, getLogger()); - setFeed(new Feed(rep, feedContentHandler)); - this.count = feedContentHandler.getCount(); - this.entities = feedContentHandler.getEntities(); - } else if (string.contains("( - entityClass, entityType, metadata, getLogger()); - feed = new Feed(); - feed.getEntries().add( - new Entry(rep, entryContentHandler)); - setFeed(feed); - entities = new ArrayList(); - if (entryContentHandler.getEntity() != null) { - entities.add(entryContentHandler.getEntity()); - } - } - default: - // Can only guess entity and entity set, a priori. - // TODO May we go a step further by analyzing the metadata - // of the data services? - // Do we support only those two types? - // Another way is to guess from the result representation. - // Sometimes, it returns a set, an entity, or a an XML - // representation of a property. - break; - } - } - - service.setLatestRequest(resource.getRequest()); - service.setLatestResponse(resource.getResponse()); - - setExecuted(true); - } - } - - /** - * Creates a new Query with the $expand option set in the URI generated - * by the returned query. - * - * @param path - * A string value that contains the requesting URI. - * @return A new Query with the $expand option set in the URI generated - * by the returned query. - */ - public Query expand(String path) { - return addParameter("$expand", path); - } - - /** - * Creates a new Query with the $filter option set in the URI generated - * by the returned query. - * - * @param predicate - * A string value that contains the predicate used to filter the - * data. - * @return A new Query with the $filter option set in the URI generated - * by the returned query. - */ - public Query filter(String predicate) { - return addParameter("$filter", predicate); - } - - /** - * Returns the total number of elements in the entity set, or -1 if it is - * available. - * - * @return The total number of elements in the entity set. - * @throws Exception - */ - public int getCount() { - if (inlineCount) { - if (!isExecuted()) { - // Execute the query which sets the count retrieved from the - // Atom document. - try { - execute(); - } catch (Exception e) { - getLogger().warning( - "Cannot retrieve inline count value due to: " - + e.getMessage()); - } - } - } else { - // Send a request to a specific URI. - String targetUri = createTargetUri(); - - if (guessType(targetUri) == TYPE_ENTITY) { - targetUri = targetUri.substring(0, targetUri.lastIndexOf("(")); - } - targetUri += "/$count"; - - ClientResource resource = service.createResource(new Reference( - targetUri)); - - try { - Representation result = resource.get(); - count = Integer.parseInt(result.getText()); - } catch (Exception e) { - getLogger().warning( - "Cannot parse count value due to: " + e.getMessage()); - } - } - - return count; - } - - /** - * Returns the atom feed object that wrap the data. - * - * @return The atom feed object that wrap the data. - */ - private Feed getFeed() { - return feed; - } - - /** - * Returns the current logger. - * - * @return The current logger. - */ - private Logger getLogger() { - if (logger == null) { - logger = Context.getCurrentLogger(); - } - return logger; - } - - /** - * Return the reference to the next page (used in server-paging mode). - * - * @return The reference to the next page (used in server-paging mode). - */ - public Reference getNextPage() { - return nextPage; - } - - /** - * Returns the query string that may be completed by calls to - * {@link Query#addParameter(String, String)} or - * {@link Query#expand(String)}. - * - * @return The query string. - */ - private String getQuery() { - return query; - } - - /** - * Returns the parent client service. - * - * @return The parent client service. - */ - public Service getService() { - return service; - } - - /** - * Returns the path of the targeted entity relatively to the data service - * URI. - * - * @return The path of the targeted entity relatively to the data service - * URI. - */ - public String getSubpath() { - return subpath; - } - - /** - * Tries to deduce the type of the query based on the analysis of the target - * URI, and returns it. - * - * @param targetUri - * The target URI to analyse. - * @return The deduced type of query or {@link Query#TYPE_UNKNOWN} if it is - * unknown. - */ - private int guessType(String targetUri) { - // Remove the trailing query part - String uri = targetUri; - int index = targetUri.indexOf("?"); - if (index != -1) { - uri = uri.substring(0, index); - } - - // Let's detect the type of query - int type = TYPE_UNKNOWN; - - // Can only match entitySet and entity from the the target URI - String entitySet = "{service}.svc/{entitySet}"; - String entity = entitySet + "({keyPredicate})"; - - Template t = new Template(entity, Template.MODE_EQUALS); - t.getVariables().put("entitySet", - new Variable(Variable.TYPE_ALL, "", true, false)); - t.getVariables().put("keyPredicate", - new Variable(Variable.TYPE_ALL, "", true, false)); - - if (t.match(uri) != -1) { - return TYPE_ENTITY; - } - - t.setPattern(entitySet); - if (t.match(uri) != -1) { - return TYPE_ENTITY_SET; - } - - return type; - } - - /** - * Creates a new Query with the $inlinecount option set in the URI - * generated by the returned query. - * - * @param inlineCount - * True if the total number of entities in the entity set must be - * returned. - * @return A new Query with the $inlinecount option set in the URI - * generated by the returned query. - */ - public Query inlineCount(boolean inlineCount) { - Query result = null; - if (inlineCount) { - result = addParameter("$inlinecount", "allpages"); - } else { - result = addParameter("$inlinecount", "none"); - } - result.inlineCount = inlineCount; - - return result; - } - - /** - * Returns true if the query has been executed. - * - * @return true if the query has been executed. - */ - private boolean isExecuted() { - return executed; - } - - /** - * Returns an iterator over a set of elements of type T. It returns null if - * the query does not retrieve elements. - * - * @return an Iterator or null if the query does not retrieve elements. - */ - public Iterator iterator() { - Iterator result = null; - - try { - execute(); - result = entities.iterator(); - - // result = new FeedParser(getFeed(), this.entityClass, - // ((Metadata) getService().getMetadata())).parse(); - // Detect server-paging mode. - setNextPage(null); - - for (Link link : getFeed().getLinks()) { - if (Relation.NEXT.equals(link.getRel())) { - setNextPage(link.getHref()); - break; - } - } - - if (getNextPage() != null) { - result = new EntryIterator(this.service, result, - getNextPage(), entityClass); - } - } catch (Exception e) { - getLogger().log(Level.WARNING, - "Can't parse the content of " + createTargetUri(), e); - } - - return result; - } - - /** - * Creates a new Query with the $orderby option set in the URI generated - * by the returned query. - * - * @param criteria - * A string value that contains the criteria used to order the - * results. - * @return A new Query with the $orderby option set in the URI generated - * by the returned query. - */ - public Query orderBy(String criteria) { - return addParameter("$orderby", criteria); - } - - /** - * Creates a new Query with the $select option set in the URI generated - * by the returned query. - * - * @param select - * A string value that contains the requesting URI. - * @return A new Query with the $select option set in the URI generated - * by the returned query. - */ - public Query select(String select) { - return addParameter("$select", select); - } - - /** - * Indicates whether the query has been executed. - * - * @param executed - * true if the query has been executed. - */ - private void setExecuted(boolean executed) { - this.executed = executed; - } - - /** - * Sets the atom feed object that wraps the data. - * - * @param feed - * The atom feed object that wraps the data. - */ - private void setFeed(Feed feed) { - this.feed = feed; - } - - /** - * Sets the reference to the next page (used in server-paging mode). - * - * @param nextPage - * The reference to the next page. - */ - public void setNextPage(Reference nextPage) { - this.nextPage = nextPage; - } - - /** - * Sets the query string of the request. - * - * @param query - * The query string of the request. - */ - public void setQuery(String query) { - this.query = query; - } - - /** - * Creates a new Query with the $skip option set in the URI generated by - * the returned query. - * - * @param rowsCount - * A number of rows to skip. - * @return A new Query with the $skip option set in the URI generated by - * the returned query. - */ - public Query skip(int rowsCount) { - return addParameter("$skip", Integer.toString(rowsCount)); - } - - /** - * Creates a new Query with the $skiptoken option set in the URI - * generated by the returned query. - * - * @param token - * A string value that contains the requesting URI. - * @return A new Query with the $skiptoken option set in the URI - * generated by the returned query. - */ - public Query skipToken(String token) { - return addParameter("$skiptoken", token); - } - - /** - * Creates a new Query with the $top option set in the URI generated by - * the returned query. - * - * @param rowsCount - * A number of rows used to limit the number of results. - * @return A new Query with the $top option set in the URI generated by - * the returned query. - */ - public Query top(int rowsCount) { - return addParameter("$top", Integer.toString(rowsCount)); - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Service.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Service.java deleted file mode 100644 index 4df6a9c8b4..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/Service.java +++ /dev/null @@ -1,1254 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.restlet.Client; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.data.ChallengeResponse; -import org.restlet.data.CharacterSet; -import org.restlet.data.Header; -import org.restlet.data.MediaType; -import org.restlet.data.Parameter; -import org.restlet.data.Preference; -import org.restlet.data.Protocol; -import org.restlet.data.Reference; -import org.restlet.data.Tag; -import org.restlet.engine.Edition; -import org.restlet.engine.header.HeaderConstants; -import org.restlet.engine.header.HeaderReader; -import org.restlet.ext.atom.Content; -import org.restlet.ext.atom.Entry; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.atom.Link; -import org.restlet.ext.atom.Relation; -import org.restlet.ext.odata.internal.EntryContentHandler; -import org.restlet.ext.odata.internal.edm.AssociationEnd; -import org.restlet.ext.odata.internal.edm.ComplexProperty; -import org.restlet.ext.odata.internal.edm.EntityContainer; -import org.restlet.ext.odata.internal.edm.EntityType; -import org.restlet.ext.odata.internal.edm.FunctionImport; -import org.restlet.ext.odata.internal.edm.Metadata; -import org.restlet.ext.odata.internal.edm.Property; -import org.restlet.ext.odata.internal.edm.TypeUtils; -import org.restlet.ext.odata.internal.reflect.ReflectUtils; -import org.restlet.ext.xml.DomRepresentation; -import org.restlet.ext.xml.SaxRepresentation; -import org.restlet.ext.xml.XmlWriter; -import org.restlet.representation.Representation; -import org.restlet.representation.StringRepresentation; -import org.restlet.resource.ClientResource; -import org.restlet.resource.ResourceException; -import org.restlet.util.Series; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * Acts as a manager for a specific remote OData service. OData services are - * stateless, but {@link Service} instances are not. State on the client is - * maintained between interactions in order to support features such as update - * management.
- *
- * This Java class is more or less equivalent to the WCF DataServiceContext - * class. - * - * @author Jerome Louvel - * @see DataServiceContext - * Class on MSDN - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Service { - /** WCF data services metadata namespace. */ - public final static String WCF_DATASERVICES_METADATA_NAMESPACE = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"; - - /** WCF data services namespace. */ - public final static String WCF_DATASERVICES_NAMESPACE = "http://schemas.microsoft.com/ado/2007/08/dataservices"; - - /** WCF data services scheme namespace. */ - public final static String WCF_DATASERVICES_SCHEME_NAMESPACE = "http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"; - - /** The client connector used in case the context does not deliver one. */ - private Client clientConnector; - - /** - * The version of the OData protocol extensions defined in every request - * issued by this service. - */ - private String clientVersion; - - /** The credentials used to authenticate requests. */ - private ChallengeResponse credentials; - - /** The latest request sent to the service. */ - private Request latestRequest; - - /** The response to the latest request. */ - private Response latestResponse; - - /** The internal logger. */ - private Logger logger; - - /** - * The maximum version of the OData protocol extensions the client can - * accept in a response. - */ - private String maxClientVersion; - - /** The metadata of the WCF service. */ - private Metadata metadata; - - /** - * The version of the OData protocol extensions defined by the remote - * service. - */ - private String serverVersion; - - /** The reference of the WCF service. */ - private Reference serviceRef; - - /** - * Constructor. - * - * @param serviceRef - * The reference to the WCF service. - */ - public Service(Reference serviceRef) { - try { - // Test the given service URI which may be actually redirected. - ClientResource cr = new ClientResource(serviceRef); - if (cr.getNext() == null) { - // The context does not provide a client connector. - // Let instantiate our own. - Protocol rProtocol = cr.getProtocol(); - Reference rReference = cr.getReference(); - Protocol protocol = (rProtocol != null) ? rProtocol - : (rReference != null) ? rReference.getSchemeProtocol() - : null; - - if (protocol != null) { - this.clientConnector = new Client(protocol); - // Set the next handler for reuse - cr.setNext(this.clientConnector); - } - } - - cr.setFollowingRedirects(false); - cr.get(); - - if (cr.getStatus().isRedirection()) { - this.serviceRef = cr.getLocationRef(); - } else { - this.serviceRef = cr.getReference(); - } - } catch (Throwable e) { - this.serviceRef = serviceRef; - } - } - - /** - * Constructor. - * - * @param serviceUri - * The URI of the WCF service. - */ - public Service(String serviceUri) { - this(new Reference(serviceUri)); - } - - /** - * Adds an entity to an entity set. - * - * @param entitySetName - * The path of the entity set relatively to the service URI. - * @param entity - * The entity to put. - * @throws Exception - */ - public void addEntity(String entitySetName, Object entity) throws Exception { - if (entity != null) { - Entry entry = toEntry(entity); - - ClientResource resource = createResource(entitySetName); - if (getMetadata() == null) { - throw new Exception("Can't add entity to this entity set " - + resource.getReference() - + " due to the lack of the service's metadata."); - } - - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - entry.write(baos); - baos.flush(); - StringRepresentation r = new StringRepresentation( - baos.toString(), MediaType.APPLICATION_ATOM); - Representation rep = resource.post(r); - EntryContentHandler entryContentHandler = new EntryContentHandler( - entity.getClass(), (Metadata) getMetadata(), - getLogger()); - Feed feed = new Feed(); - feed.getEntries().add(new Entry(rep, entryContentHandler)); - } catch (ResourceException re) { - throw new ResourceException(re.getStatus(), - "Can't add entity to this entity set " - + resource.getReference()); - } finally { - this.latestRequest = resource.getRequest(); - this.latestResponse = resource.getResponse(); - } - } - } - - /** - * Adds an association between the source and the target entity via the - * given property name. - * - * @param source - * The source entity to update. - * @param sourceProperty - * The name of the property of the source entity. - * @param target - * The entity to add to the source entity. - * @throws Exception - */ - public void addLink(Object source, String sourceProperty, Object target) - throws Exception { - if (getMetadata() == null || source == null) { - return; - } - if (target != null) { - addEntity(getSubpath(source, sourceProperty), target); - } - } - - /** - * Creates a query to a specific entity hosted by this service. - * - * @param - * The class of the target entity. - * @param subpath - * The path to this entity relatively to the service URI. - * @param entityClass - * The target class of the entity. - * @return A query object. - */ - public Query createQuery(String subpath, Class entityClass) { - return new Query(this, subpath, entityClass); - } - - /** - * Returns an instance of {@link ClientResource} given an absolute - * reference. This resource is completed with the service credentials. This - * method can be overriden in order to complete the sent requests. - * - * @param reference - * The reference of the target resource. - * @return An instance of {@link ClientResource}. - */ - public ClientResource createResource(Reference reference) { - ClientResource resource = new ClientResource(reference); - - if (clientConnector != null) { - // We provide our own cient connector. - resource.setNext(clientConnector); - } - - resource.setChallengeResponse(getCredentials()); - - if (getClientVersion() != null || getMaxClientVersion() != null) { - Series
headers = new Series
(Header.class); - - if (getClientVersion() != null) { - headers.add("DataServiceVersion", getClientVersion()); - } - - if (getMaxClientVersion() != null) { - headers.add("MaxDataServiceVersion", getMaxClientVersion()); - } - - resource.setAttribute(HeaderConstants.ATTRIBUTE_HEADERS, headers); - } - - return resource; - } - - /** - * Returns an instance of {@link ClientResource} given a path (relative to - * the service reference). This resource is completed with the service - * credentials. This method can be overriden in order to complete the sent - * requests. - * - * @param relativePath - * The relative reference of the target resource. - * @return An instance of {@link ClientResource} given a path (relative to - * the service reference). - */ - public ClientResource createResource(String relativePath) { - String ref = getServiceRef().toString(); - if (ref.endsWith("/")) { - if (relativePath.startsWith("/")) { - ref = ref + relativePath.substring(1); - } else { - ref = ref + relativePath; - } - } else { - if (relativePath.startsWith("/")) { - ref = ref + relativePath; - } else { - ref = ref + "/" + relativePath; - } - } - - return createResource(new Reference(ref)); - } - - /** - * Deletes an entity. - * - * @param entity - * The entity to delete - * @throws ResourceException - */ - public void deleteEntity(Object entity) throws ResourceException { - if (getMetadata() == null) { - return; - } - - ClientResource resource = createResource(getSubpath(entity)); - - try { - resource.delete(); - } catch (ResourceException re) { - throw new ResourceException(re.getStatus(), - "Can't delete this entity " + resource.getReference()); - } finally { - this.latestRequest = resource.getRequest(); - this.latestResponse = resource.getResponse(); - } - } - - /** - * Deletes an entity. - * - * @param entitySubpath - * The path of the entity to delete - * @throws ResourceException - */ - public void deleteEntity(String entitySubpath) throws ResourceException { - ClientResource resource = createResource(entitySubpath); - - try { - resource.delete(); - } catch (ResourceException re) { - throw new ResourceException(re.getStatus(), - "Can't delete this entity " + resource.getReference()); - } finally { - this.latestRequest = resource.getRequest(); - this.latestResponse = resource.getResponse(); - } - } - - /** - * Removes the association between a source entity and a target entity via - * the given property name. - * - * @param source - * The source entity to update. - * @param sourceProperty - * The name of the property of the source entity. - * @param target - * The entity to delete from the source entity. - * @throws ResourceException - */ - public void deleteLink(Object source, String sourceProperty, Object target) - throws ResourceException { - if (getMetadata() == null) { - return; - } - deleteEntity(getSubpath(source, sourceProperty, target)); - } - - /** - * Returns the version of the OData protocol extensions defined in every - * request issued by this service. - * - * @return The version of the OData protocol extensions defined in every - * request issued by this service. - */ - public String getClientVersion() { - return clientVersion; - } - - /** - * Returns the credentials used to authenticate requests. - * - * @return The credentials used to authenticate requests. - */ - public ChallengeResponse getCredentials() { - return credentials; - } - - /** - * Returns the latest request sent to the service. - * - * @return The latest request sent to the service. - */ - public Request getLatestRequest() { - return latestRequest; - } - - /** - * Returns the response to the latest request. - * - * @return The response to the latest request. - */ - public Response getLatestResponse() { - return latestResponse; - } - - /** - * Returns the current logger. - * - * @return The current logger. - */ - private Logger getLogger() { - if (logger == null) { - logger = Context.getCurrentLogger(); - } - return logger; - } - - /** - * Returns the maximum version of the OData protocol extensions the client - * can accept in a response. - * - * @return The maximum version of the OData protocol extensions the client - * can accept in a response. - */ - public String getMaxClientVersion() { - return maxClientVersion; - } - - /** - * Returns the metadata document related to the current service. - * - * @return The metadata document related to the current service. - */ - protected Object getMetadata() { - if (metadata == null) { - ClientResource resource = createResource("$metadata"); - - try { - getLogger().log( - Level.INFO, - "Get the metadata for " + getServiceRef() + " at " - + resource.getReference()); - Representation rep = resource.get(MediaType.APPLICATION_XML); - this.metadata = new Metadata(rep, resource.getReference()); - } catch (ResourceException e) { - getLogger().log( - Level.SEVERE, - "Can't get the metadata for " + getServiceRef() - + " (response's status: " - + resource.getStatus() + ")"); - } catch (Exception e) { - getLogger().log(Level.SEVERE, - "Can't get the metadata for " + getServiceRef(), e); - } finally { - this.latestRequest = resource.getRequest(); - this.latestResponse = resource.getResponse(); - } - } - - return metadata; - } - - /** - * Returns the version of the OData protocol extensions supported by the - * remote service. - * - * @return The version of the OData protocol extensions supported by the - * remote service. - */ - @SuppressWarnings("unchecked") - public String getServerVersion() { - if (serverVersion == null) { - // Get the version from the latest response. - if (this.latestResponse != null) { - Object o = this.latestResponse.getAttributes().get( - HeaderConstants.ATTRIBUTE_HEADERS); - - if (o != null) { - Series
headers = (Series
) o; - String strHeader = headers.getFirstValue( - "DataServiceVersion", true); - - if (strHeader != null) { - HeaderReader reader = new HeaderReader( - strHeader); - this.serverVersion = reader.readToken(); - } - } - } - } - - return serverVersion; - } - - /** - * Returns the reference to the WCF service. - * - * @return The reference to the WCF service. - */ - public Reference getServiceRef() { - return serviceRef; - } - - /** - * Extracts a String value from the Representation of a property or a - * function, or a service operation, when this representation wraps an EDM - * simple type. - * - * @param representation - * The representation to parse - * @param tagName - * The name of the property or function. - * @return The String value taken from the representation. - * @throws Exception - * Thrown when a parsing error occurs. - */ - private String getSimpleValue(Representation representation, String tagName) - throws Exception { - String result = null; - - if (representation == null) { - return result; - } - - if (MediaType.APPLICATION_ALL_XML.isCompatible(representation - .getMediaType()) - || MediaType.TEXT_XML.isCompatible(representation - .getMediaType())) { - DomRepresentation xmlRep = new DomRepresentation(representation); - - Node node = null; - if (Edition.ANDROID.isCurrentEdition()) { - try { - org.w3c.dom.NodeList nl = xmlRep.getDocument() - .getElementsByTagName(tagName); - node = (nl.getLength() > 0) ? nl.item(0) : null; - } catch (IOException e1) { - } - } else { - node = xmlRep.getNode("//" + tagName); - } - - if (node != null) { - if (Edition.ANDROID.isCurrentEdition()) { - result = org.restlet.ext.xml.XmlRepresentation.getTextContent(node); - } else { - result = node.getTextContent(); - } - } - } else { - result = representation.getText(); - } - - return result; - } - - /** - * According to the metadata of the service, returns the path of the given - * entity relatively to the current WCF service. - * - * @param entity - * The entity. - * @return The path of the given entity relatively to the current WCF - * service. - */ - private String getSubpath(Object entity) { - return ((Metadata) getMetadata()).getSubpath(entity); - } - - /** - * According to the metadata of the service, returns the path of the given - * entity's property relatively to the current WCF service. - * - * @param entity - * The entity. - * @param propertyName - * The name of the property. - * @return The path of the given entity's property relatively to the current - * WCF service. - */ - private String getSubpath(Object entity, String propertyName) { - return ((Metadata) getMetadata()).getSubpath(entity, propertyName); - } - - /** - * According to the metadata of the service, returns the relative path of - * the given target entity linked to the source entity via the source - * property. - * - * @param source - * The source entity to update. - * @param sourceProperty - * The name of the property of the source entity. - * @param target - * The entity linked to the source entity. - * @return - */ - private String getSubpath(Object source, String sourceProperty, - Object target) { - return ((Metadata) getMetadata()).getSubpath(source, sourceProperty, - target); - } - - /** - * Returns the ETag value for the given entity. - * - * @param entity - * The given entity. - * @return The ETag value for the given entity. - */ - private String getTag(Object entity) { - String result = null; - if (entity != null) { - Metadata metadata = (Metadata) getMetadata(); - EntityType type = metadata.getEntityType(entity.getClass()); - - StringBuilder sb = new StringBuilder(); - boolean found = false; - for (Property property : type.getProperties()) { - if (property.isConcurrent()) { - found = true; - Object value = null; - try { - value = ReflectUtils.invokeGetter(entity, - property.getName()); - if (value != null) { - sb.append(value); - } - } catch (Exception e) { - getLogger().warning( - "Cannot get the value of the property " - + property.getName() + " on " + entity); - } - } - } - - if (found) { - result = Reference.encode(sb.toString(), CharacterSet.US_ASCII); - } - } - - return result; - } - - /** - * Returns the binary representation of the given media resource. If the - * entity is not a media resource, it returns null. - * - * @param entity - * The given media resource. - * @return The binary representation of the given media resource. - */ - public Representation getValue(Object entity) throws ResourceException { - Reference ref = getValueRef(entity); - if (ref != null) { - ClientResource cr = createResource(ref); - return cr.get(); - } - - return null; - } - - /** - * Returns the binary representation of the given media resource. If the - * entity is not a media resource, it returns null. - * - * @param entity - * The given media resource. - * @param acceptedMediaTypes - * The requested media types of the representation. - * @return The given media resource. - */ - public Representation getValue(Object entity, - List> acceptedMediaTypes) - throws ResourceException { - Reference ref = getValueRef(entity); - if (ref != null) { - ClientResource cr = createResource(ref); - cr.getClientInfo().setAcceptedMediaTypes(acceptedMediaTypes); - return cr.get(); - } - - return null; - } - - /** - * Returns the binary representation of the given media resource. If the - * entity is not a media resource, it returns null. - * - * @param entity - * The given media resource. - * @param mediaType - * The requested media type of the representation - * @return The given media resource. - */ - public Representation getValue(Object entity, MediaType mediaType) - throws ResourceException { - Reference ref = getValueRef(entity); - if (ref != null) { - ClientResource cr = createResource(ref); - return cr.get(mediaType); - } - - return null; - } - - /** - * Returns the reference used to edit the binary representation of the given - * entity, if this is a media resource. It returns null otherwise. - * - * @param entity - * The media resource. - * @return Returns the reference used to edit the binary representation of - * the given entity, if this is a media resource. It returns null - * otherwise. - */ - private Reference getValueEditRef(Object entity) { - if (entity != null) { - Metadata metadata = (Metadata) getMetadata(); - EntityType type = metadata.getEntityType(entity.getClass()); - if (type.isBlob() && type.getBlobValueEditRefProperty() != null) { - try { - return (Reference) ReflectUtils.invokeGetter(entity, type - .getBlobValueEditRefProperty().getName()); - } catch (Exception e) { - getLogger().warning( - "Cannot get the value of the property " - + type.getBlobValueEditRefProperty() - .getName() + " on " + entity); - } - } else { - getLogger().warning( - "This entity is not a media resource " + entity); - } - } - - return null; - } - - /** - * Returns the reference of the binary representation of the given entity, - * if this is a media resource. It returns null otherwise. - * - * @param entity - * The media resource. - * @return The reference of the binary representation of the given entity, - * if this is a media resource. It returns null otherwise. - */ - public Reference getValueRef(Object entity) { - if (entity != null) { - Metadata metadata = (Metadata) getMetadata(); - - EntityType type = metadata.getEntityType(entity.getClass()); - if (type.isBlob() && type.getBlobValueRefProperty() != null) { - try { - return (Reference) ReflectUtils.invokeGetter(entity, type - .getBlobValueRefProperty().getName()); - } catch (Exception e) { - getLogger().warning( - "Cannot get the value of the property " - + type.getBlobValueRefProperty().getName() - + " on " + entity); - } - } else { - getLogger().warning( - "This entity is not a media resource " + entity); - } - } - - return null; - } - - /** - * Invokes a service operation and return the raw representation sent back - * by the service. - * - * @param service - * The name of the service. - * @param parameters - * The list of required parameters. - * @return The representation returned by the invocation of the service. - * @throws ResourceException - * Thrown when the service call is not successfull. - * @see Service - * Operations - */ - public Representation invokeComplex(String service, - Series parameters) throws ResourceException { - Representation result = null; - Metadata metadata = (Metadata) getMetadata(); - if (metadata != null && service != null) { - // Look for the FunctionImport element. - FunctionImport function = null; - for (EntityContainer container : metadata.getContainers()) { - for (FunctionImport f : container.getFunctionImports()) { - if (service.equals(f.getName())) { - function = f; - break; - } - } - if (function != null) { - break; - } - } - - if (function != null) { - ClientResource resource = createResource(service); - resource.setMethod(function.getMethod()); - if (parameters != null) { - for (org.restlet.ext.odata.internal.edm.Parameter parameter : function - .getParameters()) { - resource.getReference().addQueryParameter( - parameter.getName(), - TypeUtils.getLiteralForm(parameters - .getFirstValue(parameter.getName()), - parameter.getType())); - } - } - - result = resource.handle(); - this.latestRequest = resource.getRequest(); - this.latestResponse = resource.getResponse(); - - if (resource.getStatus().isError()) { - throw new ResourceException(resource.getStatus()); - } - } - } - - return result; - } - - /** - * Invokes a service operation and return the String value sent back by the - * service. - * - * @param service - * The name of the service. - * @param parameters - * The list of required parameters. - * @return The value returned by the invocation of the service as a String. - * @throws ResourceException - * Thrown when the service call is not successfull. - * @throws Exception - * Thrown when the value cannot be parsed. - * @see Service - * Operations - */ - public String invokeSimple(String service, Series parameters) - throws ResourceException, Exception { - return getSimpleValue(invokeComplex(service, parameters), service); - } - - /** - * Updates the given entity object with the value of the specified property. - * - * @param entity - * The entity to update. - * @param propertyName - * The name of the property. - */ - public void loadProperty(Object entity, String propertyName) { - if (getMetadata() == null || entity == null) { - return; - } - - Metadata metadata = (Metadata) getMetadata(); - - EntityType type = metadata.getEntityType(entity.getClass()); - AssociationEnd association = metadata - .getAssociation(type, propertyName); - - if (association != null) { - EntityType propertyEntityType = association.getType(); - try { - Class propertyClass = ReflectUtils.getSimpleClass(entity, - propertyName); - if (propertyClass == null) { - propertyClass = TypeUtils.getJavaClass(propertyEntityType); - } - Iterator iterator = createQuery( - getSubpath(entity, propertyName), propertyClass) - .iterator(); - - ReflectUtils.setProperty(entity, propertyName, - association.isToMany(), iterator, propertyClass); - } catch (Exception e) { - getLogger().log( - Level.WARNING, - "Can't set the property " + propertyName + " of " - + entity.getClass() + " for the service" - + getServiceRef(), e); - } - } else { - ClientResource resource = createResource(getSubpath(entity, - propertyName)); - try { - Representation rep = resource.get(); - - try { - String value = getSimpleValue(rep, propertyName); - Property property = metadata.getProperty(entity, - propertyName); - ReflectUtils.setProperty(entity, property, value); - } catch (Exception e) { - getLogger().log( - Level.WARNING, - "Can't set the property " + propertyName + " of " - + entity.getClass() + " for the service" - + getServiceRef(), e); - } - } catch (ResourceException e) { - getLogger().log( - Level.WARNING, - "Can't get the following resource " - + resource.getReference() + " for the service" - + getServiceRef(), e); - } - } - } - - /** - * Sets the version of the OData protocol extensions defined in every - * request issued by this service. - * - * @param clientVersion - * The version of the OData protocol extensions defined in every - * request issued by this service. - */ - public void setClientVersion(String clientVersion) { - this.clientVersion = clientVersion; - } - - /** - * Sets the credentials used to authenticate requests. - * - * @param credentials - * The credentials used to authenticate requests. - */ - public void setCredentials(ChallengeResponse credentials) { - this.credentials = credentials; - } - - /** - * Sets the latest request sent to the service. - * - * @param latestRequest - * The latest request sent to the service. - */ - public void setLatestRequest(Request latestRequest) { - this.latestRequest = latestRequest; - } - - /** - * Sets the response to the latest request. - * - * @param latestResponse - * The response to the latest request. - */ - public void setLatestResponse(Response latestResponse) { - this.latestResponse = latestResponse; - } - - /** - * Sets the association between the source and the target entity via the - * given property name. If target is set to null, the call represents a - * delete link operation. - * - * @param source - * The source entity to update. - * @param sourceProperty - * The name of the property of the source entity. - * @param target - * The entity to add to the source entity. - * @throws Exception - */ - public void setLink(Object source, String sourceProperty, Object target) - throws Exception { - if (getMetadata() == null || source == null) { - return; - } - if (target != null) { - // TODO Take into account the case where the target does exist. - Metadata metadata = (Metadata) getMetadata(); - ClientResource resource = createResource(metadata - .getSubpath(source) + "/$links/" + sourceProperty); - - try { - // TODO Fix chunked request with net client connector - StringBuilder sb = new StringBuilder(""); - sb.append(getServiceRef().toString()); - sb.append(metadata.getSubpath(target)); - sb.append(""); - - StringRepresentation r = new StringRepresentation( - sb.toString(), MediaType.APPLICATION_XML); - resource.put(r); - } catch (ResourceException re) { - throw new ResourceException(re.getStatus(), - "Can't set entity to this entity set " - + resource.getReference()); - } finally { - this.latestRequest = resource.getRequest(); - this.latestResponse = resource.getResponse(); - } - } else { - ReflectUtils.invokeSetter(source, sourceProperty, null); - updateEntity(source); - } - } - - /** - * Sets the maximum version of the OData protocol extensions the client can - * accept in a response. - * - * @param maxClientVersion - * The maximum version of the OData protocol extensions the - * client can accept in a response. - */ - public void setMaxClientVersion(String maxClientVersion) { - this.maxClientVersion = maxClientVersion; - } - - /** - * Sets the value of the given media entry link. - * - * @param entity - * The media entry link which value is to be updated - * @param blob - * The new representation. - * @throws ResourceException - */ - public void setValue(Object entity, Representation blob) - throws ResourceException { - Reference ref = getValueEditRef(entity); - - if (ref != null) { - ClientResource cr = createResource(ref); - cr.put(blob); - } - } - - /** - * Converts an entity to an Atom entry object. - * - * @param entity - * The entity to wrap. - * @return The Atom entry object that corresponds to the given entity. - */ - public Entry toEntry(final Object entity) { - Entry result = null; - - if (entity != null) { - Metadata metadata = (Metadata) getMetadata(); - EntityType type = metadata.getEntityType(entity.getClass()); - if (type != null) { - final SaxRepresentation r = new SaxRepresentation( - MediaType.APPLICATION_XML) { - - @Override - public void write(XmlWriter writer) throws IOException { - try { - // Attribute for nullable values. - AttributesImpl nullAttrs = new AttributesImpl(); - nullAttrs.addAttribute( - WCF_DATASERVICES_METADATA_NAMESPACE, - "null", null, "boolean", "true"); - writer.forceNSDecl( - WCF_DATASERVICES_METADATA_NAMESPACE, "m"); - writer.forceNSDecl(WCF_DATASERVICES_NAMESPACE, "d"); - writer.startElement( - WCF_DATASERVICES_METADATA_NAMESPACE, - "properties"); - write(writer, entity, nullAttrs); - writer.endElement( - WCF_DATASERVICES_METADATA_NAMESPACE, - "properties"); - } catch (SAXException e) { - throw new IOException(e.getMessage()); - } - } - - private void write(XmlWriter writer, Object entity, - AttributesImpl nullAttrs) throws SAXException { - for (Field field : entity.getClass() - .getDeclaredFields()) { - String getter = "get" - + field.getName().substring(0, 1) - .toUpperCase() - + field.getName().substring(1); - Property prop = ((Metadata) getMetadata()) - .getProperty(entity, field.getName()); - - if (prop != null) { - writeProperty(writer, entity, prop, getter, - nullAttrs); - } - } - } - - private void writeProperty(XmlWriter writer, Object entity, - Property prop, String getter, - AttributesImpl nullAttrs) throws SAXException { - for (Method method : entity.getClass() - .getDeclaredMethods()) { - if (method.getReturnType() != null - && getter.equals(method.getName()) - && method.getParameterTypes().length == 0) { - Object value = null; - - try { - value = method.invoke(entity, - (Object[]) null); - } catch (Exception e) { - } - - if (value != null) { - writer.startElement( - WCF_DATASERVICES_NAMESPACE, - prop.getName()); - - if (prop instanceof ComplexProperty) { - write(writer, value, nullAttrs); - } else { - writer.characters(TypeUtils.toEdm( - value, prop.getType())); - } - - writer.endElement( - WCF_DATASERVICES_NAMESPACE, - prop.getName()); - } else { - if (prop.isNullable()) { - writer.emptyElement( - WCF_DATASERVICES_NAMESPACE, - prop.getName(), prop.getName(), - nullAttrs); - } else { - getLogger().warning( - "The following property has a null value but is not marked as nullable: " - + prop.getName()); - writer.emptyElement( - WCF_DATASERVICES_NAMESPACE, - prop.getName()); - } - } - break; - } - } - } - }; - r.setNamespaceAware(true); - - if (type.isBlob()) { - result = new Entry() { - @Override - public void writeInlineContent(XmlWriter writer) - throws SAXException { - try { - r.write(writer); - } catch (IOException e) { - throw new SAXException(e); - } - } - }; - result.setNamespaceAware(true); - - Link editLink = new Link(getValueEditRef(entity), - Relation.EDIT_MEDIA, null); - result.getLinks().add(editLink); - Content content = new Content(); - // Get the external blob reference - content.setExternalRef(getValueRef(entity)); - content.setToEncode(false); - result.setContent(content); - } else { - result = new Entry(); - Content content = new Content(); - content.setInlineContent(r); - content.setToEncode(false); - - result.setContent(content); - } - } - } - - return result; - } - - /** - * Updates an entity. - * - * @param entity - * The entity to put. - * @throws Exception - */ - public void updateEntity(Object entity) throws Exception { - if (getMetadata() == null || entity == null) { - return; - } - - Entry entry = toEntry(entity); - ClientResource resource = createResource(getSubpath(entity)); - - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - entry.write(baos); - baos.flush(); - StringRepresentation r = new StringRepresentation(baos.toString(), - MediaType.APPLICATION_ATOM); - String tag = getTag(entity); - - if (tag != null) { - // Add a condition - resource.getConditions().setMatch(Arrays.asList(new Tag(tag))); - } - resource.put(r); - } catch (ResourceException re) { - throw new ResourceException(re.getStatus(), - "Can't update this entity " + resource.getReference()); - } finally { - this.latestRequest = resource.getRequest(); - this.latestResponse = resource.getResponse(); - } - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/EntryContentHandler.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/EntryContentHandler.java deleted file mode 100644 index b0cdbc9659..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/EntryContentHandler.java +++ /dev/null @@ -1,818 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; - -import org.restlet.Context; -import org.restlet.data.Language; -import org.restlet.data.MediaType; -import org.restlet.data.Reference; -import org.restlet.ext.atom.Content; -import org.restlet.ext.atom.Entry; -import org.restlet.ext.atom.EntryReader; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.atom.Link; -import org.restlet.ext.atom.Person; -import org.restlet.ext.atom.Relation; -import org.restlet.ext.odata.Service; -import org.restlet.ext.odata.internal.edm.AssociationEnd; -import org.restlet.ext.odata.internal.edm.EntityType; -import org.restlet.ext.odata.internal.edm.Mapping; -import org.restlet.ext.odata.internal.edm.Metadata; -import org.restlet.ext.odata.internal.edm.Property; -import org.restlet.ext.odata.internal.reflect.ReflectUtils; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Content handler for Atom Feed that takes care of OData specific needs, such - * as parsing XML content from other namespaces than Atom. It generates an - * entity based on the values discovered in the entry. - * - * @author Thierry Boileau - * @param - * The type of the parsed entity. - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class EntryContentHandler extends EntryReader { - - private enum State { - ASSOCIATION, CONTENT, ENTRY, PROPERTIES, PROPERTY - } - - /** The currently parsed association. */ - private AssociationEnd association; - - /** The path of the current XML element relatively to the Entry. */ - private List eltPath; - - /** The entity targeted by this entry. */ - private T entity; - - /** The class of the entity targeted by this entry. */ - private Class entityClass; - - /** The OData type of the parsed entity. */ - private EntityType entityType; - - /** The currently parsed inline content. */ - private Content inlineContent; - - /** The currently parsed inline entry. */ - private Entry inlineEntry; - - /** Used to parsed Atom link elements that contains entries. */ - private EntryContentHandler inlineEntryHandler; - - /** The currently parsed inline feed. */ - private Feed inlineFeed; - - /** Used to parsed Atom link elements that contains feeds. */ - private FeedContentHandler inlineFeedHandler; - - /** The currently parsed inline link. */ - private Link inlineLink; - - /** Internal logger. */ - private Logger logger; - - /** The currently parsed OData mapping. */ - private Mapping mapping; - - /** The metadata of the WCF service. */ - private Metadata metadata; - - /** Must the current property be set to null? */ - private boolean parsePropertyNull; - - /** Used to handle complex types. */ - private List propertyPath; - - /** Gleans text content. */ - private StringBuilder sb = null; - - /** Heap of states. */ - private List states; - - /** - * Constructor. - * - * @param entityClass - * The class of the parsed entities. - * @param entityType - * The entity type of the parsed entities. - * @param metadata - * The metadata of the remote OData service. - * @param logger - * The logger. - */ - public EntryContentHandler(Class entityClass, EntityType entityType, - Metadata metadata, Logger logger) { - this.entityClass = entityClass; - this.entityType = entityType; - this.metadata = metadata; - this.logger = logger; - } - - /** - * Constructor. - * - * @param entityClass - * The class of the parsed entities. - * @param metadata - * The metadata of the remote OData service. - * @param logger - * The logger. - */ - public EntryContentHandler(Class entityClass, Metadata metadata, - Logger logger) { - super(); - this.entityClass = entityClass; - this.entityType = metadata.getEntityType(entityClass); - this.metadata = metadata; - this.logger = logger; - } - - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - if (State.ASSOCIATION == getState()) { - // Delegates to the inline content handler - if (association.isToMany()) { - inlineFeedHandler.characters(ch, start, length); - } else { - inlineEntryHandler.characters(ch, start, length); - } - } else if (State.PROPERTY == getState() || mapping != null) { - sb.append(ch, start, length); - } - } - - /** - * Close the given entry, in case we really handle an entry (@see current {@link State}). Multiple levels expand fix - * start. - * - * @param entry - * The entry to close. - * @return True if the entry has been closed. - * @author Emmanuel Liossis - */ - public boolean closeEntry(Entry entry) { - boolean result = false; - if (getState() == State.ENTRY) { - endEntry(entry); - result = true; - } - - return result; - } - - /** - * Handles the end of a "link" element. Doesn't pop state if the link - * belongs to inner expanded associations! - * - * @return True if the caller should not pop state. - * @author Emmanuel Liossis - */ - public boolean closeLink() { - if (State.ASSOCIATION == getState() && inlineLink != null) { - String propertyName = ReflectUtils.normalize(inlineLink.getTitle()); - - if (association.isToMany()) { - if (inlineFeedHandler.closeLink()) { - return true; - } - - try { - ReflectUtils.setProperty(entity, propertyName, association - .isToMany(), inlineFeedHandler.getEntities() - .iterator(), ReflectUtils.getSimpleClass(entity, - propertyName)); - } catch (Exception e) { - getLogger().warning( - "Cannot set " + propertyName + " property on " - + entity + " from link"); - } - inlineFeedHandler = null; - } else { - if (inlineEntryHandler.closeLink()) { - return true; - } - - try { - ReflectUtils.invokeSetter(entity, propertyName, - inlineEntryHandler.getEntity()); - } catch (Exception e) { - getLogger().warning( - "Cannot set " + propertyName + " property on " - + entity + " from link"); - } - inlineEntryHandler = null; - } - - popState(); - association = null; - - return true; - } - - // Emmanuel Liossis: So, here we are not in ASSOCIATION state. Should - // we signal our callers to pop state? There are three cases. First, - // this can be the end of an inner reference link which doesn't open an - // association. The state in this case is typically ENTRY. In this case - // we should return true to inhibit our caller to pop state, because - // this isn't the association's end. Second, this might be a content of - // a non-expanded association. In this case the state is null because it - // hasn't found any 'entry' tag. The association state of the caller - // must be closed, so we return false. Third, this can be the end of an - // expanded, in-lined association. In this case the state is again null - // because because of previously handling the end of the 'entry' tag. - // So, all the above boils down to this simple rule: - return getState() != null; - } - - @Override - public void endContent(Content content) { - if (State.ASSOCIATION == getState()) { - // Delegates to the inline content handler - if (association.isToMany()) { - inlineFeedHandler.endContent(content); - } else { - inlineEntryHandler.endContent(content); - } - } else { - // Emmanuel Liossis: Multiple levels expand: Design flaw makes - // O(d^2) calls to inner expansions, where d is expansion depth . - // Don't pop many times for a single content close. - if (State.CONTENT == getState()) { - popState(); - } - } - } - - // Emmanuel Liossis: Multiple levels expand fix. - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - if (State.ASSOCIATION == getState()) { - // Delegates to the inline content handler - if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equals("feed")) { - if (association.isToMany()) { - inlineFeedHandler.endFeed(inlineFeed); - } - } else if (localName.equals("link")) { - if (association.isToMany()) { - inlineFeedHandler.closeLink(); - } else { - inlineEntryHandler.closeLink(); - } - // Emmanuel Liossis: Don't propagate the endElement call, - // because it would re-invoke closeLink if the expansion - // level is deep. - return; - } else if (localName.equalsIgnoreCase("entry")) { - if (association.isToMany()) { - inlineFeedHandler.endEntry(inlineEntry); - } else { - inlineEntryHandler.closeEntry(inlineEntry); - } - } else if (localName.equalsIgnoreCase("content")) { - if (association.isToMany()) { - inlineFeedHandler.endContent(inlineContent); - } else { - inlineEntryHandler.endContent(inlineContent); - } - } - } - - if (association.isToMany()) { - inlineFeedHandler.endElement(uri, localName, qName); - } else { - inlineEntryHandler.endElement(uri, localName, qName); - } - } else if (State.PROPERTY == getState()) { - if (parsePropertyNull) { - popState(); - parsePropertyNull = false; - } else { - Object obj = entity; - if (obj != null && propertyPath.size() > 1) { - // Complex property. - for (int i = 0; i < propertyPath.size() - 1; i++) { - try { - Object o = ReflectUtils.invokeGetter(obj, propertyPath.get(i)); - if (o == null) { - // Try to instantiate it - Field[] fields = obj.getClass().getDeclaredFields(); - for (Field field : fields) { - if (field.getName().equalsIgnoreCase(propertyPath.get(i))) { - o = field.getType().newInstance(); - break; - } - } - } - ReflectUtils.invokeSetter(obj, propertyPath.get(i), o); - obj = o; - } catch (Exception e) { - obj = null; - } - } - } - Property property = metadata.getProperty(obj, localName); - if (property != null) { - try { - ReflectUtils.setProperty(obj, property, sb.toString()); - } catch (Exception e) { - getLogger().warning( - "Cannot set " + localName + " property on " - + obj + " with value " + sb.toString()); - } - } - if (!propertyPath.isEmpty()) { - propertyPath.remove(propertyPath.size() - 1); - } - if (propertyPath.isEmpty()) { - // There is only one state for parsing complex or simple properties. - popState(); - } - } - } else if (State.PROPERTIES == getState()) { - popState(); - } else if (State.CONTENT == getState()) { - popState(); - } else if (mapping != null) { - // A mapping has been discovered - if (sb != null) { - try { - ReflectUtils.invokeSetter(entity, - mapping.getPropertyPath(), sb.toString()); - } catch (Exception e) { - getLogger().warning( - "Cannot set the mapped property " - + mapping.getPropertyPath() + " on " - + entity + " with value " + sb.toString()); - } - } - mapping = null; - } else if (State.ENTRY == getState()) { - if (!eltPath.isEmpty()) { - eltPath.remove(eltPath.size() - 1); - } - } - } - - @Override - public void endEntry(Entry entry) { - - this.states = new ArrayList(); - - // Handle Atom mapped values. - for (Mapping m : metadata.getMappings()) { - if (entityType != null && entityType.equals(m.getType()) - && m.getNsUri() == null && m.getNsPrefix() == null) { - // mapping atom - Person author = (entry.getAuthors().isEmpty()) ? null : entry - .getAuthors().get(0); - Person contributor = (entry.getContributors().isEmpty()) ? null - : entry.getContributors().get(0); - Object value = null; - if ("SyndicationAuthorEmail".equals(m.getValuePath())) { - value = (author != null) ? author.getEmail() : null; - } else if ("SyndicationAuthorName".equals(m.getValuePath())) { - value = (author != null) ? author.getName() : null; - } else if ("SyndicationAuthorUri".equals(m.getValuePath())) { - value = (author != null) ? author.getUri().toString() - : null; - } else if ("SyndicationContributorEmail".equals(m - .getValuePath())) { - value = (contributor != null) ? contributor.getEmail() - : null; - } else if ("SyndicationContributorName" - .equals(m.getValuePath())) { - value = (contributor != null) ? contributor.getName() - : null; - } else if ("SyndicationContributorUri".equals(m.getValuePath())) { - value = (contributor != null) ? contributor.getUri() - .toString() : null; - } else if ("SyndicationPublished".equals(m.getValuePath())) { - value = entry.getPublished(); - } else if ("SyndicationRights".equals(m.getValuePath())) { - value = (entry.getRights() != null) ? entry.getRights() - .getContent() : null; - } else if ("SyndicationSummary".equals(m.getValuePath())) { - value = entry.getSummary(); - } else if ("SyndicationTitle".equals(m.getValuePath())) { - value = (entry.getTitle() != null) ? entry.getTitle() - .getContent() : null; - } else if ("SyndicationUpdated".equals(m.getValuePath())) { - value = entry.getUpdated(); - } - - try { - if (value != null) { - ReflectUtils.invokeSetter(entity, m.getPropertyPath(), - value); - } - } catch (Exception e) { - getLogger().warning( - "Cannot set " + m.getPropertyPath() - + " property on " + entity + " with value " - + value); - } - } - } - - // If the entity is a blob, get the edit reference - if (entityType != null && entityType.isBlob() - && entityType.getBlobValueEditRefProperty() != null) { - // Look for en entry with a "edit-media" relation value. - Link link = entry.getLink(Relation.EDIT_MEDIA); - String pty = entityType.getBlobValueEditRefProperty().getName(); - if (link != null) { - try { - ReflectUtils.invokeSetter(entity, pty, link.getHref()); - } catch (Exception e) { - getLogger().warning( - "Cannot set the property " + pty + " on " + entity - + " with value " + link.getHref()); - } - } - } - } - - // Emmanuel Liossis: Fix for multiple level expansions: This method is - // replaced with the above one. - @Override - public void endLink(Link link) { - if (State.ASSOCIATION == getState()) { - String propertyName = ReflectUtils.normalize(link.getTitle()); - - if (association.isToMany()) { - inlineFeedHandler.endLink(link); - - try { - ReflectUtils.setProperty(entity, propertyName, association - .isToMany(), inlineFeedHandler.getEntities() - .iterator(), ReflectUtils.getSimpleClass(entity, - propertyName)); - } catch (Exception e) { - getLogger().warning( - "Cannot set " + propertyName + " property on " - + entity + " from link"); - } - inlineFeedHandler = null; - } else { - inlineEntryHandler.endLink(link); - - try { - ReflectUtils.invokeSetter(entity, propertyName, - inlineEntryHandler.getEntity()); - } catch (Exception e) { - getLogger().warning( - "Cannot set " + propertyName + " property on " - + entity + " from link"); - } - inlineEntryHandler = null; - } - - // This works if the inline entries does not contain links as - // well... - // Emmanuel Liossis: Indeed the above is true. It can sabotage - // expansions with depth more than 1. That's why this method is - // replaced by closeLink method. - popState(); - association = null; - } - } - - public T getEntity() { - return entity; - } - - /** - * Returns the current logger. - * - * @return The current logger. - */ - private Logger getLogger() { - if (logger == null) { - logger = Context.getCurrentLogger(); - } - return logger; - } - - /** - * Returns a media type from an Atom type attribute. - * - * @param type - * The Atom type attribute. - * @return The media type. - */ - private MediaType getMediaType(String type) { - MediaType result = null; - - if (type == null) { - // No type defined - } else if (type.equals("text")) { - result = MediaType.TEXT_PLAIN; - } else if (type.equals("html")) { - result = MediaType.TEXT_HTML; - } else if (type.equals("xhtml")) { - result = MediaType.APPLICATION_XHTML; - } else { - result = new MediaType(type); - } - - return result; - } - - /** - * Returns the state at the top of the heap. - * - * @return The state at the top of the heap. - */ - private State getState() { - State result = null; - if (this.states != null) { - int size = this.states.size(); - if (size > 0) { - result = this.states.get(size - 1); - } - } - return result; - } - - /** - * Returns the state at the top of the heap and removes it from the heap. - * - * @return The state at the top of the heap. - */ - private State popState() { - State result = null; - int size = this.states.size(); - if (size > 0) { - result = this.states.remove(size - 1); - } - - return result; - } - - /** - * Adds a new state at the top of the heap. - * - * @param state - * The state to add. - */ - private void pushState(State state) { - this.states.add(state); - } - - @Override - public void startContent(Content content) { - if (State.ENTRY == getState()) { - pushState(State.CONTENT); - inlineContent = content; - if (entityType != null && entityType.isBlob() - && entityType.getBlobValueRefProperty() != null) { - Reference ref = content.getExternalRef(); - if (ref != null) { - try { - ReflectUtils.invokeSetter(entity, entityType - .getBlobValueRefProperty().getName(), ref); - } catch (Exception e) { - getLogger().warning( - "Cannot set " - + entityType.getBlobValueRefProperty() - .getName() + " property on " - + entity + " with value " + ref); - } - } - } - - } - - else if (State.ASSOCIATION == getState()) { - if (association.isToMany()) - inlineFeedHandler.startContent(content); - else - inlineEntryHandler.startContent(content); - } - } - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attrs) throws SAXException { - if (State.ASSOCIATION == getState()) { - // Delegates to the inline content handler - if (uri.equalsIgnoreCase(Feed.ATOM_NAMESPACE)) { - if (localName.equals("feed")) { - Feed feed = new Feed(); - String attr = attrs.getValue("xml:base"); - if (attr != null) { - feed.setBaseReference(new Reference(attr)); - } - - if (association.isToMany()) - this.inlineFeedHandler.startFeed(feed); - else - this.inlineEntryHandler.startFeed(feed); - } else if (localName.equals("link")) { - Link link = new Link(); - link.setHref(new Reference(attrs.getValue("", "href"))); - link.setRel(Relation.valueOf(attrs.getValue("", "rel"))); - String type = attrs.getValue("", "type"); - if (type != null && type.length() > 0) { - link.setType(new MediaType(type)); - } - - link.setHrefLang(new Language(attrs - .getValue("", "hreflang"))); - link.setTitle(attrs.getValue("", "title")); - String attr = attrs.getValue("", "length"); - link.setLength((attr == null) ? -1L : Long.parseLong(attr)); - - if (association.isToMany()) { - inlineFeedHandler.startLink(link); - } else { - inlineEntryHandler.startLink(link); - } - } else if (localName.equalsIgnoreCase("entry")) { - Entry entry = new Entry(); - if (association.isToMany()) { - inlineFeedHandler.startEntry(entry); - } else { - inlineEntryHandler.startEntry(entry); - } - inlineEntry = entry; - } else if (localName.equalsIgnoreCase("content")) { - Content content = new Content(); - MediaType type = getMediaType(attrs.getValue("", "type")); - String srcAttr = attrs.getValue("", "src"); - if (srcAttr != null) - // Content available externally - content.setExternalRef(new Reference(srcAttr)); - content.setExternalType(type); - if (association.isToMany()) { - inlineFeedHandler.startContent(content); - } else { - inlineEntryHandler.startContent(content); - } - } - } - - if (association.isToMany()) { - inlineFeedHandler.startElement(uri, localName, qName, attrs); - } else { - inlineEntryHandler.startElement(uri, localName, qName, attrs); - } - } else if (Service.WCF_DATASERVICES_METADATA_NAMESPACE.equals(uri) - && "properties".equals(localName)) { - pushState(State.PROPERTIES); - propertyPath = new ArrayList(); - } else if (State.PROPERTIES == getState()) { - pushState(State.PROPERTY); - - if (Boolean.parseBoolean(attrs.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, "null"))) { - parsePropertyNull = true; - } else { - sb = new StringBuilder(); - propertyPath.add(localName); - } - } else if (State.PROPERTY == getState()) { - sb = new StringBuilder(); - propertyPath.add(localName); - } else if (State.ENTRY == getState()) { - if (localName.equalsIgnoreCase("link") && association != null) { - pushState(State.ASSOCIATION); - } else { - // Could be mapped value - eltPath.add(localName); - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < eltPath.size(); i++) { - if (i > 0) { - sb.append("/"); - } - sb.append(eltPath.get(i)); - } - String str = sb.toString(); - - // Check if this path is mapped. - for (Mapping m : metadata.getMappings()) { - if (entityType != null - && entityType.equals(m.getType()) - && m.getNsUri() != null - && m.getNsUri().equals(uri) - && (str.equals(m.getValueNodePath()) || str - .equals("entry/" + m.getValueNodePath()))) { - if (m.isAttributeValue()) { - String value = attrs.getValue(m - .getValueAttributeName()); - if (value != null) { - try { - ReflectUtils.invokeSetter(entity, - m.getPropertyPath(), value); - } catch (Exception e) { - getLogger().warning( - "Cannot set " + m.getPropertyPath() - + " property on " + entity - + " with value " + value); - } - } - } else { - this.sb = new StringBuilder(); - mapping = m; - } - break; - } - } - } - } - } - - @SuppressWarnings("unchecked") - @Override - public void startEntry(Entry entry) { - - if (getState() != null) { - switch (getState()) { - case ASSOCIATION: - if (association.isToMany()) - inlineFeedHandler.startEntry(entry); - else - inlineEntryHandler.startEntry(entry); - break; - case CONTENT: - case ENTRY: - case PROPERTIES: - case PROPERTY: - default: - break; - } - } else { - this.states = new ArrayList(); - pushState(State.ENTRY); - eltPath = new ArrayList(); - // Instantiate the entity - try { - entity = (T) entityClass.newInstance(); - } catch (Exception e) { - getLogger().warning( - "Error when instantiating class " + entityClass); - } - - } - } - - public void startFeed(Feed feed) { - if (State.ASSOCIATION == getState()) { - if (association.isToMany()) - inlineFeedHandler.startFeed(feed); - else - inlineEntryHandler.startFeed(feed); - } - } - - @Override - public void startLink(Link link) { - if (State.ASSOCIATION == getState()) { - // Delegates to the inline content handler - if (association.isToMany()) { - inlineFeedHandler.startLink(link); - } else { - inlineEntryHandler.startLink(link); - } - } else { - if (link.getTitle() != null && entityType != null) { - String propertyName = ReflectUtils.normalize(link.getTitle()); - // Get the associated entity - association = metadata.getAssociation(entityType, propertyName); - if (association != null) { - inlineLink = link; - if (association.isToMany()) { - inlineFeedHandler = new FeedContentHandler( - ReflectUtils.getSimpleClass(entity, - propertyName), metadata, getLogger()); - } else { - inlineEntryHandler = new EntryContentHandler( - ReflectUtils.getSimpleClass(entity, - propertyName), metadata, getLogger()); - } - } - } - } - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/EntryIterator.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/EntryIterator.java deleted file mode 100644 index 43bb6ac000..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/EntryIterator.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal; - -import java.util.Iterator; - -import org.restlet.data.Reference; -import org.restlet.ext.odata.Query; -import org.restlet.ext.odata.Service; - -/** - * Iterator that transparently supports sever-side paging. - * - * @author Thierry Boileau - * - * @param - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class EntryIterator implements Iterator { - - /** The class of the listed objects. */ - private Class entityClass; - - /** The inner iterator. */ - private Iterator iterator; - - /** The reference to the next page. */ - private Reference nextPage; - - /** The underlying service. */ - private Service service; - - /** - * Constructor. - * - * @param service - * The underlying service. - * @param iterator - * The inner iterator. - * @param nextPage - * The reference to the next page. - * @param entityClass - * The class of the listed objects. - */ - public EntryIterator(Service service, Iterator iterator, - Reference nextPage, Class entityClass) { - super(); - this.iterator = iterator; - this.nextPage = nextPage; - this.service = service; - this.entityClass = entityClass; - } - - @SuppressWarnings("unchecked") - public boolean hasNext() { - boolean result = false; - - if (iterator != null) { - result = iterator.hasNext(); - } - - if (!result && nextPage != null) { - // Get the next page. - Query query = service.createQuery(nextPage.toString(), - (Class) entityClass); - iterator = query.iterator(); - - if (iterator != null) { - result = iterator.hasNext(); - } - - // Set the reference to the next page - nextPage = null; - } - - return result; - } - - public E next() { - E result = null; - if (iterator != null) { - if (iterator.hasNext()) { - result = iterator.next(); - } - } - return result; - } - - public void remove() { - if (iterator != null) { - iterator.remove(); - } - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/FeedContentHandler.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/FeedContentHandler.java deleted file mode 100644 index df2f3c4d54..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/FeedContentHandler.java +++ /dev/null @@ -1,305 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal; - -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Logger; - -import org.restlet.Context; -import org.restlet.ext.atom.Content; -import org.restlet.ext.atom.Entry; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.atom.FeedReader; -import org.restlet.ext.atom.Link; -import org.restlet.ext.odata.Service; -import org.restlet.ext.odata.internal.edm.EntityType; -import org.restlet.ext.odata.internal.edm.Metadata; -import org.restlet.ext.odata.internal.reflect.ReflectUtils; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Generic Content handler for Atom Feed that takes care of OData specific - * needs, such as parsing XML content from other namespaces than Atom. It - * generates entities based on the values discovered in the feed. - * - * @author Thierry Boileau - * @param - * The type of the parsed entities. - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class FeedContentHandler extends FeedReader { - - /** The value retrieved from the "count" tag. */ - private int count = -1; - - /** The list of entities to complete. */ - List entities; - - /** The class of the entity targeted by this feed. */ - private Class entityClass; - - /** The OData type of the parsed entities. */ - private EntityType entityType; - - /** Used to parsed Atom entry elements. */ - EntryContentHandler entryHandler; - - /** This is true if we are inside our own 'feed' element. */ - private boolean isInFeed; - - /** Internal logger. */ - private Logger logger; - - /** The metadata of the OData service. */ - private Metadata metadata; - - /** Are we parsing the count tag? */ - private boolean parseCount; - - /** Are we parsing an entry? */ - private boolean parseEntry; - - /** Used to glean text content. */ - StringBuilder sb = null; - - /** - * Constructor. - * - * @param entityClass - * The class of the parsed entities. - * @param entityType - * The entity type of the parsed entities. - * @param metadata - * The metadata of the remote OData service. - * @param logger - * The logger. - */ - public FeedContentHandler(Class entityClass, EntityType entityType, - Metadata metadata, Logger logger) { - this.entityClass = entityClass; - this.entities = new ArrayList(); - this.entityType = entityType; - this.entryHandler = new EntryContentHandler(entityClass, entityType, - metadata, logger); - this.logger = logger; - this.metadata = metadata; - } - - /** - * Constructor. - * - * @param entityClass - * The class of the parsed entities. - * @param metadata - * The metadata of the remote OData service. - * @param logger - * The logger. - */ - public FeedContentHandler(Class entityClass, Metadata metadata, - Logger logger) { - super(); - this.entityClass = entityClass; - this.entities = new ArrayList(); - this.entryHandler = new EntryContentHandler(entityClass, metadata, - logger); - this.logger = logger; - this.metadata = metadata; - } - - @Override - public void characters(char[] ch, int start, int length) - throws SAXException { - if (parseCount) { - sb.append(ch, start, length); - } else if (parseEntry) { - // Delegate to the Entry reader - entryHandler.characters(ch, start, length); - } - } - - /** - * Handle the end of a "link" element. Doesn't close link that belongs to - * inner associations! - * - * @return Returns true if the caller should not pop state. - * @author Emmanuel Liossis - */ - public boolean closeLink() { - if (parseEntry) { - // Cascade to any expanded associations. If someone from inner - // expanded associations has matched the close of the "link" and has - // popped state, inhibit my callers from popping state. - return entryHandler.closeLink(); - } - - // If we have passed 'feed' tag but haven't met any 'entry' tag, inhibit - // callers from popping state when link closes, because in this case the - // link pertains to the feed. - return isInFeed; - } - - @Override - public void endContent(Content content) { - if (parseEntry) { - // Delegate to the Entry reader - entryHandler.endContent(content); - } - } - - @Override - public void endElement(String uri, String localName, String qName) - throws SAXException { - if (parseCount) { - this.count = Integer.parseInt(sb.toString()); - parseCount = false; - } - // Allow also the "entry" end handling to cascade. - else if (parseEntry - || (entryHandler != null && localName.equals("entry"))) { - // Delegate to the Entry reader - entryHandler.endElement(uri, localName, qName); - } - - if (!parseEntry && uri.equals("http://www.w3.org/2005/Atom") - && localName.equals("feed")) { - // Mark the end of 'feed' element pertaining to this handler. - isInFeed = false; - } - - } - - @Override - public void endEntry(Entry entry) { - // Only add the entity to the feed if it is our entry closing, - // not an inner entry of an expanded association. - if (entryHandler.closeEntry(entry)) { - parseEntry = false; - - T entity = entryHandler.getEntity(); - - if (entity != null) { - entities.add(entity); - } else { - getLogger().warning("Can't add a null entity."); - } - } - } - - @Override - public void endLink(Link link) { - if (parseEntry) { - // Delegate to the Entry reader - entryHandler.endLink(link); - } - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - if (parseEntry) { - // Delegate to the Entry reader - entryHandler.endPrefixMapping(prefix); - } - } - - /** - * Returns the value of the "count" tag, that is to say the size of the - * current entity set. - * - * @return The size of the current entity set, as specified by the Atom - * document. - */ - public int getCount() { - return count; - } - - /** - * Returns the list of discovered entities. - * - * @return The list of discovered entities. - */ - public List getEntities() { - return entities; - } - - /** - * Returns the current logger. - * - * @return The current logger. - */ - private Logger getLogger() { - if (logger == null) { - logger = Context.getCurrentLogger(); - } - return logger; - } - - @Override - public void startContent(Content content) { - if (parseEntry) { - // Delegate to the Entry reader - entryHandler.startContent(content); - } - } - - @Override - public void startElement(String uri, String localName, String qName, - Attributes attrs) throws SAXException { - if (!parseEntry - && Service.WCF_DATASERVICES_METADATA_NAMESPACE.equals(uri) - && "count".equals(localName)) { - sb = new StringBuilder(); - parseCount = true; - } else if (parseEntry) { - // Delegate to the Entry reader - entryHandler.startElement(uri, localName, qName, attrs); - } else if (uri.equals("http://www.w3.org/2005/Atom") - && localName.equals("feed")) { - // Mark the start of the 'feed' element pertaining to this handler. - isInFeed = true; - } - } - - @Override - public void startEntry(Entry entry) { - parseEntry = true; - // Delegate to the Entry reader - entryHandler.startEntry(entry); - } - - @Override - public void startFeed(Feed feed) { - if (this.entityClass == null) { - this.entityClass = ReflectUtils.getEntryClass(feed); - } - if (this.entityType == null && metadata != null) { - entityType = metadata.getEntityType(entityClass); - } - } - - @Override - public void startLink(Link link) { - if (parseEntry) { - // Delegate to the Entry reader - entryHandler.startLink(link); - } - } - - @Override - public void startPrefixMapping(String prefix, String uri) - throws SAXException { - if (parseEntry) { - // Delegate to the Entry reader - entryHandler.startPrefixMapping(prefix, uri); - } - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Association.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Association.java deleted file mode 100644 index 5b62a67268..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Association.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.List; - -/** - * Defines an association inside a schema. - * - * @author Thierry Boileau - * @see Association - * Element (CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Association extends NamedObject { - /** The list of entities linked by this association. */ - private List ends; - - /** The schema. */ - private Schema schema; - - /** - * Constructor. - * - * @param name - * The name of the schema. - */ - public Association(String name) { - super(name); - } - - /** - * Returns the list of entities linked by this association. - * - * @return The list of entities linked by this association. - */ - public List getEnds() { - if (ends == null) { - ends = new ArrayList(); - } - return ends; - } - - /** - * Returns the schema. - * - * @return The schema. - */ - public Schema getSchema() { - return schema; - } - - /** - * Sets the list of entities linked by this association. - * - * @param ends - * The list of entities linked by this association. - */ - public void setEnds(List ends) { - this.ends = ends; - } - - /** - * Sets the schema. - * - * @param schema - * The schema. - */ - public void setSchema(Schema schema) { - this.schema = schema; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationEnd.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationEnd.java deleted file mode 100644 index eba7a8b77a..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationEnd.java +++ /dev/null @@ -1,101 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -/** - * Represents one entity implied in an association. - * - * @author Thierry Boileau - * @see Association - * Element (SSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class AssociationEnd { - - /** The cardinality of the relation. */ - private String multiplicity; - - /** The role of this entity relatively to this association. */ - private final String role; - - /** The type of this entity. */ - private EntityType type; - - /** - * Constructor. - * - * @param role - * The name of the role. - */ - public AssociationEnd(String role) { - super(); - this.role = role; - } - - /** - * Returns the cardinality of the relation. - * - * @return The cardinality of the relation. - */ - public String getMultiplicity() { - return multiplicity; - } - - /** - * Returns the role of this entity relatively to this association. - * - * @return The role of this entity relatively to this association. - */ - public String getRole() { - return role; - } - - /** - * Returns the type of this entity. - * - * @return The type of this entity. - */ - public EntityType getType() { - return type; - } - - /** - * Returns true if the cardinality says that this is a one to many or many - * to many relation. - * - * @return - */ - public boolean isToMany() { - return "*".equals(getMultiplicity()); - } - - /** - * Sets the cardinality of the relation. - * - * @param multiplicity - * The cardinality of the relation. - */ - public void setMultiplicity(String multiplicity) { - this.multiplicity = multiplicity; - } - - /** - * Sets the type of this entity. - * - * @param type - * The type of this entity. - */ - public void setType(EntityType type) { - this.type = type; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationSet.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationSet.java deleted file mode 100644 index 2baff90af5..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationSet.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.List; - -/** - * Represents an association inside an EntityContainer. - * - * @author Thierry Boileau - * @see AssociationSet - * Element (EntityContainer CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class AssociationSet extends NamedObject { - - /** The referenced schema's association. */ - private Association association; - - /** The list of entities implied in this association. */ - private List ends; - - /** - * Constructor. - * - * @param name - * The name of the association set. - */ - public AssociationSet(String name) { - super(name); - } - - /** - * Returns the referenced schema's association. - * - * @return The referenced schema's association. - */ - public Association getAssociation() { - return association; - } - - /** - * Returns the list of entities implied in this association. - * - * @return The list of entities implied in this association. - */ - public List getEnds() { - if (ends == null) { - ends = new ArrayList(); - } - return ends; - } - - /** - * Sets the referenced schema's association. - * - * @param association - * The referenced schema's association. - */ - public void setAssociation(Association association) { - this.association = association; - } - - /** - * Sets the list of entities implied in this association. - * - * @param ends - * The list of entities implied in this association. - */ - public void setEnds(List ends) { - this.ends = ends; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationSetEnd.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationSetEnd.java deleted file mode 100644 index 74e2eb7144..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/AssociationSetEnd.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -/** - * Represents one entity implied in an AssociationSet. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class AssociationSetEnd { - - /** The role of this entity relatively to this association. */ - private final String role; - - /** The type of this entity. */ - private EntitySet type; - - /** - * Constructor. - * - * @param role - * The name of the role. - */ - public AssociationSetEnd(String role) { - super(); - this.role = role; - } - - /** - * Returns the role of this entity relatively to this association. - * - * @return The role of this entity relatively to this association. - */ - public String getRole() { - return role; - } - - /** - * Returns the type of this entity. - * - * @return The type of this entity. - */ - public EntitySet getType() { - return type; - } - - /** - * Sets the type of this entity. - * - * @param type - * The type of this entity. - */ - public void setType(EntitySet type) { - this.type = type; - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ComplexProperty.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ComplexProperty.java deleted file mode 100644 index 1136856b66..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ComplexProperty.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -/** - * Represents a complex property of an EntityType. - * - * @author Thierry Boileau - * @see Property - * Element (EntityType CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ComplexProperty extends Property { - - /** The type of the property. */ - private ComplexType type; - - /** - * Constructor. - * - * @param name - * The name of this property. - */ - public ComplexProperty(String name) { - super(name); - } - - /** - * Returns the type of the property. - * - * @return The type of the property. - */ - public ComplexType getComplexType() { - return type; - } - - /** - * Sets the type of the property. - * - * @param type - * The type of the property. - */ - public void setComplexType(ComplexType type) { - this.type = type; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ComplexType.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ComplexType.java deleted file mode 100644 index 4ea02e3de9..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ComplexType.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.List; - -/** - * Represents a kind of entity type, without "key", i.e. identifier. - * - * @author Thierry Boileau - * @see Complex - * Type (EDM) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ComplexType extends ODataType { - - /** The list of complex types this type inherits from. */ - private List complexTypes; - - /** - * Constructor. - * - * @param name - * The name of this type. - */ - public ComplexType(String name) { - super(name); - } - - /** - * Returns the parent type this type inherits from. - * - * @return The parent type this type inherits from. - */ - @Override - public ComplexType getBaseType() { - return (ComplexType) super.getBaseType(); - } - - /** - * Returns the list of complex types this type inherits from. - * - * @return The list of complex types this type inherits from. - */ - public List getComplexTypes() { - if (complexTypes == null) { - complexTypes = new ArrayList(); - } - return complexTypes; - } - - /** - * Sets the list of complex types this type inherits from. - * - * @param complexTypes - * The list of complex types this type inherits from. - */ - public void setComplexTypes(List complexTypes) { - this.complexTypes = complexTypes; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntityContainer.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntityContainer.java deleted file mode 100644 index 920a71bbd5..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntityContainer.java +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.List; - -/** - * Represents a set of entities and associations defined on a schema. - * - * @author Thierry Boileau - * @see Entity - * Containers (EDM) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class EntityContainer extends NamedObject { - /** The list of associations. */ - private List associations; - - /** Is this container the default one for a WCF Data Service? */ - private boolean defaultEntityContainer; - - /** The list of entities. */ - private List entities; - - /** The container this container inherits from. */ - private EntityContainer extended; - - /** The list of function imports. */ - private List functionImports; - - /** The schema. */ - private Schema schema; - - /** - * Constructor. - * - * @param name - * The name of this entity container. - */ - public EntityContainer(String name) { - super(name); - } - - /** - * Returns the list of associations. - * - * @return The list of associations. - */ - public List getAssociations() { - if (associations == null) { - associations = new ArrayList(); - } - return associations; - } - - /** - * Returns the list of entities. - * - * @return The list of entities. - */ - public List getEntities() { - if (entities == null) { - entities = new ArrayList(); - } - return entities; - } - - /** - * Returns the container this container inherits from. - * - * @return The container this container inherits from. - */ - public EntityContainer getExtended() { - return extended; - } - - /** - * Returns the list of function imports. - * - * @return The list of function imports. - */ - public List getFunctionImports() { - if (functionImports == null) { - functionImports = new ArrayList(); - } - return functionImports; - } - - /** - * Returns the schema. - * - * @return The schema. - */ - public Schema getSchema() { - return schema; - } - - /** - * Return true if this container is the default one for a WCF data service. - * - * @return True if this container is the default one for a WCF data service. - */ - public boolean isDefaultEntityContainer() { - return defaultEntityContainer; - } - - /** - * Sets the list of associations. - * - * @param associations - * The list of associations. - */ - public void setAssociations(List associations) { - this.associations = associations; - } - - /** - * Indicates if this container is the default one for a WCF data service. - * - * @param defaultEntityContainer - * True if this container is the default one for a WCF data - * service. - */ - public void setDefaultEntityContainer(boolean defaultEntityContainer) { - this.defaultEntityContainer = defaultEntityContainer; - } - - /** - * Sets the list of entities. - * - * @param entities - * The list of entities. - */ - public void setEntities(List entities) { - this.entities = entities; - } - - /** - * Sets the container this container inherits from. - * - * @param extended - * The container this container inherits from. - */ - public void setExtended(EntityContainer extended) { - this.extended = extended; - } - - /** - * Sets the list of function imports. - * - * @param functionImports - * The list of function imports. - */ - public void setFunctionImports(List functionImports) { - this.functionImports = functionImports; - } - - /** - * Sets the schema. - * - * @param schema - * The schema. - */ - public void setSchema(Schema schema) { - this.schema = schema; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntitySet.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntitySet.java deleted file mode 100644 index c9629843f0..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntitySet.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -/** - * Represents a set of entities, inside a EntityContainer. The type of these - * entities is defined inside the current schema. - * - * @author Thierry Boileau - * @see EntitySet - * Element (EntityContainer CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class EntitySet extends NamedObject { - - /** The type of contained entities. */ - private EntityType type; - - /** - * Constructor. - * - * @param name - * The name of the entity. - */ - public EntitySet(String name) { - super(name); - } - - /** - * Returns the type of contained entities. - * - * @return The type of contained entities. - */ - public EntityType getType() { - return type; - } - - /** - * Sets the type of contained entities. - * - * @param type - * The type of contained entities. - */ - public void setType(EntityType type) { - this.type = type; - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntityType.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntityType.java deleted file mode 100644 index 9f4d8123fc..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/EntityType.java +++ /dev/null @@ -1,206 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -/** - * Defines a class or type of entity inside a schema. Note that composite keys - * are not supported. - * - * @author Thierry Boileau - * @see EntityType - * Element (CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class EntityType extends ODataType { - - /** The list of associations. */ - private List associations; - - /** Is this type a blob? */ - private boolean blob; - - /** - * The entity's member that stores the resource reference able to update the - * blob value. - */ - private Property blobValueEditRefProperty; - - /** The property of the entity that stores the blob reference. */ - private Property blobValueRefProperty; - - /** The list of properties that identifies an instance of this type. */ - private List keys; - - /** - * Constructor. - * - * @param name - * The name of this entity type. - */ - public EntityType(String name) { - super(name); - } - - /** - * Returns the list of associations. - * - * @return The list of associations. - */ - public List getAssociations() { - if (associations == null) { - associations = new ArrayList(); - } - return associations; - } - - /** - * Returns the parent type this type inherits from. - * - * @return The parent type this type inherits from. - */ - @Override - public EntityType getBaseType() { - return (EntityType) super.getBaseType(); - } - - /** - * Returns the entity's member that stores the resource reference able to - * update the blob value. - * - * @return The entity's member that stores the resource reference able to - * update the blob value. - */ - public Property getBlobValueEditRefProperty() { - return blobValueEditRefProperty; - } - - /** - * Returns the name of the entity property that stores the blob reference. - * - * @return The name of the entity property that stores the blob reference. - */ - public Property getBlobValueRefProperty() { - return blobValueRefProperty; - } - - /** - * Returns the set of imported Java classes. - * - * @return The set of imported Java classes. - */ - public Set getImportedJavaClasses() { - Set result = super.getImportedJavaClasses(); - - for (NavigationProperty property : getAssociations()) { - if (property.getToRole().isToMany()) { - result.add("java.util.List"); - break; - } - } - - return result; - } - - /** - * Returns the set of imported entity types. - * - * @return The set of imported entity types. - */ - @Override - public Set getImportedTypes() { - Set result = super.getImportedTypes(); - - for (NavigationProperty property : getAssociations()) { - result.add(property.getToRole().getType()); - } - return result; - } - - /** - * Returns the "keys" property. - * - * @return The "keys" property. - */ - public List getKeys() { - return keys; - } - - /** - * Returns true if this type is a blob, that is to say it represents binary - * data. - * - * @return True, if this type is a blob, that is to say, it represents binary - * data. - */ - public boolean isBlob() { - return blob; - } - - /** - * Sets the list of associations. - * - * @param associations - * The list of associations. - */ - public void setAssociations(List associations) { - this.associations = associations; - } - - /** - * Indicates if this type is a blob, that is to say it represents binary data. - * - * @param blob - * True, if this type is a blob, that is to say, it represents binary - * data. - */ - public void setBlob(boolean blob) { - this.blob = blob; - } - - /** - * Sets the entity's member that stores the resource reference able to - * update the blob value. - * - * @param blobValueEditRefProperty - * The entity's member that stores the resource reference able to - * update the blob value. - */ - public void setBlobValueEditRefProperty(Property blobValueEditRefProperty) { - this.blobValueEditRefProperty = blobValueEditRefProperty; - } - - /** - * Sets the name of the entity property that stores the blob reference. - * - * @param blobValueRefProperty - * The name of the entity property that stores the blob - * reference. - */ - public void setBlobValueRefProperty(Property blobValueRefProperty) { - this.blobValueRefProperty = blobValueRefProperty; - } - - /** - * Sets the "keys" property. - * - * @param keys - * The "keys" property. - */ - public void setKeys(List keys) { - this.keys = keys; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/FunctionImport.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/FunctionImport.java deleted file mode 100644 index a28155ce02..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/FunctionImport.java +++ /dev/null @@ -1,279 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.List; - -import org.restlet.data.Method; - -/** - * Represents an exposed stored procedure. - * - * @author Thierry Boileau - * @see FunctionImport - * Element (CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class FunctionImport extends NamedObject { - - /** The entity set returned by this function, if applicable. */ - private EntitySet entitySet; - - /** The metadata. */ - private Metadata metadata; - - /** The method used to invoke this function. */ - private Method method; - - /** - * The method access of this function (defined in the CSDL, but not - * described). - */ - private String methodAccess; - - /** The list of parameters. */ - private List parameters; - - /** The return type of this function. */ - private String returnType; - - /** - * Constructor. - * - * @param name - * The name of the schema. - */ - public FunctionImport(String name) { - super(name); - } - - /** - * Returns the entity set returned by this function, if applicable. - * - * @return The entity set returned by this function, if applicable. - */ - public EntitySet getEntitySet() { - return entitySet; - } - - /** - * Returns the metadata. - * - * @return The metadata. - */ - public Metadata getMetadata() { - return metadata; - } - - /** - * Returns the method used to invoke this function. - * - * @return The method used to invoke this function. - */ - public Method getMethod() { - return method; - } - - /** - * Returns the method access of this function (defined in the CSDL, but not - * described). - * - * @return The method access of this function (defined in the CSDL, but not - * described). - */ - public String getMethodAccess() { - return methodAccess; - } - - /** - * Returns the list of parameters. - * - * @return The list of parameters. - */ - public List getParameters() { - if (parameters == null) { - parameters = new ArrayList(); - } - return parameters; - } - - /** - * Returns the return type of this function. - * - * @return The return type of this function. - */ - public String getReturnType() { - return returnType; - } - - /** - * Returns the return type as complex type, or null if it is not. - * - * @return The return type as complex type, or null if it is not. - */ - public ComplexType getReturnTypeAsComplexType() { - ComplexType result = null; - String rt = getSimpleReturnType(); - if (getReturnType() != null && metadata != null) { - for (Schema schema : metadata.getSchemas()) { - for (ComplexType complexType : schema.getComplexTypes()) { - if (rt.equalsIgnoreCase(complexType.getName())) { - result = complexType; - } - } - } - } - return result; - } - - /** - * Returns the return type as complex type, or null if it is not. - * - * @return The return type as complex type, or null if it is not. - */ - public EntityType getReturnTypeAsEntityType() { - EntityType result = null; - String rt = getSimpleReturnType(); - if (getReturnType() != null && metadata != null) { - for (Schema schema : metadata.getSchemas()) { - for (EntityType entityType : schema.getEntityTypes()) { - if (rt.equalsIgnoreCase(entityType.getName())) { - result = entityType; - } - } - } - } - return result; - } - - /** - * Returns the name of the return type, or if it's a collection, returns its - * element's type. - * - * @return The name of the return type, or if it's a collection, returns its - * element's type. - */ - public String getSimpleReturnType() { - return returnType; - } - - /** - * Returns true if the result of the invocation of the service is a - * collection. - * - * @return True if the result of the invocation of the service is a - * collection. - */ - public boolean isReturningCollection() { - return getReturnType() != null - && getReturnType().toLowerCase().startsWith("collection("); - } - - /** - * Returns true if the result of the invocation of the service is a complex - * type. - * - * @return True if the result of the invocation of the service is a complex - * type. - */ - public boolean isReturningComplexType() { - return getReturnTypeAsComplexType() != null; - } - - /** - * Returns true if the result of the invocation of the service is an EDM - * simple type. - * - * @return True if the result of the invocation of the service is an EDM - * simple type. - */ - public boolean isReturningEdmSimpleType() { - return getReturnType() != null - && getReturnType().toLowerCase().startsWith("edm."); - } - - /** - * Returns true if the result of the invocation of the service is an entity - * type. - * - * @return True if the result of the invocation of the service is an entity - * type. - */ - public boolean isReturningEntityType() { - return getReturnType() != null - && getReturnType().toLowerCase().startsWith("edm."); - } - - /** - * Sets the entity set returned by this function, if applicable. - * - * @param entitySet - * The entity set returned by this function, if applicable. - */ - public void setEntitySet(EntitySet entitySet) { - this.entitySet = entitySet; - } - - /** - * Sets the metadata. - * - * @param metadata - * The metadata. - */ - public void setMetadata(Metadata metadata) { - this.metadata = metadata; - } - - /** - * Sets the method used to invoke this function. - * - * @param method - * The method used to invoke this function. - */ - public void setMethod(Method method) { - this.method = method; - } - - /** - * Sets the method access of this function (defined in the CSDL, but not - * described). - * - * @param methodAccess - * The method access of this function (defined in the CSDL, but - * not described). - */ - public void setMethodAccess(String methodAccess) { - this.methodAccess = methodAccess; - } - - /** - * Sets the list of parameters. - * - * @param parameters - * The list of parameters. - */ - public void setParameters(List parameters) { - this.parameters = parameters; - } - - /** - * Sets the return type of this function. - * - * @param returnType - * The return type of this function. - */ - public void setReturnType(String returnType) { - this.returnType = returnType; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Mapping.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Mapping.java deleted file mode 100644 index 3f53a74142..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Mapping.java +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -/** - * Defines a property mapping used in customized feeds. It maps an XML element - * of the feed to parse and a property of entity. - * - * @author Thierry Boileau - * @see Atom - * Feed Customization (ADO.NET Data Services) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Mapping { - - /** Is the value taken from an attribute or not. */ - private boolean attributeValue; - - /** The content type of the value of the mapped property. */ - private String contentKind; - - /** The namespace prefix of the feed's XML element that stores the value. */ - private String nsPrefix; - - /** The namespace URI of the feed's XML element that stores the value. */ - private String nsUri; - - /** The path of the property to update. */ - private String propertyPath; - - /** The type of the entity to update. */ - private EntityType type; - - /** The path of the XML element of the feed that stores the value to set. */ - private String valuePath; - - /** - * Constructor. - * - * @param type - * The type of the entity to update. - * @param nsPrefix - * The namespace prefix of the feed's XML element that stores the - * value. - * @param nsUri - * The namespace URI of the feed's XML element that stores the - * value. - * @param propertyPath - * The type of the entity to update. - * @param valuePath - * The path of the XML element of the feed that stores the value - * to set. - * @param contentKind - * The content type of the value of the mapped property. - */ - public Mapping(EntityType type, String nsPrefix, String nsUri, - String propertyPath, String valuePath, String contentKind) { - super(); - this.type = type; - this.nsPrefix = nsPrefix; - this.nsUri = nsUri; - this.propertyPath = propertyPath; - this.valuePath = valuePath; - this.contentKind = contentKind; - - this.attributeValue = false; - if (this.valuePath != null) { - int index = valuePath.lastIndexOf("/"); - if (index != -1 && valuePath.length() > index) { - attributeValue = ('@' == valuePath.charAt(index + 1)); - } - } - } - - /** - * Returns the content type of the value of the mapped property. - * - * @return The content type of the value of the mapped property. - */ - public String getContentKind() { - return contentKind; - } - - /** - * Returns the namespace prefix of the feed's XML element that stores the - * value. - * - * @return The namespace prefix of the feed's XML element that stores the - * value. - */ - public String getNsPrefix() { - return nsPrefix; - } - - /** - * Returns the namespace URI of the feed's XML element that stores the - * value. - * - * @return The namespace URI of the feed's XML element that stores the - * value. - */ - public String getNsUri() { - return nsUri; - } - - /** - * Returns the path of the property to update. - * - * @return The path of the property to update. - */ - public String getPropertyPath() { - return propertyPath; - } - - /** - * Returns the type of the entity to update. - * - * @return The type of the entity to update. - */ - public EntityType getType() { - return type; - } - - /** - * Returns the name of the attribute that stores the value to set, if - * pertinent, and null otherwise. - * - * @return The name of the attribute that stores the value to set. - */ - public String getValueAttributeName() { - String result = null; - if (isAttributeValue()) { - int index = valuePath.lastIndexOf("/"); - result = valuePath.substring(index + 2); - } - return result; - } - - /** - * Returns the name of the attribute that stores the value to set, if - * pertinent, and null otherwise. - * - * @return The name of the attribute that stores the value to set. - */ - public String getValueNodePath() { - return (isAttributeValue()) ? valuePath.substring(0, - valuePath.lastIndexOf("/")) : valuePath; - } - - /** - * Returns the path of the XML element of the feed that stores the value to - * set. - * - * @return The path of the XML element of the feed that stores the value to - * set. - */ - public String getValuePath() { - return valuePath; - } - - /** - * Returns true if the value is taken from an attribute. - * - * @return True if the value is taken from an attribute. - */ - public boolean isAttributeValue() { - return attributeValue; - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Metadata.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Metadata.java deleted file mode 100644 index 7193f52881..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Metadata.java +++ /dev/null @@ -1,437 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.io.IOException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.restlet.data.Reference; -import org.restlet.ext.xml.SaxRepresentation; -import org.restlet.representation.Representation; - -/** - * Represents the metadata of an OData service. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Metadata extends SaxRepresentation { - - /** The list of entity containers. */ - private List containers; - - /** The list of declared property mappings. */ - private List mappings; - - /** The URI of the metadata resource. */ - private Reference metadataRef; - - /** The data services schemas. */ - private List schemas; - - /** - * Constructor. - * - * @param metadata - * The representation of the metadata. - * @param metadataRef - * Its optional URI. - * @throws IOException - */ - public Metadata(Representation metadata, Reference metadataRef) - throws IOException { - super(metadata); - setNamespaceAware(true); - this.metadataRef = metadataRef; - parse(new MetadataReader(this)); - } - - /** - * Returns the Association object that corresponds to the given property of - * the given entity type. - * - * @param type - * The entity type. - * @param propertyName - * The property name. - * @return the Association object that corresponds to the given property of - * the given entity type. - */ - public AssociationEnd getAssociation(EntityType type, String propertyName) { - AssociationEnd result = null; - - for (NavigationProperty association : type.getAssociations()) { - if (association.getNormalizedName().equals(propertyName)) { - result = association.getToRole(); - break; - } - } - - return result; - } - - /** - * Returns the complectType that corresponds to a given entity class. - * - * @param entityClass - * The entity class. - * @return The ComplexType that corresponds to a given entity class. - */ - public ComplexType getComplexType(Class entityClass) { - ComplexType result = null; - - // Try to match the entity class names (without the package); - String className = entityClass.getName(); - int index = className.lastIndexOf("."); - if (index != -1) { - className = className.substring(index + 1); - } - - for (Iterator iec = getSchemas().iterator(); result == null - && iec.hasNext();) { - Schema schema = iec.next(); - for (Iterator ies = schema.getComplexTypes() - .iterator(); result == null && ies.hasNext();) { - ComplexType type = ies.next(); - if (type.getClassName().equals(className)) { - result = type; - } - } - } - - return result; - } - - /** - * Returns the list of entity containers. - * - * @return The list of entity containers. - */ - public List getContainers() { - if (containers == null) { - containers = new ArrayList(); - } - return containers; - } - - /** - * Returns the sub-path of the entitySet of the given entity type. - * - * @param entityType - * The entity type. - * @return The sub-path of the entitySet of the given entity type. - */ - public String getEntitySetSubpath(EntityType entityType) { - String result = null; - - if (entityType == null) { - return result; - } - - // Try to match the entity class names (without the package); - for (EntityContainer entityContainer : getContainers()) { - for (EntitySet entitySet : entityContainer.getEntities()) { - EntityType type = entitySet.getType(); - if (type.equals(entityType)) { - result = "/" + entitySet.getName(); - } - } - } - - return result; - } - - /** - * Returns the entityType that corresponds to a given entity class. - * - * @param entityClass - * The entity class. - * @return The entityType that corresponds to a given entity class. - */ - public EntityType getEntityType(Class entityClass) { - EntityType result = null; - - // Try to match the entity class names (without the package); - String className = entityClass.getName(); - int index = className.lastIndexOf("."); - if (index != -1) { - className = className.substring(index + 1); - } - - for (Iterator iec = getContainers().iterator(); result == null - && iec.hasNext();) { - EntityContainer entityContainer = iec.next(); - for (Iterator ies = entityContainer.getEntities() - .iterator(); result == null && ies.hasNext();) { - EntitySet entitySet = ies.next(); - EntityType type = entitySet.getType(); - if (type.getClassName().equals(className)) { - result = type; - } - } - } - - return result; - } - - /** - * Returns the String representation of the value of the key of the given - * entity that should be used in all URIs. - * - * @param type - * The type descriptor of the object. - * @param entity - * The entity. - * @return The value of the key of the given entity or null in case of - * error. - */ - public String getKeyValue(EntityType type, Object entity) { - StringBuilder result = new StringBuilder(); - - if (type.getKeys() != null && !type.getKeys().isEmpty()) { - if (type.getKeys().size() == 1) { - Property key = type.getKeys().get(0); - String keyName = key.getNormalizedName(); - String getterName = "get" - + keyName.substring(0, 1).toUpperCase() - + keyName.substring(1); - try { - Method getter = entity.getClass().getDeclaredMethod( - getterName, (Class[]) null); - Object value = getter.invoke(entity, (Object[]) null); - String strValue = TypeUtils.toEdmKey(value, key.getType()); - if (strValue != null) { - result.append(strValue); - } else { - result.append("''"); - } - } catch (Exception e) { - // Nothing - } - } else { - Iterator it = type.getKeys().iterator(); - while (it.hasNext()) { - Property key = it.next(); - String keyName = key.getNormalizedName(); - result.append(key.getName()).append("="); - String getterName = "get" - + keyName.substring(0, 1).toUpperCase() - + keyName.substring(1); - try { - Method getter = entity.getClass().getDeclaredMethod( - getterName, (Class[]) null); - Object value = getter.invoke(entity, (Object[]) null); - String strValue = TypeUtils.toEdmKey(value, - key.getType()); - if (strValue != null) { - result.append(strValue); - } else { - result.append("''"); - } - } catch (Exception e) { - // Nothing - } - if (it.hasNext()) { - result.append(","); - } - } - } - } - - return result.toString(); - } - - /** - * Returns the value of the key of the given entity that should be used in - * all URIs. - * - * @param entity - * The entity. - * @return The value of the key of the given entity or null in case of - * error. - */ - public String getKeyValue(Object entity) { - String result = null; - if (entity != null) { - result = getKeyValue(getEntityType(entity.getClass()), entity); - } - - return result; - } - - /** - * Returns the list of declared property mappings. - * - * @return The list of declared property mappings. - */ - public List getMappings() { - if (mappings == null) { - mappings = new ArrayList(); - } - return mappings; - } - - /** - * Returns the URI of the metadata resource. - * - * @return The URI of the metadata resource. - */ - public Reference getMetadataRef() { - return metadataRef; - } - - /** - * Returns the EDM type of the given property of the given entity. - * - * @param entity - * The entity. - * @param propertyName - * The name of the property. - * @return The EDM type of the given property of the given entity. - */ - public Property getProperty(Object entity, String propertyName) { - Property result = null; - if (entity != null) { - EntityType et = getEntityType(entity.getClass()); - if (et != null) { - for (Property property : et.getProperties()) { - if (property.getName().equals(propertyName) - || property.getNormalizedName().equals(propertyName)) { - result = property; - break; - } - } - } else { - ComplexType ct = getComplexType(entity.getClass()); - if (ct != null) { - for (Property property : ct.getProperties()) { - if (property.getName().equals(propertyName) - || property.getNormalizedName().equals(propertyName)) { - result = property; - break; - } - } - } - } - - } - - return result; - } - - /** - * Returns the data service schema. - * - * @return The data service schema. - */ - public List getSchemas() { - if (schemas == null) { - schemas = new ArrayList(); - } - return schemas; - } - - /** - * According to the metadata of the service, returns the path of the given - * entity relatively to the current WCF service. - * - * @param entity - * The entity. - * @return The path of the given entity relatively to the current WCF - * service. - */ - public String getSubpath(Object entity) { - String result = null; - - if (entity == null) { - return result; - } - - // Try to match the entity class names (without the package); - String entityClass = entity.getClass().getName(); - int index = entityClass.lastIndexOf("."); - if (index != -1) { - entityClass = entityClass.substring(index + 1); - } - - for (EntityContainer entityContainer : getContainers()) { - for (EntitySet entitySet : entityContainer.getEntities()) { - EntityType type = entitySet.getType(); - - if (type.getClassName().equals(entityClass)) { - String value = getKeyValue(type, entity); - if (value != null) { - result = "/" + entitySet.getName() + "(" + value + ")"; - } - } - } - } - - return result; - } - - /** - * According to the metadata of the service, returns the path of the given - * entity's property relatively to the current WCF service. - * - * @param entity - * The entity. - * @param propertyName - * The name of the property. - * @return The path of the given entity's property relatively to the current - * WCF service. - */ - public String getSubpath(Object entity, String propertyName) { - return getSubpath(entity) + "/" + propertyName; - } - - /** - * According to the metadata of the service, returns the relative path of - * the given target entity linked to the source entity via the source - * property. - * - * @param source - * The source entity to update. - * @param sourceProperty - * The name of the property of the source entity. - * @param target - * The entity linked to the source entity. - * @return - */ - public String getSubpath(Object source, String sourceProperty, Object target) { - return getSubpath(source) + "/" + sourceProperty + "(" - + getKeyValue(target) + ")"; - } - - /** - * Sets the list of entity containers. - * - * @param containers - * The list of entity containers. - */ - public void setContainers(List containers) { - this.containers = containers; - } - - /** - * Sets the data service schemas - * - * @param schemas - * The data service schemas. - */ - public void setSchemas(List schemas) { - this.schemas = schemas; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/MetadataReader.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/MetadataReader.java deleted file mode 100644 index 55b73225b9..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/MetadataReader.java +++ /dev/null @@ -1,714 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.restlet.data.MediaType; -import org.restlet.data.Method; -import org.restlet.ext.odata.Service; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Used to parse a metadata descriptor of a given OData service and generate the - * associated object's tree. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class MetadataReader extends DefaultHandler { - - /** The list of defined states of this parser. */ - private enum State { - ASSOCIATION, ASSOCIATION_END, ASSOCIATION_SET, ASSOCIATION_SET_END, COMPLEX_TYPE, COMPLEX_TYPE_PROPERTY, DOCUMENTATION, ENTITY_CONTAINER, ENTITY_SET, ENTITY_TYPE, ENTITY_TYPE_KEY, ENTITY_TYPE_PROPERTY, FUNCTION, FUNCTION_IMPORT, NAVIGATION_PROPERTY, NONE, ON_DELETE, PARAMETER, REFERENTIAL_CONSTRAINT, SCHEMA, USING - } - - /** List of possible values for the blob reference member. */ - private final String[] blobEditRefValues = { "blobEditReference", - "blobEditReferenceValue" }; - - /** List of possible values for the blob reference member. */ - private final String[] blobRefValues = { "blobReference", - "blobReferenceValue" }; - - /** The current association. */ - private Association currentAssociation; - - /** The current association set. */ - private AssociationSet currentAssociationSet; - - /** The current complex type. */ - private ComplexType currentComplexType; - - /** The current entity container. */ - private EntityContainer currentEntityContainer; - - /** The current entity type. */ - private EntityType currentEntityType; - - /** The current functionn import. */ - private FunctionImport currentFunctionImport; - - /** The metadata objet to update. */ - private Metadata currentMetadata; - - /** The current schema. */ - private Schema currentSchema; - - /** The registered collection of associations. */ - private Map registeredAssociations; - - /** The registered collection of complex types. */ - private Map registeredComplexTypes; - - /** The registered collection of entity containers. */ - private Map registeredContainers; - - /** The registered collection of entity sets. */ - private Map registeredEntitySets; - - /** The registered collection of entity types. */ - private Map registeredEntityTypes; - - /** The registered collection of namespaces. */ - private List registeredNamespaces; - - /** The current heap of states. */ - private List states; - - /** - * Constructor. - * - * @param metadata - * The metadata object to update during the parsing. - */ - public MetadataReader(Metadata metadata) { - this.states = new ArrayList(); - pushState(State.NONE); - this.currentMetadata = metadata; - } - - /** - * Pick up the first method name among a given list of proposed names. - * Returns null if the proposed values are already in the given entity type. - * - * @param type - * The entity type to check. - * @param values - * The list of proposed values. - * @return A method name. - */ - private String chooseAttributeName(EntityType type, String[] values) { - String result = null; - int index = 0; - // Check that one of the possible names is not already set. - for (int i = 0; i < type.getProperties().size() - && (index < values.length); i++) { - Property property = type.getProperties().get(i); - if (values[index].equals(property.getName())) { - index++; - } - } - for (int i = 0; i < type.getAssociations().size() - && (index < values.length); i++) { - NavigationProperty property = type.getAssociations().get(i); - if (values[index].equals(property.getName())) { - index++; - } - } - - if (index != values.length) { - result = values[index]; - } - return result; - } - - /** - * Explores the given attributes in order to get a declared property - * mapping. - * - * @param type - * The type of the mapped property. - * @param property - * The property that declares the mapping (is null if the mapping - * is declared on the entity type tag). - * @param metadata - * The metadata instance to update. - * @param attributes - * The XML attributes to parse. - */ - private void discoverMapping(EntityType type, Property property, - Metadata metadata, Attributes attributes) { - String contentKind = null; - String nsPrefix = null; - String nsUri = null; - String propertyPath = null; - String valuePath = null; - boolean keepInContent = true; - - contentKind = attributes.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, "FC_ContentKind"); - if (contentKind == null) { - contentKind = "text"; - } - - nsPrefix = attributes.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, "FC_NsPrefix"); - nsUri = attributes.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, "FC_NsUri"); - - String str = attributes - .getValue(Service.WCF_DATASERVICES_METADATA_NAMESPACE, - "FC_KeepInContent"); - if (str != null) { - keepInContent = Boolean.parseBoolean(str); - } - - if (property == null) { - // mapping declared on the entity type, the "FC_SourcePath" - // attribute is mandatory. - propertyPath = attributes.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, - "FC_SourcePath"); - } else { - propertyPath = property.getName(); - } - - valuePath = attributes.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, "FC_TargetPath"); - - if (propertyPath != null && valuePath != null && !keepInContent) { - // The mapping is really defined between a property and an XML - // element, and the value is only available in a customized part of - // the feed. - if ((nsUri == null && nsPrefix == null) - || (nsUri != null && nsPrefix != null)) { - // The mapping is correctly declared (either in an ATOM or a - // customized XML element). - metadata.getMappings().add( - new Mapping(type, nsPrefix, nsUri, propertyPath, - valuePath, contentKind)); - } - } - } - - @Override - public void endDocument() throws SAXException { - // Update references. - for (Schema schema : currentMetadata.getSchemas()) { - // - associations.ends.type - for (Association association : schema.getAssociations()) { - // association type - for (AssociationEnd end : association.getEnds()) { - end.setType((EntityType) resolve(end.getType(), - registeredEntityTypes, schema)); - } - } - for (EntityType entityType : schema.getEntityTypes()) { - // entityType.key - if (entityType.getKeys() != null) { - List props = entityType.getKeys(); - entityType.setKeys(new ArrayList()); - for (Property prop : props) { - for (Property property : entityType.getProperties()) { - if (property.equals(prop)) { - entityType.getKeys().add(property); - break; - } - } - } - } - // entityType.associations - for (NavigationProperty navigationProperty : entityType - .getAssociations()) { - navigationProperty.setRelationship((Association) resolve( - navigationProperty.getRelationship(), - registeredAssociations, schema)); - - if (navigationProperty.getRelationship() != null) { - // association's roles. - for (AssociationEnd end : navigationProperty - .getRelationship().getEnds()) { - if (end.getRole().equals( - navigationProperty.getFromRole().getRole())) { - navigationProperty.setFromRole(end); - } else if (end.getRole().equals( - navigationProperty.getToRole().getRole())) { - navigationProperty.setToRole(end); - } - } - } else { - navigationProperty.setFromRole(null); - navigationProperty.setToRole(null); - } - } - // entityType.baseType - entityType - .setBaseType((EntityType) resolve( - entityType.getBaseType(), - registeredEntityTypes, schema)); - } - for (ComplexType complexType : schema.getComplexTypes()) { - // complexType.baseType - complexType.setBaseType((ComplexType) resolve( - complexType.getBaseType(), registeredComplexTypes, - schema)); - } - } - for (EntityContainer container : currentMetadata.getContainers()) { - // - entityContainer.extended - if (container.getExtended() != null) { - container.setExtended(registeredContainers.get(container - .getExtended().getName())); - } - - for (AssociationSet associationSet : container.getAssociations()) { - // - associationSet.association - associationSet.setAssociation((Association) resolve( - associationSet.getAssociation(), - registeredAssociations, container.getSchema())); - // - associationSet.ends.entitySet - for (AssociationSetEnd end : associationSet.getEnds()) { - for (EntitySet entitySet : container.getEntities()) { - if (entitySet.equals(end.getType())) { - end.setType(entitySet); - break; - } - } - } - } - // - entityContainer.entitySet.entityType - for (EntitySet entitySet : container.getEntities()) { - entitySet.setType((EntityType) resolve(entitySet.getType(), - registeredEntityTypes, container.getSchema())); - } - // - entityContainer.functionImport.entitySet - for (FunctionImport functionImport : container.getFunctionImports()) { - functionImport.setEntitySet((EntitySet) resolve( - functionImport.getEntitySet(), registeredEntitySets, - container.getSchema())); - } - } - - for (Schema schema : currentMetadata.getSchemas()) { - for (EntityType entityType : schema.getEntityTypes()) { - // entityType.complexTypes - for (ComplexProperty property : entityType - .getComplexProperties()) { - ComplexType type = (ComplexType) resolve( - property.getComplexType(), registeredComplexTypes, - schema); - if (type != null) { - property.setComplexType(type); - } - } - } - for (ComplexType complexType : schema.getComplexTypes()) { - // entityType.complexTypes - for (ComplexProperty property : complexType - .getComplexProperties()) { - ComplexType type = (ComplexType) resolve( - property.getComplexType(), registeredComplexTypes, - schema); - if (type != null) { - property.setComplexType(type); - } - } - } - } - } - - @Override - public void endElement(String uri, String localName, String name) - throws SAXException { - - if ("schema".equalsIgnoreCase(localName)) { - popState(); - currentSchema = null; - } else if ("using".equalsIgnoreCase(localName)) { - popState(); - } else if ("documentation".equalsIgnoreCase(localName)) { - popState(); - } else if ("entityType".equalsIgnoreCase(localName)) { - if (currentEntityType.isBlob()) { - String memberName = chooseAttributeName(currentEntityType, - blobRefValues); - - if (memberName == null) { - // Should not happen - currentEntityType.setBlob(false); - } else { - Property property = new Property(memberName); - currentEntityType.setBlobValueRefProperty(property); - } - // Sets the name of the property of the generated class that - // contains the reference of resource that is able to update the - // blob value. - memberName = chooseAttributeName(currentEntityType, - blobEditRefValues); - - if (memberName == null) { - // Should not happen - currentEntityType.setBlob(false); - } else { - Property property = new Property(memberName); - currentEntityType.setBlobValueEditRefProperty(property); - } - } - popState(); - currentEntityType = null; - } else if ("key".equalsIgnoreCase(localName)) { - popState(); - } else if ("property".equalsIgnoreCase(localName)) { - popState(); - } else if ("navigationProperty".equalsIgnoreCase(localName)) { - popState(); - } else if ("complexType".equalsIgnoreCase(localName)) { - popState(); - } else if ("association".equalsIgnoreCase(localName)) { - popState(); - currentAssociation = null; - } else if ("end".equalsIgnoreCase(localName)) { - popState(); - } else if ("onDelete".equalsIgnoreCase(localName)) { - popState(); - } else if ("referentialConstraint".equalsIgnoreCase(localName)) { - popState(); - } else if ("functionImport".equalsIgnoreCase(localName)) { - currentFunctionImport = null; - popState(); - } else if ("function".equalsIgnoreCase(localName)) { - popState(); - } else if ("entityContainer".equalsIgnoreCase(localName)) { - popState(); - currentEntityContainer = null; - } else if ("entitySet".equalsIgnoreCase(localName)) { - popState(); - } else if ("associationSet".equalsIgnoreCase(localName)) { - popState(); - currentAssociationSet = null; - } else if ("parameter".equalsIgnoreCase(localName)) { - popState(); - } - } - - /** - * Returns the current state when processing the document. - * - * @return the current state when processing the document. - */ - private State getState() { - return this.states.get(0); - } - - /** - * Drops the current state from the stack and returns it. This state becomes - * the former current state. - * - * @return the former current state. - */ - private State popState() { - return this.states.remove(0); - } - - /** - * Adds the given state. - * - * @param state - * The given state. - */ - private void pushState(State state) { - this.states.add(0, state); - } - - /** - * Finds a namedObject inside a register. - * - * @param namedObject - * The namedObject to find. - * @param register - * The register. - * @param currentSchema - * The schema of the named object. - * @return The namedObject if found inside the register, null otherwise. - */ - private NamedObject resolve(NamedObject namedObject, - Map register, Schema currentSchema) { - NamedObject result = null; - if (namedObject != null && namedObject.getName() != null) { - String key = null; - int index = namedObject.getName().lastIndexOf("."); - if (index != -1) { - // Objects are named via the namespace alias or full name - String nsName = namedObject.getName().substring(0, index); - for (Namespace namespace : registeredNamespaces) { - if (nsName.equals(namespace.getAlias()) - || nsName.equals(namespace.getName())) { - key = namespace.getName() - + namedObject.getName().substring(index); - break; - } - } - } else { - key = currentSchema.getNamespace().getName() + "." - + namedObject.getName(); - } - - result = register.get(key); - } - - return result; - } - - @Override - public void startDocument() throws SAXException { - registeredComplexTypes = new HashMap(); - registeredEntityTypes = new HashMap(); - registeredAssociations = new HashMap(); - registeredEntitySets = new HashMap(); - registeredNamespaces = new ArrayList(); - registeredContainers = new HashMap(); - } - - @Override - public void startElement(String uri, String localName, String name, - Attributes attrs) throws SAXException { - - if ("schema".equalsIgnoreCase(localName)) { - pushState(State.SCHEMA); - currentSchema = new Schema(); - this.currentMetadata.getSchemas().add(currentSchema); - - Namespace namespace = new Namespace(attrs.getValue("Namespace")); - namespace.setAlias(attrs.getValue("Alias")); - this.currentSchema.setNamespace(namespace); - registeredNamespaces.add(namespace); - } else if ("using".equalsIgnoreCase(localName)) { - pushState(State.USING); - Namespace namespace = new Namespace(attrs.getValue("Namespace")); - namespace.setAlias(attrs.getValue("Alias")); - this.currentSchema.getReferencedNamespaces().add(namespace); - } else if ("documentation".equalsIgnoreCase(localName)) { - pushState(State.DOCUMENTATION); - } else if ("entityType".equalsIgnoreCase(localName)) { - pushState(State.ENTITY_TYPE); - currentEntityType = new EntityType(attrs.getValue("Name")); - currentEntityType.setSchema(this.currentSchema); - currentEntityType.setAbstractType(Boolean.parseBoolean(attrs - .getValue("Abstract"))); - currentEntityType.setBlob(Boolean.parseBoolean(attrs.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, "HasStream"))); - String value = attrs.getValue("BaseType"); - if (value != null) { - currentEntityType.setBaseType(new EntityType(value)); - } - this.currentSchema.getEntityTypes().add(currentEntityType); - - // Check the declaration of a property mapping. - discoverMapping(currentEntityType, null, currentMetadata, attrs); - // register the new type. - registeredEntityTypes.put(currentSchema.getNamespace().getName() - + "." + currentEntityType.getName(), currentEntityType); - } else if ("key".equalsIgnoreCase(localName)) { - pushState(State.ENTITY_TYPE_KEY); - } else if ("propertyRef".equalsIgnoreCase(localName)) { - if (getState() == State.ENTITY_TYPE_KEY) { - if (currentEntityType.getKeys() == null) { - currentEntityType.setKeys(new ArrayList()); - } - currentEntityType.getKeys().add( - new Property(attrs.getValue("Name"))); - } - } else if ("property".equalsIgnoreCase(localName)) { - String type = attrs.getValue("Type"); - Property property; - if (type.toLowerCase().startsWith("edm.")) { - property = new Property(attrs.getValue("Name")); - property.setType(new Type(attrs.getValue("Type"))); - } else { - ComplexProperty p = new ComplexProperty(attrs.getValue("Name")); - p.setComplexType(new ComplexType(attrs.getValue("Type"))); - property = p; - } - - property.setDefaultValue(attrs.getValue("Default")); - // If no value is specified, the nullable facet defaults to true. - // cf - // http://www.odata.org/documentation/odata-v3-documentation/common-schema-definition-language-csdl/#531_The_edmNullable_Attribute - String nullable = attrs.getValue("Nullable"); - if (nullable == null) { - property.setNullable(true); - } else { - property.setNullable(Boolean.parseBoolean(nullable)); - } - // ConcurrencyMode - if ("fixed".equalsIgnoreCase(attrs.getValue("ConcurrencyMode"))) { - property.setConcurrent(true); - } else { - property.setConcurrent(false); - } - - property.setGetterAccess(attrs.getValue("GetterAccess")); - property.setSetterAccess(attrs.getValue("SetterAccess")); - String str = attrs.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, "MimeType"); - if (str != null) { - property.setMediaType(MediaType.valueOf(str)); - } - - if (getState() == State.ENTITY_TYPE) { - pushState(State.ENTITY_TYPE_PROPERTY); - if (property instanceof ComplexProperty) { - this.currentEntityType.getComplexProperties().add( - (ComplexProperty) property); - } else { - this.currentEntityType.getProperties().add(property); - } - } else { - pushState(State.COMPLEX_TYPE_PROPERTY); - if (property instanceof ComplexProperty) { - this.currentComplexType.getComplexProperties().add( - (ComplexProperty) property); - } else { - this.currentComplexType.getProperties().add(property); - } - } - - // Check the declaration of a property mapping. - discoverMapping(this.currentEntityType, property, currentMetadata, - attrs); - } else if ("navigationProperty".equalsIgnoreCase(localName)) { - pushState(State.NAVIGATION_PROPERTY); - NavigationProperty property = new NavigationProperty( - attrs.getValue("Name")); - property.setFromRole(new AssociationEnd(attrs.getValue("FromRole"))); - property.setRelationship(new Association(attrs - .getValue("Relationship"))); - property.setToRole(new AssociationEnd(attrs.getValue("ToRole"))); - currentEntityType.getAssociations().add(property); - } else if ("complexType".equalsIgnoreCase(localName)) { - pushState(State.COMPLEX_TYPE); - currentComplexType = new ComplexType(attrs.getValue("Name")); - currentComplexType.setSchema(this.currentSchema); - - String value = attrs.getValue("BaseType"); - if (value != null) { - currentComplexType.setBaseType(new ComplexType(value)); - } - this.currentSchema.getComplexTypes().add(currentComplexType); - // register the new type. - registeredComplexTypes.put(currentSchema.getNamespace().getName() - + "." + currentComplexType.getName(), currentComplexType); - } else if ("association".equalsIgnoreCase(localName)) { - pushState(State.ASSOCIATION); - currentAssociation = new Association(attrs.getValue("Name")); - currentSchema.getAssociations().add(currentAssociation); - registeredAssociations.put(currentSchema.getNamespace().getName() - + "." + currentAssociation.getName(), currentAssociation); - } else if ("end".equalsIgnoreCase(localName)) { - if (getState() == State.ASSOCIATION) { - pushState(State.ASSOCIATION_END); - AssociationEnd end = new AssociationEnd(attrs.getValue("Role")); - end.setMultiplicity(attrs.getValue("Multiplicity")); - end.setType(new EntityType(attrs.getValue("Type"))); - currentAssociation.getEnds().add(end); - } else { - pushState(State.ASSOCIATION_SET_END); - AssociationSetEnd end = new AssociationSetEnd( - attrs.getValue("Role")); - end.setType(new EntitySet(attrs.getValue("EntitySet"))); - currentAssociationSet.getEnds().add(end); - } - } else if ("onDelete".equalsIgnoreCase(localName)) { - pushState(State.ON_DELETE); - } else if ("referentialConstraint".equalsIgnoreCase(localName)) { - pushState(State.REFERENTIAL_CONSTRAINT); - } else if ("functionImport".equalsIgnoreCase(localName)) { - currentFunctionImport = new FunctionImport(attrs.getValue("Name")); - currentFunctionImport.setReturnType(attrs.getValue("ReturnType")); - currentFunctionImport.setEntitySet(new EntitySet(attrs - .getValue("EntitySet"))); - currentFunctionImport.setMethodAccess(attrs - .getValue("MethodAccess")); - currentFunctionImport.setMetadata(currentMetadata); - - String str = attrs.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, "HttpMethod"); - if (str != null) { - currentFunctionImport.setMethod(Method.valueOf(str)); - } - - if (State.ENTITY_CONTAINER == getState()) { - currentEntityContainer.getFunctionImports().add( - currentFunctionImport); - } - - pushState(State.FUNCTION_IMPORT); - } else if ("parameter".equalsIgnoreCase(localName)) { - if (State.FUNCTION_IMPORT == getState()) { - Parameter parameter = new Parameter(attrs.getValue("Name")); - parameter.setType(attrs.getValue("Type")); - parameter.setMode(attrs.getValue("Mode")); - String str = attrs.getValue("MaxLength"); - if (str != null) { - parameter.setMaxLength(Integer.parseInt(str)); - } - str = attrs.getValue("Precision"); - if (str != null) { - parameter.setPrecision(Integer.parseInt(str)); - } - str = attrs.getValue("Scale"); - if (str != null) { - parameter.setScale(Integer.parseInt(str)); - } - - currentFunctionImport.getParameters().add(parameter); - } - pushState(State.PARAMETER); - } else if ("function".equalsIgnoreCase(localName)) { - pushState(State.FUNCTION); - } else if ("entityContainer".equalsIgnoreCase(localName)) { - pushState(State.ENTITY_CONTAINER); - currentEntityContainer = new EntityContainer(attrs.getValue("Name")); - currentEntityContainer.setDefaultEntityContainer(Boolean - .parseBoolean(attrs.getValue( - Service.WCF_DATASERVICES_METADATA_NAMESPACE, - "IsDefaultEntityContainer"))); - String value = attrs.getValue("Extends"); - if (value != null) { - currentEntityContainer.setExtended(new EntityContainer(value)); - } - currentEntityContainer.setSchema(currentSchema); - currentMetadata.getContainers().add(currentEntityContainer); - registeredContainers.put(currentSchema.getNamespace().getName() - + "." + currentEntityContainer.getName(), - currentEntityContainer); - } else if ("entitySet".equalsIgnoreCase(localName)) { - pushState(State.ENTITY_SET); - EntitySet entitySet = new EntitySet(attrs.getValue("Name")); - registeredEntitySets.put(currentSchema.getNamespace().getName() - + "." + entitySet.getName(), entitySet); - entitySet.setType(new EntityType(attrs.getValue("EntityType"))); - currentEntityContainer.getEntities().add(entitySet); - } else if ("associationSet".equalsIgnoreCase(localName)) { - pushState(State.ASSOCIATION_SET); - currentAssociationSet = new AssociationSet(attrs.getValue("Name")); - currentAssociationSet.setAssociation(new Association(attrs - .getValue("Association"))); - currentEntityContainer.getAssociations().add(currentAssociationSet); - } - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/NamedObject.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/NamedObject.java deleted file mode 100644 index 55c0979503..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/NamedObject.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import org.restlet.engine.util.SystemUtils; -import org.restlet.ext.odata.internal.reflect.ReflectUtils; - -/** - * Base class for all EDM concepts that have a name. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class NamedObject { - - /** The name of the EDM concept. */ - private final String name; - - /** The name's value as a valid Java identifier. */ - private final String normalizedName; - - /** - * Constructor. - * - * @param name - * The name of the entity. - */ - public NamedObject(String name) { - super(); - this.name = name; - this.normalizedName = ReflectUtils.normalize(name); - } - - @Override - public boolean equals(Object obj) { - boolean result = false; - if (obj instanceof NamedObject) { - NamedObject object = (NamedObject) obj; - result = object.getName().equals(this.name); - } - return result; - } - - /** - * Returns the name. - * - * @return The name. - */ - public String getName() { - return name; - } - - /** - * Returns the name following the the java naming rules. - * - * @see - * Identifiers - * @return The name following the the java naming rules. - */ - public String getNormalizedName() { - return normalizedName; - } - - @Override - public int hashCode() { - return SystemUtils.hashCode(this.name); - } - - @Override - public String toString() { - return this.getClass() + " " + this.name; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Namespace.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Namespace.java deleted file mode 100644 index f1a309f02b..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Namespace.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -/** - * Represents a schema's namespace in the metadata descriptor of a OData - * service. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Namespace extends NamedObject { - /** The short alias for this namespace. */ - private String alias; - - /** - * Constructor. - * - * @param name - * The alias for this namespace. - */ - public Namespace(String name) { - super(name); - } - - /** - * Returns the short alias for this namespace. - * - * @return The short alias for this namespace. - */ - public String getAlias() { - return alias; - } - - /** - * Sets the short alias for this namespace. - * - * @param alias - * The short alias for this namespace. - */ - public void setAlias(String alias) { - this.alias = alias; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/NavigationProperty.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/NavigationProperty.java deleted file mode 100644 index 6da159b112..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/NavigationProperty.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -/** - * Represents an association between two properties. - * - * @author Thierry Boileau - * @see Navigation - * Properties (EDM) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class NavigationProperty extends NamedObject { - /** The start entity of the association. */ - private AssociationEnd fromRole; - - /** The association. */ - private Association relationship; - - /** The target entity of the association. */ - private AssociationEnd toRole; - - /** - * Constructor. - * - * @param name - * The name of this navigation property. - */ - public NavigationProperty(String name) { - super(name); - } - - /** - * Returns the start entity of the association. - * - * @return The start entity of the association. - */ - public AssociationEnd getFromRole() { - return fromRole; - } - - /** - * Returns the association. - * - * @return The association. - */ - public Association getRelationship() { - return relationship; - } - - /** - * Returns the target entity of the association. - * - * @return The target entity of the association. - */ - public AssociationEnd getToRole() { - return toRole; - } - - /** - * Sets the start entity of the association. - * - * @param fromRole - * The start entity of the association. - */ - public void setFromRole(AssociationEnd fromRole) { - this.fromRole = fromRole; - } - - /** - * Sets the association. - * - * @param relationship - * The association. - */ - public void setRelationship(Association relationship) { - this.relationship = relationship; - } - - /** - * Sets the target entity of the association. - * - * @param toRole - * The target entity of the association. - */ - public void setToRole(AssociationEnd toRole) { - this.toRole = toRole; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ODataType.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ODataType.java deleted file mode 100644 index fd008898b6..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/ODataType.java +++ /dev/null @@ -1,235 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -/** - * Super class of complex and entity types. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ODataType extends NamedObject implements Comparable { - - /** Is this type abstract? */ - private boolean abstractType; - - /** The parent type this type inherits from. */ - private ODataType baseType; - - /** The list of complex properties. */ - private List complexProperties; - - /** The list of properties. */ - private List properties; - - /** The schema. */ - private Schema schema; - - /** - * Constructor. - * - * @param name - * The name of this entity type. - */ - public ODataType(String name) { - super(name); - } - - /** - * Compares this object with the specified object for order. The comparison - * is based on the computed full class name - */ - public int compareTo(ODataType o) { - if (o == null) { - return 1; - } - int result = 0; - - String s1 = getFullClassName(); - String s2 = o.getFullClassName(); - if (s1 != null) { - result = s1.compareTo(s2); - } else if (s2 != null) { - result = -1 * s2.compareTo(s1); - } - return result; - } - - /** - * Returns the parent type this type inherits from. - * - * @return The parent type this type inherits from. - */ - public ODataType getBaseType() { - return baseType; - } - - /** - * Returns the Java class name related to this entity type. - * - * @return The Java class name related to this entity type. - */ - public String getClassName() { - return getNormalizedName().substring(0, 1).toUpperCase() - + getNormalizedName().substring(1); - } - - /** - * Returns the list of complex properties. - * - * @return The list of complex properties. - */ - public List getComplexProperties() { - if (complexProperties == null) { - complexProperties = new ArrayList(); - } - return complexProperties; - } - - /** - * Returns the package name related to this entity type. - * - * @return The package name related to this entity type. - */ - public String getFullClassName() { - return getPackageName() + "." + getClassName(); - } - - /** - * Returns the set of imported Java classes. - * - * @return The set of imported Java classes. - */ - public Set getImportedJavaClasses() { - Set result = new TreeSet(); - - for (Property property : getProperties()) { - if (property.getType() != null) { - result.addAll(property.getType().getImportedJavaClasses()); - } - } - - for (ComplexProperty property : getComplexProperties()) { - if (property.getComplexType() != null - && property.getComplexType().getSchema() != null) { - if (!property.getComplexType().getSchema().equals(getSchema())) { - result.add(property.getComplexType().getFullClassName()); - } - } - } - - return result; - } - - /** - * Returns the set of imported entity types. By default, returns an empty - * set. - * - * @return The set of imported entity types. - */ - public Set getImportedTypes() { - return new TreeSet(); - } - - /** - * Returns the package name related to this entity type. - * - * @return The package name related to this entity type. - */ - public String getPackageName() { - return TypeUtils.getPackageName(getSchema()); - } - - /** - * Returns the list of properties. - * - * @return The list of properties. - */ - public List getProperties() { - if (properties == null) { - properties = new ArrayList(); - } - return properties; - } - - /** - * Returns the schema. - * - * @return The schema. - */ - public Schema getSchema() { - return schema; - } - - /** - * Returns true if this type is abstract. - * - * @return True if this type is abstract - */ - public boolean isAbstractType() { - return abstractType; - } - - /** - * Indicates if this type is abstract - * - * @param abstractType - * True if this type is abstract - */ - public void setAbstractType(boolean abstractType) { - this.abstractType = abstractType; - } - - /** - * Sets the parent type this type inherits from. - * - * @param baseType - * The parent type this type inherits from. - */ - public void setBaseType(ODataType baseType) { - this.baseType = baseType; - } - - /** - * Sets the list of complex properties. - * - * @param complexProperties - * The list of complex properties. - */ - public void setComplexProperties(List complexProperties) { - this.complexProperties = complexProperties; - } - - /** - * Sets the list of properties. - * - * @param properties - * The list of properties. - */ - public void setProperties(List properties) { - this.properties = properties; - } - - /** - * Sets the schema. - * - * @param schema - * The schema. - */ - public void setSchema(Schema schema) { - this.schema = schema; - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Parameter.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Parameter.java deleted file mode 100644 index 3a7a422f2b..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Parameter.java +++ /dev/null @@ -1,144 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -/** - * Represents a parameter used when invoking a {@link FunctionImport}. - * - * @author Thierry Boileau - * @see FunctionImport - * Element (CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Parameter extends NamedObject { - - /** The maximum length of the parameter value. */ - private int maxLength; - - /** The mode of the parameter among "In", "Out", and "InOut". */ - private String mode; - - /** The precision of the parameter value. */ - private int precision; - - /** The scale of the parameter value. */ - private int scale; - - /** The type of the parameter. */ - private String type; - - /** - * Constructor. - * - * @param name - * The name of the parameter. - */ - public Parameter(String name) { - super(name); - } - - /** - * Returns the maximum length of the parameter value. - * - * @return The maximum length of the parameter value. - */ - public int getMaxLength() { - return maxLength; - } - - /** - * Returns the mode of the parameter among "In", "Out", and "InOut". - * - * @return The mode of the parameter among "In", "Out", and "InOut". - */ - public String getMode() { - return mode; - } - - /** - * Returns the precision of the parameter value. - * - * @return The precision of the parameter value. - */ - public int getPrecision() { - return precision; - } - - /** - * Returns the scale of the parameter value. - * - * @return The scale of the parameter value. - */ - public int getScale() { - return scale; - } - - /** - * Returns the type of the parameter. - * - * @return The type of the parameter. - */ - public String getType() { - return type; - } - - /** - * Sets the maximum length of the parameter value. - * - * @param maxLength - * The maximum length of the parameter value. - */ - public void setMaxLength(int maxLength) { - this.maxLength = maxLength; - } - - /** - * Sets the mode of the parameter. - * - * @param mode - * The mode of the parameter. - */ - public void setMode(String mode) { - this.mode = mode; - } - - /** - * Sets the precision of the parameter value. - * - * @param precision - * The precision of the parameter value. - */ - public void setPrecision(int precision) { - this.precision = precision; - } - - /** - * Sets the scale of the parameter value. - * - * @param scale - * The scale of the parameter value. - */ - public void setScale(int scale) { - this.scale = scale; - } - - /** - * Sets the type of the parameter. - * - * @param type - * The type of the parameter. - */ - public void setType(String type) { - this.type = type; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Property.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Property.java deleted file mode 100644 index 4d72582c53..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Property.java +++ /dev/null @@ -1,212 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import org.restlet.data.MediaType; -import org.restlet.ext.odata.internal.reflect.ReflectUtils; - -/** - * Represents a property of an EntityType. - * - * @author Thierry Boileau - * @see Property - * Element (EntityType CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Property extends NamedObject { - - /** True if this property should be used for optimistic concurrency checks. */ - private boolean concurrent; - - /** The default value. */ - private String defaultValue; - - /** The access level modifier of the getter method. */ - private String getterAccess; - - /** The media type stored in the content. */ - private MediaType mediaType; - - /** True if this property is not mandatory. */ - private boolean nullable; - - /** The access level modifier of the setter method. */ - private String setterAccess; - - /** The type of the property. */ - private Type type; - - /** - * Constructor. - * - * @param name - * The name of this property. - */ - public Property(String name) { - super(name); - } - - /** - * Returns the default value. - * - * @return The default value. - */ - - public String getDefaultValue() { - return defaultValue; - } - - /** - * Returns the access level modifier of the getter method. - * - * @return The access level modifier of the getter method. - */ - - public String getGetterAccess() { - return getterAccess; - } - - /** - * Returns the media type stored in the content. - * - * @return The media type stored in the content. - */ - public MediaType getMediaType() { - return mediaType; - } - - /** - * Returns the property name used as a class member. - * - * @return The property name used as a class member. - */ - public String getPropertyName() { - String result = super.getNormalizedName(); - if (ReflectUtils.isReservedWord(result)) { - result = "_" + result; - } - - return result; - } - - /** - * Returns the access level modifier of the setter method. - * - * @return The access level modifier of the setter method. - */ - - public String getSetterAccess() { - return setterAccess; - } - - /** - * Returns the type of the property. - * - * @return The type of the property. - */ - public Type getType() { - return type; - } - - /** - * Returns true if this property should be used for optimistic concurrency - * checks. - * - * @return True if this property should be used for optimistic concurrency - * checks. - */ - public boolean isConcurrent() { - return concurrent; - } - - /** - * Returns true if this property is not mandatory. - * - * @return True if this property is not mandatory. - */ - - public boolean isNullable() { - return nullable; - } - - /** - * Indicates if this property should be used for optimistic concurrency - * checks. - * - * @param concurrent - * True if this property should be used for optimistic - * concurrency checks. - */ - public void setConcurrent(boolean concurrent) { - this.concurrent = concurrent; - } - - /** - * Sets the default value. - * - * @param defaultValue - * The default value. - */ - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - /** - * Sets the access level modifier of the getter method. - * - * @param getterAccess - * The access level modifier of the getter method. - */ - public void setGetterAccess(String getterAccess) { - this.getterAccess = getterAccess; - } - - /** - * Sets the media type stored in the content. - * - * @param mediaType - * The media type stored in the content. - */ - public void setMediaType(MediaType mediaType) { - this.mediaType = mediaType; - } - - /** - * Sets true if this property is not mandatory. - * - * @param nullable - * True if this property is not mandatory. - */ - public void setNullable(boolean nullable) { - this.nullable = nullable; - } - - /** - * Sets the access level modifier of the setter method. - * - * @param setterAccess - * The access level modifier of the setter method. - */ - public void setSetterAccess(String setterAccess) { - this.setterAccess = setterAccess; - } - - /** - * Sets the type of the property. - * - * @param type - * The type of the property. - */ - public void setType(Type type) { - this.type = type; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Schema.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Schema.java deleted file mode 100644 index 3bcadf602b..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Schema.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.ArrayList; -import java.util.List; - -/** - * Defines a set of entity types and associations. - * - * @author Thierry Boileau - * @see Schema - * Element (CSDL) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Schema { - - /** The list of defined associations. */ - private List associations; - - /** The list of defined complex types. */ - private List complexTypes; - - /** The list of defined entity types. */ - private List entityTypes; - - /** The namespace of this schema. */ - private Namespace namespace; - - /** The list of referenced namespaces. */ - private List referencedNamespaces; - - /** - * Returns the list of defined associations. - * - * @return The list of defined associations. - */ - public List getAssociations() { - if (associations == null) { - associations = new ArrayList(); - } - return associations; - } - - /** - * Returns the list of defined complex types. - * - * @return The list of defined complex types. - */ - public List getComplexTypes() { - if (complexTypes == null) { - complexTypes = new ArrayList(); - } - return complexTypes; - } - - /** - * Returns the list of defined entity types. - * - * @return The list of defined entity types. - */ - public List getEntityTypes() { - if (entityTypes == null) { - entityTypes = new ArrayList(); - } - return entityTypes; - } - - /** - * Returns the namespace of this schema. - * - * @return The namespace of this schema. - */ - public Namespace getNamespace() { - return namespace; - } - - /** - * Returns the list of referenced namespaces. - * - * @return The list of referenced namespaces. - */ - public List getReferencedNamespaces() { - if (referencedNamespaces == null) { - referencedNamespaces = new ArrayList(); - } - return referencedNamespaces; - } - - /** - * Sets the list of defined associations. - * - * @param associations - * The list of defined associations. - */ - public void setAssociations(List associations) { - this.associations = associations; - } - - /** - * Sets the list of defined complex types. - * - * @param complexTypes - * The list of defined complex types. - */ - public void setComplexTypes(List complexTypes) { - this.complexTypes = complexTypes; - } - - /** - * Sets the list of defined entity types. - * - * @param types - * The list of defined entity types. - */ - public void setEntityTypes(List types) { - this.entityTypes = types; - } - - /** - * Sets the namespace of this schema. - * - * @param namespace - * The namespace of this schema. - */ - public void setNamespace(Namespace namespace) { - this.namespace = namespace; - } - - /** - * Sets the list of referenced namespaces. - * - * @param referencedNamespaces - * The list of referenced namespaces. - */ - public void setReferencedNamespaces(List referencedNamespaces) { - this.referencedNamespaces = referencedNamespaces; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Type.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Type.java deleted file mode 100644 index a67a2fd456..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/Type.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.util.Set; -import java.util.TreeSet; - -/** - * Represents an EDM simple type. - * - * @author Thierry Boileau - * @see Simple - * Types (EDM) - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class Type extends NamedObject { - - /** - * Constructor. - * - * @param typeName - * The name of the type. - */ - public Type(String typeName) { - super(typeName); - } - - /** - * Returns the name of the corresponding Java class or scalar type. - * - * @return The name of the corresponding Java class or scalar type. - */ - public String getClassName() { - return TypeUtils.toJavaTypeName(getName()); - } - - /** - * Returns the set of imported Java classes. - * - * @return The set of imported Java classes. - */ - public Set getImportedJavaClasses() { - Set result = new TreeSet(); - - if (getName().endsWith("DateTime")) { - result.add(getJavaClass().getName()); - } else if (getName().endsWith("DateTimeOffset")) { - result.add(getJavaClass().getName()); - } - - return result; - } - - /** - * Returns the corresponding Java class. - * - * @return The corresponding Java class. - */ - public Class getJavaClass() { - return TypeUtils.toJavaClass(getName()); - } - - /** - * Returns the class name of the corresponding Java class. Returns null for - * a scalar type. - * - * @return The class name of the corresponding Java class. - */ - public String getPackageName() { - String result = null; - if (getName().endsWith("DateTime")) { - result = "java.util"; - } else if (getName().endsWith("DateTimeOffset")) { - result = "java.util"; - } - - return result; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/TypeUtils.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/TypeUtils.java deleted file mode 100644 index d39ba3cf31..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/edm/TypeUtils.java +++ /dev/null @@ -1,631 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.edm; - -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; -import java.util.Arrays; -import java.util.Base64; -import java.util.Date; -import java.util.List; -import java.util.Locale; - -import org.restlet.Context; -import org.restlet.engine.util.DateUtils; -import org.restlet.ext.odata.internal.reflect.ReflectUtils; - -/** - * Handle type operations. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class TypeUtils { - - /** Formater for the EDM DateTime type. */ - public static final List dateTimeFormats = Arrays.asList( - "yyyy-MM-dd'T'HH:mm:ssz", "yyyy-MM-dd'T'HH:mm:ss", - "yyyy-MM-dd'T'HH:mm", "EEE, dd MMM yyyy HH:mm:ss zzz"); - - /** Formater for the EDM Decimal type. */ - public static final NumberFormat decimalFormat = DecimalFormat - .getNumberInstance(Locale.US); - - /** Formater for the EDM Double type. */ - public static final NumberFormat doubleFormat = new DecimalFormat( - "0.###############", new DecimalFormatSymbols(Locale.US)); - - /** Formater for the EDM Single type. */ - public static final NumberFormat singleFormat = new DecimalFormat( - "0.#######", new DecimalFormatSymbols(Locale.US)); - - /** Formater for the EDM Time type. */ - public static final NumberFormat timeFormat = DecimalFormat - .getIntegerInstance(Locale.US); - - /** - * Converts the String representation of the target WCF type to its - * corresponding value. - * - * @param value - * The value to convert. - * @param adoNetType - * The target WCF type. - * @return The converted value. - */ - public static Object fromEdm(String value, String adoNetType) { - if (value == null) { - return null; - } - - Object result = null; - try { - if (adoNetType.endsWith("Binary")) { - result = Base64.getDecoder().decode(value); - } else if (adoNetType.endsWith("Boolean")) { - result = Boolean.valueOf(value); - } else if (adoNetType.endsWith("DateTime")) { - result = DateUtils.parse(value, dateTimeFormats); - } else if (adoNetType.endsWith("DateTimeOffset")) { - result = DateUtils.parse(value, dateTimeFormats); - } else if (adoNetType.endsWith("Time")) { - result = timeFormat.parseObject(value); - } else if (adoNetType.endsWith("Decimal")) { - result = decimalFormat.parseObject(value); - } else if (adoNetType.endsWith("Single")) { - result = singleFormat.parseObject(value); - } else if (adoNetType.endsWith("Double")) { - result = doubleFormat.parseObject(value); - } else if (adoNetType.endsWith("Guid")) { - result = value; - } else if (adoNetType.endsWith("Int16")) { - result = Short.valueOf(value); - } else if (adoNetType.endsWith("Int32")) { - result = Integer.valueOf(value); - } else if (adoNetType.endsWith("Int64")) { - result = Long.valueOf(value); - } else if (adoNetType.endsWith("Byte")) { - result = Byte.valueOf(value); - } else if (adoNetType.endsWith("String")) { - result = value; - } - } catch (Exception e) { - Context.getCurrentLogger().warning( - "Cannot convert " + value + " from this EDM type " - + adoNetType); - } - - return result; - } - - /** - * Returns a correct full class name from the given name. Especially, it - * ensures that the first character of each sub package is in lower case. - * - * @param name - * The name. - * @return The package name extracted from the given name. - */ - public static String getFullClassName(String name) { - StringBuilder builder = new StringBuilder(); - - int index = name.lastIndexOf("."); - if (index > -1) { - builder.append(getPackageName(ReflectUtils.normalize(name - .substring(0, index)))); - builder.append(name.substring(index)); - } else { - builder.append(name); - } - - return builder.toString(); - } - - /** - * Returns the Java class that corresponds to the given type according to - * the naming rules. It looks for the schema namespace name taken as the - * package name, then the name of this entity type is the class name. - * - * @param type - * The entity type. - * @return The Java class that corresponds to this type. - */ - public static Class getJavaClass(EntityType type) { - Class result = null; - String fullClassName = getPackageName(type.getSchema()) + "." - + type.getClassName(); - try { - result = Class.forName(fullClassName); - } catch (ClassNotFoundException e) { - Context.getCurrentLogger().warning( - "Can't find the following class in the class loader: " - + fullClassName); - } - return result; - } - - /** - * Returns the literal form of the given value. - * - * @param value - * The value to convert. - * @param adoNetType - * The type of the value. - * @return The literal form of the given value. - * @see Abstract - * Type System - */ - public static String getLiteralForm(String value, String adoNetType) { - if (value == null) { - return null; - } - - String result = null; - try { - if (adoNetType.endsWith("Binary")) { - result = "'" + value + "'"; - } else if (adoNetType.endsWith("DateTime")) { - result = "datetime'" + value + "'"; - } else if (adoNetType.endsWith("DateTimeOffset")) { - result = "datetimeoffset'" + value + "'"; - } else if (adoNetType.endsWith("Time")) { - result = "time'" + value + "'"; - } else if (adoNetType.endsWith("Guid")) { - result = "guid'" + value + "'"; - } else if (adoNetType.endsWith("String")) { - result = "'" + value + "'"; - } else if (adoNetType.endsWith("Boolean")) { - result = String.valueOf(value); - } else if (adoNetType.endsWith("Byte")) { - result = String.valueOf(value); - } else if (adoNetType.endsWith("Int16")) { - result = String.valueOf(value); - } else if (adoNetType.endsWith("Int32")) { - result = String.valueOf(value); - } else if (adoNetType.endsWith("Int64")) { - result = value + "L"; - } else if (adoNetType.endsWith("Decimal")) { - result = value + "d"; - } else if (adoNetType.endsWith("Single")) { - result = String.valueOf(value); - } else if (adoNetType.endsWith("Double")) { - result = String.valueOf(value); - } - } catch (Exception e) { - Context.getCurrentLogger().warning( - "Cannot convert " + value + " from this EDM type " - + adoNetType); - } - - return result; - } - - /** - * Returns the package name related to the given schema. - * - * @param schema - * The schema. - * @return The package name related to the given schema. - */ - public static String getPackageName(Schema schema) { - return getPackageName(schema.getNamespace().getName()); - } - - /** - * Returns a correct package name from the given name. Especially, it - * ensures that the first character of each sub package is in lower case. - * - * @param name - * The name. - * @return The package name extracted from the given name. - */ - public static String getPackageName(String name) { - StringBuilder builder = new StringBuilder(); - - String[] tab = name.split("\\."); - for (int i = 0; i < tab.length; i++) { - String string = tab[i]; - if (i > 0) { - builder.append("."); - } - builder.append(string.toLowerCase()); - } - return builder.toString(); - } - - /** - * Converts a value to the String representation of the target WCF type. - * - * @param value - * The value to convert. - * @param type - * The target WCF type. - * @return The converted value. - */ - public static String toEdm(Object value, Type type) { - String adoNetType = type.getName(); - if (value == null || adoNetType == null) { - return null; - } - - String result = null; - if (adoNetType.endsWith("Binary")) { - if ((byte[].class).isAssignableFrom(value.getClass())) { - result = toEdmBinary((byte[]) value); - } - } else if (adoNetType.endsWith("Boolean")) { - if ((Boolean.class).isAssignableFrom(value.getClass())) { - result = toEdmBoolean((Boolean) value); - } - } else if (adoNetType.endsWith("DateTime")) { - if ((Date.class).isAssignableFrom(value.getClass())) { - result = toEdmDateTime((Date) value); - } - } else if (adoNetType.endsWith("DateTimeOffset")) { - if ((Date.class).isAssignableFrom(value.getClass())) { - result = toEdmDateTime((Date) value); - } - } else if (adoNetType.endsWith("Time")) { - if ((Long.class).isAssignableFrom(value.getClass())) { - result = toEdmTime((Long) value); - } - } else if (adoNetType.endsWith("Decimal")) { - if ((Double.class).isAssignableFrom(value.getClass())) { - result = toEdmDecimal((Double) value); - } - } else if (adoNetType.endsWith("Single")) { - if ((Float.class).isAssignableFrom(value.getClass())) { - result = toEdmSingle((Float) value); - } else if ((Double.class).isAssignableFrom(value.getClass())) { - result = toEdmSingle((Double) value); - } - } else if (adoNetType.endsWith("Double")) { - if ((Double.class).isAssignableFrom(value.getClass())) { - result = toEdmDouble((Double) value); - } - } else if (adoNetType.endsWith("Guid")) { - result = value.toString(); - } else if (adoNetType.endsWith("Int16")) { - if ((Short.class).isAssignableFrom(value.getClass())) { - result = toEdmInt16((Short) value); - } - } else if (adoNetType.endsWith("Int32")) { - if ((Integer.class).isAssignableFrom(value.getClass())) { - result = toEdmInt32((Integer) value); - } - } else if (adoNetType.endsWith("Int64")) { - if ((Long.class).isAssignableFrom(value.getClass())) { - result = toEdmInt64((Long) value); - } - } else if (adoNetType.endsWith("Byte")) { - if ((Byte.class).isAssignableFrom(value.getClass())) { - result = toEdmByte((Byte) value); - } - } else if (adoNetType.endsWith("String")) { - result = value.toString(); - } - - if (result == null) { - result = value.toString(); - } - - return result; - } - - /** - * Convert the given value to the String representation of a EDM Binary - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmBinary(byte[] value) { - return Base64.getEncoder().encodeToString(value); - } - - /** - * Convert the given value to the String representation of a EDM Boolean - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmBoolean(boolean value) { - return Boolean.toString(value); - } - - /** - * Convert the given value to the String representation of a EDM Byte value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmByte(byte value) { - return Byte.toString(value); - } - - /** - * Convert the given value to the String representation of a EDM DateTime - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmDateTime(Date value) { - return DateUtils.format(value, dateTimeFormats.get(0)); - } - - /** - * Convert the given value to the String representation of a EDM Decimal - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmDecimal(double value) { - return decimalFormat.format(value); - } - - /** - * Convert the given value to the String representation of a EDM Double - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmDouble(double value) { - return doubleFormat.format(value); - } - - /** - * Convert the given value to the String representation of a EDM Int16 - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmInt16(short value) { - return Short.toString(value); - } - - /** - * Convert the given value to the String representation of a EDM Int32 - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmInt32(int value) { - return Integer.toString(value); - } - - /** - * Convert the given value to the String representation of a EDM Int64 - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmInt64(long value) { - return Long.toString(value); - } - - /** - * Converts a value to the String representation of the target WCF type when - * used a key in the URIs. - * - * @param value - * The value to convert. - * @param type - * The target WCF type. - * @return The converted value. - */ - public static String toEdmKey(Object value, Type type) { - String adoNetType = type.getName(); - if (value == null || adoNetType == null) { - return null; - } - - String result = null; - if (adoNetType.endsWith("Binary")) { - if ((byte[].class).isAssignableFrom(value.getClass())) { - result = toEdmBinary((byte[]) value); - } - } else if (adoNetType.endsWith("Boolean")) { - if ((Boolean.class).isAssignableFrom(value.getClass())) { - result = toEdmBoolean((Boolean) value); - } - } else if (adoNetType.endsWith("DateTime")) { - if ((Date.class).isAssignableFrom(value.getClass())) { - result = toEdmDateTime((Date) value); - } - } else if (adoNetType.endsWith("DateTimeOffset")) { - if ((Date.class).isAssignableFrom(value.getClass())) { - result = toEdmDateTime((Date) value); - } - } else if (adoNetType.endsWith("Time")) { - if ((Long.class).isAssignableFrom(value.getClass())) { - result = toEdmTime((Long) value); - } - } else if (adoNetType.endsWith("Decimal")) { - if ((Double.class).isAssignableFrom(value.getClass())) { - result = toEdmDecimal((Double) value); - } - } else if (adoNetType.endsWith("Single")) { - if ((Float.class).isAssignableFrom(value.getClass())) { - result = toEdmSingle((Float) value); - } else if ((Double.class).isAssignableFrom(value.getClass())) { - result = toEdmSingle((Double) value); - } - } else if (adoNetType.endsWith("Double")) { - if ((Double.class).isAssignableFrom(value.getClass())) { - result = toEdmDouble((Double) value); - } - } else if (adoNetType.endsWith("Guid")) { - result = value.toString(); - } else if (adoNetType.endsWith("Int16")) { - if ((Short.class).isAssignableFrom(value.getClass())) { - result = toEdmInt16((Short) value); - } - } else if (adoNetType.endsWith("Int32")) { - if ((Integer.class).isAssignableFrom(value.getClass())) { - result = toEdmInt32((Integer) value); - } - } else if (adoNetType.endsWith("Int64")) { - if ((Long.class).isAssignableFrom(value.getClass())) { - result = toEdmInt64((Long) value); - } - } else if (adoNetType.endsWith("Byte")) { - if ((Byte.class).isAssignableFrom(value.getClass())) { - result = toEdmByte((Byte) value); - } - } else if (adoNetType.endsWith("String")) { - result = "'" + value.toString() + "'"; - } - - if (result == null) { - result = value.toString(); - } - - return result; - } - - /** - * Convert the given value to the String representation of a EDM Single - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmSingle(double value) { - return singleFormat.format(value); - } - - /** - * Convert the given value to the String representation of a EDM Single - * value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmSingle(float value) { - return singleFormat.format(value); - } - - /** - * Convert the given value to the String representation of a EDM Time value. - * - * @param value - * The value to convert. - * @return The value converted as String object. - */ - public static String toEdmTime(long value) { - return timeFormat.format(value); - } - - /** - * Returns the corresponding Java class or scalar type. - * - * @param edmTypeName - * The type name. - * @return The corresponding Java class or scalar type. - */ - public static Class toJavaClass(String edmTypeName) { - Class result = Object.class; - if (edmTypeName.endsWith("Binary")) { - result = byte[].class; - } else if (edmTypeName.endsWith("Boolean")) { - result = Boolean.class; - } else if (edmTypeName.endsWith("DateTime")) { - result = Date.class; - } else if (edmTypeName.endsWith("DateTimeOffset")) { - result = Date.class; - } else if (edmTypeName.endsWith("Time")) { - result = Long.class; - } else if (edmTypeName.endsWith("Decimal")) { - result = Double.class; - } else if (edmTypeName.endsWith("Single")) { - result = Double.class; - } else if (edmTypeName.endsWith("Double")) { - result = Double.class; - } else if (edmTypeName.endsWith("Guid")) { - result = String.class; - } else if (edmTypeName.endsWith("Int16")) { - result = Short.class; - } else if (edmTypeName.endsWith("Int32")) { - result = Integer.class; - } else if (edmTypeName.endsWith("Int64")) { - result = Long.class; - } else if (edmTypeName.endsWith("Byte")) { - result = Byte.class; - } else if (edmTypeName.endsWith("String")) { - result = String.class; - } - - return result; - } - - /** - * Returns the name of the corresponding Java class or scalar type. - * - * @param edmTypeName - * The type name. - * @return The name of the corresponding Java class or scalar type. - */ - public static String toJavaTypeName(String edmTypeName) { - String result = "Object"; - if (edmTypeName.endsWith("Binary")) { - result = "byte[]"; - } else if (edmTypeName.endsWith("Boolean")) { - result = "boolean"; - } else if (edmTypeName.endsWith("DateTime")) { - result = "Date"; - } else if (edmTypeName.endsWith("DateTimeOffset")) { - result = "Date"; - } else if (edmTypeName.endsWith("Time")) { - result = "long"; - } else if (edmTypeName.endsWith("Decimal")) { - result = "double"; - } else if (edmTypeName.endsWith("Single")) { - result = "double"; - } else if (edmTypeName.endsWith("Double")) { - result = "double"; - } else if (edmTypeName.endsWith("Guid")) { - result = "String"; - } else if (edmTypeName.endsWith("Int16")) { - result = "short"; - } else if (edmTypeName.endsWith("Int32")) { - result = "int"; - } else if (edmTypeName.endsWith("Int64")) { - result = "long"; - } else if (edmTypeName.endsWith("Byte")) { - result = "byte"; - } else if (edmTypeName.endsWith("String")) { - result = "String"; - } - - return result; - } - -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/reflect/ReflectUtils.java b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/reflect/ReflectUtils.java deleted file mode 100644 index 0722c346ab..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/reflect/ReflectUtils.java +++ /dev/null @@ -1,509 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.odata.internal.reflect; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.restlet.Context; -import org.restlet.ext.atom.Category; -import org.restlet.ext.atom.Entry; -import org.restlet.ext.atom.Feed; -import org.restlet.ext.odata.internal.edm.Property; -import org.restlet.ext.odata.internal.edm.TypeUtils; - -/** - * Handles Java reflection operations. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ReflectUtils { - - /** The internal logger. */ - private final static Logger logger = Context.getCurrentLogger(); - - /** List of reserved Java words. */ - private final static List reservedWords = Arrays.asList("abstract", - "assert", "boolean", "break", "byte", "case", "catch", "char", - "class", "const", "continue", "default", "do", "double", "double", - "else", "enum", "extends", "final", "finally", "float", "for", - "if", "goto", "implements", "import", "instanceof", "int", - "interface", "long", "native", "new", "package", "private", - "protected", "public", "return", "short", "static", "strictfp", - "super", "switch", "switch", "synchronized", "this", "throw", - "transient", "try", "void", "volatile", "while"); - - /** - * Returns the Java class of a set of entries contained inside a Feed. - * - * @param feed - * The feed to analyze. - * @return The Java class of a set of entries contained inside a Feed or - * null if it has not been found. - */ - public static Class getEntryClass(Feed feed) { - Class result = null; - if (feed != null && feed.getEntries() != null - && !feed.getEntries().isEmpty()) { - for (Entry entry : feed.getEntries()) { - if (entry.getCategories() != null - && !entry.getCategories().isEmpty()) { - Category category = entry.getCategories().get(0); - try { - result = Class.forName(TypeUtils - .getFullClassName(category.getTerm())); - break; - } catch (ClassNotFoundException e) { - continue; - } - } - } - } - - return result; - } - - /** - * Returns the class of this entity's attribute, or if it is a Collection - * (array, generic list, set), it returns the generic type. - * - * @param entity - * The entity. - * @param propertyName - * The property name. - * @return The simple class of this entity's attribute. - */ - public static Class getSimpleClass(Object entity, String propertyName) { - Class result = null; - String normPteName = normalize(propertyName); - try { - Field field = entity.getClass().getDeclaredField(normPteName); - if (field.getType().isArray()) { - result = field.getType().getComponentType(); - } else { - java.lang.reflect.Type genericFieldType = field - .getGenericType(); - - if (genericFieldType instanceof ParameterizedType) { - ParameterizedType aType = (ParameterizedType) genericFieldType; - java.lang.reflect.Type[] fieldArgTypes = aType - .getActualTypeArguments(); - if (fieldArgTypes.length == 1) { - result = (Class) fieldArgTypes[0]; - } - } else { - result = field.getType(); - } - } - } catch (Exception e) { - logger.log(Level.WARNING, "Can't access to the following property " - + normPteName + " on " + entity.getClass() + ".", e); - } - - return result; - } - - /** - * Returns the value of a property on an entity based on its name. - * - * @param entity - * The entity. - * @param propertyName - * The property name. - * @return The value of a property for an entity. - * @throws Exception - */ - public static Object invokeGetter(Object entity, String propertyName) - throws Exception { - Object result = null; - - if (propertyName != null && entity != null) { - propertyName = propertyName.replaceAll("/", "."); - Object o = entity; - String pty = propertyName; - int index = propertyName.indexOf("."); - if (index != -1) { - o = invokeGetter(entity, propertyName.substring(0, index)); - pty = propertyName.substring(index + 1); - - result = invokeGetter(o, pty); - } else { - String getterName = null; - char firstLetter = propertyName.charAt(0); - if (Character.isLowerCase(firstLetter)) { - getterName = "get" + Character.toUpperCase(firstLetter) - + pty.substring(1); - } else { - getterName = "get" + pty; - } - - Method getter = null; - Method method; - for (int i = 0; (getter == null) - && (i < entity.getClass().getDeclaredMethods().length); i++) { - method = entity.getClass().getDeclaredMethods()[i]; - - if (method.getName().equals(getterName)) { - getter = method; - } - } - - if (getter != null) { - result = getter.invoke(o); - } - } - } - - return result; - } - - /** - * Sets a property on an entity based on its name. - * - * @param entity - * The entity to update. - * @param propertyName - * The property name. - * @param propertyValue - * The property value. - * @throws Exception - */ - public static void invokeSetter(Object entity, String propertyName, - Object propertyValue) throws Exception { - if (propertyName != null && entity != null) { - propertyName = propertyName.replaceAll("/", "."); - Object o = entity; - String pty = propertyName; - String[] strings = propertyName.split("\\."); - if (strings.length > 1) { - for (int i = 0; i < strings.length - 1; i++) { - String string = strings[i]; - Object p = invokeGetter(o, string); - if (p == null) { - // Try to instantiate it - Field[] fields = o.getClass().getDeclaredFields(); - for (Field field : fields) { - if (field.getName().equalsIgnoreCase(string)) { - p = field.getType().newInstance(); - break; - } - } - } - if (p == null) { - // can't set a property on a null value - return; - } - o = p; - } - pty = strings[strings.length - 1]; - } - - String setterName = null; - char firstLetter = pty.charAt(0); - if (Character.isLowerCase(firstLetter)) { - setterName = "set" + Character.toUpperCase(firstLetter) + pty.substring(1); - } else { - setterName = "set" + pty; - } - - Method setter = null; - Method method; - for (int i = 0; (setter == null) - && (i < o.getClass().getDeclaredMethods().length); i++) { - method = o.getClass().getDeclaredMethods()[i]; - - if (method.getName().equals(setterName)) { - if ((method.getParameterTypes() != null) - && (method.getParameterTypes().length == 1)) { - setter = method; - } - } - } - - if (setter != null) { - setter.invoke(o, propertyValue); - } - } - } - - /** - * Sets a property on an entity based on its name. - * - * @param entity - * The entity to update. - * @param propertyName - * The property name. - * @param propertyValue - * The property value. - * @param propertyType - * The property data type. - * @throws Exception - */ - public static void invokeSetter(Object entity, String propertyName, - String propertyValue, String propertyType) throws Exception { - - if (propertyName != null) { - propertyName = propertyName.replaceAll("/", "."); - Object o = entity; - String pty = propertyName; - - String[] strings = propertyName.split("\\."); - if (strings.length > 1) { - for (int i = 0; i < strings.length - 1; i++) { - String string = strings[i]; - Object p = invokeGetter(o, string); - if (p == null) { - // Try to instantiate it - Field[] fields = o.getClass().getDeclaredFields(); - for (Field field : fields) { - if (field.getName().equalsIgnoreCase(string)) { - p = field.getType().newInstance(); - break; - } - } - } - o = p; - } - pty = strings[strings.length - 1]; - } - - String setterName = null; - char firstLetter = propertyName.charAt(0); - if (Character.isLowerCase(firstLetter)) { - setterName = "set" + Character.toUpperCase(firstLetter) - + pty.substring(1); - } else { - setterName = "set" + pty; - } - - Method setter = null; - Object setterParameter = null; - Method method; - for (int i = 0; (setter == null) - && (i < o.getClass().getDeclaredMethods().length); i++) { - method = o.getClass().getDeclaredMethods()[i]; - - if (method.getName().equals(setterName)) { - if ((method.getParameterTypes() != null) - && (method.getParameterTypes().length == 1)) { - Class parameterType = method.getParameterTypes()[0]; - - if (String.class.equals(parameterType)) { - setterParameter = propertyValue; - setter = method; - } else if (Integer.class.equals(parameterType)) { - setterParameter = Integer.valueOf(propertyValue); - setter = method; - } else if (int.class.equals(parameterType)) { - setterParameter = Integer.valueOf(propertyValue); - setter = method; - } - } - } - } - - if (setter != null) { - setter.invoke(o, setterParameter); - } - } - } - - /** - * Returns true if the given name is a Java reserved word. - * - * @param name - * The name to test. - * @return True if the given name is a Java reserved word. - */ - public static boolean isReservedWord(String name) { - return reservedWords.contains(name); - } - - /** - * Returns the name following the the java naming rules. - * - * @see - * Identifiers - * @param name - * The name to convert. - * @return The name following the the java naming rules. - */ - public static String normalize(String name) { - String result = null; - if (name != null) { - // Build the normalized name according to the java naming rules - StringBuilder b = new StringBuilder(); - boolean upperCase = false; - char oldChar = 0; - for (int i = 0; i < name.length(); i++) { - char c = name.charAt(i); - if (Character.isDigit(c)) { - b.append(c); - oldChar = c; - } else if (c >= 'a' && c <= 'z') { - if (upperCase) { - b.append(Character.toUpperCase(c)); - upperCase = false; - } else { - b.append(c); - } - oldChar = c; - } else if (c >= 'A' && c <= 'Z') { - if (upperCase) { - b.append(c); - upperCase = false; - } else if (oldChar != 0 && Character.isLowerCase(oldChar)) { - b.append(c); - } else { - b.append(Character.toLowerCase(c)); - } - oldChar = c; - } else if (c == '.') { - upperCase = true; - } else if (Character.isJavaIdentifierPart(c)) { - b.append(c); - oldChar = c; - } else { - upperCase = true; - } - } - result = b.toString(); - } - - return result; - } - - /** - * Sets a property on an entity based on its name. - * - * @param entity - * The entity to update. - * @param property - * The property. - * @param propertyValue - * The property value. - * @throws Exception - */ - public static void setProperty(Object entity, Property property, - String propertyValue) throws Exception { - if (property.getType() != null) { - invokeSetter(entity, property.getNormalizedName(), - TypeUtils.fromEdm(propertyValue, property.getType() - .getName())); - } - - } - - /** - * Sets a property on an entity based on its name. - * - * @param entity - * The entity to update. - * @param propertyName - * The property name. - * @param isCollection - * Should this property be a collection. - * @param iterator - * The collection of values to set. - * @param propertyClass - * The kind of objects stored by this property. - * @throws Exception - */ - public static void setProperty(Object entity, String propertyName, - boolean isCollection, Iterator iterator, Class propertyClass) - throws Exception { - String normPteName = normalize(propertyName); - if (iterator == null || !iterator.hasNext()) { - return; - } - boolean isGeneric = false; - boolean isArray = false; - Field field = entity.getClass().getDeclaredField(normPteName); - if (field.getType().isArray()) { - isArray = true; - } else { - java.lang.reflect.Type genericFieldType = field.getGenericType(); - - if (genericFieldType instanceof ParameterizedType) { - ParameterizedType aType = (ParameterizedType) genericFieldType; - java.lang.reflect.Type[] fieldArgTypes = aType - .getActualTypeArguments(); - if (fieldArgTypes.length == 1) { - isGeneric = true; - } - } - } - - if (isCollection) { - if (isArray) { - List list = new ArrayList(); - for (; iterator.hasNext();) { - list.add(iterator.next()); - } - ReflectUtils.invokeSetter(entity, normPteName, list.toArray()); - } else if (isGeneric) { - if (List.class.isAssignableFrom(field.getType())) { - List list = new ArrayList(); - for (; iterator.hasNext();) { - list.add(iterator.next()); - } - ReflectUtils.invokeSetter(entity, normPteName, list); - } else if (Set.class.isAssignableFrom(field.getType())) { - Set set = new TreeSet(); - for (; iterator.hasNext();) { - set.add(iterator.next()); - } - - ReflectUtils.invokeSetter(entity, normPteName, set); - } - } - } else { - for (; iterator.hasNext();) { - Object property = iterator.next(); - ReflectUtils.invokeSetter(entity, normPteName, property); - } - } - - } - - /** - * Sets a property on an entity based on its name. - * - * @param entity - * The entity to update. - * @param propertyName - * The property name. - * @param propertyValue - * The property value. - * @throws Exception - */ - public static void setProperty(Object entity, String propertyName, - String propertyValue) throws Exception { - int colonIndex = propertyName.indexOf(':'); - - if (colonIndex != -1) { - propertyName = propertyName.substring(colonIndex + 1); - } - - invokeSetter(entity, propertyName, propertyValue, null); - } -} diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/complexType.ftl b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/complexType.ftl deleted file mode 100644 index 280b3f438a..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/complexType.ftl +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file are subject to the terms of one of the following - * open source licenses: Apache 2.0 or or EPL 1.0 (the "Licenses"). You can - * select the license that you prefer but you may not use this file except in - * compliance with one of these Licenses. - * - * You can obtain a copy of the Apache 2.0 license at - * http://www.opensource.org/licenses/apache-2.0 - * - * You can obtain a copy of the EPL 1.0 license at - * http://www.opensource.org/licenses/eclipse-1.0 - * - * See the Licenses for the specific language governing permissions and - * limitations under the Licenses. - * - * Alternatively, you can obtain a royalty free commercial license with less - * limitations, transferable or non-transferable, directly at - * https://restlet.talend.com/ - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package ${packageName}; - -<#compress> -<#list type.importedJavaClasses?sort as clazz> -import ${clazz}; - - -<#list type.importedTypes?sort as t> -import ${t.fullClassName}; - - - - -<#compress> -/** - * Generated by the generator tool for the OData extension for the Restlet framework.
- * -<#if metadata.metadataRef??> * @see Metadata of the target OData service - * - */ - - -public <#if type.abstractType>abstract class ${className} { - -<#list type.properties?sort_by("name") as property> - <#if property.type??> - private ${property.type.className} ${property.propertyName}<#if property.defaultValue??> = property.defaultValue; - <#else> - // private [error: no defined type] ${property.propertyName}<#if property.defaultValue??> = property.defaultValue; - - -<#list type.complexProperties?sort_by("name") as property> - <#if property.complexType??> - private ${property.complexType.className} ${property.propertyName}; - <#else> - // private [error: no defined type] ${property.propertyName}; - - - - /** - * Constructor without parameter. - * - */ - public ${className}() { - super(); - } - -<#list type.properties?sort_by("name") as property> - <#if property.type??> - /** - * Returns the value of the "${property.propertyName}" attribute. - * - * @return The value of the "${property.propertyName}" attribute. - */ - <#if property.getterAccess??>${property.getterAccess}<#else>public ${property.type.className} get${property.normalizedName?cap_first}() { - return ${property.propertyName}; - } - - - -<#list type.complexProperties?sort_by("name") as property> - <#if property.complexType??> - /** - * Returns the value of the "${property.propertyName}" attribute. - * - * @return The value of the "${property.propertyName}" attribute. - */ - <#if property.getterAccess??>${property.getterAccess}<#else>public ${property.complexType.className} get${property.normalizedName?cap_first}() { - return ${property.propertyName}; - } - - - -<#list type.properties?sort_by("name") as property> - <#if property.type??> - /** - * Sets the value of the "${property.propertyName}" attribute. - * - * @param ${property.propertyName} - * The value of the "${property.normalizedName}" attribute. - */ - <#if property.setterAccess??>${property.setterAccess}<#else>public void set${property.normalizedName?cap_first}(${property.type.className} ${property.propertyName}) { - this.${property.propertyName} = ${property.propertyName}; - } - - - -<#list type.complexProperties?sort_by("name") as property> - <#if property.complexType??> - /** - * Sets the value of the "${property.normalizedName}" attribute. - * - * @param ${property.propertyName} - * The value of the "${property.normalizedName}" attribute. - */ - <#if property.setterAccess??>${property.setterAccess}<#else>public void set${property.normalizedName?cap_first}(${property.complexType.className} ${property.propertyName}) { - this.${property.propertyName} = ${property.propertyName}; - } - - - -} \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/entityType.ftl b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/entityType.ftl deleted file mode 100644 index c0f03cbfcd..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/entityType.ftl +++ /dev/null @@ -1,223 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file are subject to the terms of one of the following - * open source licenses: Apache 2.0 or or EPL 1.0 (the "Licenses"). You can - * select the license that you prefer but you may not use this file except in - * compliance with one of these Licenses. - * - * You can obtain a copy of the Apache 2.0 license at - * http://www.opensource.org/licenses/apache-2.0 - * - * You can obtain a copy of the EPL 1.0 license at - * http://www.opensource.org/licenses/eclipse-1.0 - * - * See the Licenses for the specific language governing permissions and - * limitations under the Licenses. - * - * Alternatively, you can obtain a royalty free commercial license with less - * limitations, transferable or non-transferable, directly at - * https://restlet.talend.com/ - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package ${packageName}; - -<#if type.blob>import org.restlet.data.Reference; -<#compress> -<#list type.importedJavaClasses?sort as clazz> -import ${clazz}; - - -<#list type.importedTypes?sort as t> -import ${t.fullClassName}; - - - - -<#compress> -/** - * Generated by the generator tool for the OData extension for the Restlet framework.
- * -<#if metadata.metadataRef??> * @see Metadata of the target OData service - * - */ - - -public <#if type.abstractType>abstract class ${className} { - -<#list type.properties?sort_by("name") as property> - <#if property.type??> - private ${property.type.className} ${property.propertyName}<#if property.defaultValue??> = property.defaultValue; - <#else> - // private [error: no defined type] ${property.propertyName}<#if property.defaultValue??> = property.defaultValue; - - -<#list type.complexProperties?sort_by("name") as property> - <#if property.complexType??> - private ${property.complexType.className} ${property.propertyName}; - <#else> - // private [error: no defined type] ${property.propertyName}; - - -<#list type.associations?sort_by("name") as association> - private <#if association.toRole.toMany>List<${association.toRole.type.className}><#else>${association.toRole.type.className} ${association.normalizedName}; - -<#if type.blob> - /** The reference of the underlying blob representation. */ - private Reference ${type.blobValueRefProperty.name}; - /** The reference to update the underlying blob representation. */ - private Reference ${type.blobValueEditRefProperty.name}; - - - /** - * Constructor without parameter. - * - */ - public ${className}() { - super(); - } - - /** - * Constructor. - * - * @param id - * The identifiant value of the entity. - */ - public ${className}(<#if type.keys??><#list type.keys as key>${key.type.className} ${key.normalizedName}<#if key_has_next>, ) { - this(); -<#if type.keys??><#list type.keys as key> - this.${key.normalizedName} = ${key.normalizedName}; - - } - -<#list type.properties?sort_by("name") as property> - <#if property.type??> - /** - * Returns the value of the "${property.propertyName}" attribute. - * - * @return The value of the "${property.propertyName}" attribute. - */ - <#if property.getterAccess??>${property.getterAccess}<#else>public ${property.type.className} get${property.normalizedName?cap_first}() { - return ${property.propertyName}; - } - - -<#list type.complexProperties?sort_by("name") as property> - <#if property.complexType??> - /** - * Returns the value of the "${property.propertyName}" attribute. - * - * @return The value of the "${property.propertyName}" attribute. - */ - <#if property.getterAccess??>${property.getterAccess}<#else>public ${property.complexType.className} get${property.normalizedName?cap_first}() { - return ${property.propertyName}; - } - - -<#list type.associations?sort_by("name") as association> - /** - * Returns the value of the "${association.normalizedName}" attribute. - * - * @return The value of the "${association.normalizedName}" attribute. - */ - <#if association.toRole.toMany> - public List<${association.toRole.type.className}> get${association.normalizedName?cap_first}() { - <#else> - public ${association.toRole.type.className} get${association.normalizedName?cap_first}() { - - return ${association.normalizedName}; - } - - -<#if type.blob> - /** - * Returns the @{Link Reference} of the underlying blob. - * - * @return The @{Link Reference} of the underlying blob. - */ - public Reference get${type.blobValueRefProperty.name?cap_first}() { - return ${type.blobValueRefProperty.name}; - } - - -<#if type.blob> - /** - * Returns the @{Link Reference} to update the underlying blob. - * - * @return The @{Link Reference} to update the underlying blob. - */ - public Reference get${type.blobValueEditRefProperty.name?cap_first}() { - return ${type.blobValueEditRefProperty.name}; - } - - -<#list type.properties?sort_by("name") as property> - <#if property.type??> - /** - * Sets the value of the "${property.normalizedName}" attribute. - * - * @param ${property.propertyName} - * The value of the "${property.normalizedName}" attribute. - */ - <#if property.setterAccess??>${property.setterAccess}<#else>public void set${property.normalizedName?cap_first}(${property.type.className} ${property.propertyName}) { - this.${property.propertyName} = ${property.propertyName}; - } - - -<#list type.complexProperties?sort_by("name") as property> - <#if property.complexType??> - /** - * Sets the value of the "${property.normalizedName}" attribute. - * - * @param ${property.propertyName} - * The value of the "${property.normalizedName}" attribute. - */ - <#if property.setterAccess??>${property.setterAccess}<#else>public void set${property.normalizedName?cap_first}(${property.complexType.className} ${property.propertyName}) { - this.${property.propertyName} = ${property.propertyName}; - } - - - -<#list type.associations?sort_by("name") as association> - /** - * Sets the value of the "${association.normalizedName}" attribute. - * - * @param ${association.normalizedName}" - * The value of the "${association.normalizedName}" attribute. - */ - <#if association.toRole.toMany> - public void set${association.normalizedName?cap_first}(List<${association.toRole.type.className}> ${association.normalizedName}) { - <#else> - public void set${association.normalizedName?cap_first}(${association.toRole.type.className} ${association.normalizedName}) { - - this.${association.normalizedName} = ${association.normalizedName}; - } - - -<#if type.blob> - /** - * Sets the @{Link Reference} of the underlying blob. - * - * @param ref - * The @{Link Reference} of the underlying blob. - */ - public void set${type.blobValueRefProperty.name?cap_first}(Reference ref) { - this.${type.blobValueRefProperty.name} = ref; - } - - -<#if type.blob> - /** - * Sets the @{Link Reference} to update the underlying blob. - * - * @param ref - * The @{Link Reference} to update the underlying blob. - */ - public void set${type.blobValueEditRefProperty.name?cap_first}(Reference ref) { - this.${type.blobValueEditRefProperty.name} = ref; - } - - -} \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/service.ftl b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/service.ftl deleted file mode 100644 index 2c4f5a52bd..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/internal/templates/service.ftl +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file are subject to the terms of one of the following - * open source licenses: Apache 2.0 or or EPL 1.0 (the "Licenses"). You can - * select the license that you prefer but you may not use this file except in - * compliance with one of these Licenses. - * - * You can obtain a copy of the Apache 2.0 license at - * http://www.opensource.org/licenses/apache-2.0 - * - * You can obtain a copy of the EPL 1.0 license at - * http://www.opensource.org/licenses/eclipse-1.0 - * - * See the Licenses for the specific language governing permissions and - * limitations under the Licenses. - * - * Alternatively, you can obtain a royalty free commercial license with less - * limitations, transferable or non-transferable, directly at - * https://restlet.talend.com/ - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -import java.util.List; - -import org.restlet.data.MediaType; -import org.restlet.data.Preference; -import org.restlet.data.Reference; -import org.restlet.ext.odata.Query; -import org.restlet.representation.Representation; -import org.restlet.resource.ClientResource; -import org.restlet.resource.ResourceException; - -<#list entityContainer.entities?sort as entitySet> -import ${entitySet.type.fullClassName}; - - -<#compress> -/** - * Generated by the generator tool for the OData extension for the Restlet framework.
- * -<#if metadata.metadataRef??> * @see Metadata of the target OData service - * - */ - - -public class ${className} extends org.restlet.ext.odata.Service { - - /** - * Constructor. - * - */ - public ${className}() { - super("${dataServiceUri}"); - } - -<#list entityContainer.entities as entitySet> - <#assign type=entitySet.type> - /** - * Adds a new entity to the service. - * - * @param entity - * The entity to add to the service. - * @throws Exception - */ - public void addEntity(${type.fullClassName} entity) throws Exception { - <#if entityContainer.defaultEntityContainer>addEntity("/${entitySet.name}", entity);<#else>addEntity("/${entityContainer.name}.${entitySet.name}", entity); - } - - /** - * Creates a query for ${type.normalizedName} entities hosted by this service. - * - * @param subpath - * The path to this entity relatively to the service URI. - * @return A query object. - */ - public Query<${type.fullClassName}> create${type.className}Query(String subpath) { - return createQuery(subpath, ${type.fullClassName}.class); - } - - <#if (type.blob && type.blobValueRefProperty?? && type.blobValueRefProperty.name??)> - /** - * Returns the binary representation of the given media resource. - * - * @param entity - * The given media resource. - * @return The binary representation of the given media resource. - */ - public Representation getValue(${type.fullClassName} entity) throws ResourceException { - Reference ref = getValueRef(entity); - if (ref != null) { - ClientResource cr = createResource(ref); - return cr.get(); - } - - return null; - } - - /** - * Returns the binary representation of the given media resource. - * - * @param entity - * The given media resource. - * @param acceptedMediaTypes - * The requested media types of the representation. - * @return The given media resource. - */ - public Representation getValue(${type.fullClassName} entity, - List> acceptedMediaTypes) - throws ResourceException { - Reference ref = getValueRef(entity); - if (ref != null) { - ClientResource cr = createResource(ref); - cr.getClientInfo().setAcceptedMediaTypes(acceptedMediaTypes); - return cr.get(); - } - - return null; - } - - /** - * Returns the binary representation of the given media resource. - * - * @param entity - * The given media resource. - * @param mediaType - * The requested media type of the representation - * @return The given media resource. - */ - public Representation getValue(${type.fullClassName} entity, MediaType mediaType) - throws ResourceException { - Reference ref = getValueRef(entity); - if (ref != null) { - ClientResource cr = createResource(ref); - return cr.get(mediaType); - } - - return null; - } - - /** - * Returns the reference of the binary representation of the given entity. - * - * @param entity - * The media resource. - * @return The reference of the binary representation of the given entity. - */ - public Reference getValueRef(${type.fullClassName} entity) { - if (entity != null) { - return entity.get${type.blobValueRefProperty.name?cap_first}(); - } - - return null; - } - - /** - * Sets the value of the given media entry link. - * - * @param entity - * The media entry link which value is to be updated - * @param blob - * The new representation. - * @throws ResourceException - */ - public void setValue(${type.fullClassName} entity, Representation blob) - throws ResourceException { - Reference ref = entity.get${type.blobValueEditRefProperty.name?cap_first}(); - - if (ref != null) { - ClientResource cr = createResource(ref); - cr.put(blob); - } - } - - - -} \ No newline at end of file diff --git a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/package.html b/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/package.html deleted file mode 100644 index de292e1cec..0000000000 --- a/org.restlet.java/org.restlet.ext.odata/src/main/java/org/restlet/ext/odata/package.html +++ /dev/null @@ -1,13 +0,0 @@ - - -Support for the OData web protocol. This client-side extension helps accessing web services -implementing the Open Data Protocol (OData). This protocol is typically powered by Microsoft's -WCF Data Services technology. - -@since Restlet 2.0 -@see Open Data Protocol (OData) -@see WCF Data Services -@see User Guide - OData extension -@deprecated Will be removed in next major release. - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/package.html b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/package.html deleted file mode 100644 index 089e6e8889..0000000000 --- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/package.html +++ /dev/null @@ -1,7 +0,0 @@ - - -Supports Restlet applications. -

-@since Restlet 2.0 - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/package.html b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/package.html deleted file mode 100644 index 73ec80f11b..0000000000 --- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/package.html +++ /dev/null @@ -1,7 +0,0 @@ - - -Supports HTTP header parsing and formatting. -

-@since Restlet 2.0 - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/package.html b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/package.html deleted file mode 100644 index e5b3a0f7a9..0000000000 --- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/package.html +++ /dev/null @@ -1,6 +0,0 @@ - - -Supports input and output work. -

@since Restlet 2.0 - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/package.html b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/package.html deleted file mode 100644 index ff984d0e51..0000000000 --- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/package.html +++ /dev/null @@ -1,7 +0,0 @@ - - -Supports the log service. -

-@since Restlet 2.0 - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/package.html b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/package.html deleted file mode 100644 index e2886f941c..0000000000 --- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/package.html +++ /dev/null @@ -1,7 +0,0 @@ - - -Supports resources. -

-@since Restlet 2.0 - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/package.html b/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/package.html deleted file mode 100644 index bd7c30a7ff..0000000000 --- a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/package.html +++ /dev/null @@ -1,7 +0,0 @@ - - -General utilities. -

-@since Restlet 2.0 - - \ No newline at end of file diff --git a/org.restlet.java/org.restlet/src/test/resources/maven-version.properties b/org.restlet.java/org.restlet/src/test/resources/maven-version.properties deleted file mode 100644 index 1e713b3a63..0000000000 --- a/org.restlet.java/org.restlet/src/test/resources/maven-version.properties +++ /dev/null @@ -1 +0,0 @@ -maven.version=${project.version} \ No newline at end of file diff --git a/org.restlet.java/pom.xml b/org.restlet.java/pom.xml deleted file mode 100644 index f5cb65f3fc..0000000000 --- a/org.restlet.java/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../pom.xml - - - org.restlet.java - org.restlet.java.parent - pom - Restlet Framework - Java edition - The first REST API framework for Java - - - org.restlet - org.restlet.ext.atom - org.restlet.ext.crypto - org.restlet.ext.freemarker - org.restlet.ext.gson - org.restlet.ext.guice - org.restlet.ext.gwt - org.restlet.ext.jaas - org.restlet.ext.jackson - org.restlet.ext.jaxb - org.restlet.ext.jetty - org.restlet.ext.json - org.restlet.ext.odata - org.restlet.ext.servlet - org.restlet.ext.slf4j - org.restlet.ext.spring - org.restlet.ext.thymeleaf - org.restlet.ext.velocity - org.restlet.ext.xml - - - diff --git a/org.restlet.java/org.restlet/pom.xml b/org.restlet/pom.xml similarity index 98% rename from org.restlet.java/org.restlet/pom.xml rename to org.restlet/pom.xml index e6553c9ef5..90a515c9c2 100644 --- a/org.restlet.java/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -6,7 +6,7 @@ org.restlet org.restlet.parent 2.7-SNAPSHOT - ../../pom.xml + ../pom.xml org.restlet diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Application.java b/org.restlet/src/main/java/org/restlet/Application.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Application.java rename to org.restlet/src/main/java/org/restlet/Application.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Client.java b/org.restlet/src/main/java/org/restlet/Client.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Client.java rename to org.restlet/src/main/java/org/restlet/Client.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Component.java b/org.restlet/src/main/java/org/restlet/Component.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Component.java rename to org.restlet/src/main/java/org/restlet/Component.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Connector.java b/org.restlet/src/main/java/org/restlet/Connector.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Connector.java rename to org.restlet/src/main/java/org/restlet/Connector.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Context.java b/org.restlet/src/main/java/org/restlet/Context.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Context.java rename to org.restlet/src/main/java/org/restlet/Context.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Message.java b/org.restlet/src/main/java/org/restlet/Message.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Message.java rename to org.restlet/src/main/java/org/restlet/Message.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Request.java b/org.restlet/src/main/java/org/restlet/Request.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Request.java rename to org.restlet/src/main/java/org/restlet/Request.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Response.java b/org.restlet/src/main/java/org/restlet/Response.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Response.java rename to org.restlet/src/main/java/org/restlet/Response.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Restlet.java b/org.restlet/src/main/java/org/restlet/Restlet.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Restlet.java rename to org.restlet/src/main/java/org/restlet/Restlet.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Server.java b/org.restlet/src/main/java/org/restlet/Server.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Server.java rename to org.restlet/src/main/java/org/restlet/Server.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/Uniform.java b/org.restlet/src/main/java/org/restlet/Uniform.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/Uniform.java rename to org.restlet/src/main/java/org/restlet/Uniform.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/AuthenticationInfo.java b/org.restlet/src/main/java/org/restlet/data/AuthenticationInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/AuthenticationInfo.java rename to org.restlet/src/main/java/org/restlet/data/AuthenticationInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/CacheDirective.java b/org.restlet/src/main/java/org/restlet/data/CacheDirective.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/CacheDirective.java rename to org.restlet/src/main/java/org/restlet/data/CacheDirective.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/ChallengeMessage.java b/org.restlet/src/main/java/org/restlet/data/ChallengeMessage.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/ChallengeMessage.java rename to org.restlet/src/main/java/org/restlet/data/ChallengeMessage.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/ChallengeRequest.java b/org.restlet/src/main/java/org/restlet/data/ChallengeRequest.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/ChallengeRequest.java rename to org.restlet/src/main/java/org/restlet/data/ChallengeRequest.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/ChallengeResponse.java b/org.restlet/src/main/java/org/restlet/data/ChallengeResponse.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/ChallengeResponse.java rename to org.restlet/src/main/java/org/restlet/data/ChallengeResponse.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/ChallengeScheme.java b/org.restlet/src/main/java/org/restlet/data/ChallengeScheme.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/ChallengeScheme.java rename to org.restlet/src/main/java/org/restlet/data/ChallengeScheme.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/CharacterSet.java b/org.restlet/src/main/java/org/restlet/data/CharacterSet.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/CharacterSet.java rename to org.restlet/src/main/java/org/restlet/data/CharacterSet.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/ClientInfo.java b/org.restlet/src/main/java/org/restlet/data/ClientInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/ClientInfo.java rename to org.restlet/src/main/java/org/restlet/data/ClientInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Conditions.java b/org.restlet/src/main/java/org/restlet/data/Conditions.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Conditions.java rename to org.restlet/src/main/java/org/restlet/data/Conditions.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Cookie.java b/org.restlet/src/main/java/org/restlet/data/Cookie.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Cookie.java rename to org.restlet/src/main/java/org/restlet/data/Cookie.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/CookieSetting.java b/org.restlet/src/main/java/org/restlet/data/CookieSetting.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/CookieSetting.java rename to org.restlet/src/main/java/org/restlet/data/CookieSetting.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Digest.java b/org.restlet/src/main/java/org/restlet/data/Digest.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Digest.java rename to org.restlet/src/main/java/org/restlet/data/Digest.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Dimension.java b/org.restlet/src/main/java/org/restlet/data/Dimension.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Dimension.java rename to org.restlet/src/main/java/org/restlet/data/Dimension.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Disposition.java b/org.restlet/src/main/java/org/restlet/data/Disposition.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Disposition.java rename to org.restlet/src/main/java/org/restlet/data/Disposition.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Encoding.java b/org.restlet/src/main/java/org/restlet/data/Encoding.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Encoding.java rename to org.restlet/src/main/java/org/restlet/data/Encoding.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Expectation.java b/org.restlet/src/main/java/org/restlet/data/Expectation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Expectation.java rename to org.restlet/src/main/java/org/restlet/data/Expectation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Form.java b/org.restlet/src/main/java/org/restlet/data/Form.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Form.java rename to org.restlet/src/main/java/org/restlet/data/Form.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Header.java b/org.restlet/src/main/java/org/restlet/data/Header.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Header.java rename to org.restlet/src/main/java/org/restlet/data/Header.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Language.java b/org.restlet/src/main/java/org/restlet/data/Language.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Language.java rename to org.restlet/src/main/java/org/restlet/data/Language.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/LocalReference.java b/org.restlet/src/main/java/org/restlet/data/LocalReference.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/LocalReference.java rename to org.restlet/src/main/java/org/restlet/data/LocalReference.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/MediaType.java b/org.restlet/src/main/java/org/restlet/data/MediaType.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/MediaType.java rename to org.restlet/src/main/java/org/restlet/data/MediaType.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Metadata.java b/org.restlet/src/main/java/org/restlet/data/Metadata.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Metadata.java rename to org.restlet/src/main/java/org/restlet/data/Metadata.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Method.java b/org.restlet/src/main/java/org/restlet/data/Method.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Method.java rename to org.restlet/src/main/java/org/restlet/data/Method.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Parameter.java b/org.restlet/src/main/java/org/restlet/data/Parameter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Parameter.java rename to org.restlet/src/main/java/org/restlet/data/Parameter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Preference.java b/org.restlet/src/main/java/org/restlet/data/Preference.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Preference.java rename to org.restlet/src/main/java/org/restlet/data/Preference.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Product.java b/org.restlet/src/main/java/org/restlet/data/Product.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Product.java rename to org.restlet/src/main/java/org/restlet/data/Product.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Protocol.java b/org.restlet/src/main/java/org/restlet/data/Protocol.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Protocol.java rename to org.restlet/src/main/java/org/restlet/data/Protocol.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Range.java b/org.restlet/src/main/java/org/restlet/data/Range.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Range.java rename to org.restlet/src/main/java/org/restlet/data/Range.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/RecipientInfo.java b/org.restlet/src/main/java/org/restlet/data/RecipientInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/RecipientInfo.java rename to org.restlet/src/main/java/org/restlet/data/RecipientInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Reference.java b/org.restlet/src/main/java/org/restlet/data/Reference.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Reference.java rename to org.restlet/src/main/java/org/restlet/data/Reference.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/ReferenceList.java b/org.restlet/src/main/java/org/restlet/data/ReferenceList.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/ReferenceList.java rename to org.restlet/src/main/java/org/restlet/data/ReferenceList.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/ServerInfo.java b/org.restlet/src/main/java/org/restlet/data/ServerInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/ServerInfo.java rename to org.restlet/src/main/java/org/restlet/data/ServerInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Status.java b/org.restlet/src/main/java/org/restlet/data/Status.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Status.java rename to org.restlet/src/main/java/org/restlet/data/Status.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Tag.java b/org.restlet/src/main/java/org/restlet/data/Tag.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Tag.java rename to org.restlet/src/main/java/org/restlet/data/Tag.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/Warning.java b/org.restlet/src/main/java/org/restlet/data/Warning.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/Warning.java rename to org.restlet/src/main/java/org/restlet/data/Warning.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/agent.properties b/org.restlet/src/main/java/org/restlet/data/agent.properties similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/agent.properties rename to org.restlet/src/main/java/org/restlet/data/agent.properties diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/data/package.html b/org.restlet/src/main/java/org/restlet/data/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/data/package.html rename to org.restlet/src/main/java/org/restlet/data/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/CompositeHelper.java b/org.restlet/src/main/java/org/restlet/engine/CompositeHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/CompositeHelper.java rename to org.restlet/src/main/java/org/restlet/engine/CompositeHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Edition.java b/org.restlet/src/main/java/org/restlet/engine/Edition.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Edition.java rename to org.restlet/src/main/java/org/restlet/engine/Edition.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Engine.java rename to org.restlet/src/main/java/org/restlet/engine/Engine.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Helper.java b/org.restlet/src/main/java/org/restlet/engine/Helper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/Helper.java rename to org.restlet/src/main/java/org/restlet/engine/Helper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/RestletHelper.java b/org.restlet/src/main/java/org/restlet/engine/RestletHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/RestletHelper.java rename to org.restlet/src/main/java/org/restlet/engine/RestletHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/Adapter.java b/org.restlet/src/main/java/org/restlet/engine/adapter/Adapter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/Adapter.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/Adapter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/Call.java b/org.restlet/src/main/java/org/restlet/engine/adapter/Call.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/Call.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/Call.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ClientAdapter.java b/org.restlet/src/main/java/org/restlet/engine/adapter/ClientAdapter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ClientAdapter.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/ClientAdapter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ClientCall.java b/org.restlet/src/main/java/org/restlet/engine/adapter/ClientCall.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ClientCall.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/ClientCall.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/HttpClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/HttpClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/HttpClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/HttpRequest.java b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpRequest.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/HttpRequest.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/HttpRequest.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/HttpResponse.java b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpResponse.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/HttpResponse.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/HttpResponse.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ServerAdapter.java b/org.restlet/src/main/java/org/restlet/engine/adapter/ServerAdapter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ServerAdapter.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/ServerAdapter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ServerCall.java b/org.restlet/src/main/java/org/restlet/engine/adapter/ServerCall.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/ServerCall.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/ServerCall.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/package.html b/org.restlet/src/main/java/org/restlet/engine/adapter/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/adapter/package.html rename to org.restlet/src/main/java/org/restlet/engine/adapter/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/ApplicationHelper.java b/org.restlet/src/main/java/org/restlet/engine/application/ApplicationHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/ApplicationHelper.java rename to org.restlet/src/main/java/org/restlet/engine/application/ApplicationHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/Conneg.java b/org.restlet/src/main/java/org/restlet/engine/application/Conneg.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/Conneg.java rename to org.restlet/src/main/java/org/restlet/engine/application/Conneg.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/CorsFilter.java b/org.restlet/src/main/java/org/restlet/engine/application/CorsFilter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/CorsFilter.java rename to org.restlet/src/main/java/org/restlet/engine/application/CorsFilter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/CorsResponseHelper.java b/org.restlet/src/main/java/org/restlet/engine/application/CorsResponseHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/CorsResponseHelper.java rename to org.restlet/src/main/java/org/restlet/engine/application/CorsResponseHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/DecodeRepresentation.java b/org.restlet/src/main/java/org/restlet/engine/application/DecodeRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/DecodeRepresentation.java rename to org.restlet/src/main/java/org/restlet/engine/application/DecodeRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/Decoder.java b/org.restlet/src/main/java/org/restlet/engine/application/Decoder.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/Decoder.java rename to org.restlet/src/main/java/org/restlet/engine/application/Decoder.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/EncodeRepresentation.java b/org.restlet/src/main/java/org/restlet/engine/application/EncodeRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/EncodeRepresentation.java rename to org.restlet/src/main/java/org/restlet/engine/application/EncodeRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/Encoder.java b/org.restlet/src/main/java/org/restlet/engine/application/Encoder.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/Encoder.java rename to org.restlet/src/main/java/org/restlet/engine/application/Encoder.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/FlexibleConneg.java b/org.restlet/src/main/java/org/restlet/engine/application/FlexibleConneg.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/FlexibleConneg.java rename to org.restlet/src/main/java/org/restlet/engine/application/FlexibleConneg.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/MetadataExtension.java b/org.restlet/src/main/java/org/restlet/engine/application/MetadataExtension.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/MetadataExtension.java rename to org.restlet/src/main/java/org/restlet/engine/application/MetadataExtension.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/RangeFilter.java b/org.restlet/src/main/java/org/restlet/engine/application/RangeFilter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/RangeFilter.java rename to org.restlet/src/main/java/org/restlet/engine/application/RangeFilter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/RangeRepresentation.java b/org.restlet/src/main/java/org/restlet/engine/application/RangeRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/RangeRepresentation.java rename to org.restlet/src/main/java/org/restlet/engine/application/RangeRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/StatusFilter.java b/org.restlet/src/main/java/org/restlet/engine/application/StatusFilter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/StatusFilter.java rename to org.restlet/src/main/java/org/restlet/engine/application/StatusFilter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/StatusInfo.java b/org.restlet/src/main/java/org/restlet/engine/application/StatusInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/StatusInfo.java rename to org.restlet/src/main/java/org/restlet/engine/application/StatusInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/StrictConneg.java b/org.restlet/src/main/java/org/restlet/engine/application/StrictConneg.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/StrictConneg.java rename to org.restlet/src/main/java/org/restlet/engine/application/StrictConneg.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/TunnelFilter.java b/org.restlet/src/main/java/org/restlet/engine/application/TunnelFilter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/application/TunnelFilter.java rename to org.restlet/src/main/java/org/restlet/engine/application/TunnelFilter.java diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/package.html b/org.restlet/src/main/java/org/restlet/engine/application/package.html similarity index 100% rename from org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/application/package.html rename to org.restlet/src/main/java/org/restlet/engine/application/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ClientRoute.java b/org.restlet/src/main/java/org/restlet/engine/component/ClientRoute.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ClientRoute.java rename to org.restlet/src/main/java/org/restlet/engine/component/ClientRoute.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ClientRouter.java b/org.restlet/src/main/java/org/restlet/engine/component/ClientRouter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ClientRouter.java rename to org.restlet/src/main/java/org/restlet/engine/component/ClientRouter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ComponentClientDispatcher.java b/org.restlet/src/main/java/org/restlet/engine/component/ComponentClientDispatcher.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ComponentClientDispatcher.java rename to org.restlet/src/main/java/org/restlet/engine/component/ComponentClientDispatcher.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ComponentContext.java b/org.restlet/src/main/java/org/restlet/engine/component/ComponentContext.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ComponentContext.java rename to org.restlet/src/main/java/org/restlet/engine/component/ComponentContext.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ComponentHelper.java b/org.restlet/src/main/java/org/restlet/engine/component/ComponentHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ComponentHelper.java rename to org.restlet/src/main/java/org/restlet/engine/component/ComponentHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java b/org.restlet/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java rename to org.restlet/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/HostRoute.java b/org.restlet/src/main/java/org/restlet/engine/component/HostRoute.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/HostRoute.java rename to org.restlet/src/main/java/org/restlet/engine/component/HostRoute.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/InternalRouter.java b/org.restlet/src/main/java/org/restlet/engine/component/InternalRouter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/InternalRouter.java rename to org.restlet/src/main/java/org/restlet/engine/component/InternalRouter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ServerRouter.java b/org.restlet/src/main/java/org/restlet/engine/component/ServerRouter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/ServerRouter.java rename to org.restlet/src/main/java/org/restlet/engine/component/ServerRouter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/package.html b/org.restlet/src/main/java/org/restlet/engine/component/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/component/package.html rename to org.restlet/src/main/java/org/restlet/engine/component/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/ClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/ClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java b/org.restlet/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java rename to org.restlet/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ConnectorHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/ConnectorHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ConnectorHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/ConnectorHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/FtpClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/FtpClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/FtpClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/FtpClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpProtocolHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpProtocolHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpProtocolHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpProtocolHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/Method.java b/org.restlet/src/main/java/org/restlet/engine/connector/Method.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/Method.java rename to org.restlet/src/main/java/org/restlet/engine/connector/Method.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/NetServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/NetServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/NetServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/NetServerHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ProtocolHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/ProtocolHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ProtocolHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/ProtocolHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/ServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/ServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/ServerHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/package.html b/org.restlet/src/main/java/org/restlet/engine/connector/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/connector/package.html rename to org.restlet/src/main/java/org/restlet/engine/connector/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/ConverterHelper.java b/org.restlet/src/main/java/org/restlet/engine/converter/ConverterHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/ConverterHelper.java rename to org.restlet/src/main/java/org/restlet/engine/converter/ConverterHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/ConverterUtils.java b/org.restlet/src/main/java/org/restlet/engine/converter/ConverterUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/ConverterUtils.java rename to org.restlet/src/main/java/org/restlet/engine/converter/ConverterUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/DefaultConverter.java b/org.restlet/src/main/java/org/restlet/engine/converter/DefaultConverter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/DefaultConverter.java rename to org.restlet/src/main/java/org/restlet/engine/converter/DefaultConverter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/StatusInfoHtmlConverter.java b/org.restlet/src/main/java/org/restlet/engine/converter/StatusInfoHtmlConverter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/StatusInfoHtmlConverter.java rename to org.restlet/src/main/java/org/restlet/engine/converter/StatusInfoHtmlConverter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/package.html b/org.restlet/src/main/java/org/restlet/engine/converter/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/converter/package.html rename to org.restlet/src/main/java/org/restlet/engine/converter/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CacheDirectiveReader.java b/org.restlet/src/main/java/org/restlet/engine/header/CacheDirectiveReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CacheDirectiveReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/CacheDirectiveReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CacheDirectiveWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/CacheDirectiveWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CacheDirectiveWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/CacheDirectiveWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java b/org.restlet/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ChallengeWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/ChallengeWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ChallengeWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/ChallengeWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ContentType.java b/org.restlet/src/main/java/org/restlet/engine/header/ContentType.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ContentType.java rename to org.restlet/src/main/java/org/restlet/engine/header/ContentType.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ContentTypeReader.java b/org.restlet/src/main/java/org/restlet/engine/header/ContentTypeReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ContentTypeReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/ContentTypeReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CookieReader.java b/org.restlet/src/main/java/org/restlet/engine/header/CookieReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CookieReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/CookieReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingReader.java b/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/CookieSettingReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/CookieSettingWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CookieWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/CookieWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/CookieWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/CookieWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DateWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/DateWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DateWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/DateWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DimensionReader.java b/org.restlet/src/main/java/org/restlet/engine/header/DimensionReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DimensionReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/DimensionReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DimensionWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/DimensionWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DimensionWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/DimensionWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DispositionReader.java b/org.restlet/src/main/java/org/restlet/engine/header/DispositionReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DispositionReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/DispositionReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DispositionWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/DispositionWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/DispositionWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/DispositionWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/EncodingReader.java b/org.restlet/src/main/java/org/restlet/engine/header/EncodingReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/EncodingReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/EncodingReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/EncodingWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/EncodingWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/EncodingWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/EncodingWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ExpectationReader.java b/org.restlet/src/main/java/org/restlet/engine/header/ExpectationReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ExpectationReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/ExpectationReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ExpectationWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/ExpectationWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ExpectationWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/ExpectationWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/HeaderConstants.java b/org.restlet/src/main/java/org/restlet/engine/header/HeaderConstants.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/HeaderConstants.java rename to org.restlet/src/main/java/org/restlet/engine/header/HeaderConstants.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/HeaderReader.java b/org.restlet/src/main/java/org/restlet/engine/header/HeaderReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/HeaderReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/HeaderReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/HeaderUtils.java b/org.restlet/src/main/java/org/restlet/engine/header/HeaderUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/HeaderUtils.java rename to org.restlet/src/main/java/org/restlet/engine/header/HeaderUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/HeaderWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/HeaderWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/HeaderWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/HeaderWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/LanguageReader.java b/org.restlet/src/main/java/org/restlet/engine/header/LanguageReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/LanguageReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/LanguageReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/LanguageWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/LanguageWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/LanguageWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/LanguageWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/MetadataWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/MetadataWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/MetadataWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/MetadataWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/MethodReader.java b/org.restlet/src/main/java/org/restlet/engine/header/MethodReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/MethodReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/MethodReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/MethodWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/MethodWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/MethodWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/MethodWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/PreferenceReader.java b/org.restlet/src/main/java/org/restlet/engine/header/PreferenceReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/PreferenceReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/PreferenceReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/PreferenceWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/PreferenceWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/PreferenceWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/PreferenceWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ProductReader.java b/org.restlet/src/main/java/org/restlet/engine/header/ProductReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ProductReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/ProductReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ProductWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/ProductWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/ProductWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/ProductWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/RangeReader.java b/org.restlet/src/main/java/org/restlet/engine/header/RangeReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/RangeReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/RangeReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/RangeWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/RangeWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/RangeWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/RangeWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/RecipientInfoReader.java b/org.restlet/src/main/java/org/restlet/engine/header/RecipientInfoReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/RecipientInfoReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/RecipientInfoReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/RecipientInfoWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/RecipientInfoWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/RecipientInfoWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/RecipientInfoWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/StringReader.java b/org.restlet/src/main/java/org/restlet/engine/header/StringReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/StringReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/StringReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/StringWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/StringWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/StringWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/StringWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/TagReader.java b/org.restlet/src/main/java/org/restlet/engine/header/TagReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/TagReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/TagReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/TagWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/TagWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/TagWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/TagWriter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/TokenReader.java b/org.restlet/src/main/java/org/restlet/engine/header/TokenReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/TokenReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/TokenReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/WarningReader.java b/org.restlet/src/main/java/org/restlet/engine/header/WarningReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/WarningReader.java rename to org.restlet/src/main/java/org/restlet/engine/header/WarningReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/WarningWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/WarningWriter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/header/WarningWriter.java rename to org.restlet/src/main/java/org/restlet/engine/header/WarningWriter.java diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/package.html b/org.restlet/src/main/java/org/restlet/engine/header/package.html similarity index 100% rename from org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/header/package.html rename to org.restlet/src/main/java/org/restlet/engine/header/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/internal/Activator.java b/org.restlet/src/main/java/org/restlet/engine/internal/Activator.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/internal/Activator.java rename to org.restlet/src/main/java/org/restlet/engine/internal/Activator.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/IoUtils.java b/org.restlet/src/main/java/org/restlet/engine/io/IoUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/IoUtils.java rename to org.restlet/src/main/java/org/restlet/engine/io/IoUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/PipeStream.java b/org.restlet/src/main/java/org/restlet/engine/io/PipeStream.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/PipeStream.java rename to org.restlet/src/main/java/org/restlet/engine/io/PipeStream.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/RangeInputStream.java b/org.restlet/src/main/java/org/restlet/engine/io/RangeInputStream.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/RangeInputStream.java rename to org.restlet/src/main/java/org/restlet/engine/io/RangeInputStream.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/ReaderInputStream.java b/org.restlet/src/main/java/org/restlet/engine/io/ReaderInputStream.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/ReaderInputStream.java rename to org.restlet/src/main/java/org/restlet/engine/io/ReaderInputStream.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/UnclosableInputStream.java b/org.restlet/src/main/java/org/restlet/engine/io/UnclosableInputStream.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/UnclosableInputStream.java rename to org.restlet/src/main/java/org/restlet/engine/io/UnclosableInputStream.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/UnclosableOutputStream.java b/org.restlet/src/main/java/org/restlet/engine/io/UnclosableOutputStream.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/UnclosableOutputStream.java rename to org.restlet/src/main/java/org/restlet/engine/io/UnclosableOutputStream.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/WriterOutputStream.java b/org.restlet/src/main/java/org/restlet/engine/io/WriterOutputStream.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/io/WriterOutputStream.java rename to org.restlet/src/main/java/org/restlet/engine/io/WriterOutputStream.java diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/package.html b/org.restlet/src/main/java/org/restlet/engine/io/package.html similarity index 100% rename from org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/io/package.html rename to org.restlet/src/main/java/org/restlet/engine/io/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/ClapClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/ClapClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/ClapClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/local/ClapClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/DirectoryServerResource.java b/org.restlet/src/main/java/org/restlet/engine/local/DirectoryServerResource.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/DirectoryServerResource.java rename to org.restlet/src/main/java/org/restlet/engine/local/DirectoryServerResource.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/Entity.java b/org.restlet/src/main/java/org/restlet/engine/local/Entity.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/Entity.java rename to org.restlet/src/main/java/org/restlet/engine/local/Entity.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/EntityClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/EntityClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/EntityClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/local/EntityClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/FileClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/FileClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/FileClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/local/FileClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/FileEntity.java b/org.restlet/src/main/java/org/restlet/engine/local/FileEntity.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/FileEntity.java rename to org.restlet/src/main/java/org/restlet/engine/local/FileEntity.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/LocalClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/LocalClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/LocalClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/local/LocalClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/RiapClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/RiapClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/RiapClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/local/RiapClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/RiapServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/RiapServerHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/RiapServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/local/RiapServerHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/ZipClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/ZipClientHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/ZipClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/local/ZipClientHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/ZipEntryEntity.java b/org.restlet/src/main/java/org/restlet/engine/local/ZipEntryEntity.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/ZipEntryEntity.java rename to org.restlet/src/main/java/org/restlet/engine/local/ZipEntryEntity.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/ZipEntryRepresentation.java b/org.restlet/src/main/java/org/restlet/engine/local/ZipEntryRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/ZipEntryRepresentation.java rename to org.restlet/src/main/java/org/restlet/engine/local/ZipEntryRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/package.html b/org.restlet/src/main/java/org/restlet/engine/local/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/local/package.html rename to org.restlet/src/main/java/org/restlet/engine/local/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/AccessLogFileHandler.java b/org.restlet/src/main/java/org/restlet/engine/log/AccessLogFileHandler.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/AccessLogFileHandler.java rename to org.restlet/src/main/java/org/restlet/engine/log/AccessLogFileHandler.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/AccessLogFormatter.java b/org.restlet/src/main/java/org/restlet/engine/log/AccessLogFormatter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/AccessLogFormatter.java rename to org.restlet/src/main/java/org/restlet/engine/log/AccessLogFormatter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/DefaultAccessLogFormatter.java b/org.restlet/src/main/java/org/restlet/engine/log/DefaultAccessLogFormatter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/DefaultAccessLogFormatter.java rename to org.restlet/src/main/java/org/restlet/engine/log/DefaultAccessLogFormatter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/IdentClient.java b/org.restlet/src/main/java/org/restlet/engine/log/IdentClient.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/IdentClient.java rename to org.restlet/src/main/java/org/restlet/engine/log/IdentClient.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/LogFilter.java b/org.restlet/src/main/java/org/restlet/engine/log/LogFilter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/LogFilter.java rename to org.restlet/src/main/java/org/restlet/engine/log/LogFilter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/LogUtils.java b/org.restlet/src/main/java/org/restlet/engine/log/LogUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/LogUtils.java rename to org.restlet/src/main/java/org/restlet/engine/log/LogUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/LoggerFacade.java b/org.restlet/src/main/java/org/restlet/engine/log/LoggerFacade.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/LoggerFacade.java rename to org.restlet/src/main/java/org/restlet/engine/log/LoggerFacade.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/LoggingThreadFactory.java b/org.restlet/src/main/java/org/restlet/engine/log/LoggingThreadFactory.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/LoggingThreadFactory.java rename to org.restlet/src/main/java/org/restlet/engine/log/LoggingThreadFactory.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/SimplerFormatter.java b/org.restlet/src/main/java/org/restlet/engine/log/SimplerFormatter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/SimplerFormatter.java rename to org.restlet/src/main/java/org/restlet/engine/log/SimplerFormatter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/SimplestFormatter.java b/org.restlet/src/main/java/org/restlet/engine/log/SimplestFormatter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/log/SimplestFormatter.java rename to org.restlet/src/main/java/org/restlet/engine/log/SimplestFormatter.java diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/log/package.html b/org.restlet/src/main/java/org/restlet/engine/log/package.html similarity index 100% rename from org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/log/package.html rename to org.restlet/src/main/java/org/restlet/engine/log/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/package.html b/org.restlet/src/main/java/org/restlet/engine/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/package.html rename to org.restlet/src/main/java/org/restlet/engine/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationInfo.java b/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationInfo.java rename to org.restlet/src/main/java/org/restlet/engine/resource/AnnotationInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationUtils.java b/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationUtils.java rename to org.restlet/src/main/java/org/restlet/engine/resource/AnnotationUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/ClientInvocationHandler.java b/org.restlet/src/main/java/org/restlet/engine/resource/ClientInvocationHandler.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/ClientInvocationHandler.java rename to org.restlet/src/main/java/org/restlet/engine/resource/ClientInvocationHandler.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java b/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java rename to org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/ThrowableAnnotationInfo.java b/org.restlet/src/main/java/org/restlet/engine/resource/ThrowableAnnotationInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/ThrowableAnnotationInfo.java rename to org.restlet/src/main/java/org/restlet/engine/resource/ThrowableAnnotationInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/VariantInfo.java b/org.restlet/src/main/java/org/restlet/engine/resource/VariantInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/resource/VariantInfo.java rename to org.restlet/src/main/java/org/restlet/engine/resource/VariantInfo.java diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/resource/package.html b/org.restlet/src/main/java/org/restlet/engine/resource/package.html similarity index 100% rename from org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/resource/package.html rename to org.restlet/src/main/java/org/restlet/engine/resource/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/AuthenticatorHelper.java b/org.restlet/src/main/java/org/restlet/engine/security/AuthenticatorHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/AuthenticatorHelper.java rename to org.restlet/src/main/java/org/restlet/engine/security/AuthenticatorHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/AuthenticatorUtils.java b/org.restlet/src/main/java/org/restlet/engine/security/AuthenticatorUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/AuthenticatorUtils.java rename to org.restlet/src/main/java/org/restlet/engine/security/AuthenticatorUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/HttpBasicHelper.java b/org.restlet/src/main/java/org/restlet/engine/security/HttpBasicHelper.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/HttpBasicHelper.java rename to org.restlet/src/main/java/org/restlet/engine/security/HttpBasicHelper.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/RoleMapping.java b/org.restlet/src/main/java/org/restlet/engine/security/RoleMapping.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/RoleMapping.java rename to org.restlet/src/main/java/org/restlet/engine/security/RoleMapping.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/package.html b/org.restlet/src/main/java/org/restlet/engine/security/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/security/package.html rename to org.restlet/src/main/java/org/restlet/engine/security/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/DefaultSslContext.java b/org.restlet/src/main/java/org/restlet/engine/ssl/DefaultSslContext.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/DefaultSslContext.java rename to org.restlet/src/main/java/org/restlet/engine/ssl/DefaultSslContext.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/DefaultSslContextFactory.java b/org.restlet/src/main/java/org/restlet/engine/ssl/DefaultSslContextFactory.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/DefaultSslContextFactory.java rename to org.restlet/src/main/java/org/restlet/engine/ssl/DefaultSslContextFactory.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/SslContextFactory.java b/org.restlet/src/main/java/org/restlet/engine/ssl/SslContextFactory.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/SslContextFactory.java rename to org.restlet/src/main/java/org/restlet/engine/ssl/SslContextFactory.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/SslUtils.java b/org.restlet/src/main/java/org/restlet/engine/ssl/SslUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/SslUtils.java rename to org.restlet/src/main/java/org/restlet/engine/ssl/SslUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslContextSpi.java b/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslContextSpi.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslContextSpi.java rename to org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslContextSpi.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslServerSocketFactory.java b/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslServerSocketFactory.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslServerSocketFactory.java rename to org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslServerSocketFactory.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslSocketFactory.java b/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslSocketFactory.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslSocketFactory.java rename to org.restlet/src/main/java/org/restlet/engine/ssl/WrapperSslSocketFactory.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/package.html b/org.restlet/src/main/java/org/restlet/engine/ssl/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/ssl/package.html rename to org.restlet/src/main/java/org/restlet/engine/ssl/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/AlphaNumericComparator.java b/org.restlet/src/main/java/org/restlet/engine/util/AlphaNumericComparator.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/AlphaNumericComparator.java rename to org.restlet/src/main/java/org/restlet/engine/util/AlphaNumericComparator.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/AlphabeticalComparator.java b/org.restlet/src/main/java/org/restlet/engine/util/AlphabeticalComparator.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/AlphabeticalComparator.java rename to org.restlet/src/main/java/org/restlet/engine/util/AlphabeticalComparator.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/BeanInfoUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/BeanInfoUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/BeanInfoUtils.java rename to org.restlet/src/main/java/org/restlet/engine/util/BeanInfoUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/CallResolver.java b/org.restlet/src/main/java/org/restlet/engine/util/CallResolver.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/CallResolver.java rename to org.restlet/src/main/java/org/restlet/engine/util/CallResolver.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/CaseInsensitiveHashSet.java b/org.restlet/src/main/java/org/restlet/engine/util/CaseInsensitiveHashSet.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/CaseInsensitiveHashSet.java rename to org.restlet/src/main/java/org/restlet/engine/util/CaseInsensitiveHashSet.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java b/org.restlet/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java rename to org.restlet/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ChildContext.java b/org.restlet/src/main/java/org/restlet/engine/util/ChildContext.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ChildContext.java rename to org.restlet/src/main/java/org/restlet/engine/util/ChildContext.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ContextualRunnable.java b/org.restlet/src/main/java/org/restlet/engine/util/ContextualRunnable.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ContextualRunnable.java rename to org.restlet/src/main/java/org/restlet/engine/util/ContextualRunnable.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/DateUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/DateUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/DateUtils.java rename to org.restlet/src/main/java/org/restlet/engine/util/DateUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/DefaultSaxHandler.java b/org.restlet/src/main/java/org/restlet/engine/util/DefaultSaxHandler.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/DefaultSaxHandler.java rename to org.restlet/src/main/java/org/restlet/engine/util/DefaultSaxHandler.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/EngineClassLoader.java b/org.restlet/src/main/java/org/restlet/engine/util/EngineClassLoader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/EngineClassLoader.java rename to org.restlet/src/main/java/org/restlet/engine/util/EngineClassLoader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/FormReader.java b/org.restlet/src/main/java/org/restlet/engine/util/FormReader.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/FormReader.java rename to org.restlet/src/main/java/org/restlet/engine/util/FormReader.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/FormUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/FormUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/FormUtils.java rename to org.restlet/src/main/java/org/restlet/engine/util/FormUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ImmutableDate.java b/org.restlet/src/main/java/org/restlet/engine/util/ImmutableDate.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ImmutableDate.java rename to org.restlet/src/main/java/org/restlet/engine/util/ImmutableDate.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/InternetDateFormat.java b/org.restlet/src/main/java/org/restlet/engine/util/InternetDateFormat.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/InternetDateFormat.java rename to org.restlet/src/main/java/org/restlet/engine/util/InternetDateFormat.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ListUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/ListUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ListUtils.java rename to org.restlet/src/main/java/org/restlet/engine/util/ListUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/MapResolver.java b/org.restlet/src/main/java/org/restlet/engine/util/MapResolver.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/MapResolver.java rename to org.restlet/src/main/java/org/restlet/engine/util/MapResolver.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/Pool.java b/org.restlet/src/main/java/org/restlet/engine/util/Pool.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/Pool.java rename to org.restlet/src/main/java/org/restlet/engine/util/Pool.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ReferenceUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/ReferenceUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/ReferenceUtils.java rename to org.restlet/src/main/java/org/restlet/engine/util/ReferenceUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/SetUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/SetUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/SetUtils.java rename to org.restlet/src/main/java/org/restlet/engine/util/SetUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/StringUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/StringUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/StringUtils.java rename to org.restlet/src/main/java/org/restlet/engine/util/StringUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/SystemUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/SystemUtils.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/SystemUtils.java rename to org.restlet/src/main/java/org/restlet/engine/util/SystemUtils.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/TemplateDispatcher.java b/org.restlet/src/main/java/org/restlet/engine/util/TemplateDispatcher.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/TemplateDispatcher.java rename to org.restlet/src/main/java/org/restlet/engine/util/TemplateDispatcher.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/WrapperScheduledExecutorService.java b/org.restlet/src/main/java/org/restlet/engine/util/WrapperScheduledExecutorService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/engine/util/WrapperScheduledExecutorService.java rename to org.restlet/src/main/java/org/restlet/engine/util/WrapperScheduledExecutorService.java diff --git a/org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/package.html b/org.restlet/src/main/java/org/restlet/engine/util/package.html similarity index 100% rename from org.restlet.gwt/org.restlet.gwt/src/main/java/org/restlet/client/engine/util/package.html rename to org.restlet/src/main/java/org/restlet/engine/util/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/package.html b/org.restlet/src/main/java/org/restlet/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/package.html rename to org.restlet/src/main/java/org/restlet/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/AppendableRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/AppendableRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/AppendableRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/AppendableRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/BufferingRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/BufferingRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/BufferingRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/BufferingRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ByteArrayRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/ByteArrayRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ByteArrayRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/ByteArrayRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/CharacterRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/CharacterRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/CharacterRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/CharacterRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/DigesterRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/DigesterRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/DigesterRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/DigesterRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/EmptyRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/EmptyRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/EmptyRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/EmptyRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/FileRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/FileRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/FileRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/FileRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/InputRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/InputRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/InputRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/InputRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ObjectRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/ObjectRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ObjectRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/ObjectRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/OutputRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/OutputRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/OutputRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/OutputRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ReaderRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/ReaderRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/ReaderRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/ReaderRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/Representation.java b/org.restlet/src/main/java/org/restlet/representation/Representation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/Representation.java rename to org.restlet/src/main/java/org/restlet/representation/Representation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/RepresentationInfo.java b/org.restlet/src/main/java/org/restlet/representation/RepresentationInfo.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/RepresentationInfo.java rename to org.restlet/src/main/java/org/restlet/representation/RepresentationInfo.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/StreamRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/StreamRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/StreamRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/StreamRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/StringRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/StringRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/StringRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/StringRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/Variant.java b/org.restlet/src/main/java/org/restlet/representation/Variant.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/Variant.java rename to org.restlet/src/main/java/org/restlet/representation/Variant.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/WriterRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/WriterRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/WriterRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/WriterRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/representation/package.html b/org.restlet/src/main/java/org/restlet/representation/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/representation/package.html rename to org.restlet/src/main/java/org/restlet/representation/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/ClientProxy.java b/org.restlet/src/main/java/org/restlet/resource/ClientProxy.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/ClientProxy.java rename to org.restlet/src/main/java/org/restlet/resource/ClientProxy.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/ClientResource.java b/org.restlet/src/main/java/org/restlet/resource/ClientResource.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/ClientResource.java rename to org.restlet/src/main/java/org/restlet/resource/ClientResource.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Delete.java b/org.restlet/src/main/java/org/restlet/resource/Delete.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Delete.java rename to org.restlet/src/main/java/org/restlet/resource/Delete.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Directory.java b/org.restlet/src/main/java/org/restlet/resource/Directory.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Directory.java rename to org.restlet/src/main/java/org/restlet/resource/Directory.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Finder.java b/org.restlet/src/main/java/org/restlet/resource/Finder.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Finder.java rename to org.restlet/src/main/java/org/restlet/resource/Finder.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Get.java b/org.restlet/src/main/java/org/restlet/resource/Get.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Get.java rename to org.restlet/src/main/java/org/restlet/resource/Get.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Options.java b/org.restlet/src/main/java/org/restlet/resource/Options.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Options.java rename to org.restlet/src/main/java/org/restlet/resource/Options.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Patch.java b/org.restlet/src/main/java/org/restlet/resource/Patch.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Patch.java rename to org.restlet/src/main/java/org/restlet/resource/Patch.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Post.java b/org.restlet/src/main/java/org/restlet/resource/Post.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Post.java rename to org.restlet/src/main/java/org/restlet/resource/Post.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Put.java b/org.restlet/src/main/java/org/restlet/resource/Put.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Put.java rename to org.restlet/src/main/java/org/restlet/resource/Put.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Resource.java b/org.restlet/src/main/java/org/restlet/resource/Resource.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Resource.java rename to org.restlet/src/main/java/org/restlet/resource/Resource.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/ResourceException.java b/org.restlet/src/main/java/org/restlet/resource/ResourceException.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/ResourceException.java rename to org.restlet/src/main/java/org/restlet/resource/ResourceException.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Result.java b/org.restlet/src/main/java/org/restlet/resource/Result.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Result.java rename to org.restlet/src/main/java/org/restlet/resource/Result.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/ServerResource.java b/org.restlet/src/main/java/org/restlet/resource/ServerResource.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/ServerResource.java rename to org.restlet/src/main/java/org/restlet/resource/ServerResource.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Status.java b/org.restlet/src/main/java/org/restlet/resource/Status.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/Status.java rename to org.restlet/src/main/java/org/restlet/resource/Status.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/resource/package.html b/org.restlet/src/main/java/org/restlet/resource/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/resource/package.html rename to org.restlet/src/main/java/org/restlet/resource/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Extractor.java b/org.restlet/src/main/java/org/restlet/routing/Extractor.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Extractor.java rename to org.restlet/src/main/java/org/restlet/routing/Extractor.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Filter.java b/org.restlet/src/main/java/org/restlet/routing/Filter.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Filter.java rename to org.restlet/src/main/java/org/restlet/routing/Filter.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Redirector.java b/org.restlet/src/main/java/org/restlet/routing/Redirector.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Redirector.java rename to org.restlet/src/main/java/org/restlet/routing/Redirector.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Route.java b/org.restlet/src/main/java/org/restlet/routing/Route.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Route.java rename to org.restlet/src/main/java/org/restlet/routing/Route.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Router.java b/org.restlet/src/main/java/org/restlet/routing/Router.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Router.java rename to org.restlet/src/main/java/org/restlet/routing/Router.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Template.java b/org.restlet/src/main/java/org/restlet/routing/Template.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Template.java rename to org.restlet/src/main/java/org/restlet/routing/Template.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/TemplateRoute.java b/org.restlet/src/main/java/org/restlet/routing/TemplateRoute.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/TemplateRoute.java rename to org.restlet/src/main/java/org/restlet/routing/TemplateRoute.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Validator.java b/org.restlet/src/main/java/org/restlet/routing/Validator.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Validator.java rename to org.restlet/src/main/java/org/restlet/routing/Validator.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Variable.java b/org.restlet/src/main/java/org/restlet/routing/Variable.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/Variable.java rename to org.restlet/src/main/java/org/restlet/routing/Variable.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/VirtualHost.java b/org.restlet/src/main/java/org/restlet/routing/VirtualHost.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/VirtualHost.java rename to org.restlet/src/main/java/org/restlet/routing/VirtualHost.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/routing/package.html b/org.restlet/src/main/java/org/restlet/routing/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/routing/package.html rename to org.restlet/src/main/java/org/restlet/routing/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/Authenticator.java b/org.restlet/src/main/java/org/restlet/security/Authenticator.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/Authenticator.java rename to org.restlet/src/main/java/org/restlet/security/Authenticator.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/Authorizer.java b/org.restlet/src/main/java/org/restlet/security/Authorizer.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/Authorizer.java rename to org.restlet/src/main/java/org/restlet/security/Authorizer.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/CertificateAuthenticator.java b/org.restlet/src/main/java/org/restlet/security/CertificateAuthenticator.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/CertificateAuthenticator.java rename to org.restlet/src/main/java/org/restlet/security/CertificateAuthenticator.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/ChallengeAuthenticator.java b/org.restlet/src/main/java/org/restlet/security/ChallengeAuthenticator.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/ChallengeAuthenticator.java rename to org.restlet/src/main/java/org/restlet/security/ChallengeAuthenticator.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/ConfidentialAuthorizer.java b/org.restlet/src/main/java/org/restlet/security/ConfidentialAuthorizer.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/ConfidentialAuthorizer.java rename to org.restlet/src/main/java/org/restlet/security/ConfidentialAuthorizer.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/Enroler.java b/org.restlet/src/main/java/org/restlet/security/Enroler.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/Enroler.java rename to org.restlet/src/main/java/org/restlet/security/Enroler.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/Group.java b/org.restlet/src/main/java/org/restlet/security/Group.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/Group.java rename to org.restlet/src/main/java/org/restlet/security/Group.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/LocalVerifier.java b/org.restlet/src/main/java/org/restlet/security/LocalVerifier.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/LocalVerifier.java rename to org.restlet/src/main/java/org/restlet/security/LocalVerifier.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/MapVerifier.java b/org.restlet/src/main/java/org/restlet/security/MapVerifier.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/MapVerifier.java rename to org.restlet/src/main/java/org/restlet/security/MapVerifier.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/MemoryRealm.java b/org.restlet/src/main/java/org/restlet/security/MemoryRealm.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/MemoryRealm.java rename to org.restlet/src/main/java/org/restlet/security/MemoryRealm.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/MethodAuthorizer.java b/org.restlet/src/main/java/org/restlet/security/MethodAuthorizer.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/MethodAuthorizer.java rename to org.restlet/src/main/java/org/restlet/security/MethodAuthorizer.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/Realm.java b/org.restlet/src/main/java/org/restlet/security/Realm.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/Realm.java rename to org.restlet/src/main/java/org/restlet/security/Realm.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/Role.java b/org.restlet/src/main/java/org/restlet/security/Role.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/Role.java rename to org.restlet/src/main/java/org/restlet/security/Role.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/RoleAuthorizer.java b/org.restlet/src/main/java/org/restlet/security/RoleAuthorizer.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/RoleAuthorizer.java rename to org.restlet/src/main/java/org/restlet/security/RoleAuthorizer.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/SecretVerifier.java b/org.restlet/src/main/java/org/restlet/security/SecretVerifier.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/SecretVerifier.java rename to org.restlet/src/main/java/org/restlet/security/SecretVerifier.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/User.java b/org.restlet/src/main/java/org/restlet/security/User.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/User.java rename to org.restlet/src/main/java/org/restlet/security/User.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/Verifier.java b/org.restlet/src/main/java/org/restlet/security/Verifier.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/Verifier.java rename to org.restlet/src/main/java/org/restlet/security/Verifier.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/security/package.html b/org.restlet/src/main/java/org/restlet/security/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/security/package.html rename to org.restlet/src/main/java/org/restlet/security/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/ConnectorService.java b/org.restlet/src/main/java/org/restlet/service/ConnectorService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/ConnectorService.java rename to org.restlet/src/main/java/org/restlet/service/ConnectorService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/ConnegService.java b/org.restlet/src/main/java/org/restlet/service/ConnegService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/ConnegService.java rename to org.restlet/src/main/java/org/restlet/service/ConnegService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/ConverterService.java b/org.restlet/src/main/java/org/restlet/service/ConverterService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/ConverterService.java rename to org.restlet/src/main/java/org/restlet/service/ConverterService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/CorsService.java b/org.restlet/src/main/java/org/restlet/service/CorsService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/CorsService.java rename to org.restlet/src/main/java/org/restlet/service/CorsService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/DecoderService.java b/org.restlet/src/main/java/org/restlet/service/DecoderService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/DecoderService.java rename to org.restlet/src/main/java/org/restlet/service/DecoderService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/EncoderService.java b/org.restlet/src/main/java/org/restlet/service/EncoderService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/EncoderService.java rename to org.restlet/src/main/java/org/restlet/service/EncoderService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/LogService.java b/org.restlet/src/main/java/org/restlet/service/LogService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/LogService.java rename to org.restlet/src/main/java/org/restlet/service/LogService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/MetadataService.java b/org.restlet/src/main/java/org/restlet/service/MetadataService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/MetadataService.java rename to org.restlet/src/main/java/org/restlet/service/MetadataService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/RangeService.java b/org.restlet/src/main/java/org/restlet/service/RangeService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/RangeService.java rename to org.restlet/src/main/java/org/restlet/service/RangeService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/Service.java b/org.restlet/src/main/java/org/restlet/service/Service.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/Service.java rename to org.restlet/src/main/java/org/restlet/service/Service.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/StatusService.java b/org.restlet/src/main/java/org/restlet/service/StatusService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/StatusService.java rename to org.restlet/src/main/java/org/restlet/service/StatusService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/TaskService.java b/org.restlet/src/main/java/org/restlet/service/TaskService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/TaskService.java rename to org.restlet/src/main/java/org/restlet/service/TaskService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/TunnelService.java b/org.restlet/src/main/java/org/restlet/service/TunnelService.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/TunnelService.java rename to org.restlet/src/main/java/org/restlet/service/TunnelService.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/accept-encoding.properties b/org.restlet/src/main/java/org/restlet/service/accept-encoding.properties similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/accept-encoding.properties rename to org.restlet/src/main/java/org/restlet/service/accept-encoding.properties diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/accept.properties b/org.restlet/src/main/java/org/restlet/service/accept.properties similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/accept.properties rename to org.restlet/src/main/java/org/restlet/service/accept.properties diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/service/package.html b/org.restlet/src/main/java/org/restlet/service/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/service/package.html rename to org.restlet/src/main/java/org/restlet/service/package.html diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ClientList.java b/org.restlet/src/main/java/org/restlet/util/ClientList.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/ClientList.java rename to org.restlet/src/main/java/org/restlet/util/ClientList.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/NamedValue.java b/org.restlet/src/main/java/org/restlet/util/NamedValue.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/NamedValue.java rename to org.restlet/src/main/java/org/restlet/util/NamedValue.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/Resolver.java b/org.restlet/src/main/java/org/restlet/util/Resolver.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/Resolver.java rename to org.restlet/src/main/java/org/restlet/util/Resolver.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/RouteList.java b/org.restlet/src/main/java/org/restlet/util/RouteList.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/RouteList.java rename to org.restlet/src/main/java/org/restlet/util/RouteList.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/Series.java b/org.restlet/src/main/java/org/restlet/util/Series.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/Series.java rename to org.restlet/src/main/java/org/restlet/util/Series.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ServerList.java b/org.restlet/src/main/java/org/restlet/util/ServerList.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/ServerList.java rename to org.restlet/src/main/java/org/restlet/util/ServerList.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/ServiceList.java b/org.restlet/src/main/java/org/restlet/util/ServiceList.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/ServiceList.java rename to org.restlet/src/main/java/org/restlet/util/ServiceList.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperList.java b/org.restlet/src/main/java/org/restlet/util/WrapperList.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperList.java rename to org.restlet/src/main/java/org/restlet/util/WrapperList.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperMap.java b/org.restlet/src/main/java/org/restlet/util/WrapperMap.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperMap.java rename to org.restlet/src/main/java/org/restlet/util/WrapperMap.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRepresentation.java b/org.restlet/src/main/java/org/restlet/util/WrapperRepresentation.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRepresentation.java rename to org.restlet/src/main/java/org/restlet/util/WrapperRepresentation.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRequest.java b/org.restlet/src/main/java/org/restlet/util/WrapperRequest.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRequest.java rename to org.restlet/src/main/java/org/restlet/util/WrapperRequest.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperResponse.java b/org.restlet/src/main/java/org/restlet/util/WrapperResponse.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperResponse.java rename to org.restlet/src/main/java/org/restlet/util/WrapperResponse.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRestlet.java b/org.restlet/src/main/java/org/restlet/util/WrapperRestlet.java similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/WrapperRestlet.java rename to org.restlet/src/main/java/org/restlet/util/WrapperRestlet.java diff --git a/org.restlet.java/org.restlet/src/main/java/org/restlet/util/package.html b/org.restlet/src/main/java/org/restlet/util/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/main/java/org/restlet/util/package.html rename to org.restlet/src/main/java/org/restlet/util/package.html diff --git a/org.restlet.java/org.restlet/src/main/resources/META-INF/MANIFEST.MF b/org.restlet/src/main/resources/META-INF/MANIFEST.MF similarity index 100% rename from org.restlet.java/org.restlet/src/main/resources/META-INF/MANIFEST.MF rename to org.restlet/src/main/resources/META-INF/MANIFEST.MF diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/ApplicationContextTestCase.java b/org.restlet/src/test/java/org/restlet/ApplicationContextTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/ApplicationContextTestCase.java rename to org.restlet/src/test/java/org/restlet/ApplicationContextTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java b/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java rename to org.restlet/src/test/java/org/restlet/Bug1145TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/CallTestCase.java b/org.restlet/src/test/java/org/restlet/CallTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/CallTestCase.java rename to org.restlet/src/test/java/org/restlet/CallTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/RestartTestCase.java b/org.restlet/src/test/java/org/restlet/RestartTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/RestartTestCase.java rename to org.restlet/src/test/java/org/restlet/RestartTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/AuthenticationInfoTestCase.java b/org.restlet/src/test/java/org/restlet/data/AuthenticationInfoTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/AuthenticationInfoTestCase.java rename to org.restlet/src/test/java/org/restlet/data/AuthenticationInfoTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/ClientInfoTestCase.java b/org.restlet/src/test/java/org/restlet/data/ClientInfoTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/ClientInfoTestCase.java rename to org.restlet/src/test/java/org/restlet/data/ClientInfoTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/CookieTestCase.java b/org.restlet/src/test/java/org/restlet/data/CookieTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/CookieTestCase.java rename to org.restlet/src/test/java/org/restlet/data/CookieTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/FileClientTestCase.java b/org.restlet/src/test/java/org/restlet/data/FileClientTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/FileClientTestCase.java rename to org.restlet/src/test/java/org/restlet/data/FileClientTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/FileReferenceTestCase.java b/org.restlet/src/test/java/org/restlet/data/FileReferenceTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/FileReferenceTestCase.java rename to org.restlet/src/test/java/org/restlet/data/FileReferenceTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/FormTestCase.java b/org.restlet/src/test/java/org/restlet/data/FormTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/FormTestCase.java rename to org.restlet/src/test/java/org/restlet/data/FormTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/LanguageTestCase.java b/org.restlet/src/test/java/org/restlet/data/LanguageTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/LanguageTestCase.java rename to org.restlet/src/test/java/org/restlet/data/LanguageTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/MediaTypeTestCase.java b/org.restlet/src/test/java/org/restlet/data/MediaTypeTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/MediaTypeTestCase.java rename to org.restlet/src/test/java/org/restlet/data/MediaTypeTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/MethodTestCase.java b/org.restlet/src/test/java/org/restlet/data/MethodTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/MethodTestCase.java rename to org.restlet/src/test/java/org/restlet/data/MethodTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/ProductTokenTestCase.java b/org.restlet/src/test/java/org/restlet/data/ProductTokenTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/ProductTokenTestCase.java rename to org.restlet/src/test/java/org/restlet/data/ProductTokenTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/RangeTestCase.java b/org.restlet/src/test/java/org/restlet/data/RangeTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/RangeTestCase.java rename to org.restlet/src/test/java/org/restlet/data/RangeTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/RecipientInfoTestCase.java b/org.restlet/src/test/java/org/restlet/data/RecipientInfoTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/RecipientInfoTestCase.java rename to org.restlet/src/test/java/org/restlet/data/RecipientInfoTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/ReferenceTestCase.java b/org.restlet/src/test/java/org/restlet/data/ReferenceTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/ReferenceTestCase.java rename to org.restlet/src/test/java/org/restlet/data/ReferenceTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/RiapConnectorsTestCase.java b/org.restlet/src/test/java/org/restlet/data/RiapConnectorsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/RiapConnectorsTestCase.java rename to org.restlet/src/test/java/org/restlet/data/RiapConnectorsTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/RiapTestCase.java b/org.restlet/src/test/java/org/restlet/data/RiapTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/RiapTestCase.java rename to org.restlet/src/test/java/org/restlet/data/RiapTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/StatusTestCase.java b/org.restlet/src/test/java/org/restlet/data/StatusTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/StatusTestCase.java rename to org.restlet/src/test/java/org/restlet/data/StatusTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/TagTestCase.java b/org.restlet/src/test/java/org/restlet/data/TagTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/TagTestCase.java rename to org.restlet/src/test/java/org/restlet/data/TagTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/data/ZipClientTestCase.java b/org.restlet/src/test/java/org/restlet/data/ZipClientTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/data/ZipClientTestCase.java rename to org.restlet/src/test/java/org/restlet/data/ZipClientTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/EngineTest.java b/org.restlet/src/test/java/org/restlet/engine/EngineTest.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/EngineTest.java rename to org.restlet/src/test/java/org/restlet/engine/EngineTest.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/application/CorsResponseFilterTestCase.java b/org.restlet/src/test/java/org/restlet/engine/application/CorsResponseFilterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/application/CorsResponseFilterTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/application/CorsResponseFilterTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/application/RangeRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/engine/application/RangeRepresentationTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/application/RangeRepresentationTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/application/RangeRepresentationTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/application/TunnelFilterTestCase.java b/org.restlet/src/test/java/org/restlet/engine/application/TunnelFilterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/application/TunnelFilterTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/application/TunnelFilterTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/ContentTypeTestCase.java b/org.restlet/src/test/java/org/restlet/engine/header/ContentTypeTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/ContentTypeTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/header/ContentTypeTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/CookieReaderTestCase.java b/org.restlet/src/test/java/org/restlet/engine/header/CookieReaderTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/CookieReaderTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/header/CookieReaderTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/DispositionReaderTestCase.java b/org.restlet/src/test/java/org/restlet/engine/header/DispositionReaderTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/DispositionReaderTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/header/DispositionReaderTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/DispositionWriterTestCase.java b/org.restlet/src/test/java/org/restlet/engine/header/DispositionWriterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/DispositionWriterTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/header/DispositionWriterTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/HeaderTestCase.java b/org.restlet/src/test/java/org/restlet/engine/header/HeaderTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/HeaderTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/header/HeaderTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/HeaderUtilsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/header/HeaderUtilsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/HeaderUtilsTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/header/HeaderUtilsTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/PreferenceReaderTestCase.java b/org.restlet/src/test/java/org/restlet/engine/header/PreferenceReaderTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/PreferenceReaderTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/header/PreferenceReaderTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/RangeReaderTestCase.java b/org.restlet/src/test/java/org/restlet/engine/header/RangeReaderTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/header/RangeReaderTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/header/RangeReaderTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/io/IoUtilsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/io/IoUtilsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/io/IoUtilsTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/io/IoUtilsTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/io/ReaderInputStreamTestCase.java b/org.restlet/src/test/java/org/restlet/engine/io/ReaderInputStreamTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/io/ReaderInputStreamTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/io/ReaderInputStreamTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/io/UnclosableInputStreamTestCase.java b/org.restlet/src/test/java/org/restlet/engine/io/UnclosableInputStreamTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/io/UnclosableInputStreamTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/io/UnclosableInputStreamTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/io/UnclosableOutputStreamTestCase.java b/org.restlet/src/test/java/org/restlet/engine/io/UnclosableOutputStreamTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/io/UnclosableOutputStreamTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/io/UnclosableOutputStreamTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/resource/AnnotationUtilsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/resource/AnnotationUtilsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/resource/AnnotationUtilsTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/resource/AnnotationUtilsTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/util/AlphaNumericComparatorTestCase.java b/org.restlet/src/test/java/org/restlet/engine/util/AlphaNumericComparatorTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/util/AlphaNumericComparatorTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/util/AlphaNumericComparatorTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/util/DateUtilsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/util/DateUtilsTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/util/DateUtilsTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/util/DateUtilsTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/engine/util/HtmlEncodingTestCase.java b/org.restlet/src/test/java/org/restlet/engine/util/HtmlEncodingTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/engine/util/HtmlEncodingTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/util/HtmlEncodingTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/representation/AppendableRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/representation/AppendableRepresentationTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/representation/AppendableRepresentationTestCase.java rename to org.restlet/src/test/java/org/restlet/representation/AppendableRepresentationTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java rename to org.restlet/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java rename to org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AbstractAnnotatedResourceTestCase.java b/org.restlet/src/test/java/org/restlet/resource/AbstractAnnotatedResourceTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AbstractAnnotatedResourceTestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AbstractAnnotatedResourceTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AbstractAnnotatedResourceWithFinderTestCase.java b/org.restlet/src/test/java/org/restlet/resource/AbstractAnnotatedResourceWithFinderTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AbstractAnnotatedResourceWithFinderTestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AbstractAnnotatedResourceWithFinderTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AbstractGenericAnnotatedServerResource.java b/org.restlet/src/test/java/org/restlet/resource/AbstractGenericAnnotatedServerResource.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AbstractGenericAnnotatedServerResource.java rename to org.restlet/src/test/java/org/restlet/resource/AbstractGenericAnnotatedServerResource.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource01TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource01TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource01TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource01TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource02TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource02TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource02TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource02TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource03TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource03TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource03TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource03TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource04TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource04TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource04TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource04TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource05TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource05TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource05TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource05TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource06TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource06TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource06TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource06TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource07TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource07TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource07TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource07TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource08TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource08TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource08TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource08TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource12TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource12TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource12TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource12TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource13TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource13TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource13TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource13TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource14TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource14TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource14TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource14TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource15OkTestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource15OkTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource15OkTestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource15OkTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource15TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource15TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource15TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource15TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource16TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource16TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource16TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource16TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource17TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource17TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource17TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource17TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource18TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource18TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource18TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource18TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource20TestCase.java b/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource20TestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/AnnotatedResource20TestCase.java rename to org.restlet/src/test/java/org/restlet/resource/AnnotatedResource20TestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/DirectoryTestCase.java b/org.restlet/src/test/java/org/restlet/resource/DirectoryTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/DirectoryTestCase.java rename to org.restlet/src/test/java/org/restlet/resource/DirectoryTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/GenericAnnotatedServerResource.java b/org.restlet/src/test/java/org/restlet/resource/GenericAnnotatedServerResource.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/GenericAnnotatedServerResource.java rename to org.restlet/src/test/java/org/restlet/resource/GenericAnnotatedServerResource.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/GenericServerResource16.java b/org.restlet/src/test/java/org/restlet/resource/GenericServerResource16.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/GenericServerResource16.java rename to org.restlet/src/test/java/org/restlet/resource/GenericServerResource16.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/GenericServerResource17.java b/org.restlet/src/test/java/org/restlet/resource/GenericServerResource17.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/GenericServerResource17.java rename to org.restlet/src/test/java/org/restlet/resource/GenericServerResource17.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyBean.java b/org.restlet/src/test/java/org/restlet/resource/MyBean.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyBean.java rename to org.restlet/src/test/java/org/restlet/resource/MyBean.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyException01.java b/org.restlet/src/test/java/org/restlet/resource/MyException01.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyException01.java rename to org.restlet/src/test/java/org/restlet/resource/MyException01.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyException02.java b/org.restlet/src/test/java/org/restlet/resource/MyException02.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyException02.java rename to org.restlet/src/test/java/org/restlet/resource/MyException02.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource01.java b/org.restlet/src/test/java/org/restlet/resource/MyResource01.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource01.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource01.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource02.java b/org.restlet/src/test/java/org/restlet/resource/MyResource02.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource02.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource02.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource03.java b/org.restlet/src/test/java/org/restlet/resource/MyResource03.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource03.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource03.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource04.java b/org.restlet/src/test/java/org/restlet/resource/MyResource04.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource04.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource04.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource05.java b/org.restlet/src/test/java/org/restlet/resource/MyResource05.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource05.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource05.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource06.java b/org.restlet/src/test/java/org/restlet/resource/MyResource06.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource06.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource06.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource07.java b/org.restlet/src/test/java/org/restlet/resource/MyResource07.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource07.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource07.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource08.java b/org.restlet/src/test/java/org/restlet/resource/MyResource08.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource08.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource08.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource12.java b/org.restlet/src/test/java/org/restlet/resource/MyResource12.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource12.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource12.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource17.java b/org.restlet/src/test/java/org/restlet/resource/MyResource17.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource17.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource17.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource20.java b/org.restlet/src/test/java/org/restlet/resource/MyResource20.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyResource20.java rename to org.restlet/src/test/java/org/restlet/resource/MyResource20.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource01.java b/org.restlet/src/test/java/org/restlet/resource/MyServerResource01.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource01.java rename to org.restlet/src/test/java/org/restlet/resource/MyServerResource01.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource12.java b/org.restlet/src/test/java/org/restlet/resource/MyServerResource12.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource12.java rename to org.restlet/src/test/java/org/restlet/resource/MyServerResource12.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource15.java b/org.restlet/src/test/java/org/restlet/resource/MyServerResource15.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource15.java rename to org.restlet/src/test/java/org/restlet/resource/MyServerResource15.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource15Ok.java b/org.restlet/src/test/java/org/restlet/resource/MyServerResource15Ok.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource15Ok.java rename to org.restlet/src/test/java/org/restlet/resource/MyServerResource15Ok.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource16.java b/org.restlet/src/test/java/org/restlet/resource/MyServerResource16.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource16.java rename to org.restlet/src/test/java/org/restlet/resource/MyServerResource16.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource17.java b/org.restlet/src/test/java/org/restlet/resource/MyServerResource17.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource17.java rename to org.restlet/src/test/java/org/restlet/resource/MyServerResource17.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource18.java b/org.restlet/src/test/java/org/restlet/resource/MyServerResource18.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource18.java rename to org.restlet/src/test/java/org/restlet/resource/MyServerResource18.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource20.java b/org.restlet/src/test/java/org/restlet/resource/MyServerResource20.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/resource/MyServerResource20.java rename to org.restlet/src/test/java/org/restlet/resource/MyServerResource20.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/AbstractFilterTestCase.java b/org.restlet/src/test/java/org/restlet/routing/AbstractFilterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/AbstractFilterTestCase.java rename to org.restlet/src/test/java/org/restlet/routing/AbstractFilterTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/FilterTestCase.java b/org.restlet/src/test/java/org/restlet/routing/FilterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/FilterTestCase.java rename to org.restlet/src/test/java/org/restlet/routing/FilterTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/MockFilter.java b/org.restlet/src/test/java/org/restlet/routing/MockFilter.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/MockFilter.java rename to org.restlet/src/test/java/org/restlet/routing/MockFilter.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/MockRestlet.java b/org.restlet/src/test/java/org/restlet/routing/MockRestlet.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/MockRestlet.java rename to org.restlet/src/test/java/org/restlet/routing/MockRestlet.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/RedirectTestCase.java b/org.restlet/src/test/java/org/restlet/routing/RedirectTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/RedirectTestCase.java rename to org.restlet/src/test/java/org/restlet/routing/RedirectTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/RouteListTestCase.java b/org.restlet/src/test/java/org/restlet/routing/RouteListTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/RouteListTestCase.java rename to org.restlet/src/test/java/org/restlet/routing/RouteListTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/TemplateTestCase.java b/org.restlet/src/test/java/org/restlet/routing/TemplateTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/TemplateTestCase.java rename to org.restlet/src/test/java/org/restlet/routing/TemplateTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/TraceRestlet.java b/org.restlet/src/test/java/org/restlet/routing/TraceRestlet.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/TraceRestlet.java rename to org.restlet/src/test/java/org/restlet/routing/TraceRestlet.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/routing/ValidatorTestCase.java b/org.restlet/src/test/java/org/restlet/routing/ValidatorTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/routing/ValidatorTestCase.java rename to org.restlet/src/test/java/org/restlet/routing/ValidatorTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/security/HelloWorldRestlet.java b/org.restlet/src/test/java/org/restlet/security/HelloWorldRestlet.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/security/HelloWorldRestlet.java rename to org.restlet/src/test/java/org/restlet/security/HelloWorldRestlet.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/security/HttpBasicTestCase.java b/org.restlet/src/test/java/org/restlet/security/HttpBasicTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/security/HttpBasicTestCase.java rename to org.restlet/src/test/java/org/restlet/security/HttpBasicTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/security/MemoryRealmTest.java b/org.restlet/src/test/java/org/restlet/security/MemoryRealmTest.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/security/MemoryRealmTest.java rename to org.restlet/src/test/java/org/restlet/security/MemoryRealmTest.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/security/RoleTestCase.java b/org.restlet/src/test/java/org/restlet/security/RoleTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/security/RoleTestCase.java rename to org.restlet/src/test/java/org/restlet/security/RoleTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/security/SaasApplication.java b/org.restlet/src/test/java/org/restlet/security/SaasApplication.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/security/SaasApplication.java rename to org.restlet/src/test/java/org/restlet/security/SaasApplication.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/security/SaasComponent.java b/org.restlet/src/test/java/org/restlet/security/SaasComponent.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/security/SaasComponent.java rename to org.restlet/src/test/java/org/restlet/security/SaasComponent.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/security/SecurityTestCase.java b/org.restlet/src/test/java/org/restlet/security/SecurityTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/security/SecurityTestCase.java rename to org.restlet/src/test/java/org/restlet/security/SecurityTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/security/package.html b/org.restlet/src/test/java/org/restlet/security/package.html similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/security/package.html rename to org.restlet/src/test/java/org/restlet/security/package.html diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/service/ConnegServiceTestCase.java b/org.restlet/src/test/java/org/restlet/service/ConnegServiceTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/service/ConnegServiceTestCase.java rename to org.restlet/src/test/java/org/restlet/service/ConnegServiceTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/service/MetadataServiceTestCase.java b/org.restlet/src/test/java/org/restlet/service/MetadataServiceTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/service/MetadataServiceTestCase.java rename to org.restlet/src/test/java/org/restlet/service/MetadataServiceTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/service/StatusServiceTestCase.java b/org.restlet/src/test/java/org/restlet/service/StatusServiceTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/service/StatusServiceTestCase.java rename to org.restlet/src/test/java/org/restlet/service/StatusServiceTestCase.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/service/UserAgentTestResource.java b/org.restlet/src/test/java/org/restlet/service/UserAgentTestResource.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/service/UserAgentTestResource.java rename to org.restlet/src/test/java/org/restlet/service/UserAgentTestResource.java diff --git a/org.restlet.java/org.restlet/src/test/java/org/restlet/service/UserAgentTunnelFilterTestCase.java b/org.restlet/src/test/java/org/restlet/service/UserAgentTunnelFilterTestCase.java similarity index 100% rename from org.restlet.java/org.restlet/src/test/java/org/restlet/service/UserAgentTunnelFilterTestCase.java rename to org.restlet/src/test/java/org/restlet/service/UserAgentTunnelFilterTestCase.java diff --git a/org.restlet.gwt/org.restlet.gwt/src/test/resources/maven-version.properties b/org.restlet/src/test/resources/maven-version.properties similarity index 100% rename from org.restlet.gwt/org.restlet.gwt/src/test/resources/maven-version.properties rename to org.restlet/src/test/resources/maven-version.properties diff --git a/pom.xml b/pom.xml index 630c2df64e..2bc7c49c70 100644 --- a/pom.xml +++ b/pom.xml @@ -52,28 +52,39 @@ 2.3.34 2.13.1 - 7.0.0 - 2.12.2 - 2.12.2 - 3.0.12 2.19.1 - 4.0.0 - 4.0.0 2.14.0 12.0.22 20250517 1.2.17 1.3 4.3.1 - 6.0.0 2.0.17 6.2.8 + 6.0.0 3.1.3.RELEASE 2.4.1 5.13.1 + + org.restlet + org.restlet.ext.crypto + org.restlet.ext.freemarker + org.restlet.ext.gson + org.restlet.ext.jaas + org.restlet.ext.jackson + org.restlet.ext.jetty + org.restlet.ext.json + org.restlet.ext.servlet + org.restlet.ext.slf4j + org.restlet.ext.spring + org.restlet.ext.thymeleaf + org.restlet.ext.velocity + org.restlet.ext.xml + + github @@ -236,11 +247,6 @@ - - org.restlet.java - org.restlet.gwt - - diff --git a/readme.md b/readme.md index 407367f2d8..e0a6fc2c9a 100644 --- a/readme.md +++ b/readme.md @@ -17,10 +17,10 @@ While Restlet applications can still be deployed in Servlet containers, they can To learn more about Restlet Framework, please have a look at the following resources: * [Download](https://restlet.talend.com/downloads/current/) -* [Tutorials](https://restlet.talend.com/documentation/tutorials/2.6/) -* [User Guide](https://restlet.talend.com/documentation/user-guide/2.6/) -* [JavaDocs](https://restlet.talend.com/documentation/javadocs/2.6/) -* [Change Log](https://restlet.talend.com/documentation/2.6/changelog) +* [Tutorials](https://restlet.talend.com/documentation/tutorials/2.7/) +* [User Guide](https://restlet.talend.com/documentation/user-guide/2.7/) +* [JavaDocs](https://restlet.talend.com/documentation/javadocs/2.7/) +* [Change Log](https://restlet.talend.com/documentation/2.7/changelog) * [Issues](https://github.com/restlet/restlet-framework-java/issues) * [Discussions](https://github.com/restlet/restlet-framework-java/discussions) * [Stack Overflow](http://stackoverflow.com/questions/tagged/restlet) From 5194d267f4d1982e7896f826f67ab49c8ec096ac Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sat, 21 Jun 2025 15:25:33 +0200 Subject: [PATCH 03/22] Bumped version 2.7.0-m1 --- changes.md | 2 +- org.restlet.ext.crypto/pom.xml | 2 +- org.restlet.ext.freemarker/pom.xml | 2 +- org.restlet.ext.gson/pom.xml | 2 +- org.restlet.ext.jaas/pom.xml | 2 +- org.restlet.ext.jackson/pom.xml | 2 +- org.restlet.ext.jetty/pom.xml | 2 +- org.restlet.ext.json/pom.xml | 2 +- org.restlet.ext.servlet/pom.xml | 2 +- org.restlet.ext.slf4j/pom.xml | 2 +- org.restlet.ext.spring/pom.xml | 2 +- org.restlet.ext.thymeleaf/pom.xml | 2 +- org.restlet.ext.velocity/pom.xml | 2 +- org.restlet.ext.xml/pom.xml | 2 +- org.restlet/pom.xml | 2 +- org.restlet/src/main/java/org/restlet/engine/Engine.java | 2 +- pom.xml | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/changes.md b/changes.md index b41f39daa4..3c14ec9747 100644 --- a/changes.md +++ b/changes.md @@ -1,7 +1,7 @@ Changes log =========== -- 2.7 Milestone 1 (??-06-2025) +- 2.7 Milestone 1 (21-06-2025) - Misc - Remove deprecated extension Atom, Guice, GWT, JAXB, OData - Remove edition GWT \ No newline at end of file diff --git a/org.restlet.ext.crypto/pom.xml b/org.restlet.ext.crypto/pom.xml index 36b0448377..f45b227a72 100644 --- a/org.restlet.ext.crypto/pom.xml +++ b/org.restlet.ext.crypto/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.freemarker/pom.xml b/org.restlet.ext.freemarker/pom.xml index 2a9f036de3..21d808213f 100644 --- a/org.restlet.ext.freemarker/pom.xml +++ b/org.restlet.ext.freemarker/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.gson/pom.xml b/org.restlet.ext.gson/pom.xml index a63298ec40..99853f07c4 100644 --- a/org.restlet.ext.gson/pom.xml +++ b/org.restlet.ext.gson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.jaas/pom.xml b/org.restlet.ext.jaas/pom.xml index 02cbc42dc9..3631bbea22 100644 --- a/org.restlet.ext.jaas/pom.xml +++ b/org.restlet.ext.jaas/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.jackson/pom.xml b/org.restlet.ext.jackson/pom.xml index 8bb4505f79..352daf6747 100644 --- a/org.restlet.ext.jackson/pom.xml +++ b/org.restlet.ext.jackson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.jetty/pom.xml b/org.restlet.ext.jetty/pom.xml index bcc9a40ba2..a4b2803c5d 100644 --- a/org.restlet.ext.jetty/pom.xml +++ b/org.restlet.ext.jetty/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.json/pom.xml b/org.restlet.ext.json/pom.xml index 60aca3af9c..28e2dc2207 100644 --- a/org.restlet.ext.json/pom.xml +++ b/org.restlet.ext.json/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.servlet/pom.xml b/org.restlet.ext.servlet/pom.xml index 4604892819..1ea7deeeb9 100644 --- a/org.restlet.ext.servlet/pom.xml +++ b/org.restlet.ext.servlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.slf4j/pom.xml b/org.restlet.ext.slf4j/pom.xml index 04cc137b84..e6a703eff2 100644 --- a/org.restlet.ext.slf4j/pom.xml +++ b/org.restlet.ext.slf4j/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.spring/pom.xml b/org.restlet.ext.spring/pom.xml index 81f0e5338c..4489f79572 100644 --- a/org.restlet.ext.spring/pom.xml +++ b/org.restlet.ext.spring/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.thymeleaf/pom.xml b/org.restlet.ext.thymeleaf/pom.xml index 4f55c634a9..a078d1f931 100644 --- a/org.restlet.ext.thymeleaf/pom.xml +++ b/org.restlet.ext.thymeleaf/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.velocity/pom.xml b/org.restlet.ext.velocity/pom.xml index 143e0d805b..09d1700e3e 100644 --- a/org.restlet.ext.velocity/pom.xml +++ b/org.restlet.ext.velocity/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet.ext.xml/pom.xml b/org.restlet.ext.xml/pom.xml index 4b85af553a..7b2fb83357 100644 --- a/org.restlet.ext.xml/pom.xml +++ b/org.restlet.ext.xml/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index 90a515c9c2..fbaa4989fd 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 ../pom.xml diff --git a/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java index e6b5bdc7ed..b4383abeac 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -90,7 +90,7 @@ public class Engine { public static final String MINOR_NUMBER = "7"; /** Release number. */ - public static final String RELEASE_NUMBER = "-SNAPSHOT"; + public static final String RELEASE_NUMBER = ".0-m1"; /** The org.restlet log level. */ private static volatile Level restletLogLevel; diff --git a/pom.xml b/pom.xml index 2bc7c49c70..847231ebe8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m1 pom Restlet Framework - Parent From 67f99e16393d54d8a49762654da01c19d78c7b38 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sat, 21 Jun 2025 15:27:32 +0200 Subject: [PATCH 04/22] Bumped version 2.7.SNAPSHOT --- changes.md | 3 +++ org.restlet.ext.crypto/pom.xml | 2 +- org.restlet.ext.freemarker/pom.xml | 2 +- org.restlet.ext.gson/pom.xml | 2 +- org.restlet.ext.jaas/pom.xml | 2 +- org.restlet.ext.jackson/pom.xml | 2 +- org.restlet.ext.jetty/pom.xml | 2 +- org.restlet.ext.json/pom.xml | 2 +- org.restlet.ext.servlet/pom.xml | 2 +- org.restlet.ext.slf4j/pom.xml | 2 +- org.restlet.ext.spring/pom.xml | 2 +- org.restlet.ext.thymeleaf/pom.xml | 2 +- org.restlet.ext.velocity/pom.xml | 2 +- org.restlet.ext.xml/pom.xml | 2 +- org.restlet/pom.xml | 2 +- org.restlet/src/main/java/org/restlet/engine/Engine.java | 2 +- pom.xml | 2 +- 17 files changed, 19 insertions(+), 16 deletions(-) diff --git a/changes.md b/changes.md index 3c14ec9747..d48df99043 100644 --- a/changes.md +++ b/changes.md @@ -1,6 +1,9 @@ Changes log =========== +- 2.7 Milestone 2 (??-07-2025) + - Misc + - 2.7 Milestone 1 (21-06-2025) - Misc - Remove deprecated extension Atom, Guice, GWT, JAXB, OData diff --git a/org.restlet.ext.crypto/pom.xml b/org.restlet.ext.crypto/pom.xml index f45b227a72..0f12cff847 100644 --- a/org.restlet.ext.crypto/pom.xml +++ b/org.restlet.ext.crypto/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.freemarker/pom.xml b/org.restlet.ext.freemarker/pom.xml index 21d808213f..f9f53c6591 100644 --- a/org.restlet.ext.freemarker/pom.xml +++ b/org.restlet.ext.freemarker/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.gson/pom.xml b/org.restlet.ext.gson/pom.xml index 99853f07c4..572fa2781d 100644 --- a/org.restlet.ext.gson/pom.xml +++ b/org.restlet.ext.gson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jaas/pom.xml b/org.restlet.ext.jaas/pom.xml index 3631bbea22..eb6ea64c62 100644 --- a/org.restlet.ext.jaas/pom.xml +++ b/org.restlet.ext.jaas/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jackson/pom.xml b/org.restlet.ext.jackson/pom.xml index 352daf6747..4ba2015102 100644 --- a/org.restlet.ext.jackson/pom.xml +++ b/org.restlet.ext.jackson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jetty/pom.xml b/org.restlet.ext.jetty/pom.xml index a4b2803c5d..f0353f799d 100644 --- a/org.restlet.ext.jetty/pom.xml +++ b/org.restlet.ext.jetty/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.json/pom.xml b/org.restlet.ext.json/pom.xml index 28e2dc2207..88b13acb6a 100644 --- a/org.restlet.ext.json/pom.xml +++ b/org.restlet.ext.json/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.servlet/pom.xml b/org.restlet.ext.servlet/pom.xml index 1ea7deeeb9..d4840a0958 100644 --- a/org.restlet.ext.servlet/pom.xml +++ b/org.restlet.ext.servlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.slf4j/pom.xml b/org.restlet.ext.slf4j/pom.xml index e6a703eff2..443a11bdff 100644 --- a/org.restlet.ext.slf4j/pom.xml +++ b/org.restlet.ext.slf4j/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.spring/pom.xml b/org.restlet.ext.spring/pom.xml index 4489f79572..83b5024c6d 100644 --- a/org.restlet.ext.spring/pom.xml +++ b/org.restlet.ext.spring/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.thymeleaf/pom.xml b/org.restlet.ext.thymeleaf/pom.xml index a078d1f931..6244b44a01 100644 --- a/org.restlet.ext.thymeleaf/pom.xml +++ b/org.restlet.ext.thymeleaf/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.velocity/pom.xml b/org.restlet.ext.velocity/pom.xml index 09d1700e3e..b02ec74053 100644 --- a/org.restlet.ext.velocity/pom.xml +++ b/org.restlet.ext.velocity/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.xml/pom.xml b/org.restlet.ext.xml/pom.xml index 7b2fb83357..3f675b948c 100644 --- a/org.restlet.ext.xml/pom.xml +++ b/org.restlet.ext.xml/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index fbaa4989fd..c48caa54ed 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT ../pom.xml diff --git a/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java index b4383abeac..e6b5bdc7ed 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -90,7 +90,7 @@ public class Engine { public static final String MINOR_NUMBER = "7"; /** Release number. */ - public static final String RELEASE_NUMBER = ".0-m1"; + public static final String RELEASE_NUMBER = "-SNAPSHOT"; /** The org.restlet log level. */ private static volatile Level restletLogLevel; diff --git a/pom.xml b/pom.xml index 847231ebe8..e0218d99e7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m1 + 2.7.SNAPSHOT pom Restlet Framework - Parent From c682921eef9f322dd3bf6bce6b90e908ba3ab229 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sat, 21 Jun 2025 15:28:42 +0200 Subject: [PATCH 05/22] Bumped version 2.7-SNAPSHOT --- org.restlet.ext.crypto/pom.xml | 2 +- org.restlet.ext.freemarker/pom.xml | 2 +- org.restlet.ext.gson/pom.xml | 2 +- org.restlet.ext.jaas/pom.xml | 2 +- org.restlet.ext.jackson/pom.xml | 2 +- org.restlet.ext.jetty/pom.xml | 2 +- org.restlet.ext.json/pom.xml | 2 +- org.restlet.ext.servlet/pom.xml | 2 +- org.restlet.ext.slf4j/pom.xml | 2 +- org.restlet.ext.spring/pom.xml | 2 +- org.restlet.ext.thymeleaf/pom.xml | 2 +- org.restlet.ext.velocity/pom.xml | 2 +- org.restlet.ext.xml/pom.xml | 2 +- org.restlet/pom.xml | 2 +- pom.xml | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/org.restlet.ext.crypto/pom.xml b/org.restlet.ext.crypto/pom.xml index 0f12cff847..36b0448377 100644 --- a/org.restlet.ext.crypto/pom.xml +++ b/org.restlet.ext.crypto/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.freemarker/pom.xml b/org.restlet.ext.freemarker/pom.xml index f9f53c6591..2a9f036de3 100644 --- a/org.restlet.ext.freemarker/pom.xml +++ b/org.restlet.ext.freemarker/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.gson/pom.xml b/org.restlet.ext.gson/pom.xml index 572fa2781d..a63298ec40 100644 --- a/org.restlet.ext.gson/pom.xml +++ b/org.restlet.ext.gson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jaas/pom.xml b/org.restlet.ext.jaas/pom.xml index eb6ea64c62..02cbc42dc9 100644 --- a/org.restlet.ext.jaas/pom.xml +++ b/org.restlet.ext.jaas/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jackson/pom.xml b/org.restlet.ext.jackson/pom.xml index 4ba2015102..8bb4505f79 100644 --- a/org.restlet.ext.jackson/pom.xml +++ b/org.restlet.ext.jackson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jetty/pom.xml b/org.restlet.ext.jetty/pom.xml index f0353f799d..bcc9a40ba2 100644 --- a/org.restlet.ext.jetty/pom.xml +++ b/org.restlet.ext.jetty/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.json/pom.xml b/org.restlet.ext.json/pom.xml index 88b13acb6a..60aca3af9c 100644 --- a/org.restlet.ext.json/pom.xml +++ b/org.restlet.ext.json/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.servlet/pom.xml b/org.restlet.ext.servlet/pom.xml index d4840a0958..4604892819 100644 --- a/org.restlet.ext.servlet/pom.xml +++ b/org.restlet.ext.servlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.slf4j/pom.xml b/org.restlet.ext.slf4j/pom.xml index 443a11bdff..04cc137b84 100644 --- a/org.restlet.ext.slf4j/pom.xml +++ b/org.restlet.ext.slf4j/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.spring/pom.xml b/org.restlet.ext.spring/pom.xml index 83b5024c6d..81f0e5338c 100644 --- a/org.restlet.ext.spring/pom.xml +++ b/org.restlet.ext.spring/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.thymeleaf/pom.xml b/org.restlet.ext.thymeleaf/pom.xml index 6244b44a01..4f55c634a9 100644 --- a/org.restlet.ext.thymeleaf/pom.xml +++ b/org.restlet.ext.thymeleaf/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.velocity/pom.xml b/org.restlet.ext.velocity/pom.xml index b02ec74053..143e0d805b 100644 --- a/org.restlet.ext.velocity/pom.xml +++ b/org.restlet.ext.velocity/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.xml/pom.xml b/org.restlet.ext.xml/pom.xml index 3f675b948c..4b85af553a 100644 --- a/org.restlet.ext.xml/pom.xml +++ b/org.restlet.ext.xml/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index c48caa54ed..90a515c9c2 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index e0218d99e7..2bc7c49c70 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.SNAPSHOT + 2.7-SNAPSHOT pom Restlet Framework - Parent From f72fb42b7ec27ca859e0b165ce0bb2e7cb9bb14b Mon Sep 17 00:00:00 2001 From: Jerome Louvel <374450+jlouvel@users.noreply.github.com> Date: Sat, 21 Jun 2025 11:42:26 -0400 Subject: [PATCH 06/22] Removed deprecated code - removed internal FTP and HTTP connectors, - removed Servlet extension - removed Servlet classes in Spring extension - removed deprecated API methods --- .../restlet/ext/jetty/JettyServerHelper.java | 335 ++--- .../connectors/BaseConnectorsTestCase.java | 41 +- .../ServerMaxConnectionsTestCase.java | 34 +- .../connectors/SslBaseConnectorsTestCase.java | 32 +- org.restlet.ext.servlet/pom.xml | 39 - .../restlet/ext/servlet/ServerServlet.java | 1078 ----------------- .../restlet/ext/servlet/ServletAdapter.java | 202 --- .../org/restlet/ext/servlet/ServletUtils.java | 75 -- .../ext/servlet/internal/ServletCall.java | 444 ------- .../ext/servlet/internal/ServletLogger.java | 63 - .../servlet/internal/ServletLoggerFacade.java | 75 -- .../internal/ServletServerAdapter.java | 85 -- .../servlet/internal/ServletWarClient.java | 91 -- .../internal/ServletWarClientHelper.java | 97 -- .../servlet/internal/ServletWarEntity.java | 207 ---- .../java/org/restlet/ext/servlet/package.html | 11 - .../src/main/resources/META-INF/MANIFEST.MF | 3 - .../src/main/resources/OSGI-INF/restlet.xml | 7 - org.restlet.ext.spring/pom.xml | 26 - .../ext/spring/RestletFrameworkServlet.java | 165 --- .../ext/spring/SpringServerServlet.java | 120 -- .../org/restlet/data/ChallengeResponse.java | 33 - .../main/java/org/restlet/engine/Engine.java | 8 - .../restlet/engine/adapter/HttpResponse.java | 1 - .../ConnectionClosingRepresentation.java | 47 - .../engine/connector/FtpClientHelper.java | 185 --- .../engine/connector/HttpClientHelper.java | 212 ---- .../engine/connector/HttpExchangeCall.java | 149 --- .../engine/connector/HttpServerHelper.java | 81 -- .../connector/HttpUrlConnectionCall.java | 347 ------ .../engine/connector/HttpsServerHelper.java | 119 -- .../engine/connector/NetServerHelper.java | 219 ---- .../engine/resource/MethodAnnotationInfo.java | 6 +- .../engine/security/HttpBasicHelper.java | 19 +- .../java/org/restlet/Bug1145TestCase.java | 15 +- .../FileRepresentationTestCase.java | 31 +- .../restlet/resource/DirectoryTestCase.java | 54 +- 37 files changed, 292 insertions(+), 4464 deletions(-) delete mode 100644 org.restlet.ext.servlet/pom.xml delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServerServlet.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletAdapter.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletUtils.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java delete mode 100644 org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/package.html delete mode 100644 org.restlet.ext.servlet/src/main/resources/META-INF/MANIFEST.MF delete mode 100644 org.restlet.ext.servlet/src/main/resources/OSGI-INF/restlet.xml delete mode 100644 org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java delete mode 100644 org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServerServlet.java delete mode 100644 org.restlet/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java delete mode 100644 org.restlet/src/main/java/org/restlet/engine/connector/FtpClientHelper.java delete mode 100644 org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java delete mode 100644 org.restlet/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java delete mode 100644 org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java delete mode 100644 org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java delete mode 100644 org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java delete mode 100644 org.restlet/src/main/java/org/restlet/engine/connector/NetServerHelper.java diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java index 292b5e2292..54426591cb 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java +++ b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java @@ -28,8 +28,8 @@ import java.util.concurrent.Executor; /** - * Abstract Jetty web server connector. Here is the list of parameters that are supported. They should be set in the - * Server's context before it is started: + * Abstract Jetty web server connector. Here is the list of parameters that are + * supported. They should be set in the Server's context before it is started: * * * @@ -60,13 +60,15 @@ * * * - * + * * * * * * - * + * * * * @@ -78,8 +80,9 @@ * * * - * + * * * * @@ -91,15 +94,17 @@ * * * - * + * * * * * * - * + * * * * @@ -111,30 +116,34 @@ * * * - * + * * * * * * - * + * * * * * * - * + * * * * * * - * + * * * * @@ -146,27 +155,15 @@ * * * - * - * - * - * - * - * - * + * * * * * * - * - * - * - * - * - * - * + * * * * @@ -178,15 +175,17 @@ * * * - * + * * * * * * - * + * * * * @@ -196,11 +195,13 @@ * *
list of supported parameters
threadPool.idleTimeoutint60000Thread pool idle timeout in milliseconds; threads that are idle for longer than this period may be stoppedThread pool idle timeout in milliseconds; threads that are idle for + * longer than this period may be stopped
threadPool.stopTimeoutlong5000Thread pool stop timeout in milliseconds; the maximum time allowed for the service to shutdownThread pool stop timeout in milliseconds; the maximum time allowed for + * the service to shutdown
connector.acceptorsconnector.selectorsint-1Connector selector thread count; When less or equal than 0, Jetty computes a default value derived from a - * heuristic over available CPUs and thread pool size.Connector selector thread count; When less or equal than 0, Jetty + * computes a default value derived from a heuristic over available CPUs and + * thread pool size.
connector.acceptQueueSizeconnector.idleTimeoutint30000Connector idle timeout in milliseconds; see {@link Socket#setSoTimeout(int)}; this value is interpreted as the - * maximum time between some progress being made on the connection; so if a single byte is read or written, then the - * timeout is resetConnector idle timeout in milliseconds; see + * {@link Socket#setSoTimeout(int)}; this value is interpreted as the maximum + * time between some progress being made on the connection; so if a single byte + * is read or written, then the timeout is reset
connector.stopTimeoutlong30000Connector stop timeout in milliseconds; the maximum time allowed for the service to shutdownConnector stop timeout in milliseconds; the maximum time allowed for the + * service to shutdown
http.headerCacheSizehttp.requestHeaderSizeint8*1024HTTP request header size in bytes; larger headers will allow for more and/or larger cookies plus larger form - * content encoded in a URL; however, larger headers consume more memory and can make a server more vulnerable to denial - * of service attacksHTTP request header size in bytes; larger headers will allow for more + * and/or larger cookies plus larger form content encoded in a URL; however, + * larger headers consume more memory and can make a server more vulnerable to + * denial of service attacks
http.responseHeaderSizeint8*1024HTTP response header size in bytes; larger headers will allow for more and/or larger cookies and longer HTTP - * headers (e.g. for redirection); however, larger headers will also consume more memoryHTTP response header size in bytes; larger headers will allow for more + * and/or larger cookies and longer HTTP headers (e.g. for redirection); + * however, larger headers will also consume more memory
http.outputBufferSizeint32*1024HTTP output buffer size in bytes; a larger buffer can improve performance by allowing a content producer to run - * without blocking, however larger buffers consume more memory and may induce some latency before a client starts - * processing the contentHTTP output buffer size in bytes; a larger buffer can improve performance + * by allowing a content producer to run without blocking, however larger + * buffers consume more memory and may induce some latency before a client + * starts processing the content
lowResource.periodint1000Low-resource monitor period in milliseconds; when 0, low-resource monitoring is disabledLow-resource monitor period in milliseconds; when 0, low-resource + * monitoring is disabled
lowResource.threadslowResource.maxMemoryint0Low-resource monitor max memory in bytes; when 0, the check disabled; memory used is calculated as - * (totalMemory-freeMemory)
lowResource.maxConnectionsint0Low-resource monitor max connections; when 0, the check is disabled. Deprecated, see server.maxConnectionsLow-resource monitor max memory in bytes; when 0, the check disabled; + * memory used is calculated as (totalMemory-freeMemory)
lowResource.idleTimeoutint1000Low-resource monitor idle timeout in milliseconds; applied to EndPoints when in the low-resources state
lowResource.stopTimeoutlong30000Low-resource monitor stop timeout in milliseconds; the maximum time allowed for the service to shutdown. - * Deprecated, use shutdown.timeout insteadLow-resource monitor idle timeout in milliseconds; applied to EndPoints + * when in the low-resources state
server.maxConnectionsserver.maxConnections.idleTimeoutlong0The endpoint idle timeout in milliseconds to apply when the connection limit is reached; when 0, there is no idle - * timeout.The endpoint idle timeout in milliseconds to apply when the connection + * limit is reached; when 0, there is no idle timeout.
shutdown.gracefullybooleantrueWhen true, upon JVM shutdown, the Jetty server will block incoming requests and wait for pending requests to end - * before shutting down. Otherwise, incoming requests are not blocked and all requests are aborted.When true, upon JVM shutdown, the Jetty server will block incoming + * requests and wait for pending requests to end before shutting down. + * Otherwise, incoming requests are not blocked and all requests are + * aborted.
shutdown.timeout
* - * @see Jetty 12 documentation + * @see Jetty 12 + * documentation * @author Jerome Louvel * @author Tal Liron */ -public abstract class JettyServerHelper extends org.restlet.engine.adapter.HttpServerHelper { +public abstract class JettyServerHelper + extends org.restlet.engine.adapter.HttpServerHelper { /** The wrapped Jetty server. */ private volatile org.eclipse.jetty.server.Server wrappedServer; @@ -239,7 +240,8 @@ protected HttpConfiguration createHttpConfiguration() { * @param configuration The HTTP configuration. * @return New internal Jetty connection factories. */ - protected abstract ConnectionFactory[] createConnectionFactories(final HttpConfiguration configuration); + protected abstract ConnectionFactory[] createConnectionFactories( + final HttpConfiguration configuration); /** * Creates the Jetty connectors. @@ -247,7 +249,8 @@ protected HttpConfiguration createHttpConfiguration() { * @param server The Jetty server. * @return The Jetty connectors. */ - protected abstract List createConnectors(org.eclipse.jetty.server.Server server); + protected abstract List createConnectors( + org.eclipse.jetty.server.Server server); /** * Creates a Jetty connector based on a classical TCP type of transport. @@ -255,17 +258,21 @@ protected HttpConfiguration createHttpConfiguration() { * @param server The Jetty server. * @return A Jetty connector. */ - protected ServerConnector createServerConnector(final org.eclipse.jetty.server.Server server, final HttpConfiguration configuration) { + protected ServerConnector createServerConnector( + final org.eclipse.jetty.server.Server server, + final HttpConfiguration configuration) { final int acceptors = getConnectorAcceptors(); final int selectors = getConnectorSelectors(); final Executor executor = getConnectorExecutor(); final Scheduler scheduler = getConnectorScheduler(); final ByteBufferPool byteBufferPool = getConnectorByteBufferPool(); - final ConnectionFactory[] connectionFactories = createConnectionFactories(configuration); + final ConnectionFactory[] connectionFactories = createConnectionFactories( + configuration); - final ServerConnector connector = new ServerConnector(server, executor, scheduler, byteBufferPool, acceptors, - selectors, connectionFactories); + final ServerConnector connector = new ServerConnector(server, executor, + scheduler, byteBufferPool, acceptors, selectors, + connectionFactories); final String address = getHelped().getAddress(); if (address != null) { @@ -285,17 +292,20 @@ protected ServerConnector createServerConnector(final org.eclipse.jetty.server.S * @param server A Jetty server. * @return A Jetty low-resource monitor or null. */ - private LowResourceMonitor createLowResourceMonitor(org.eclipse.jetty.server.Server server) { + private LowResourceMonitor createLowResourceMonitor( + org.eclipse.jetty.server.Server server) { final LowResourceMonitor result; final int period = getLowResourceMonitorPeriod(); if (period > 0) { result = new LowResourceMonitor(server); - result.setMonitoredConnectors(Arrays.asList(server.getConnectors())); + result.setMonitoredConnectors( + Arrays.asList(server.getConnectors())); result.setPeriod(period); result.setMonitorThreads(getLowResourceMonitorThreads()); result.setMaxMemory(getLowResourceMonitorMaxMemory()); - result.setLowResourcesIdleTimeout(getLowResourceMonitorIdleTimeout()); + result.setLowResourcesIdleTimeout( + getLowResourceMonitorIdleTimeout()); } else { result = null; } @@ -313,12 +323,15 @@ private org.eclipse.jetty.server.Server createServer() { final ThreadPool threadPool = createThreadPool(); // Server - final org.eclipse.jetty.server.Server jettyServer = new org.eclipse.jetty.server.Server(threadPool); + final org.eclipse.jetty.server.Server jettyServer = new org.eclipse.jetty.server.Server( + threadPool); int serverMaxConnections = getServerMaxConnections(); if (serverMaxConnections > 0) { - ConnectionLimit connectionLimit = new ConnectionLimit(serverMaxConnections, jettyServer); - connectionLimit.setIdleTimeout(getServerMaxConnectionsIdleTimeout()); + ConnectionLimit connectionLimit = new ConnectionLimit( + serverMaxConnections, jettyServer); + connectionLimit + .setIdleTimeout(getServerMaxConnectionsIdleTimeout()); jettyServer.addBean(connectionLimit); } @@ -332,11 +345,12 @@ private org.eclipse.jetty.server.Server createServer() { jettyServer.setHandler(createJettyHandler()); // Connectors - createConnectors(jettyServer) - .forEach(jettyServer::addConnector); + createConnectors(jettyServer).forEach(jettyServer::addConnector); - // Low-resource monitor (must be created after connectors have been added) - LowResourceMonitor lowResourceMonitor = createLowResourceMonitor(jettyServer); + // Low-resource monitor (must be created after connectors have been + // added) + LowResourceMonitor lowResourceMonitor = createLowResourceMonitor( + jettyServer); jettyServer.addBean(lowResourceMonitor); return jettyServer; @@ -353,8 +367,10 @@ private Handler.Abstract createJettyHandler() { final JettyServerHelper jettyServerHelper = this; Handler.Abstract jettyServerHelperWrapperHandler = new Handler.Abstract() { @Override - public boolean handle(Request request, Response response, Callback callback) { - JettyServerCall httpCall = new JettyServerCall(jettyServerHelper.getHelped(), request, response, + public boolean handle(Request request, Response response, + Callback callback) { + JettyServerCall httpCall = new JettyServerCall( + jettyServerHelper.getHelped(), request, response, callback); jettyServerHelper.handle(httpCall); return true; // Indicates that the request is accepted @@ -394,12 +410,14 @@ private ThreadPool createThreadPool() { } /** - * Connector acceptor thread count. Defaults to -1. When -1, Jetty will default to 1. + * Connector acceptor thread count. Defaults to -1. When -1, Jetty will + * default to 1. * * @return Connector acceptor thread count. */ public int getConnectorAcceptors() { - return Integer.parseInt(getHelpedParameters().getFirstValue("connector.acceptors", "-1")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("connector.acceptors", "-1")); } /** @@ -410,11 +428,13 @@ public int getConnectorAcceptors() { * @return Connector accept queue size. */ public int getConnectorAcceptQueueSize() { - return Integer.parseInt(getHelpedParameters().getFirstValue("connector.acceptQueueSize", "0")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("connector.acceptQueueSize", "0")); } /** - * Connector byte buffer pool. Defaults to null. When null, will use a new {@link ArrayByteBufferPool}. + * Connector byte buffer pool. Defaults to null. When null, will use a new + * {@link ArrayByteBufferPool}. * * @return Connector byte buffer pool or null. */ @@ -423,7 +443,8 @@ public ByteBufferPool getConnectorByteBufferPool() { } /** - * Connector executor. Defaults to null. When null, will use the server's thread pool. + * Connector executor. Defaults to null. When null, will use the server's + * thread pool. * * @return Connector executor or null. */ @@ -436,17 +457,20 @@ public Executor getConnectorExecutor() { *

* See {@link Socket#setSoTimeout(int)}. *

- * This value is interpreted as the maximum time between some progress being made on the connection. So if a single - * byte is read or written, then the timeout is reset. + * This value is interpreted as the maximum time between some progress being + * made on the connection. So if a single byte is read or written, then the + * timeout is reset. * * @return Connector idle timeout. */ public int getConnectorIdleTimeout() { - return Integer.parseInt(getHelpedParameters().getFirstValue("connector.idleTimeout", "30000")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("connector.idleTimeout", "30000")); } /** - * Connector scheduler. Defaults to null. When null, will use a new {@link ScheduledExecutorScheduler}. + * Connector scheduler. Defaults to null. When null, will use a new + * {@link ScheduledExecutorScheduler}. * * @return Connector scheduler or null. */ @@ -455,26 +479,15 @@ public Scheduler getConnectorScheduler() { } /** - * Connector selector thread count. Defaults to -1. When less or equal than 0, Jetty computes a default value - * derived from a heuristic over available CPUs and thread pool size. + * Connector selector thread count. Defaults to -1. When less or equal than + * 0, Jetty computes a default value derived from a heuristic over available + * CPUs and thread pool size. * * @return Connector acceptor thread count. */ public int getConnectorSelectors() { - return Integer.parseInt(getHelpedParameters().getFirstValue("connector.selectors", "-1")); - } - - /** - * Connector stop timeout in milliseconds. Defaults to 30000. - *

- * The maximum time allowed for the service to shut down. - * - * @return Connector stop timeout. - * @deprecated cf {@link #getShutdownTimeout()} - */ - @Deprecated - public int getConnectorStopTimeout() { - return Integer.parseInt(getHelpedParameters().getFirstValue("connector.stopTimeout", "30000")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("connector.selectors", "-1")); } /** @@ -483,43 +496,50 @@ public int getConnectorStopTimeout() { * @return HTTP header cache size. */ public int getHttpHeaderCacheSize() { - return Integer.parseInt(getHelpedParameters().getFirstValue("http.headerCacheSize", "1024")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("http.headerCacheSize", "1024")); } /** * HTTP output buffer size in bytes. Defaults to 32*1024. *

- * A larger buffer can improve performance by allowing a content producer to run without blocking, however, larger - * buffers consume more memory and may induce some latency before a client starts processing the content. + * A larger buffer can improve performance by allowing a content producer to + * run without blocking, however, larger buffers consume more memory and may + * induce some latency before a client starts processing the content. * * @return HTTP output buffer size. */ public int getHttpOutputBufferSize() { - return Integer.parseInt(getHelpedParameters().getFirstValue("http.outputBufferSize", "32768")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("http.outputBufferSize", "32768")); } /** * HTTP request header size in bytes. Defaults to 8*1024. *

- * Larger headers will allow for more and/or larger cookies plus larger form content encoded in a URL. However, - * larger headers consume more memory and can make a server more vulnerable to denial of service attacks. + * Larger headers will allow for more and/or larger cookies plus larger form + * content encoded in a URL. However, larger headers consume more memory and + * can make a server more vulnerable to denial of service attacks. * * @return HTTP request header size. */ public int getHttpRequestHeaderSize() { - return Integer.parseInt(getHelpedParameters().getFirstValue("http.requestHeaderSize", "8192")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("http.requestHeaderSize", "8192")); } /** * HTTP response header size in bytes. Defaults to 8*1024. *

- * Larger headers will allow for more and/or larger cookies and longer HTTP headers (e.g., for redirection). - * However, larger headers will also consume more memory. + * Larger headers will allow for more and/or larger cookies and longer HTTP + * headers (e.g., for redirection). However, larger headers will also + * consume more memory. * * @return HTTP response header size. */ public int getHttpResponseHeaderSize() { - return Integer.parseInt(getHelpedParameters().getFirstValue("http.responseHeaderSize", "8192")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("http.responseHeaderSize", "8192")); } /** @@ -530,60 +550,43 @@ public int getHttpResponseHeaderSize() { * @return Low-resource monitor idle timeout. */ public int getLowResourceMonitorIdleTimeout() { - return Integer.parseInt(getHelpedParameters().getFirstValue("lowResource.idleTimeout", "1000")); - } - - /** - * Low-resource monitor max connections. Defaults to 0. When 0, the check is disabled. - * - * @return Low-resource monitor max connections. - * @deprecated cf {@link #getServerMaxConnections()} - */ - @Deprecated - public int getLowResourceMonitorMaxConnections() { - return Integer.parseInt(getHelpedParameters().getFirstValue("lowResource.maxConnections", "0")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("lowResource.idleTimeout", "1000")); } /** - * Low-resource monitor max memory in bytes. Defaults to 0. When 0, the check is disabled. + * Low-resource monitor max memory in bytes. Defaults to 0. When 0, the + * check is disabled. *

* Memory used is calculated as (totalMemory-freeMemory). * * @return Low-resource monitor max memory. */ public long getLowResourceMonitorMaxMemory() { - return Long.parseLong(getHelpedParameters().getFirstValue("lowResource.maxMemory", "0")); + return Long.parseLong(getHelpedParameters() + .getFirstValue("lowResource.maxMemory", "0")); } /** - * Low-resource monitor period in milliseconds. Defaults to 1000. When 0, low-resource monitoring is disabled. + * Low-resource monitor period in milliseconds. Defaults to 1000. When 0, + * low-resource monitoring is disabled. * * @return Low-resource monitor period. */ public int getLowResourceMonitorPeriod() { - return Integer.parseInt(getHelpedParameters().getFirstValue("lowResource.period", "1000")); - } - - /** - * Low-resource monitor stop timeout in milliseconds. Defaults to 30000. - *

- * The maximum time allowed for the service to shut down. - * - * @return Low-resource monitor stop timeout. - * @deprecated cf {@link #getShutdownTimeout()} - */ - @Deprecated - public long getLowResourceMonitorStopTimeout() { - return Long.parseLong(getHelpedParameters().getFirstValue("lowResource.stopTimeout", "30000")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("lowResource.period", "1000")); } /** - * Low-resource monitor, whether to check if we're low on threads. Defaults to true. + * Low-resource monitor, whether to check if we're low on threads. Defaults + * to true. * * @return Low-resource monitor threads. */ public boolean getLowResourceMonitorThreads() { - return Boolean.parseBoolean(getHelpedParameters().getFirstValue("lowResource.threads", "true")); + return Boolean.parseBoolean(getHelpedParameters() + .getFirstValue("lowResource.threads", "true")); } /** @@ -592,41 +595,39 @@ public boolean getLowResourceMonitorThreads() { * @return Low-resource monitor max connections. */ public int getServerMaxConnections() { - final int result; - - final String serverMaxConnectionsValue = getHelpedParameters().getFirstValue("server.maxConnections"); - - if (serverMaxConnectionsValue == null) { - result = getLowResourceMonitorMaxConnections(); - } else { - result = Integer.parseInt(serverMaxConnectionsValue); - } - - return result; + return Integer.parseInt(getHelpedParameters() + .getFirstValue("server.maxConnections", "0")); } /** - * The endpoint idle timeout in milliseconds to apply when the connection limit is reached. Defaults to 0. When 0, - * there is no idle timeout. + * The endpoint idle timeout in milliseconds to apply when the connection + * limit is reached. Defaults to 0. When 0, there is no idle timeout. *

- * The maximum time allowed for the endpoint to close when the connection limit is reached. + * The maximum time allowed for the endpoint to close when the connection + * limit is reached. * - * @return The endpoint idle timeout in milliseconds to apply when the connection limit is reached. + * @return The endpoint idle timeout in milliseconds to apply when the + * connection limit is reached. */ public long getServerMaxConnectionsIdleTimeout() { - return Long.parseLong(getHelpedParameters().getFirstValue("server.maxConnections.idleTimeout", "0")); + return Long.parseLong(getHelpedParameters() + .getFirstValue("server.maxConnections.idleTimeout", "0")); } /** - * When true, upon JVM shutdown, the Jetty server will block incoming requests and wait for pending requests to end - * before shutting down. Otherwise, incoming requests are not blocked and all requests are aborted. Defaults to - * true. + * When true, upon JVM shutdown, the Jetty server will block incoming + * requests and wait for pending requests to end before shutting down. + * Otherwise, incoming requests are not blocked and all requests are + * aborted. Defaults to true. * - * @return True if upon JVM shutdown, the Jetty server will block incoming requests and wait for pending requests to - * end before shutting down. Otherwise, incoming requests are not blocked and all requests are aborted. + * @return True if upon JVM shutdown, the Jetty server will block incoming + * requests and wait for pending requests to end before shutting + * down. Otherwise, incoming requests are not blocked and all + * requests are aborted. */ public boolean getShutdownGracefully() { - return Boolean.parseBoolean(getHelpedParameters().getFirstValue("shutdown.gracefully", "true")); + return Boolean.parseBoolean(getHelpedParameters() + .getFirstValue("shutdown.gracefully", "true")); } /** @@ -635,17 +636,8 @@ public boolean getShutdownGracefully() { * @return Server shutdown timeout. */ public long getShutdownTimeout() { - final long result; - - final String shutdownTimeoutValue = getHelpedParameters().getFirstValue("shutdown.timeout"); - - if (shutdownTimeoutValue == null) { - result = getLowResourceMonitorStopTimeout(); - } else { - result = Long.parseLong(shutdownTimeoutValue); - } - - return result; + return Long.parseLong( + getHelpedParameters().getFirstValue("shutdown.timeout", "0")); } /** @@ -656,7 +648,8 @@ public long getShutdownTimeout() { * @return Thread pool idle timeout. */ public int getThreadPoolIdleTimeout() { - return Integer.parseInt(getHelpedParameters().getFirstValue("threadPool.idleTimeout", "60000")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("threadPool.idleTimeout", "60000")); } /** @@ -665,7 +658,8 @@ public int getThreadPoolIdleTimeout() { * @return Thread pool maximum threads. */ public int getThreadPoolMaxThreads() { - return Integer.parseInt(getHelpedParameters().getFirstValue("threadPool.maxThreads", "200")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("threadPool.maxThreads", "200")); } /** @@ -674,7 +668,8 @@ public int getThreadPoolMaxThreads() { * @return Thread pool minimum threads. */ public int getThreadPoolMinThreads() { - return Integer.parseInt(getHelpedParameters().getFirstValue("threadPool.minThreads", "8")); + return Integer.parseInt(getHelpedParameters() + .getFirstValue("threadPool.minThreads", "8")); } /** @@ -685,7 +680,8 @@ public int getThreadPoolMinThreads() { * @return Thread pool stop timeout. */ public long getThreadPoolStopTimeout() { - return Long.parseLong(getHelpedParameters().getFirstValue("threadPool.stopTimeout", "5000")); + return Long.parseLong(getHelpedParameters() + .getFirstValue("threadPool.stopTimeout", "5000")); } /** @@ -694,7 +690,8 @@ public long getThreadPoolStopTimeout() { * @return Thread pool maximum threads. */ public int getThreadPoolThreadsPriority() { - return Integer.parseInt(getHelpedParameters().getFirstValue("threadPool.threadsPriority", + return Integer.parseInt(getHelpedParameters().getFirstValue( + "threadPool.threadsPriority", String.valueOf(Thread.NORM_PRIORITY))); } @@ -715,7 +712,8 @@ protected org.eclipse.jetty.server.Server getWrappedServer() { * * @param wrappedServer The wrapped Jetty server. */ - protected void setWrappedServer(org.eclipse.jetty.server.Server wrappedServer) { + protected void setWrappedServer( + org.eclipse.jetty.server.Server wrappedServer) { Objects.requireNonNull(wrappedServer); this.wrappedServer = wrappedServer; } @@ -724,9 +722,11 @@ protected void setWrappedServer(org.eclipse.jetty.server.Server wrappedServer) { public void start() throws Exception { super.start(); org.eclipse.jetty.server.Server server = getWrappedServer(); - AbstractNetworkConnector connector = (AbstractNetworkConnector) server.getConnectors()[0]; + AbstractNetworkConnector connector = (AbstractNetworkConnector) server + .getConnectors()[0]; - getLogger().info("Starting the Jetty " + getProtocols() + " server on port " + getHelped().getPort()); + getLogger().info("Starting the Jetty " + getProtocols() + + " server on port " + getHelped().getPort()); try { server.start(); // We won't know the local port until after the server starts @@ -742,7 +742,8 @@ public void start() throws Exception { @Override public void stop() throws Exception { - getLogger().info("Stopping the Jetty " + getProtocols() + " server on port " + getHelped().getPort()); + getLogger().info("Stopping the Jetty " + getProtocols() + + " server on port " + getHelped().getPort()); if (this.wrappedServer != null) { getWrappedServer().stop(); } diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java index dbdbe1e4ec..d8e6f8d3c9 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java +++ b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java @@ -9,22 +9,23 @@ package org.restlet.ext.jetty.connectors; +import static org.junit.jupiter.api.DynamicTest.dynamicTest; + +import java.util.List; +import java.util.logging.Level; +import java.util.stream.Stream; + import org.junit.jupiter.api.DynamicTest; import org.junit.jupiter.api.TestFactory; -import org.restlet.*; +import org.restlet.Application; +import org.restlet.Component; +import org.restlet.Server; import org.restlet.data.Protocol; import org.restlet.engine.Engine; import org.restlet.engine.adapter.HttpServerHelper; import org.restlet.engine.connector.ClientHelper; -import org.restlet.engine.connector.HttpClientHelper; import org.restlet.engine.connector.ServerHelper; -import java.util.List; -import java.util.logging.Level; -import java.util.stream.Stream; - -import static org.junit.jupiter.api.DynamicTest.dynamicTest; - /** * Base test case that will call an abstract method for several client/server * connectors configurations. @@ -66,26 +67,22 @@ protected void configureServer(final Server server) { protected List listTestCases() { return List.of( - // let's focus on Jetty server extension - // new ConnectorTestCase(HttpServer.INTERNAL_HTTP, HttpClient.INTERNAL), - // new ConnectorTestCase(HttpServer.INTERNAL_HTTP, HttpClient.JETTY), - new ConnectorTestCase(HttpServer.JETTY_HTTP, HttpClient.INTERNAL), - new ConnectorTestCase(HttpServer.JETTY_HTTP, HttpClient.JETTY) - ); + new ConnectorTestCase(HttpServer.JETTY_HTTP, HttpClient.JETTY)); } @TestFactory Stream testsFactory() { - return listTestCases().stream() - .map(testCase -> dynamicTest( - testCase.getTestLabel(), - () -> runTest(testCase.httpServer, testCase.httpClient))); + return listTestCases().stream().map(testCase -> dynamicTest( + testCase.getTestLabel(), + () -> runTest(testCase.httpServer, testCase.httpClient))); } - private void runTest(final HttpServer server, final HttpClient client) throws Exception { + private void runTest(final HttpServer server, final HttpClient client) + throws Exception { if (shouldDebug()) { System.setProperty("org.eclipse.jetty.LEVEL", "TRACE"); - System.setProperty("sun.net.www.protocol.http.HttpURLConnection.LEVEL", "ALL"); + System.setProperty( + "sun.net.www.protocol.http.HttpURLConnection.LEVEL", "ALL"); } initEngine(server, client); @@ -134,8 +131,6 @@ private void resetEngine() { } public enum HttpServer { - INTERNAL_HTTP(new org.restlet.engine.connector.HttpServerHelper(null)), - INTERNAL_HTTPS(new org.restlet.engine.connector.HttpsServerHelper(null)), JETTY_HTTP(new org.restlet.ext.jetty.HttpServerHelper(null)), JETTY_HTTPS(new org.restlet.ext.jetty.HttpsServerHelper(null)); @@ -147,7 +142,7 @@ public enum HttpServer { } public enum HttpClient { - INTERNAL(new HttpClientHelper(null)), JETTY(new org.restlet.ext.jetty.HttpClientHelper(null)); + JETTY(new org.restlet.ext.jetty.HttpClientHelper(null)); final ClientHelper clientHelper; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java index 5944a3a56e..d3eecac161 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java +++ b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java @@ -9,13 +9,9 @@ package org.restlet.ext.jetty.connectors; -import org.restlet.*; -import org.restlet.data.Method; -import org.restlet.data.Parameter; -import org.restlet.data.Protocol; -import org.restlet.data.Status; -import org.restlet.engine.connector.HttpClientHelper; -import org.restlet.util.Series; +import static java.lang.String.format; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.time.Duration; import java.util.ArrayList; @@ -25,9 +21,18 @@ import java.util.concurrent.Executors; import java.util.logging.Logger; -import static java.lang.String.format; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import org.restlet.Application; +import org.restlet.Client; +import org.restlet.Context; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.Server; +import org.restlet.data.Method; +import org.restlet.data.Parameter; +import org.restlet.data.Protocol; +import org.restlet.data.Status; +import org.restlet.util.Series; /** * This tests the ability of the server to accept a fixed number of incoming connections. @@ -86,15 +91,6 @@ private Status sendGet(final String uri) { try { final Request request = new Request(Method.GET, uri + "/" + Thread.currentThread().getName()); final Client client = new Client(new Context(), Protocol.HTTP); - - if (client.getContext().getAttributes().get("org.restlet.engine.helper") instanceof HttpClientHelper) { - // Specific to the internal client - // When Jetty refuses the extra connection, this does not block the underlying native HttpClient... - // Let's set a timeout higher than the wait time imposed by the server (otherwise all requests will fail) - String readTimeoutInMs = Long.toString(SERVER_RESOURCE_FREEZE_DURATION.toMillis() * 2); - client.getContext().getParameters().add("readTimeout", readTimeoutInMs); - } - final Response response = client.handle(request); log("client get sent " + Thread.currentThread().getName()); result = response.getStatus(); diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java index 25fdcfe67b..724d344c68 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java +++ b/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java @@ -9,18 +9,24 @@ package org.restlet.ext.jetty.connectors; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.file.Files; +import java.util.List; + import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.restlet.*; +import org.restlet.Client; +import org.restlet.Component; +import org.restlet.Server; import org.restlet.data.Parameter; import org.restlet.data.Protocol; import org.restlet.engine.io.IoUtils; import org.restlet.util.Series; -import java.io.*; -import java.nio.file.Files; -import java.util.List; - /** * Base test case that will call an abstract method for several client/server * connectors configurations. (Modified for SSL support.) @@ -39,10 +45,13 @@ public abstract class SslBaseConnectorsTestCase extends BaseConnectorsTestCase { @BeforeAll public static void globalSetUp() throws IOException { - testKeystoreFile = Files.createTempFile("sslBaseConnectorsTest", KEYSTORE_FILE_NAME).toFile(); + testKeystoreFile = Files + .createTempFile("sslBaseConnectorsTest", KEYSTORE_FILE_NAME) + .toFile(); testKeystoreFile.delete(); - InputStream resourceAsStream = SslBaseConnectorsTestCase.class.getResourceAsStream(KEYSTORE_FILE_NAME); + InputStream resourceAsStream = SslBaseConnectorsTestCase.class + .getResourceAsStream(KEYSTORE_FILE_NAME); if (resourceAsStream != null) { OutputStream outputStream = new FileOutputStream(testKeystoreFile); IoUtils.copy(resourceAsStream, outputStream); @@ -56,13 +65,8 @@ public static void globalSetUp() throws IOException { @Override protected List listTestCases() { - return List.of( - // let's focus on Jetty server extension - // new ConnectorTestCase(HttpServer.INTERNAL_HTTPS, HttpClient.JETTY), - // new ConnectorTestCase(HttpServer.INTERNAL_HTTPS, HttpClient.INTERNAL), - new ConnectorTestCase(HttpServer.JETTY_HTTPS, HttpClient.INTERNAL), - new ConnectorTestCase(HttpServer.JETTY_HTTPS, HttpClient.JETTY) - ); + return List.of(new ConnectorTestCase(HttpServer.JETTY_HTTPS, + HttpClient.JETTY)); } @Override diff --git a/org.restlet.ext.servlet/pom.xml b/org.restlet.ext.servlet/pom.xml deleted file mode 100644 index 4604892819..0000000000 --- a/org.restlet.ext.servlet/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../pom.xml - - - org.restlet.ext.servlet - bundle - Restlet Framework - Servlet extension - Integration with Servlet API. - - - - jakarta.servlet - jakarta.servlet-api - ${lib-servlet-version} - provided - - - org.restlet - org.restlet - ${project.version} - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServerServlet.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServerServlet.java deleted file mode 100644 index e9f1f46f9a..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServerServlet.java +++ /dev/null @@ -1,1078 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet; - -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.Enumeration; -import java.util.List; - -import jakarta.servlet.ServletConfig; -import jakarta.servlet.ServletContext; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.restlet.Application; -import org.restlet.Client; -import org.restlet.Component; -import org.restlet.Context; -import org.restlet.Server; -import org.restlet.data.Protocol; -import org.restlet.engine.Engine; -import org.restlet.engine.adapter.HttpServerHelper; -import org.restlet.engine.adapter.ServerCall; -import org.restlet.engine.component.ComponentContext; -import org.restlet.engine.log.LoggerFacade; -import org.restlet.ext.servlet.internal.ServletCall; -import org.restlet.ext.servlet.internal.ServletLoggerFacade; -import org.restlet.ext.servlet.internal.ServletWarClient; -import org.restlet.routing.Route; -import org.restlet.routing.TemplateRoute; -import org.restlet.routing.VirtualHost; - -/** - * Servlet acting like an HTTP server connector. This Servlet can deploy - * multiple Restlet applications or components. This allows you to reuse an - * existing standalone Restlet Component, potentially containing several - * applications, and declaring client connectors, for example for the CLAP, FILE - * or HTTP protocols.
- *
- * There are two separate ways to configure the deployment using this Servlet. - * They are described below by order of priority: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
list of supported deployment modes
ModeDescription
1The "/WEB-INF/web.xml" file contains a parameter named - * "org.restlet.component". Its value must be the path of a class that inherits - * from {@link Component}. It is used to instantiate and attach the described - * component, contained applications and connectors. Please note that you can - * combine the definition of your own custom Component subclass and method - * 1.
2The "/WEB-INF/web.xml" file contains a parameter named - * "org.restlet.application". Its value must be the path of a class that - * inherits from {@link Application}. It is used to instantiate the application - * and to attach it to an implicit Restlet Component.
- *
- * In deployment mode 2, you can also add an optional "org.restlet.clients" - * context parameter that contains a space separated list of client protocols - * supported by the underlying component. For each one, a new client connector - * is added to the implicit {@link Component} instance.
- * - * Here is an example configuration to attach two separate applications: - * - *

- * <?xml version="1.0" encoding="UTF-8"?>
- * <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- *         xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- *         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- *         id="WebApp_ID" version="2.5">
- * 
- *         <display-name>Restlet adapters</display-name>
- * 
- *         <servlet>
- *                 <servlet-name>Restlet1</servlet-name>
- *                 <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
- *                 <init-param>
- *                         <param-name>org.restlet.application</param-name>
- *                         <param-value>test.MyApplication1</param-value>
- *                 </init-param>
- *         </servlet>
- * 
- *         <servlet-mapping>
- *                 <servlet-name>Restlet1</servlet-name>
- *                 <url-pattern>/1/*</url-pattern>
- *         </servlet-mapping>
- * 
- *         <servlet>
- *                 <servlet-name>Restlet2</servlet-name>
- *                 <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
- *                 <init-param>
- *                         <param-name>org.restlet.application</param-name>
- *                         <param-value>test.MyApplication2</param-value>
- *                 </init-param>
- *         </servlet>
- * 
- *         <servlet-mapping>
- *                 <servlet-name>Restlet2</servlet-name>
- *                 <url-pattern>/2/*</url-pattern>
- *         </servlet-mapping>
- * 
- * </web-app>
- * 
- * - * Now, here is a more detailed template configuration showing you more - * configuration options: - * - *
- * <?xml version="1.0" encoding="UTF-8"?>
- * <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- *         xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- *         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- *         id="WebApp_ID" version="2.5">
- * 
- *         <display-name>Restlet adapters</display-name>
- * 
- *         <!-- Servlet to Restlet adapter declaration (Mandatory) -->
- *         <servlet>
- *                 <servlet-name>RestletAdapter</servlet-name>
- *                 <servlet-class>org.restlet.ext.servlet.ServerServlet</servlet-class>
- * 
- *                 <!-- Your component class name (Optional - For mode 1) -->
- *                 <init-param>
- *                         <param-name>org.restlet.component</param-name>
- *                         <param-value>test.MyComponent</param-value>
- *                 </init-param>
- * 
- *                 <!-- Your application class name (Optional - For mode 2) -->
- *                 <init-param>
- *                         <param-name>org.restlet.application</param-name>
- *                         <param-value>test.MyApplication</param-value>
- *                 </init-param>
- * 
- *                 <!-- List of supported client protocols (Optional - Only in mode 2) -->
- *                 <init-param>
- *                         <param-name>org.restlet.clients</param-name>
- *                         <param-value>HTTP HTTPS FILE</param-value>
- *                 </init-param>
- * 
- *                 <!-- Add the Servlet context path to routes (Optional) -->
- *                 <init-param>
- *                         <param-name>org.restlet.autoWire</param-name>
- *                         <param-value>true</param-value>
- *                 </init-param>
- *         </servlet>
- * 
- *         <!-- Mapping catching all requests on a given path (Mandatory) -->
- *         <servlet-mapping>
- *                 <servlet-name>RestletAdapter</servlet-name>
- *                 <url-pattern>/*</url-pattern>
- *         </servlet-mapping>
- * 
- * </web-app>
- * 
- * - * Note that the enumeration of "initParameters" of your Servlet will be copied - * to the "context.parameters" property of your Restlet Application. This way, - * you can pass additional initialization parameters to your application, and - * maybe share them with other Servlets.
- *
- * An additional boolean parameter called "org.restlet.autoWire" allows you to - * control the way your customized Component fits in the context of the wrapping - * Servlet. The root cause is that both your Servlet Container and your Restlet - * Component handle part of the URI routing, respectively to the right Servlet - * and to the right virtual host and Restlets (most of the time Application - * instances).
- *
- * When a request reaches the Servlet container, it is first routed according to - * its web.xml configuration (i.e. declared virtual hosts and webapp context - * path which is generally the name of the webapp WAR file). Once the incoming - * request reaches the ServerServlet and the wrapped Restlet Component, its URI - * is, for the second time, entirely subject to a separate routing chain. It - * begins with the virtual hosts, then continues to the URI pattern used when - * attaching Restlets to the host. The important conclusion is that both routing - * configurations must be consistent in order to work fine.
- *
- * In deployment mode 2, the context path of the servlet is automatically added. - * That's what we call the auto-wire feature. This is the default case, and is - * equivalent to setting the value "true" for the "org.restlet.autoWire" - * parameter as described above. In mode 1, if you want to manually control the - * URI wiring, you can disable the auto-wiring by setting the property to - * "false".
- *
- * Also, a WAR client connector is automatically attached to the parent Restlet - * component. It lets you access to resources inside your WAR using the uniform - * interface. Here is an example of WAR URI that can be resolved by this client: - * "war:///WEB-INF/web.xml". In order to use it, just call the - * {@link Context#getClientDispatcher()} in your application.
- *
- * Also, the ServletContext is copied into an - * "org.restlet.ext.servlet.ServletContext" attribute of the Restlet application - * in case you need access to it.
- *
- * Finally, an "org.restlet.ext.servlet.offsetPath" attribute, containing the - * computed offset path used to attach applications when (and only when) the - * auto-wiring feature is set, is added to the component's context. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServerServlet extends HttpServlet { - /** - * Name of the attribute key containing a reference to the current - * application. - */ - private static final String APPLICATION_KEY = "org.restlet.application"; - - /** - * The Servlet context initialization parameter's name containing a boolean - * value. "true" indicates that all applications will be attached to the - * Component's virtual hosts with the Servlet Context path value. - */ - private static final String AUTO_WIRE_KEY = "org.restlet.autoWire"; - - /** The default value for the AUTO_WIRE_KEY parameter. */ - private static final String AUTO_WIRE_KEY_DEFAULT = "true"; - - /** - * Name of the attribute key containing a list of supported client - * protocols. - */ - private static final String CLIENTS_KEY = "org.restlet.clients"; - - /** - * Name of the attribute key containing a reference to the current - * component. - */ - private static final String COMPONENT_KEY = "org.restlet.component"; - - /** - * The Servlet context initialization parameter's name containing the name - * of the Servlet context attribute that should be used to store the Restlet - * Application instance. - */ - private static final String NAME_APPLICATION_ATTRIBUTE = "org.restlet.attribute.application"; - - /** The default value for the NAME_APPLICATION_ATTRIBUTE parameter. */ - private static final String NAME_APPLICATION_ATTRIBUTE_DEFAULT = "org.restlet.ext.servlet.ServerServlet.application"; - - /** - * The Servlet context initialization parameter's name containing the name - * of the Servlet context attribute that should be used to store the Restlet - * Component instance. - */ - private static final String NAME_COMPONENT_ATTRIBUTE = "org.restlet.attribute.component"; - - /** The default value for the NAME_COMPONENT_ATTRIBUTE parameter. */ - private static final String NAME_COMPONENT_ATTRIBUTE_DEFAULT = "org.restlet.ext.servlet.ServerServlet.component"; - - /** - * Name of the attribute containing the computed offset path used to attach - * applications when (and only when) the auto-wiring feature is set, is - * added to the component's context. - */ - private static final String NAME_OFFSET_PATH_ATTRIBUTE = "org.restlet.ext.servlet.offsetPath"; - - /** - * The Servlet context initialization parameter's name containing the name - * of the Servlet context attribute that should be used to store the HTTP - * server connector instance. - */ - private static final String NAME_SERVER_ATTRIBUTE = "org.restlet.attribute.server"; - - /** The default value for the NAME_SERVER_ATTRIBUTE parameter. */ - private static final String NAME_SERVER_ATTRIBUTE_DEFAULT = "org.restlet.ext.servlet.ServerServlet.server"; - - /** Serial version identifier. */ - private static final long serialVersionUID = 1L; - - /** The associated Restlet application. */ - private volatile transient Application application; - - /** The associated Restlet component. */ - private volatile transient Component component; - - /** The associated HTTP server helper. */ - private volatile transient HttpServerHelper helper; - - /** - * Constructor. - */ - public ServerServlet() { - this.application = null; - this.component = null; - this.helper = null; - } - - /** - * Creates the single Application used by this Servlet. - * - * @param parentContext - * The parent component context. - * - * @return The newly created Application or null if unable to create - */ - protected Application createApplication(Context parentContext) { - Application application = null; - - // Try to instantiate a new target application - // First, find the application class name - String applicationClassName = getInitParameter(APPLICATION_KEY, null); - - // Load the application class using the given class name - if (applicationClassName != null) { - try { - Class targetClass = loadClass(applicationClassName); - - try { - // Instantiate an application with the default constructor - // then invoke the setContext method. - application = (Application) targetClass.getConstructor() - .newInstance(); - - // Set the context based on the Servlet's context - application.setContext(parentContext.createChildContext()); - } catch (NoSuchMethodException e) { - log("[Restlet] ServerServlet couldn't invoke the constructor of the target class. Please check this class has a constructor without parameter. The constructor with a parameter of type Context will be used instead."); - // The constructor with the Context parameter does not - // exist. Create a new instance of the application class by - // invoking the constructor with the Context parameter. - application = (Application) targetClass.getConstructor( - Context.class).newInstance( - parentContext.createChildContext()); - } - } catch (ClassNotFoundException e) { - log("[Restlet] ServerServlet couldn't find the target class. Please check that your classpath includes " - + applicationClassName, e); - - } catch (InstantiationException e) { - log("[Restlet] ServerServlet couldn't instantiate the target class. Please check this class has an empty constructor " - + applicationClassName, e); - } catch (IllegalAccessException e) { - log("[Restlet] ServerServlet couldn't instantiate the target class. Please check that you have to proper access rights to " - + applicationClassName, e); - } catch (NoSuchMethodException e) { - log("[Restlet] ServerServlet couldn't invoke the constructor of the target class. Please check this class has a constructor with a single parameter of Context " - + applicationClassName, e); - } catch (InvocationTargetException e) { - log("[Restlet] ServerServlet couldn't instantiate the target class. An exception was thrown while creating " - + applicationClassName, e); - } - } - - return application; - } - - /** - * Creates a new Servlet call wrapping a Servlet request/response couple and - * a Server connector. - * - * @param server - * The Server connector. - * @param request - * The Servlet request. - * @param response - * The Servlet response. - * @return The new ServletCall instance. - */ - protected ServerCall createCall(Server server, HttpServletRequest request, - HttpServletResponse response) { - return new ServletCall(server, request, response); - } - - /** - * Creates the single Component used by this Servlet. - * - * @return The newly created Component or null if unable to create. - */ - protected Component createComponent() { - // Detect customized Component - String componentClassName = getInitParameter(COMPONENT_KEY, null); - Class targetClass = null; - Component component = null; - - if (componentClassName != null) { - try { - targetClass = loadClass(componentClassName); - } catch (ClassNotFoundException e) { - log("[Restlet] ServerServlet couldn't find the target component class. Please check that your classpath includes " - + componentClassName, e); - } - } - log("[Restlet] ServerServlet: component class is " + componentClassName); - - if (targetClass != null) { - try { - @SuppressWarnings("unchecked") - Constructor ctor = ((Class) targetClass) - .getConstructor(); - - log("[Restlet] ServerServlet: instantiating custom component"); - component = ctor.newInstance(); - } catch (IllegalAccessException e) { - log("[Restlet] ServerServlet couldn't instantiate the target class. Please check that you have proper access rights to " - + componentClassName, e); - } catch (InvocationTargetException e) { - log("[Restlet] ServerServlet encountered an exception instantiating the target class " - + componentClassName, e.getTargetException()); - } catch (InstantiationException | NoSuchMethodException e) { - log(String.format( - "[Restlet] ServerServlet couldn't instantiate the target class. Please check that %s has %s.", - componentClassName, "an empty constructor"), e); - } - } - - // Create the default Component - if (component == null) { - component = new Component(); - - // Define the list of supported client protocols. - final String clientProtocolsString = getInitParameter(CLIENTS_KEY, - null); - if (clientProtocolsString != null) { - final String[] clientProtocols = clientProtocolsString - .split(" "); - Client client; - - for (final String clientProtocol : clientProtocols) { - client = new Client(clientProtocol); - - if (client.isAvailable()) { - component.getClients().add(client); - } else { - log("[Restlet] Couldn't find a client connector for protocol " - + clientProtocol); - } - } - } - } - - return component; - } - - /** - * Creates a new logger facade to be set in the Restlet Engine. By default it - * redirects all logging call to the - * {@link ServletContext#log(String, Throwable)} method. - * - * @return A new logger facade to be set in the Restlet Engine. - */ - protected LoggerFacade createLoggerFacade() { - return new ServletLoggerFacade(getServletContext()); - } - - /** - * Creates the associated HTTP server handling calls. - * - * @param request - * The HTTP Servlet request. - * @return The new HTTP server handling calls. - */ - protected HttpServerHelper createServer(HttpServletRequest request) { - HttpServerHelper result = null; - Component component = getComponent(); - - if (component != null) { - // First, let's create a pseudo server - Server server = new Server(component.getContext() - .createChildContext(), (List) null, - this.getLocalAddr(request), this.getLocalPort(request), - component); - result = new HttpServerHelper(server); - - // Change the default adapter - Context serverContext = server.getContext(); - serverContext.getParameters().add("adapter", - "org.restlet.ext.servlet.internal.ServletServerAdapter"); - - // Attach the hosted application(s) to the right path - String uriPattern = this.getContextPath(request) - + request.getServletPath(); - - if (isDefaultComponent()) { - if (getApplication() != null) { - log("[Restlet] Attaching application: " + getApplication() - + " to URI: " + uriPattern); - component.getDefaultHost().attach(uriPattern, - getApplication()); - } - } else { - // According to the mode, configure correctly the component. - String autoWire = getInitParameter(AUTO_WIRE_KEY, - AUTO_WIRE_KEY_DEFAULT); - if (AUTO_WIRE_KEY_DEFAULT.equalsIgnoreCase(autoWire)) { - // Translate all defined routes as much as possible - // with the context path only or the full servlet path. - - // 1- get the offset - boolean addContextPath = false; - boolean addFullServletPath = false; - - if (component.getDefaultHost().getRoutes().isEmpty()) { - // Case where the default host has a default route (with - // an empty pattern). - addFullServletPath = component.getDefaultHost() - .getDefaultRoute() != null; - } else { - for (Route route : component.getDefaultHost() - .getRoutes()) { - if (route instanceof TemplateRoute) { - TemplateRoute templateRoute = (TemplateRoute) route; - - if (templateRoute.getTemplate().getPattern() == null) { - addFullServletPath = true; - continue; - } - - if (!templateRoute.getTemplate().getPattern() - .startsWith(uriPattern)) { - if (!templateRoute - .getTemplate() - .getPattern() - .startsWith( - request.getServletPath())) { - addFullServletPath = true; - } else { - addContextPath = true; - break; - } - } - } - } - } - if (!addContextPath) { - for (VirtualHost virtualHost : component.getHosts()) { - if (virtualHost.getRoutes().isEmpty()) { - // Case where the default host has a default - // route (with an empty pattern). - addFullServletPath = virtualHost - .getDefaultRoute() != null; - } else { - for (Route route : virtualHost.getRoutes()) { - if (route instanceof TemplateRoute) { - TemplateRoute templateRoute = (TemplateRoute) route; - - if (templateRoute.getTemplate() - .getPattern() == null) { - addFullServletPath = true; - continue; - } - - if (!templateRoute.getTemplate() - .getPattern() - .startsWith(uriPattern)) { - if (!templateRoute - .getTemplate() - .getPattern() - .startsWith( - request.getServletPath())) { - addFullServletPath = true; - } else { - addContextPath = true; - break; - } - } - } - } - } - if (addContextPath) { - break; - } - } - } - - // 2- Translate all routes. - if (addContextPath || addFullServletPath) { - String offsetPath = null; - - if (addContextPath) { - offsetPath = this.getContextPath(request); - } else { - offsetPath = uriPattern; - } - - if (offsetPath != null) { - getComponent() - .getContext() - .getAttributes() - .put(NAME_OFFSET_PATH_ATTRIBUTE, offsetPath); - } - - // Shift the default route (if any) of the default host - Route defaultRoute = component.getDefaultHost() - .getDefaultRoute(); - - if (defaultRoute != null) { - if (defaultRoute instanceof TemplateRoute) { - TemplateRoute defaultTemplateRoute = (TemplateRoute) defaultRoute; - defaultTemplateRoute.getTemplate().setPattern( - offsetPath - + defaultTemplateRoute - .getTemplate() - .getPattern()); - log("[Restlet] Attaching restlet: " - + defaultRoute.getNext() - + " to URI: " - + offsetPath - + defaultTemplateRoute.getTemplate() - .getPattern()); - } else { - log("[Restlet] Attaching restlet: " - + defaultRoute.getNext()); - } - } - - // Shift the routes of the default host - for (Route route : component.getDefaultHost() - .getRoutes()) { - if (route instanceof TemplateRoute) { - TemplateRoute templateRoute = (TemplateRoute) route; - - log("[Restlet] Attaching restlet: " - + route.getNext() - + " to URI: " - + offsetPath - + templateRoute.getTemplate() - .getPattern()); - templateRoute.getTemplate().setPattern( - offsetPath - + templateRoute.getTemplate() - .getPattern()); - } else { - log("[Restlet] Attaching restlet: " - + defaultRoute.getNext()); - } - } - - for (VirtualHost virtualHost : component.getHosts()) { - // Shift the default route (if any) of the virtual - // host - defaultRoute = virtualHost.getDefaultRoute(); - if (defaultRoute != null) { - if (defaultRoute instanceof TemplateRoute) { - TemplateRoute defaultTemplateRoute = (TemplateRoute) defaultRoute; - defaultTemplateRoute - .getTemplate() - .setPattern( - offsetPath - + defaultTemplateRoute - .getTemplate() - .getPattern()); - log("[Restlet] Attaching restlet: " - + defaultRoute.getNext() - + " to URI: " - + offsetPath - + defaultTemplateRoute - .getTemplate().getPattern()); - } else { - log("[Restlet] Attaching restlet: " - + defaultRoute.getNext()); - } - } - - // Shift the routes of the virtual host - for (Route route : virtualHost.getRoutes()) { - if (route instanceof TemplateRoute) { - TemplateRoute templateRoute = (TemplateRoute) route; - - log("[Restlet] Attaching restlet: " - + route.getNext() - + " to URI: " - + offsetPath - + templateRoute.getTemplate() - .getPattern()); - templateRoute.getTemplate().setPattern( - offsetPath - + templateRoute - .getTemplate() - .getPattern()); - } else { - log("[Restlet] Attaching restlet: " - + route.getNext()); - } - } - } - } - } - } - } - - return result; - } - - /** - * Creates a new client for the WAR protocol. - * - * @param context - * The parent context. - * @param config - * The Servlet config. - * @return The new WAR client instance. - */ - protected Client createWarClient(Context context, ServletConfig config) { - return new ServletWarClient(context, config.getServletContext()); - } - - @Override - public void destroy() { - if ((getComponent() != null) && (getComponent().isStarted())) { - try { - getComponent().stop(); - } catch (Exception e) { - log("Error during the stopping of the Restlet component", e); - } - } - - super.destroy(); - } - - /** - * Returns the application. It creates a new one if none exists. - * - * @return The application. - */ - public Application getApplication() { - // Lazy initialization with double-check. - Application result = this.application; - - if (result == null) { - synchronized (this) { - result = this.application; - if (result == null) { - // In case a component is explicitly defined, it cannot be - // completed. - if (isDefaultComponent()) { - // Find the attribute name to use to store the - // application - String applicationAttributeName = getInitParameter( - NAME_APPLICATION_ATTRIBUTE, - NAME_APPLICATION_ATTRIBUTE_DEFAULT + "." - + getServletName()); - - // Look up the attribute for a target - result = (Application) getServletContext() - .getAttribute(applicationAttributeName); - - if (result == null) { - result = createApplication(getComponent() - .getContext()); - init(result); - getServletContext().setAttribute( - applicationAttributeName, result); - } - - this.application = result; - } - } - } - } - - return result; - } - - /** - * Returns the component. It creates a new one if none exists. - * - * @return The component. - */ - public Component getComponent() { - // Lazy initialization with double-check. - Component result = this.component; - - if (result == null) { - synchronized (this) { - result = this.component; - if (result == null) { - // Find the attribute name to use to store the component - final String componentAttributeName = getInitParameter( - NAME_COMPONENT_ATTRIBUTE, - NAME_COMPONENT_ATTRIBUTE_DEFAULT + "." - + getServletName()); - - // Look up the attribute for a target - result = (Component) getServletContext().getAttribute( - componentAttributeName); - - if (result == null) { - result = createComponent(); - init(result); - getServletContext().setAttribute( - componentAttributeName, result); - } - } - - this.component = result; - } - } - - return result; - } - - /** - * Intercepter method need for subclasses such as XdbServerServlet. - * - * @param request - * The Servlet request. - * @return The portion of the request URI that indicates the context of the - * request. - */ - protected String getContextPath(HttpServletRequest request) { - return request.getContextPath(); - } - - /** - * Returns the value of a given initialization parameter, first from the - * Servlet configuration, then from the Web Application context. - * - * @param name - * The parameter name. - * @param defaultValue - * The default to use in case the parameter is not found. - * @return The value of the parameter or null. - */ - public String getInitParameter(String name, String defaultValue) { - String result = getServletConfig().getInitParameter(name); - - if (result == null) { - result = getServletConfig().getServletContext().getInitParameter( - name); - } - - if (result == null) { - result = defaultValue; - } - - return result; - } - - /** - * Intercepter method need for subclasses such as XdbServerServlet. - * - * @param request - * The Servlet request. - * @return The Internet Protocol (IP) address of the interface on which the - * request was received. - */ - protected String getLocalAddr(HttpServletRequest request) { - return request.getLocalAddr(); - } - - /** - * Intercepter method need for subclasses such as XdbServerServlet. - * - * @param request - * The Servlet request. - * @return The Internet Protocol (IP) port number of the interface on which - * the request was received - */ - protected int getLocalPort(HttpServletRequest request) { - return request.getLocalPort(); - } - - /** - * Returns the associated HTTP server handling calls. It creates a new one - * if none exists. - * - * @param request - * The HTTP Servlet request. - * @return The HTTP server handling calls. - */ - public HttpServerHelper getServer(HttpServletRequest request) { - // Lazy initialization with double-check. - HttpServerHelper result = this.helper; - - if (result == null) { - synchronized (this) { - result = this.helper; - if (result == null) { - // Find the attribute name to use to store the server - // reference - final String serverAttributeName = getInitParameter( - NAME_SERVER_ATTRIBUTE, - NAME_SERVER_ATTRIBUTE_DEFAULT + "." - + getServletName()); - - // Look up the attribute for a target - result = (HttpServerHelper) getServletContext() - .getAttribute(serverAttributeName); - - if (result == null) { - result = createServer(request); - getServletContext().setAttribute(serverAttributeName, - result); - } - - this.helper = result; - } - } - } - - return result; - } - - /** - * If no logger facade class has been set for the Restlet Engine in system - * properties, then pro-actively set a logger facade that will send all logging - * calls to the {@link ServletContext#log(String, Throwable)} method. Then, get - * the Restlet Component and starts it, triggering additional creation methods. - */ - @Override - public void init() throws ServletException { - if (System.getProperty("org.restlet.engine.loggerFacadeClass") == null) { - Engine.getInstance().setLoggerFacade(createLoggerFacade()); - } - - if ((getComponent() != null) && (getComponent().isStopped())) { - try { - getComponent().start(); - } catch (Exception e) { - log("Error during the starting of the Restlet Application", e); - } - } - } - - /** - * Initialize a application. Copies Servlet parameters into the component's - * context. Copies the ServletContext into an - * "org.restlet.ext.servlet.ServletContext" attribute. - * - * @param application - * The application to configure. - */ - protected void init(Application application) { - if (application != null) { - Context applicationContext = application.getContext(); - - if (applicationContext != null) { - // Copies the ServletContext into an attribute - applicationContext.getAttributes().put( - "org.restlet.ext.servlet.ServletContext", - getServletContext()); - - // Copy all the servlet parameters into the context - String initParam; - - // Copy all the Servlet component initialization parameters - jakarta.servlet.ServletConfig servletConfig = getServletConfig(); - for (Enumeration enum1 = servletConfig - .getInitParameterNames(); enum1.hasMoreElements();) { - initParam = enum1.nextElement(); - applicationContext.getParameters().add(initParam, - servletConfig.getInitParameter(initParam)); - } - - // Copy all the Servlet application initialization parameters - for (Enumeration enum1 = getServletContext() - .getInitParameterNames(); enum1.hasMoreElements();) { - initParam = enum1.nextElement(); - applicationContext.getParameters().add(initParam, - getServletContext().getInitParameter(initParam)); - } - } - } - } - - /** - * Initialize a component. Adds a default WAR client and copies Servlet - * parameters into the component's context. Copies the ServletContext into - * an "org.restlet.ext.servlet.ServletContext" attribute. - * - * @param component - * The component to configure. - */ - protected void init(Component component) { - if (component != null) { - // Complete the configuration of the Component - // Add the WAR client - component.getClients() - .add(createWarClient(component.getContext(), - getServletConfig())); - - // Copy all the servlet parameters into the context - ComponentContext componentContext = (ComponentContext) component - .getContext(); - - // Copies the ServletContext into an attribute - componentContext.getAttributes().put( - "org.restlet.ext.servlet.ServletContext", - getServletContext()); - - // Copy all the Servlet container initialization parameters - String initParam; - jakarta.servlet.ServletConfig servletConfig = getServletConfig(); - - for (Enumeration enum1 = servletConfig - .getInitParameterNames(); enum1.hasMoreElements();) { - initParam = enum1.nextElement(); - componentContext.getParameters().add(initParam, - servletConfig.getInitParameter(initParam)); - } - - // Copy all the Servlet application initialization parameters - for (Enumeration enum1 = getServletContext() - .getInitParameterNames(); enum1.hasMoreElements();) { - initParam = enum1.nextElement(); - componentContext.getParameters().add(initParam, - getServletContext().getInitParameter(initParam)); - } - - // Copy all Servlet's context attributes - String attributeName; - for (Enumeration namesEnum = getServletContext() - .getAttributeNames(); namesEnum.hasMoreElements();) { - attributeName = namesEnum.nextElement(); - componentContext.getAttributes().put(attributeName, - getServletContext().getAttribute(attributeName)); - } - } - } - - /** - * Indicates if the Component hosted by this Servlet is the default one or - * one provided by the user via a context parameter. - * - * @return True if the Component is the default one, false otherwise. - */ - private boolean isDefaultComponent() { - String componentAttributeName = getInitParameter(COMPONENT_KEY, null); - if (componentAttributeName != null) { - return false; - } - - return true; - } - - /** - * Returns a class for a given qualified class name. - * - * @param className - * The class name to lookup. - * @return The class object. - * @throws ClassNotFoundException - */ - protected Class loadClass(String className) - throws ClassNotFoundException { - return Engine.loadClass(className); - } - - /** - * Services a HTTP Servlet request as an uniform call. - * - * @param request - * The HTTP Servlet request. - * @param response - * The HTTP Servlet response. - */ - @Override - public void service(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - HttpServerHelper helper = getServer(request); - - if (helper != null) { - helper.handle(createCall(helper.getHelped(), request, response)); - } else { - log("[Restlet] Unable to get the Restlet HTTP server connector. Status code 500 returned."); - response.sendError(500); - } - } -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletAdapter.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletAdapter.java deleted file mode 100644 index c639c7ea39..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletAdapter.java +++ /dev/null @@ -1,202 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet; - -import jakarta.servlet.ServletContext; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.restlet.Context; -import org.restlet.Restlet; -import org.restlet.data.Reference; -import org.restlet.engine.Engine; -import org.restlet.engine.adapter.HttpRequest; -import org.restlet.engine.adapter.HttpResponse; -import org.restlet.ext.servlet.internal.ServletCall; -import org.restlet.ext.servlet.internal.ServletLogger; -import org.restlet.ext.servlet.internal.ServletServerAdapter; -import org.restlet.routing.Router; - -/** - * HTTP adapter from Servlet calls to Restlet calls. This class can be used in - * any Servlet, just create a new instance and override the service() method in - * your Servlet to delegate all those calls to this class's service() method. - * Remember to set the next {@link Restlet}, for example using a {@link Router} - * instance. You can get the Restlet context directly on instances of this - * class, it will be based on the parent Servlet's context for logging purpose.
- *
- * This class is especially useful when directly integrating Restlets with - * Spring managed Web applications. Here is a simple usage example: - * - *
- * public class TestServlet extends HttpServlet {
- *     private ServletAdapter adapter;
- * 
- *     public void init() throws ServletException {
- *         super.init();
- *         this.adapter = new ServletAdapter(getServletContext());
- * 
- *         Restlet trace = new Restlet(this.adapter.getContext()) {
- *             public void handle(Request req, Response res) {
- *                 getLogger().info("Hello World");
- *                 res.setEntity("Hello World!", MediaType.TEXT_PLAIN);
- *             }
- *         };
- * 
- *         this.adapter.setNext(trace);
- *     }
- * 
- *     protected void service(HttpServletRequest req, HttpServletResponse res)
- *             throws ServletException, IOException {
- *         this.adapter.service(req, res);
- *     }
- * }
- * 
- * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServletAdapter extends ServletServerAdapter { - - /** The next Restlet. */ - private volatile Restlet next; - - /** - * Constructor. Remember to manually set the "target" property before - * invoking the service() method. - * - * @param context - * The Servlet context. - */ - public ServletAdapter(ServletContext context) { - this(context, null); - } - - /** - * Constructor. - * - * @param context - * The Servlet context. - * @param next - * The next Restlet. - */ - public ServletAdapter(ServletContext context, Restlet next) { - super(new Context(new ServletLogger(context))); - this.next = next; - } - - /** - * Returns the base reference of new Restlet requests. - * - * @param request - * The Servlet request. - * @return The base reference of new Restlet requests. - */ - public Reference getBaseRef(HttpServletRequest request) { - Reference result = null; - final String basePath = request.getContextPath() - + request.getServletPath(); - final String baseUri = request.getRequestURL().toString(); - // Path starts at first slash after scheme:// - final int pathStart = baseUri.indexOf("/", - request.getScheme().length() + 3); - if (basePath.length() == 0) { - // basePath is empty in case the webapp is mounted on root context - if (pathStart != -1) { - result = new Reference(baseUri.substring(0, pathStart)); - } else { - result = new Reference(baseUri); - } - } else { - if (pathStart != -1) { - final int baseIndex = baseUri.indexOf(basePath, pathStart); - if (baseIndex != -1) { - result = new Reference(baseUri.substring(0, baseIndex - + basePath.length())); - } - } - } - - return result; - } - - /** - * Returns the next Restlet. - * - * @return The next Restlet. - */ - public Restlet getNext() { - return this.next; - } - - /** - * Returns the root reference of new Restlet requests. By default it returns - * the result of getBaseRef(). - * - * @param request - * The Servlet request. - * @return The root reference of new Restlet requests. - */ - public Reference getRootRef(HttpServletRequest request) { - return getBaseRef(request); - } - - /** - * Services a HTTP Servlet request as a Restlet request handled by the - * "target" Restlet. - * - * @param request - * The HTTP Servlet request. - * @param response - * The HTTP Servlet response. - */ - public void service(HttpServletRequest request, HttpServletResponse response) { - if (getNext() != null) { - try { - // Set the current context - Context.setCurrent(getContext()); - - // Convert the Servlet call to a Restlet call - ServletCall servletCall = new ServletCall( - request.getLocalAddr(), request.getLocalPort(), - request, response); - HttpRequest httpRequest = toRequest(servletCall); - HttpResponse httpResponse = new HttpResponse(servletCall, - httpRequest); - - // Adjust the relative reference - httpRequest.getResourceRef().setBaseRef(getBaseRef(request)); - - // Adjust the root reference - httpRequest.setRootRef(getRootRef(request)); - - // Handle the request and commit the response - getNext().handle(httpRequest, httpResponse); - commit(httpResponse); - } finally { - Engine.clearThreadLocalVariables(); - } - } else { - getLogger().warning("Unable to find the Restlet target"); - } - } - - /** - * Sets the next Restlet. - * - * @param next - * The next Restlet. - */ - public void setNext(Restlet next) { - this.next = next; - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletUtils.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletUtils.java deleted file mode 100644 index d1089b51f4..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/ServletUtils.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.engine.adapter.Call; -import org.restlet.engine.adapter.HttpRequest; -import org.restlet.engine.adapter.HttpResponse; -import org.restlet.ext.servlet.internal.ServletCall; - -/** - * Servlet related utilities. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public final class ServletUtils { - - /** - * Returns the Servlet request that was used to generate the given Restlet - * request. - * - * @param request - * The Restlet request. - * @return The Servlet request or null. - */ - public static HttpServletRequest getRequest(Request request) { - HttpServletRequest result = null; - - if (request instanceof HttpRequest) { - Call call = ((HttpRequest) request).getHttpCall(); - - if (call instanceof ServletCall) { - result = ((ServletCall) call).getRequest(); - } - } - - return result; - } - - /** - * Returns the Servlet response that was used to generate the given Restlet - * response. - * - * @param response - * The Restlet response. - * @return The Servlet request or null. - */ - public static HttpServletResponse getResponse(Response response) { - HttpServletResponse result = null; - - if (response instanceof HttpResponse) { - Call call = ((HttpResponse) response).getHttpCall(); - - if (call instanceof ServletCall) { - result = ((ServletCall) call).getResponse(); - } - } - - return result; - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java deleted file mode 100644 index b67e77ef98..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletCall.java +++ /dev/null @@ -1,444 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet.internal; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.security.Principal; -import java.security.cert.Certificate; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.Level; - -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.restlet.Response; -import org.restlet.Server; -import org.restlet.data.Form; -import org.restlet.data.Header; -import org.restlet.data.MediaType; -import org.restlet.data.Protocol; -import org.restlet.data.Status; -import org.restlet.engine.adapter.ServerCall; -import org.restlet.engine.header.HeaderConstants; -import org.restlet.engine.header.LanguageReader; -import org.restlet.engine.io.UnclosableInputStream; -import org.restlet.engine.io.UnclosableOutputStream; -import org.restlet.representation.Representation; -import org.restlet.util.Series; - -/** - * Call that is used by the Servlet HTTP server connector. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServletCall extends ServerCall { - - /** The HTTP Servlet request to wrap. */ - private volatile HttpServletRequest request; - - /** The request headers. */ - private volatile Series
requestHeaders; - - /** The HTTP Servlet response to wrap. */ - private volatile HttpServletResponse response; - - /** - * Constructor. - * - * @param server - * The parent server. - * @param request - * The HTTP Servlet request to wrap. - * @param response - * The HTTP Servlet response to wrap. - */ - public ServletCall(Server server, HttpServletRequest request, - HttpServletResponse response) { - super(server); - this.request = request; - this.response = response; - } - - /** - * Constructor. - * - * @param serverAddress - * The server IP address. - * @param serverPort - * The server port. - * @param request - * The Servlet request - * @param response - * The Servlet response. - */ - public ServletCall(String serverAddress, int serverPort, - HttpServletRequest request, HttpServletResponse response) { - super(serverAddress, serverPort); - this.request = request; - this.response = response; - } - - /** - * Not supported. Always returns false. - */ - @Override - public boolean abort() { - return false; - } - - @Override - public void flushBuffers() throws IOException { - getResponse().flushBuffer(); - } - - @Override - public List getCertificates() { - Certificate[] certificateArray = (Certificate[]) getRequest() - .getAttribute("jakarta.servlet.request.X509Certificate"); - - if (certificateArray != null) { - return Arrays.asList(certificateArray); - } - - return null; - } - - @Override - public String getCipherSuite() { - return (String) getRequest().getAttribute( - "jakarta.servlet.request.cipher_suite"); - } - - @Override - public String getClientAddress() { - return getRequest().getRemoteAddr(); - } - - @Override - public int getClientPort() { - return getRequest().getRemotePort(); - } - - /** - * Returns the server domain name. - * - * @return The server domain name. - */ - @Override - public String getHostDomain() { - return getRequest().getServerName(); - } - - /** - * Returns the request method. - * - * @return The request method. - */ - @Override - public String getMethod() { - return getRequest().getMethod(); - } - - /** - * Returns the server protocol. - * - * @return The server protocol. - */ - @Override - public Protocol getProtocol() { - return Protocol.valueOf(getRequest().getScheme()); - } - - /** - * Returns the HTTP Servlet request. - * - * @return The HTTP Servlet request. - */ - public HttpServletRequest getRequest() { - return this.request; - } - - @Override - public Representation getRequestEntity() { - Representation result = null; - - if (getRequest().getContentType() != null - && MediaType.APPLICATION_WWW_FORM.isCompatible(new MediaType( - getRequest().getContentType()))) { - Form form = new Form(); - Map map = request.getParameterMap(); - - for (Entry entry : map.entrySet()) { - for (int i = 0; i < entry.getValue().length; i++) { - form.add(entry.getKey(), entry.getValue()[i]); - } - } - - result = form.getWebRepresentation(); - - // Extract some interesting header values - Header header = getRequestHeaders().getFirst( - HeaderConstants.HEADER_CONTENT_LANGUAGE, true); - - if (header != null) { - new LanguageReader(header.getValue()).addValues(result - .getLanguages()); - } - } else { - result = super.getRequestEntity(); - } - - return result; - } - - @Override - public InputStream getRequestEntityStream(long size) { - try { - return new UnclosableInputStream(getRequest().getInputStream()); - } catch (IOException e) { - return null; - } - } - - /** - * Returns the list of request headers. - * - * @return The list of request headers. - */ - @Override - public Series
getRequestHeaders() { - if (this.requestHeaders == null) { - this.requestHeaders = new Series
(Header.class); - - // Copy the headers from the request object - String headerName; - String headerValue; - - for (Enumeration names = getRequest().getHeaderNames(); names - .hasMoreElements();) { - headerName = names.nextElement(); - - for (Enumeration values = getRequest().getHeaders( - headerName); values.hasMoreElements();) { - headerValue = values.nextElement(); - this.requestHeaders.add(headerName, headerValue); - } - } - } - - return this.requestHeaders; - } - - @Override - public InputStream getRequestHeadStream() { - // Not available - return null; - } - - /** - * Returns the full request URI. - * - * @return The full request URI. - */ - @Override - public String getRequestUri() { - final String queryString = getRequest().getQueryString(); - - if ((queryString == null) || (queryString.isEmpty())) { - return getRequest().getRequestURI(); - } - - return getRequest().getRequestURI() + '?' + queryString; - } - - /** - * Returns the HTTP Servlet response. - * - * @return The HTTP Servlet response. - */ - public HttpServletResponse getResponse() { - return this.response; - } - - /** - * Returns the response stream if it exists, null otherwise. - * - * @return The response stream if it exists, null otherwise. - */ - @Override - public OutputStream getResponseEntityStream() { - try { - return new UnclosableOutputStream(getResponse().getOutputStream()); - } catch (IOException e) { - return null; - } - } - - /** - * Returns the response address.
- * Corresponds to the IP address of the responding server. - * - * @return The response address. - */ - @Override - public String getServerAddress() { - return getRequest().getLocalAddr(); - } - - /** - * Returns the server port. - * - * @return The server port. - */ - @Override - public int getServerPort() { - return getRequest().getServerPort(); - } - - @Override - public Integer getSslKeySize() { - Integer keySize = (Integer) getRequest().getAttribute( - "jakarta.servlet.request.key_size"); - - if (keySize == null) { - keySize = super.getSslKeySize(); - } - - return keySize; - } - - @Override - public String getSslSessionId() { - Object sessionId = getRequest().getAttribute( - "jakarta.servlet.request.ssl_session_id"); - - if (sessionId instanceof String) { - return (String) sessionId; - } - - /* - * The following is for the non-standard, pre-Servlet 3 spec used by - * Tomcat/Coyote. - */ - sessionId = getRequest().getAttribute( - "jakarta.servlet.request.ssl_session"); - - if (sessionId instanceof String) { - return (String) sessionId; - } - - return null; - } - - @Override - public Principal getUserPrincipal() { - return getRequest().getUserPrincipal(); - } - - @Override - public String getVersion() { - String result = null; - final int index = getRequest().getProtocol().indexOf('/'); - - if (index != -1) { - result = getRequest().getProtocol().substring(index + 1); - } - - return result; - } - - /** - * Indicates if the request was made using a confidential mean.
- * - * @return True if the request was made using a confidential mean.
- */ - @Override - public boolean isConfidential() { - return getRequest().isSecure(); - } - - /** - * Sends the response back to the client. Commits the status, headers and - * optional entity and send them on the network. - * - * @param response - * The high-level response. - */ - @Override - public void sendResponse(Response response) throws IOException { - // Set the status code in the response. We do this after adding the - // headers because when we have to rely on the 'sendError' method, - // the Servlet containers are expected to commit their response. - if (Status.isError(getStatusCode()) && (response.getEntity() == null)) { - try { - // Add the response headers - Header header; - - for (Iterator
iter = getResponseHeaders().iterator(); iter - .hasNext();) { - header = iter.next(); - - // We don't need to set the content length, especially - // because it could send the response too early on some - // containers (ex: Tomcat 5.0). - if (!header.getName().equals( - HeaderConstants.HEADER_CONTENT_LENGTH)) { - getResponse().addHeader(header.getName(), - header.getValue()); - } - } - - getResponse().sendError(getStatusCode(), getReasonPhrase()); - } catch (IOException ioe) { - getLogger().log(Level.WARNING, - "Unable to set the response error status", ioe); - } - } else { - // Send the response entity - getResponse().setStatus(getStatusCode()); - - // Add the response headers after setting the status because - // otherwise some containers (ex: Tomcat 5.0) immediately send - // the response if a "Content-Length: 0" header is found. - Header header; - Header contentLengthHeader = null; - - for (Iterator
iter = getResponseHeaders().iterator(); iter - .hasNext();) { - header = iter.next(); - - if (header.getName().equals( - HeaderConstants.HEADER_CONTENT_LENGTH)) { - contentLengthHeader = header; - } else { - getResponse() - .addHeader(header.getName(), header.getValue()); - } - } - - if (contentLengthHeader != null) { - getResponse().addHeader(contentLengthHeader.getName(), - contentLengthHeader.getValue()); - } - - super.sendResponse(response); - } - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java deleted file mode 100644 index 196e7406a8..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLogger.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet.internal; - -import java.util.logging.LogRecord; -import java.util.logging.Logger; - -import jakarta.servlet.ServletContext; - -/** - * Logger that wraps the logging methods of jakarta.servlet.ServletContext. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServletLogger extends Logger { - /** The Servlet context to use for logging. */ - private volatile ServletContext context; - - /** - * Constructor. - * - * @param context - * The Servlet context to use. - */ - public ServletLogger(jakarta.servlet.ServletContext context) { - super(null, null); - this.context = context; - } - - /** - * Returns the Servlet context to use for logging. - * - * @return The Servlet context to use for logging. - */ - protected ServletContext getContext() { - return this.context; - } - - /** - * Log a LogRecord. - * - * @param record - * The LogRecord to be published - */ - @Override - public void log(LogRecord record) { - if (record.getThrown() != null) { - getContext().log(record.getMessage(), record.getThrown()); - } else { - getContext().log(record.getMessage()); - } - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java deleted file mode 100644 index 2a6bd2541c..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletLoggerFacade.java +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet.internal; - -import java.util.logging.Logger; - -import jakarta.servlet.ServletContext; - -import org.restlet.engine.log.LoggerFacade; - -/** - * Restlet log facade for the {@link ServletContext#log(String, Throwable)} - * method. In order to use Servlet as the logging facade for Restlet, you need - * to set the "org.restlet.engine.loggerFacadeClass" system property with the - * "org.restlet.ext.servlet.ServletLoggerFacade" value. - * - * @see ServletContext#log(String, Throwable) - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServletLoggerFacade extends LoggerFacade { - - /** - * As Servlet logging doesn't use logger names, we will reuse the same logger. - **/ - private final ServletLogger servletLogger; - - /** - * Constructor. - * - * @param context The Servlet context of the parent container. - */ - public ServletLoggerFacade(ServletContext context) { - this.servletLogger = createServletLogger(context); - } - - /** - * Create a new reusable {@link ServletLogger}. - * - * @param context The Servlet context of the parent container. - * @return The new reusable {@link ServletLogger}. - */ - protected ServletLogger createServletLogger(ServletContext context) { - return new ServletLogger(context); - } - - @Override - public Logger getAnonymousLogger() { - return getServletLogger(); - } - - @Override - public Logger getLogger(String loggerName) { - return getServletLogger(); - } - - /** - * Returns the Servlet logger reused for all calls as there is no need for - * distinct logger with Servlet logging methods. - * - * @return The Servlet logger reused for all calls. - */ - protected ServletLogger getServletLogger() { - return servletLogger; - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java deleted file mode 100644 index 49f56cc9e6..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletServerAdapter.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet.internal; - -import java.util.Enumeration; - -import org.restlet.Context; -import org.restlet.data.Form; -import org.restlet.engine.adapter.HttpRequest; -import org.restlet.engine.adapter.ServerAdapter; -import org.restlet.engine.adapter.ServerCall; - -/** - * Default server adapter from Servlet calls to Restlet calls. This class is - * used by the {@code ServerServlet} to ensure that Servlet specific concepts - * are properly transfered to Restlet.
- * Especially, it makes sure that the "jsessionid" matrix parameter is removed - * from the resource's reference, as this may interfer with the routing process, - * and because this parameter is useless for Restlet-based applications.
- *
- * it also copies the Servlet's request attributes into the Restlet's request - * attributes map. - * - * @author Jeremy Gustie - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServletServerAdapter extends ServerAdapter { - - /** - * Constructor. - * - * @param context - * The context to use. - */ - public ServletServerAdapter(Context context) { - super(context); - } - - @Override - public HttpRequest toRequest(ServerCall httpCall) { - final HttpRequest result = super.toRequest(httpCall); - - // Remove the Servlet API "jsessionid" matrix parameter - Form matrixForm = result.getResourceRef().getMatrixAsForm(); - if (matrixForm.removeAll("jsessionid", true)) { - String lastSegment = result.getResourceRef().getLastSegment(); - final int matrixIndex = lastSegment.indexOf(';'); - if (matrixForm.isEmpty()) { - // No matrix left - lastSegment = lastSegment.substring(0, matrixIndex); - } else { - // Add the remaining matrix parameters back in - lastSegment = lastSegment.substring(0, matrixIndex + 1) - + matrixForm.getMatrixString(); - } - result.getResourceRef().setLastSegment(lastSegment); - } - - if (httpCall instanceof ServletCall) { - ServletCall servletCall = (ServletCall) httpCall; - - // Copy all Servlet's request attributes - String attributeName; - for (final Enumeration namesEnum = servletCall.getRequest() - .getAttributeNames(); namesEnum.hasMoreElements();) { - attributeName = namesEnum.nextElement(); - Object attribute = servletCall.getRequest().getAttribute(attributeName); - if (attribute != null) { - result.getAttributes().put(attributeName, attribute); - } - } - } - - return result; - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java deleted file mode 100644 index 7909e70a2b..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClient.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet.internal; - -import java.util.List; - -import org.restlet.Client; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.data.Protocol; -import org.restlet.engine.connector.ClientHelper; - -/** - * Connector acting as a WAR client for a Servlet Application. It internally - * uses one of the available connectors registered with the current Restlet - * implementation.
- *
- * Here is an example of WAR URI that can be resolved by this client: - * "war:///WEB-INF/web.xml" - * - * Concurrency note: instances of this class or its subclasses can be invoked by - * several threads at the same time and therefore must be thread-safe. You - * should be especially careful when storing state in member variables. - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServletWarClient extends Client { - /** The helper provided by the implementation. */ - private volatile ClientHelper helper; - - /** - * Constructor. - * - * @param parentContext - * The parent context. - */ - public ServletWarClient(Context parentContext, - jakarta.servlet.ServletContext servletContext) { - super(parentContext.createChildContext(), (List) null); - getProtocols().add(Protocol.WAR); - this.helper = new ServletWarClientHelper(this, servletContext); - } - - /** - * Returns the helper provided by the implementation. - * - * @return The helper provided by the implementation. - */ - private ClientHelper getHelper() { - return this.helper; - } - - /** - * Handles a call. - * - * @param request - * The request to handle. - * @param response - * The response to update. - */ - @Override - public void handle(Request request, Response response) { - super.handle(request, response); - getHelper().handle(request, response); - } - - /** Start callback. */ - @Override - public void start() throws Exception { - super.start(); - getHelper().start(); - } - - /** Stop callback. */ - @Override - public void stop() throws Exception { - getHelper().stop(); - super.stop(); - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java deleted file mode 100644 index 32bf359c66..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarClientHelper.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet.internal; - -import jakarta.servlet.ServletContext; - -import org.restlet.Client; -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.data.Protocol; -import org.restlet.engine.local.Entity; -import org.restlet.engine.local.EntityClientHelper; - -/** - * Client connector based on a Servlet context (JEE Web application context). - * Here is a sample resource URI:
- * - *
- * war:///path/to/my/resource/entry.txt
- * 
- * - *
- * You can note that there is no authority which is denoted by the sequence of - * three "/" characters. This connector is designed to be used inside a context - * (e.g. inside a servlet based application) and subconsequently does not - * require the use of a authority. Such URI are "relative" to the root of the - * servlet context.
- * Here is a sample code excerpt that illustrates the way to use this connector: - * - * Response response = getContext().getClientDispatcher().get("war:///myDir/test.txt"); - if (response.isEntityAvailable()) { - //Do what you want to do. - } - - * - * @author Jerome Louvel - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServletWarClientHelper extends EntityClientHelper { - - /** The Servlet context to use. */ - private volatile ServletContext servletContext; - - /** - * Constructor. - * - * @param client - * The client to help. - * @param servletContext - * The Servlet context. - */ - public ServletWarClientHelper(Client client, ServletContext servletContext) { - super(client); - getProtocols().clear(); - getProtocols().add(Protocol.WAR); - this.servletContext = servletContext; - } - - @Override - public Entity getEntity(String decodedPath) { - return new ServletWarEntity(getServletContext(), decodedPath, - getMetadataService()); - } - - /** - * Returns the Servlet context. - * - * @return The Servlet context. - */ - public ServletContext getServletContext() { - return this.servletContext; - } - - @Override - public void handleLocal(Request request, Response response, - String decodedPath) { - String scheme = request.getResourceRef().getScheme(); - - if (Protocol.WAR.getSchemeName().equalsIgnoreCase(scheme)) { - super.handleLocal(request, response, decodedPath); - } else { - throw new IllegalArgumentException( - "Protocol \"" - + scheme - + "\" not supported by the connector. Only WAR is supported."); - } - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java deleted file mode 100644 index 805f63d21d..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/internal/ServletWarEntity.java +++ /dev/null @@ -1,207 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.servlet.internal; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; - -import jakarta.servlet.ServletContext; - -import org.restlet.Context; -import org.restlet.data.MediaType; -import org.restlet.engine.local.Entity; -import org.restlet.representation.InputRepresentation; -import org.restlet.representation.Representation; -import org.restlet.service.MetadataService; - -/** - * Local entity based on a Servlet context's resource file. - * - * @author Thierry Boileau - * @deprecated Will be removed in next major release. - */ -@Deprecated -public class ServletWarEntity extends Entity { - /** - * List of children files if it is a directory. We suppose that in a WAR - * entity, this list does not change, and thus can be cached during the - * request processing. - */ - private List children = null; - - /** Is this file a directory? */ - private final boolean directory; - - /** The full name of the file (without trailing "/"). */ - private final String fullName; - - /** The relative path of the file inside the context. */ - private final String path; - - /** The Servlet context to use. */ - private final ServletContext servletContext; - - /** - * Constructor. - * - * @param servletContext - * The parent Servlet context. - * @param path - * The entity path. - * @param metadataService - * The metadata service to use. - */ - public ServletWarEntity(ServletContext servletContext, String path, - MetadataService metadataService) { - super(metadataService); - this.children = null; - this.servletContext = servletContext; - this.path = path; - - if (path.endsWith("/")) { - this.directory = true; - this.fullName = path.substring(0, path.length() - 1); - Set childPaths = getServletContext().getResourcePaths(path); - - if (childPaths != null && !childPaths.isEmpty()) { - this.children = new ArrayList(); - - for (Object childPath : childPaths) { - if (!childPath.equals(this.path)) { - this.children.add(new ServletWarEntity( - this.servletContext, (String) childPath, - metadataService)); - } - } - } - } else { - this.fullName = path; - Set childPaths = getServletContext().getResourcePaths(path); - - if (childPaths != null && !childPaths.isEmpty()) { - this.directory = true; - this.children = new ArrayList(); - - for (Object childPath : childPaths) { - if (!childPath.equals(this.path)) { - this.children.add(new ServletWarEntity( - this.servletContext, (String) childPath, - metadataService)); - } - } - } else { - this.directory = false; - } - } - } - - @Override - public boolean exists() { - boolean result = false; - - try { - result = (isDirectory() && getChildren() != null) - || (isNormal() && getServletContext() - .getResource(this.path) != null); - } catch (MalformedURLException e) { - Context.getCurrentLogger().log(Level.WARNING, - "Unable to test the existence of the WAR resource", e); - } - - return result; - } - - @Override - public List getChildren() { - return this.children; - } - - @Override - public String getName() { - int index = this.fullName.lastIndexOf("/"); - - if (index != -1) { - return this.fullName.substring(index + 1); - } - - return this.fullName; - } - - @Override - public Entity getParent() { - Entity result = null; - int index = this.fullName.lastIndexOf("/"); - - if (index != -1) { - result = new ServletWarEntity(getServletContext(), - this.fullName.substring(0, index + 1), getMetadataService()); - } - - return result; - } - - @Override - public Representation getRepresentation(MediaType defaultMediaType, - int timeToLive) { - Representation result = null; - - try { - URL resource = getServletContext().getResource(path); - if (resource != null) { - URLConnection connection = resource.openConnection(); - result = new InputRepresentation(connection.getInputStream(), - defaultMediaType); - - // Sets the modification date - result.setModificationDate(new Date(connection - .getLastModified())); - - // Sets the expiration date - if (timeToLive == 0) { - result.setExpirationDate(null); - } else if (timeToLive > 0) { - result.setExpirationDate(new Date(System - .currentTimeMillis() + (1000L * timeToLive))); - } - } - } catch (IOException e) { - Context.getCurrentLogger().log(Level.WARNING, - "Error getting the WAR resource.", e); - } - return result; - } - - /** - * Returns the Servlet context to use. - * - * @return The Servlet context to use. - */ - public ServletContext getServletContext() { - return this.servletContext; - } - - @Override - public boolean isDirectory() { - return this.directory; - } - - @Override - public boolean isNormal() { - return !isDirectory(); - } - -} diff --git a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/package.html b/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/package.html deleted file mode 100644 index 462220f4cd..0000000000 --- a/org.restlet.ext.servlet/src/main/java/org/restlet/ext/servlet/package.html +++ /dev/null @@ -1,11 +0,0 @@ - - -Integration with Servlet API. Java Servlet technology provides Web developers with a simple, -consistent mechanism for extending the functionality of a Web server and for accessing existing business systems. - -@since Restlet 1.0 -@see Servlet HTTP server -@see User Guide - Servlet extension -@deprecated Will be removed in next major release. - - \ No newline at end of file diff --git a/org.restlet.ext.servlet/src/main/resources/META-INF/MANIFEST.MF b/org.restlet.ext.servlet/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index 254272e1c0..0000000000 --- a/org.restlet.ext.servlet/src/main/resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/org.restlet.ext.servlet/src/main/resources/OSGI-INF/restlet.xml b/org.restlet.ext.servlet/src/main/resources/OSGI-INF/restlet.xml deleted file mode 100644 index ba48a4be88..0000000000 --- a/org.restlet.ext.servlet/src/main/resources/OSGI-INF/restlet.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/org.restlet.ext.spring/pom.xml b/org.restlet.ext.spring/pom.xml index 81f0e5338c..ecc42cd90a 100644 --- a/org.restlet.ext.spring/pom.xml +++ b/org.restlet.ext.spring/pom.xml @@ -15,11 +15,6 @@ Integration with Spring Framework. - - org.springframework - spring-beans - ${lib-spring-version} - org.springframework spring-core @@ -30,27 +25,6 @@ spring-context ${lib-spring-version} - - org.springframework - spring-web - ${lib-spring-version} - - - org.springframework - spring-webmvc - ${lib-spring-version} - - - jakarta.servlet - jakarta.servlet-api - ${lib-servlet-version} - provided - - - org.restlet - org.restlet.ext.servlet - ${project.version} - org.restlet org.restlet diff --git a/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java deleted file mode 100644 index d9d5144e38..0000000000 --- a/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/RestletFrameworkServlet.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.spring; - -import java.io.IOException; - -import jakarta.servlet.ServletException; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.restlet.Application; -import org.restlet.Context; -import org.restlet.Restlet; -import org.restlet.ext.servlet.ServletAdapter; -import org.springframework.beans.BeansException; -import org.springframework.web.servlet.FrameworkServlet; - -/** - * A Servlet which provides an automatic Restlet integration with an existing - * {@link org.springframework.web.context.WebApplicationContext}. The usage is - * similar to Spring's {@link org.springframework.web.servlet.DispatcherServlet} - * . In the web.xml file, declare the Servlet and map its root URL like this: - * - *
- * <servlet>
- *    <servlet-name>api</servlet-name>
- *    <servlet-class>org.restlet.ext.spring.RestletFrameworkServlet</servlet-class>
- *    <load-on-startup>1</load-on-startup>
- * </servlet>
- * 
- * <servlet-mapping>
- *    <servlet-name>api</servlet-name>
- *    <url-pattern>/api/v1/*</url-pattern>
- * </servlet-mapping>
- * 
- * - *

- * Then, create a beans XML file called - * /WEB-INF/[servlet-name]-servlet.xml — in this case, - * /WEB-INF/api-servlet.xml — and define your restlets and - * resources in it. - *

- * All requests to this servlet will be delegated to a single top-level restlet - * loaded from the Spring application context. By default, this servlet looks - * for a bean named "root". You can override that by passing in the - * targetRestletBeanName parameter. For example: - * - *

- * <servlet>
- *    <servlet-name>api</servlet-name>
- *    <servlet-class>org.restlet.ext.spring.RestletFrameworkServlet</servlet-class>
- *    <load-on-startup>1</load-on-startup>
- *    <init-param>
- *       <param-name>targetRestletBeanName</param-name>
- *       <param-value>guard</param-value>
- *    </init-param>
- * </servlet>
- * 
- *

- * If the target restlet is an {@link org.restlet.Application}, it will be used - * directly. Otherwise, it will be wrapped in an instance of {@link Application}. - * - * @author Rhett Sutphin - */ -public class RestletFrameworkServlet extends FrameworkServlet { - /** The default bean name for the target Restlet. */ - private static final String DEFAULT_TARGET_RESTLET_BEAN_NAME = "root"; - - private static final long serialVersionUID = 1L; - - /** The adapter of Servlet calls into Restlet equivalents. */ - private volatile ServletAdapter adapter; - - /** The bean name of the target Restlet. */ - private volatile String targetRestletBeanName; - - /** - * Creates the Restlet {@link Context} to use if the target application does - * not already have a context associated, or if the target restlet is not an - * {@link Application} at all. - *

- * Uses a simple {@link Context} by default. - * - * @return A new instance of {@link Context} - */ - protected Context createContext() { - return new Context(); - } - - @Override - protected void doService(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - getAdapter().service(request, response); - } - - /** - * Provides access to the {@link ServletAdapter} used to handle requests. - * Exposed so that subclasses may do additional configuration, if necessary, - * by overriding {@link #initFrameworkServlet()}. - * - * @return The adapter of Servlet calls into Restlet equivalents. - */ - protected ServletAdapter getAdapter() { - return this.adapter; - } - - /** - * Returns the target Restlet from Spring's Web application context. - * - * @return The target Restlet. - */ - protected Restlet getTargetRestlet() { - return (Restlet) getWebApplicationContext().getBean( - getTargetRestletBeanName()); - } - - /** - * Returns the bean name of the target Restlet. Returns "root" by default. - * - * @return The bean name. - */ - public String getTargetRestletBeanName() { - return (this.targetRestletBeanName == null) ? DEFAULT_TARGET_RESTLET_BEAN_NAME - : this.targetRestletBeanName; - } - - @Override - protected void initFrameworkServlet() throws ServletException, - BeansException { - super.initFrameworkServlet(); - this.adapter = new ServletAdapter(getServletContext()); - - org.restlet.Application application; - - if (getTargetRestlet() instanceof Application) { - application = (Application) getTargetRestlet(); - } else { - application = new Application(); - application.setInboundRoot(getTargetRestlet()); - } - - if (application.getContext() == null) { - application.setContext(createContext()); - } - - this.adapter.setNext(application); - } - - /** - * Sets the bean name of the target Restlet. - * - * @param targetRestletBeanName - * The bean name. - */ - public void setTargetRestletBeanName(String targetRestletBeanName) { - this.targetRestletBeanName = targetRestletBeanName; - } -} diff --git a/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServerServlet.java b/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServerServlet.java deleted file mode 100644 index 94791002c1..0000000000 --- a/org.restlet.ext.spring/src/main/java/org/restlet/ext/spring/SpringServerServlet.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.ext.spring; - -import org.restlet.Application; -import org.restlet.Component; -import org.restlet.Context; -import org.restlet.ext.servlet.ServerServlet; -import org.springframework.beans.BeansException; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; - -/** - * Spring specific ServerServlet adapter. This class is similar to the - * ServerServlet, but instead of creating the used Restlet Application and - * Restlet Component, it lookups them up from the SpringContext which is found - * in the ServletContext. - * - * If the Application or Component beans can't be found, the default behavior of - * the parent class is used. - * - * @author Florian Schwarz - */ -public class SpringServerServlet extends ServerServlet { - - /** - * Name of the Servlet parameter containing a bean-id of the application to - * use. - */ - public static final String APPLICATION_BEAN_PARAM_NAME = "org.restlet.application"; - - /** - * Name of the Servlet parameter containing a bean-id of the component to - * use. - */ - public static final String Component_BEAN_PARAM_NAME = "org.restlet.component"; - - private static final long serialVersionUID = 110030403435929871L; - - /** - * Lookups the single Restlet Application used by this Servlet from the - * SpringContext inside the ServletContext. The bean name looked up is - * {@link #APPLICATION_BEAN_PARAM_NAME}. - * - * @param parentContext - * The parent component context. - * @return The Restlet-Application to use. - */ - @Override - public Application createApplication(Context parentContext) { - Application application = null; - - final String applicationBeanName = getInitParameter( - SpringServerServlet.APPLICATION_BEAN_PARAM_NAME, null); - application = (Application) getWebApplicationContext().getBean( - applicationBeanName); - - if (application != null) { - // Set the context based on the Servlet's context - application.setContext(parentContext.createChildContext()); - } else { - application = super.createApplication(parentContext); - } - - return application; - } - - /** - * Lookups the single Restlet Component used by this Servlet from Spring's - * Context available inside the ServletContext. The bean name looked up is - * {@link #Component_BEAN_PARAM_NAME}. - * - * @return The Restlet-Component to use. - */ - @Override - public Component createComponent() { - Component component = null; - final String componentBeanName = getInitParameter( - Component_BEAN_PARAM_NAME, null); - - // Not mentioned in the Spring JavaDocs, but getBean surely fails if - // the argument is null. - if (componentBeanName != null) { - try { - component = (Component) getWebApplicationContext().getBean( - componentBeanName); - } catch (BeansException be) { - // The bean has not been found, let the parent create it. - } - } - - if (component == null) { - component = super.createComponent(); - } - - return component; - } - - /** - * Get the Spring WebApplicationContext from the ServletContext. (by hand - * would be webApplicationContext applicationContext = - * (WebApplicationContext) - * getServletContext().getAttribute(WebApplicationContext - * .ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);) - * - * @return The Spring WebApplicationContext. - */ - public WebApplicationContext getWebApplicationContext() { - return WebApplicationContextUtils - .getRequiredWebApplicationContext(getServletContext()); - } - -} diff --git a/org.restlet/src/main/java/org/restlet/data/ChallengeResponse.java b/org.restlet/src/main/java/org/restlet/data/ChallengeResponse.java index 2253236709..d5ac4de161 100644 --- a/org.restlet/src/main/java/org/restlet/data/ChallengeResponse.java +++ b/org.restlet/src/main/java/org/restlet/data/ChallengeResponse.java @@ -292,17 +292,6 @@ public String getSecretAlgorithm() { return secretAlgorithm; } - /** - * Returns the server nonce count. - * - * @return The server nonce count. - * @deprecated Use {@code getServerNonceCount} instead. - */ - @Deprecated - public int getServerNounceCount() { - return getServerNonceCount(); - } - /** * Returns the server nonce count. * @@ -312,17 +301,6 @@ public int getServerNonceCount() { return serverNonceCount; } - /** - * Returns the server nonce count as a hexadecimal string of eight characters. - * - * @return The server nonce count as a hexadecimal string. - * @deprecated Use {@code getServerNonceCountAsHex} instead. - */ - @Deprecated - public String getServerNounceCountAsHex() { - return getServerNonceCountAsHex(); - } - /** * Returns the server nonce count as a hexadecimal string of eight characters. * @@ -414,17 +392,6 @@ public void setSecretAlgorithm(String secretDigestAlgorithm) { this.secretAlgorithm = secretDigestAlgorithm; } - /** - * Sets the server nonce count. - * - * @param serverNonceCount The server nonce count. - * @deprecated Use {@code setServerNonceCount} instead. - */ - @Deprecated - public void setServerNounceCount(int serverNonceCount) { - setServerNonceCount(serverNonceCount); - } - /** * Sets the server nonce count. * diff --git a/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java index e6b5bdc7ed..81abe244e7 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -737,17 +737,9 @@ public void registerDefaultAuthentications() { * Registers the default client and server connectors. */ public void registerDefaultConnectors() { - getRegisteredClients().add(new org.restlet.engine.connector.FtpClientHelper(null)); - getRegisteredClients().add(new org.restlet.engine.connector.HttpClientHelper(null)); getRegisteredClients().add(new org.restlet.engine.local.ClapClientHelper(null)); getRegisteredClients().add(new org.restlet.engine.local.RiapClientHelper(null)); getRegisteredServers().add(new org.restlet.engine.local.RiapServerHelper(null)); - - if (Edition.ANDROID.isNotCurrentEdition()) { - getRegisteredServers().add(new org.restlet.engine.connector.HttpServerHelper(null)); - getRegisteredServers().add(new org.restlet.engine.connector.HttpsServerHelper(null)); - } - getRegisteredClients().add(new org.restlet.engine.local.FileClientHelper(null)); getRegisteredClients().add(new org.restlet.engine.local.ZipClientHelper(null)); } diff --git a/org.restlet/src/main/java/org/restlet/engine/adapter/HttpResponse.java b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpResponse.java index 6ac16d65b4..6f933eae40 100644 --- a/org.restlet/src/main/java/org/restlet/engine/adapter/HttpResponse.java +++ b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpResponse.java @@ -9,7 +9,6 @@ package org.restlet.engine.adapter; -import org.restlet.Message; import org.restlet.Request; import org.restlet.Response; import org.restlet.data.ServerInfo; diff --git a/org.restlet/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java b/org.restlet/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java deleted file mode 100644 index 91485763d7..0000000000 --- a/org.restlet/src/main/java/org/restlet/engine/connector/ConnectionClosingRepresentation.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.engine.connector; - -import org.restlet.representation.Representation; -import org.restlet.util.WrapperRepresentation; - -import java.net.HttpURLConnection; - -/** - * Representation that wraps another representation and closes the parent - * {@link HttpURLConnection} when the representation is released. - * - * @author Kevin Conaway - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -class ConnectionClosingRepresentation extends WrapperRepresentation { - - /** The parent connection. */ - private final HttpURLConnection connection; - - /** - * Default constructor. - * - * @param wrappedRepresentation The wrapped representation. - * @param connection The parent connection. - */ - public ConnectionClosingRepresentation(Representation wrappedRepresentation, HttpURLConnection connection) { - super(wrappedRepresentation); - this.connection = connection; - } - - @Override - public void release() { - this.connection.disconnect(); - super.release(); - } - -} diff --git a/org.restlet/src/main/java/org/restlet/engine/connector/FtpClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/FtpClientHelper.java deleted file mode 100644 index 7da80dbd34..0000000000 --- a/org.restlet/src/main/java/org/restlet/engine/connector/FtpClientHelper.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.engine.connector; - -import org.restlet.Client; -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.data.Method; -import org.restlet.data.*; -import org.restlet.engine.local.Entity; -import org.restlet.engine.util.SystemUtils; -import org.restlet.representation.InputRepresentation; - -import java.io.IOException; -import java.net.URL; -import java.net.URLConnection; -import java.util.logging.Level; - -/** - * FTP client connector using the {@link URLConnection}. Here is the list of - * parameters that are supported. They should be set in the Client's context - * before it is started: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
list of supported parameters
Parameter nameValue typeDefault valueDescription
allowUserInteractionbooleanfalseIf true, this URL is being examined in a context in which it makes sense - * to allow user interactions such as popping up an authentication dialog.
readTimeoutint60000Sets the read timeout to a specified timeout, in milliseconds. A timeout - * of zero is interpreted as an infinite timeout.
useCachesbooleanfalseIf true, the protocol is allowed to use caching whenever it can.
- * - * @see Networking - * Features - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class FtpClientHelper extends ClientHelper { - /** - * Constructor. - * - * @param client The client to help. - */ - public FtpClientHelper(Client client) { - super(client); - getProtocols().add(Protocol.FTP); - } - - /** - * Returns the read timeout value. A timeout of zero is interpreted as an - * infinite timeout. - * - * @return The read timeout value. - */ - public int getReadTimeout() { - return Integer.parseInt(getHelpedParameters().getFirstValue("readTimeout", "60000")); - } - - /** - * Returns the connection timeout. Defaults to 15000. - * - * @return The connection timeout. - */ - public int getSocketConnectTimeoutMs() { - int result = 0; - - if (getHelpedParameters().getNames().contains("socketConnectTimeoutMs")) { - result = Integer.parseInt(getHelpedParameters().getFirstValue("socketConnectTimeoutMs", "15000")); - } - - return result; - } - - @Override - public void handle(Request request, Response response) { - try { - if (Protocol.FTP.equals(request.getProtocol())) { - if (Method.GET.equals(request.getMethod())) { - Reference ftpRef = request.getResourceRef(); - String userInfo = null; - - if ((request.getChallengeResponse() != null) - && ChallengeScheme.FTP_PLAIN.equals(request.getChallengeResponse().getScheme()) - && (request.getChallengeResponse().getIdentifier() != null)) { - userInfo = request.getChallengeResponse().getIdentifier(); - - if (request.getChallengeResponse().getSecret() != null) { - userInfo += ":" + new String(request.getChallengeResponse().getSecret()); - } - } - - if (userInfo != null) { - ftpRef.setUserInfo(userInfo); - } - - URL url = ftpRef.toUrl(); - URLConnection connection = url.openConnection(); - - // These properties can only be used with Java 1.5 and upper - // releases - int majorVersionNumber = SystemUtils.getJavaMajorVersion(); - int minorVersionNumber = SystemUtils.getJavaMinorVersion(); - if ((majorVersionNumber > 1) || ((majorVersionNumber == 1) && (minorVersionNumber >= 5))) { - connection.setConnectTimeout(getSocketConnectTimeoutMs()); - connection.setReadTimeout(getReadTimeout()); - } - - connection.setAllowUserInteraction(isAllowUserInteraction()); - connection.setUseCaches(isUseCaches()); - response.setEntity(new InputRepresentation(connection.getInputStream())); - - // Try to infer the metadata from the file extensions - Entity.updateMetadata(request.getResourceRef().getPath(), response.getEntity(), true, - getMetadataService()); - } else { - getLogger().log(Level.WARNING, "Only GET method are supported by this FTP connector"); - } - } - } catch (IOException e) { - getLogger().log(Level.WARNING, "FTP client error", e); - response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, e.getMessage()); - } - } - - /** - * Indicates if this URL is being examined in a context in which it makes sense - * to allow user interactions such as popping up an authentication dialog. - * - * @return True if it makes sense to allow user interactions. - */ - public boolean isAllowUserInteraction() { - return Boolean.parseBoolean(getHelpedParameters().getFirstValue("allowUserInteraction", "false")); - } - - /** - * Indicates if the protocol is allowed to use caching whenever it can. - * - * @return True if the protocol is allowed to use caching whenever it can. - */ - public boolean isUseCaches() { - return Boolean.parseBoolean(getHelpedParameters().getFirstValue("useCaches", "false")); - } - - @Override - public synchronized void start() throws Exception { - super.start(); - getLogger().info("Starting the internal FTP client"); - } - - @Override - public synchronized void stop() throws Exception { - super.stop(); - getLogger().info("Stopping the internal FTP client"); - } - -} diff --git a/org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java deleted file mode 100644 index 51e6bbda26..0000000000 --- a/org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java +++ /dev/null @@ -1,212 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.engine.connector; - -import org.restlet.Client; -import org.restlet.Request; -import org.restlet.data.Protocol; -import org.restlet.engine.adapter.ClientCall; -import org.restlet.engine.util.ReferenceUtils; - -import javax.net.ssl.HostnameVerifier; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.util.logging.Level; - -/** - * HTTP client connector using the {@link HttpUrlConnectionCall}. Here is the - * list of parameters that are supported. They should be set in the Client's - * context before it is started: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
list of supported parameters
Parameter nameValue typeDefault valueDescription
allowUserInteractionbooleanfalseIf true, this URL is being examined in a context in which it makes sense - * to allow user interactions such as popping up an authentication dialog.
chunkLengthint0 (uses HttpURLConnection's default)The chunk-length when using chunked encoding streaming mode for response - * entities. A value of -1 means chunked encoding is disabled for response - * entities.
followRedirectsbooleanfalseIf true, the protocol will automatically follow redirects. If false, the - * protocol will not automatically follow redirects.
readTimeoutint60000Sets the read timeout to a specified timeout, in milliseconds. A timeout - * of zero is interpreted as an infinite timeout.
socketConnectTimeoutMsint15000The socket connection timeout or 0 for unlimited wait.
sslContextFactoryStringorg.restlet.engine.ssl.DefaultSslContextFactoryLet you specify a {@link org.restlet.engine.ssl.SslContextFactory} - * qualified class name as a parameter, or an instance as an attribute for a - * more complete and flexible SSL context setting.
useCachesbooleanfalseIf true, the protocol is allowed to use caching whenever it can.
- * For the default SSL parameters see the Javadocs of the - * {@link org.restlet.engine.ssl.DefaultSslContextFactory} class. - *

- * It is also possible to specify a hostname verifier for HTTPS connections. See - * the {@link #getHostnameVerifier()} method for details. - *

- * Note that by default, the {@link HttpURLConnection} class as implemented by - * Sun will retry a request if an IO exception is caught, for example, due to a - * connection reset by the server. This can be annoying, especially because the - * HTTP semantics of non-idempotent methods like POST can be broken, but also - * because the new request won't include an entity. There is one way to disable - * this behavior for POST requests only by setting the system property - * "sun.net.http.retryPost" to "false". - * - * @see Networking - * Features - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class HttpClientHelper extends org.restlet.engine.adapter.HttpClientHelper { - - /** - * Constructor. - * - * @param client The client to help. - */ - public HttpClientHelper(Client client) { - super(client); - getProtocols().add(Protocol.HTTP); - getProtocols().add(Protocol.HTTPS); - } - - /** - * Creates a low-level HTTP client call from a high-level uniform call. - * - * @param request The high-level request. - * @return A low-level HTTP client call. - */ - @Override - public ClientCall create(Request request) { - ClientCall result = null; - - try { - result = new HttpUrlConnectionCall(this, request.getMethod().toString(), - ReferenceUtils.update(request.getResourceRef(), request).toString(), request.isEntityAvailable()); - } catch (IOException ioe) { - getLogger().log(Level.WARNING, "Unable to create the HTTP client call", ioe); - } - - return result; - } - - /** - * Returns the chunk-length when using chunked encoding streaming mode for - * response entities. A value of -1 means chunked encoding is disabled for - * response entities. - * - * @return The chunk-length when using chunked encoding streaming mode for - * response entities. - */ - public int getChunkLength() { - return Integer.parseInt(getHelpedParameters().getFirstValue("chunkLength", "0")); - } - - /** - * Returns the hostname verifier by looking up the "hostnameVerifier" attribute - * of the client's context. - * - * @return The hostname verifier or null. - */ - public HostnameVerifier getHostnameVerifier() { - return (HostnameVerifier) ((getContext() == null) ? null - : getContext().getAttributes().get("hostnameVerifier")); - } - - /** - * Returns the read timeout value. A timeout of zero is interpreted as an - * infinite timeout. Default to 60000. - * - * @return The read timeout value. - */ - public int getReadTimeout() { - return Integer.parseInt(getHelpedParameters().getFirstValue("readTimeout", "60000")); - } - - /** - * Indicates if this URL is being examined in a context in which it makes sense - * to allow user interactions such as popping up an authentication dialog. - * - * @return True if it makes sense to allow user interactions. - */ - public boolean isAllowUserInteraction() { - return Boolean.parseBoolean(getHelpedParameters().getFirstValue("allowUserInteraction", "false")); - } - - /** - * Indicates if the protocol automatically follows redirects. - * - * @return True if the protocol automatically follows redirects. - */ - public boolean isFollowRedirects() { - return Boolean.parseBoolean(getHelpedParameters().getFirstValue("followRedirects", "false")); - } - - /** - * Indicates if the protocol is allowed to use caching whenever it can. - * - * @return True if the protocol is allowed to use caching whenever it can. - */ - public boolean isUseCaches() { - return Boolean.parseBoolean(getHelpedParameters().getFirstValue("useCaches", "false")); - } - - @Override - public synchronized void start() throws Exception { - super.start(); - getLogger().info("Starting the internal HTTP client"); - } - - @Override - public synchronized void stop() throws Exception { - super.stop(); - getLogger().info("Stopping the internal HTTP client"); - } - -} diff --git a/org.restlet/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java deleted file mode 100644 index addf34291a..0000000000 --- a/org.restlet/src/main/java/org/restlet/engine/connector/HttpExchangeCall.java +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.engine.connector; - -import com.sun.net.httpserver.Headers; -import com.sun.net.httpserver.HttpExchange; -import org.restlet.Server; -import org.restlet.data.Header; -import org.restlet.engine.adapter.ServerCall; -import org.restlet.representation.Representation; -import org.restlet.util.Series; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; - -/** - * Call that is used by the Basic HTTP server. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class HttpExchangeCall extends ServerCall { - - /** The wrapped HTTP exchange. */ - private final HttpExchange exchange; - - /** Indicates if the request headers were parsed and added. */ - private volatile boolean requestHeadersAdded; - - /** - * Constructor. - * - * @param server The parent server. - * @param exchange The wrapped {@link HttpExchange} instance. - */ - public HttpExchangeCall(Server server, HttpExchange exchange) { - this(server, exchange, false); - } - - /** - * Constructor. - * - * @param server The parent server. - * @param exchange The wrapped {@link HttpExchange} instance. - * @param confidential True if the confidentiality of the call is ensured (ex: - * via SSL) - */ - public HttpExchangeCall(Server server, HttpExchange exchange, boolean confidential) { - super(server); - this.exchange = exchange; - setConfidential(confidential); - } - - @Override - public boolean abort() { - this.exchange.close(); - return true; - } - - @Override - public void flushBuffers() throws IOException { - this.exchange.getResponseBody().flush(); - } - - @Override - public String getClientAddress() { - return this.exchange.getRemoteAddress().getAddress().getHostAddress(); - } - - @Override - public int getClientPort() { - return this.exchange.getRemoteAddress().getPort(); - } - - @Override - public String getMethod() { - return this.exchange.getRequestMethod(); - } - - @Override - public Series

getRequestHeaders() { - final Series
result = super.getRequestHeaders(); - - if (!this.requestHeadersAdded) { - final Headers headers = this.exchange.getRequestHeaders(); - - for (String name : headers.keySet()) { - for (String value : headers.get(name)) { - result.add(name, value); - } - } - this.requestHeadersAdded = true; - } - - return result; - } - - @Override - public InputStream getRequestEntityStream(long size) { - return this.exchange.getRequestBody(); - } - - @Override - public InputStream getRequestHeadStream() { - return null; - } - - @Override - public String getRequestUri() { - return this.exchange.getRequestURI().toString(); - } - - @Override - public OutputStream getResponseEntityStream() { - return this.exchange.getResponseBody(); - } - - @Override - public void writeResponseHead(org.restlet.Response restletResponse) throws IOException { - final Headers headers = this.exchange.getResponseHeaders(); - - for (Header header : getResponseHeaders()) { - headers.add(header.getName(), header.getValue()); - } - - // Send the headers - Representation entity = restletResponse.getEntity(); - long responseLength = 0; - - if (entity == null || !entity.isAvailable()) { - responseLength = -1; - } else if (entity.getAvailableSize() != Representation.UNKNOWN_SIZE) { - responseLength = entity.getAvailableSize(); - } - - this.exchange.sendResponseHeaders(getStatusCode(), responseLength); - } - -} diff --git a/org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java deleted file mode 100644 index b3257a842c..0000000000 --- a/org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.engine.connector; - -import com.sun.net.httpserver.HttpExchange; -import com.sun.net.httpserver.HttpHandler; -import com.sun.net.httpserver.HttpServer; -import org.restlet.Server; -import org.restlet.data.Protocol; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; - -/** - * Internal HTTP server connector. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class HttpServerHelper extends NetServerHelper { - /** The underlying HTTP server. */ - private volatile HttpServer server; - - /** - * Constructor. - * - * @param server The server to help. - */ - public HttpServerHelper(Server server) { - super(server); - getProtocols().add(Protocol.HTTP); - } - - @Override - public void start() throws Exception { - // Use ephemeral port - int port = Math.max(getHelped().getPort(), 0); - if (getHelped().getAddress() != null) { - // This call may throw UnknownHostException and otherwise always - // returns an instance of INetAddress. - // Note: textual representation of inet addresses are supported - InetAddress iaddr = InetAddress.getByName(getHelped().getAddress()); - - // Note: the backlog of 50 is the default - setAddress(new InetSocketAddress(iaddr, port)); - } else { - // Listens to any local IP address - setAddress(new InetSocketAddress(port)); - } - - this.server = HttpServer.create(getAddress(), 0); - server.createContext("/", new HttpHandler() { - @Override - public void handle(HttpExchange httpExchange) throws IOException { - HttpServerHelper.this.handle(new HttpExchangeCall(getHelped(), httpExchange)); - } - }); - // creates a default executor - server.setExecutor(createThreadPool()); - server.start(); - - setConfidential(false); - setEphemeralPort(server.getAddress().getPort()); - super.start(); - } - - @Override - public synchronized void stop() throws Exception { - super.stop(); - this.server.stop(0); - } -} diff --git a/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java deleted file mode 100644 index 6a8c2842bd..0000000000 --- a/org.restlet/src/main/java/org/restlet/engine/connector/HttpUrlConnectionCall.java +++ /dev/null @@ -1,347 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.engine.connector; - -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.Uniform; -import org.restlet.data.Header; -import org.restlet.data.Status; -import org.restlet.engine.adapter.ClientCall; -import org.restlet.engine.util.SystemUtils; -import org.restlet.representation.Representation; -import org.restlet.util.Series; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.ConnectException; -import java.net.HttpURLConnection; -import java.net.SocketTimeoutException; -import java.net.URL; -import java.util.logging.Level; - -/** - * HTTP client connector call based on JDK's java.net.HttpURLConnection class. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class HttpUrlConnectionCall extends ClientCall { - - /** The wrapped HTTP URL connection. */ - private final HttpURLConnection connection; - - /** Indicates if the response headers were added. */ - private volatile boolean responseHeadersAdded; - - /** - * Constructor. - * - * @param helper The parent HTTP client helper. - * @param method The method name. - * @param requestUri The request URI. - * @param hasEntity Indicates if the call has an entity to send to the - * server. - * @throws IOException - */ - public HttpUrlConnectionCall(HttpClientHelper helper, String method, String requestUri, boolean hasEntity) - throws IOException { - super(helper, method, requestUri); - - if (requestUri.startsWith("http")) { - URL url = new URL(requestUri); - this.connection = (HttpURLConnection) url.openConnection(); - - // These properties can only be used with Java 1.5 and upper releases - int majorVersionNumber = SystemUtils.getJavaMajorVersion(); - int minorVersionNumber = SystemUtils.getJavaMinorVersion(); - if ((majorVersionNumber > 1) || ((majorVersionNumber == 1) && (minorVersionNumber >= 5))) { - this.connection.setConnectTimeout(getHelper().getSocketConnectTimeoutMs()); - this.connection.setReadTimeout(getHelper().getReadTimeout()); - } - - this.connection.setAllowUserInteraction(getHelper().isAllowUserInteraction()); - this.connection.setDoOutput(hasEntity); - this.connection.setInstanceFollowRedirects(getHelper().isFollowRedirects()); - this.connection.setUseCaches(getHelper().isUseCaches()); - this.responseHeadersAdded = false; - - if (this.connection instanceof javax.net.ssl.HttpsURLConnection) { - setConfidential(true); - javax.net.ssl.HttpsURLConnection https = (javax.net.ssl.HttpsURLConnection) this.connection; - org.restlet.engine.ssl.SslContextFactory sslContextFactory = org.restlet.engine.ssl.SslUtils - .getSslContextFactory(getHelper()); - - if (sslContextFactory != null) { - try { - javax.net.ssl.SSLContext sslContext = sslContextFactory.createSslContext(); - https.setSSLSocketFactory(sslContext.getSocketFactory()); - } catch (Exception e) { - throw new RuntimeException("Unable to create SSLContext.", e); - } - } - - javax.net.ssl.HostnameVerifier verifier = helper.getHostnameVerifier(); - - if (verifier != null) { - https.setHostnameVerifier(verifier); - } - } - } else { - throw new IllegalArgumentException("Only HTTP or HTTPS resource URIs are allowed here"); - } - } - - /** - * Returns the connection. - * - * @return The connection. - */ - public HttpURLConnection getConnection() { - return this.connection; - } - - /** - * Returns the HTTP client helper. - * - * @return The HTTP client helper. - */ - @Override - public HttpClientHelper getHelper() { - return (HttpClientHelper) super.getHelper(); - } - - /** - * Returns the response reason phrase. - * - * @return The response reason phrase. - */ - @Override - public String getReasonPhrase() { - try { - return getConnection().getResponseMessage(); - } catch (IOException e) { - return null; - } - } - - @Override - protected Representation getRepresentation(InputStream stream) { - Representation r = super.getRepresentation(stream); - return new ConnectionClosingRepresentation(r, getConnection()); - } - - @Override - public OutputStream getRequestEntityStream() { - return getRequestStream(); - } - - @Override - public OutputStream getRequestHeadStream() { - return getRequestStream(); - } - - /** - * Returns the request entity stream if it exists. - * - * @return The request entity stream if it exists. - */ - public OutputStream getRequestStream() { - try { - return getConnection().getOutputStream(); - } catch (IOException ioe) { - return null; - } - } - - @Override - public InputStream getResponseEntityStream(long size) { - InputStream result = null; - - try { - result = getConnection().getInputStream(); - } catch (IOException ioe) { - result = getConnection().getErrorStream(); - } - - if (result == null) { - // Maybe an error stream is available instead - result = getConnection().getErrorStream(); - } - - return result; - } - - /** - * Returns the modifiable list of response headers. - * - * @return The modifiable list of response headers. - */ - @Override - public Series
getResponseHeaders() { - Series
result = super.getResponseHeaders(); - - if (!this.responseHeadersAdded) { - boolean loop = true; - int i = 0; - String headerName = null; - String headerValue = null; - - while (loop) { - try { - headerName = getConnection().getHeaderFieldKey(i); - headerValue = getConnection().getHeaderField(i); - } catch (java.util.NoSuchElementException e) { - // Some implementations, especially the one for Google App - // Engine throws a NoSuchElementException though this is not - // stated by the contract of the abstract class - // HttpUrlConnection. - headerName = null; - } - if (headerName != null) { - result.add(headerName, headerValue); - } else { - // As stated by the HttpUrlConnection javadocs, some - // implementations may treat the 0th header field as - // special, i.e., as the status line returned by the HTTP - // server. - loop = (i == 0); - } - i++; - } - - this.responseHeadersAdded = true; - } - - return result; - } - - /** - * Returns the response address.
- * Corresponds to the IP address of the responding server. - * - * @return The response address. - */ - @Override - public String getServerAddress() { - return getConnection().getURL().getHost(); - } - - /** - * Returns the response status code. - * - * @return The response status code. - * @throws IOException - * @throws IOException - */ - @Override - public int getStatusCode() throws IOException { - return getConnection().getResponseCode(); - } - - /** - * Sends the request to the client. - * Commits the request line, headers, and optional entity and send them over the network. - * - * @param request The high-level request. - * @return The result status. - */ - @Override - public Status sendRequest(Request request) { - Status result = null; - - try { - if (request.isEntityAvailable()) { - Representation entity = request.getEntity(); - - // These properties can only be used with Java 1.5 and upper - // releases - int majorVersionNumber = SystemUtils.getJavaMajorVersion(); - int minorVersionNumber = SystemUtils.getJavaMinorVersion(); - if ((majorVersionNumber > 1) || ((majorVersionNumber == 1) && (minorVersionNumber >= 5))) { - // Adjust the streaming mode - if (entity.getSize() != -1) { - // The size of the entity is known in advance - getConnection().setFixedLengthStreamingMode(entity.getSize()); - } else { - // The size of the entity is not known in advance - if (getHelper().getChunkLength() >= 0) { - // Use chunked encoding - getConnection().setChunkedStreamingMode(getHelper().getChunkLength()); - } else { - // Use entity buffering to determine the content - // length - } - } - } - } - - // Set the request method - getConnection().setRequestMethod(getMethod()); - - // Set the request headers - for (Header header : getRequestHeaders()) { - if (header.getValue() != null) { - getConnection().addRequestProperty(header.getName(), header.getValue()); - } else { - getHelper().getLogger() - .info("The following header has a null value and has been discarded: " + header.getName()); - } - } - - // Ensure that the connection is active - getConnection().connect(); - - // Send the optional entity - result = super.sendRequest(request); - } catch (ConnectException ce) { - getHelper().getLogger().log(Level.FINE, - "An error occurred during the connection to the remote HTTP server.", ce); - result = new Status(Status.CONNECTOR_ERROR_CONNECTION, ce); - } catch (SocketTimeoutException ste) { - getHelper().getLogger().log(Level.FINE, - "An timeout error occurred during the communication with the remote HTTP server.", ste); - result = new Status(Status.CONNECTOR_ERROR_COMMUNICATION, ste); - } catch (FileNotFoundException fnfe) { - getHelper().getLogger().log(Level.FINE, - "An unexpected error occurred during the sending of the HTTP request.", fnfe); - result = new Status(Status.CONNECTOR_ERROR_INTERNAL, fnfe); - } catch (IOException ioe) { - getHelper().getLogger().log(Level.FINE, - "An error occurred during the communication with the remote HTTP server.", ioe); - result = new Status(Status.CONNECTOR_ERROR_COMMUNICATION, ioe); - } catch (Exception e) { - getHelper().getLogger().log(Level.FINE, - "An unexpected error occurred during the sending of the HTTP request.", e); - result = new Status(Status.CONNECTOR_ERROR_INTERNAL, e); - } - - return result; - } - - @Override - public void sendRequest(Request request, Response response, Uniform callback) throws Exception { - // Send the request - sendRequest(request); - - if (request.getOnSent() != null) { - request.getOnSent().handle(request, response); - } - - if (callback != null) { - // Transmit to the callback, if any. - callback.handle(request, response); - } - } - -} diff --git a/org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java deleted file mode 100644 index ea79f8426b..0000000000 --- a/org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.engine.connector; - -import com.sun.net.httpserver.*; -import org.restlet.Server; -import org.restlet.data.Protocol; -import org.restlet.engine.ssl.DefaultSslContextFactory; -import org.restlet.engine.ssl.SslContextFactory; -import org.restlet.engine.ssl.SslUtils; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLParameters; -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; - -/** - * Internal HTTPS server connector. Here is the list of additional parameters - * that are supported. They should be set in the Server's context before it is - * started: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
list of supported parameters
Parameter nameValue typeDefault valueDescription
sslContextFactoryStringorg.restlet.engine.ssl.DefaultSslContextFactoryLet you specify a {@link SslContextFactory} qualified class name as a - * parameter, or an instance as an attribute for a more complete and flexible - * SSL context setting.
- * For the default SSL parameters see the Javadocs of the - * {@link DefaultSslContextFactory} class. - * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public class HttpsServerHelper extends NetServerHelper { - /** The underlying HTTPS server. */ - private volatile HttpsServer server; - - /** - * Constructor. - * - * @param server The server to help. - */ - public HttpsServerHelper(Server server) { - super(server); - getProtocols().add(Protocol.HTTPS); - } - - /** Starts the Restlet. */ - @Override - public void start() throws Exception { - // Use ephemeral port - int port = Math.max(getHelped().getPort(), 0); - if (getHelped().getAddress() != null) { - // This call may throw UnknownHostException and otherwise always - // returns an instance of INetAddress. - // Note: textual representation of inet addresses are supported - InetAddress iaddr = InetAddress.getByName(getHelped().getAddress()); - - // Note: the backlog of 50 is the default - setAddress(new InetSocketAddress(iaddr, port)); - } else { - // Listens to any local IP address - setAddress(new InetSocketAddress(port)); - } - - // Complete initialization - this.server = HttpsServer.create(getAddress(), 0); - - // Initialize the SSL context - SslContextFactory sslContextFactory = SslUtils.getSslContextFactory(this); - SSLContext sslContext = sslContextFactory.createSslContext(); - final SSLParameters sslParams = sslContext.getDefaultSSLParameters(); - server.setHttpsConfigurator(new HttpsConfigurator(sslContext) { - public void configure(HttpsParameters params) { - params.setSSLParameters(sslParams); - } - }); - - server.createContext("/", new HttpHandler() { - @Override - public void handle(HttpExchange httpExchange) throws IOException { - HttpsServerHelper.this.handle(new HttpExchangeCall(getHelped(), httpExchange, true)); - } - }); - // creates a default executor - server.setExecutor(createThreadPool()); - server.start(); - - setConfidential(true); - setEphemeralPort(server.getAddress().getPort()); - super.start(); - } - - @Override - public synchronized void stop() throws Exception { - super.stop(); - this.server.stop(0); - } - -} diff --git a/org.restlet/src/main/java/org/restlet/engine/connector/NetServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/NetServerHelper.java deleted file mode 100644 index df02d1fddd..0000000000 --- a/org.restlet/src/main/java/org/restlet/engine/connector/NetServerHelper.java +++ /dev/null @@ -1,219 +0,0 @@ -/** - * Copyright 2005-2024 Qlik - * - * The contents of this file is subject to the terms of the Apache 2.0 open - * source license available at http://www.opensource.org/licenses/apache-2.0 - * - * Restlet is a registered trademark of QlikTech International AB. - */ - -package org.restlet.engine.connector; - -import org.restlet.Server; -import org.restlet.engine.adapter.HttpServerHelper; -import org.restlet.engine.log.LoggingThreadFactory; - -import java.net.InetSocketAddress; -import java.util.concurrent.*; - -/** - * Abstract Internal web server connector based on com.sun.net.httpserver - * package. Here is the list of parameters that are supported. They should be - * set in the Server's context before it is started: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
list of supported parameters
Parameter nameValue typeDefault valueDescription
minThreadsint1Minimum number of worker threads waiting to service calls, even if they - * are idle. Technically speaking, this is a core number of threads that are - * pre-started.
maxThreadsint10Maximum number of worker threads that can service calls. If this number - * is reached then additional calls are queued if the "maxQueued" value hasn't - * been reached.
maxQueuedint0Maximum number of calls that can be queued if there aren't any worker - * thread available to service them. If the value is '0', then no queue is used - * and calls are rejected if no worker thread is immediately available. If the - * value is '-1', then an unbounded queue is used and calls are never - * rejected.
- *
- * Note: make sure that this value is consistent with {@link #getMinThreads()} - * and the behavior of the {@link ThreadPoolExecutor} configured - * internally.
maxThreadIdleTimeMsint300 000Time for an idle thread to wait for an operation before being - * collected.
- * - * @author Jerome Louvel - * @deprecated Will be removed in the next 2.7/3.0 release. - */ -@Deprecated -public abstract class NetServerHelper extends HttpServerHelper { - /** - * Socket this server is listening to. - */ - private volatile InetSocketAddress address; - - /** - * Indicates if this service is acting in HTTP or HTTPS mode. - */ - private volatile boolean confidential; - - /** - * Constructor. - * - * @param server The server to help. - */ - public NetServerHelper(Server server) { - super(server); - } - - /** - * Creates the handler service. - * - * @return The handler service. - */ - protected ThreadPoolExecutor createThreadPool() { - int maxThreads = getMaxThreads(); - int minThreads = getMinThreads(); - - BlockingQueue queue = null; - - if (getMaxQueued() == 0) { - queue = new SynchronousQueue(); - } else if (getMaxQueued() < 0) { - queue = new LinkedBlockingQueue(); - } else { - queue = new ArrayBlockingQueue(getMaxQueued()); - } - - ThreadPoolExecutor result = new ThreadPoolExecutor(minThreads, maxThreads, getMaxThreadIdleTimeMs(), - TimeUnit.MILLISECONDS, queue, new LoggingThreadFactory(getLogger(), true)); - result.setRejectedExecutionHandler(new RejectedExecutionHandler() { - public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { - getLogger().warning("Unable to run the following server-side task: " + r); - } - }); - - // Ensure that core threads act like a minimum number of threads - result.prestartAllCoreThreads(); - return result; - } - - /** - * Returns the socket address this server is listening to. - * - * @return The socket address this server is listening to. - */ - protected InetSocketAddress getAddress() { - return this.address; - } - - /** - * Returns the maximum number of calls that can be queued if there aren't any - * worker thread available to service them. If the value is '0', then no queue - * is used and calls are rejected if no worker thread is immediately available. - * If the value is '-1', then an unbounded queue is used and calls are never - * rejected.
- *
- * Note: make sure that this value is consistent with {@link #getMinThreads()} - * and the behavior of the {@link ThreadPoolExecutor} configured internally. - * - * @return The maximum number of calls that can be queued. - */ - public int getMaxQueued() { - return Integer.parseInt(getHelpedParameters().getFirstValue("maxQueued", "0")); - } - - /** - * Returns the time for an idle thread to wait for an operation before being - * collected. - * - * @return The time for an idle thread to wait for an operation before being - * collected. - */ - public int getMaxThreadIdleTimeMs() { - return Integer.parseInt(getHelpedParameters().getFirstValue("maxThreadIdleTimeMs", "300000")); - } - - /** - * Returns the maximum threads that will service requests. - * - * @return The maximum threads that will service requests. - */ - public int getMaxThreads() { - return Integer.parseInt(getHelpedParameters().getFirstValue("maxThreads", "10")); - } - - /** - * Returns the minimum threads waiting to service requests. Technically - * speaking, this is a core number of threads that are pre-started. - * - * @return The minimum threads waiting to service requests. - */ - public int getMinThreads() { - return Integer.parseInt(getHelpedParameters().getFirstValue("minThreads", "1")); - } - - /** - * Indicates if this service is acting in HTTP or HTTPS mode. - * - * @return True if this service is acting in HTTP or HTTPS mode. - */ - public boolean isConfidential() { - return this.confidential; - } - - /** - * Sets the socket address this server is listening to. - * - * @param address The socket address this server is listening to. - */ - protected void setAddress(InetSocketAddress address) { - this.address = address; - } - - /** - * Indicates if this service is acting in HTTP or HTTPS mode. - * - * @param confidential True if this service is acting in HTTP or HTTPS mode. - */ - protected void setConfidential(boolean confidential) { - this.confidential = confidential; - } - - @Override - public synchronized void start() throws Exception { - super.start(); - getLogger().info("Starting the internal " + getProtocols() + " server on port " + getHelped().getPort()); - } - - @Override - public synchronized void stop() throws Exception { - getLogger().info("Stopping the internal server"); - } - -} diff --git a/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java b/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java index 387f43a72e..28582170b3 100644 --- a/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java +++ b/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java @@ -171,7 +171,8 @@ public String getQuery() { * @return A list of request variants. * @throws IOException */ - public List getRequestVariants(MetadataService metadataService, + @SuppressWarnings("unchecked") + public List getRequestVariants(MetadataService metadataService, org.restlet.service.ConverterService converterService) throws IOException { List result = null; Class[] classes = getJavaInputTypes(); @@ -199,7 +200,8 @@ public List getRequestVariants(MetadataService metadataService, * @return A list of response variants. * @throws IOException */ - public List getResponseVariants(MetadataService metadataService, + @SuppressWarnings("unchecked") + public List getResponseVariants(MetadataService metadataService, org.restlet.service.ConverterService converterService) throws IOException { List result = null; diff --git a/org.restlet/src/main/java/org/restlet/engine/security/HttpBasicHelper.java b/org.restlet/src/main/java/org/restlet/engine/security/HttpBasicHelper.java index 4a884e54ca..43ce5cfa94 100644 --- a/org.restlet/src/main/java/org/restlet/engine/security/HttpBasicHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/security/HttpBasicHelper.java @@ -9,22 +9,25 @@ package org.restlet.engine.security; +import java.io.CharArrayWriter; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Base64; +import java.util.logging.Level; + import org.restlet.Context; import org.restlet.Request; import org.restlet.Response; -import org.restlet.data.*; +import org.restlet.data.ChallengeRequest; +import org.restlet.data.ChallengeResponse; +import org.restlet.data.ChallengeScheme; +import org.restlet.data.Header; +import org.restlet.data.Parameter; import org.restlet.engine.header.ChallengeWriter; import org.restlet.engine.header.HeaderReader; import org.restlet.engine.io.IoUtils; import org.restlet.util.Series; -import java.io.CharArrayWriter; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.util.Base64; -import java.util.Objects; -import java.util.logging.Level; - /** * Implements the HTTP BASIC authentication. * diff --git a/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java b/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java index 15fb837faf..8878e0d63d 100644 --- a/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java +++ b/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java @@ -9,6 +9,11 @@ package org.restlet; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.HashSet; +import java.util.List; + import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -16,16 +21,8 @@ import org.restlet.data.Method; import org.restlet.data.Protocol; import org.restlet.data.Status; -import org.restlet.engine.Engine; -import org.restlet.engine.connector.HttpClientHelper; -import org.restlet.engine.connector.HttpServerHelper; import org.restlet.representation.StringRepresentation; -import java.util.HashSet; -import java.util.List; - -import static org.junit.jupiter.api.Assertions.assertEquals; - public class Bug1145TestCase { public static class Bug1145TestCaseRestlet extends Restlet { @Override @@ -46,8 +43,6 @@ public void handle(Request request, Response response) { @BeforeEach public void setUpEach() throws Exception { - Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null)); - Engine.getInstance().getRegisteredServers().add(new HttpServerHelper(null)); this.client = new Client(Protocol.HTTP); this.component = new Component(); diff --git a/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java index 57d0c7809f..dd23429cb6 100644 --- a/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java +++ b/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java @@ -9,21 +9,29 @@ package org.restlet.representation; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.restlet.*; -import org.restlet.data.*; -import org.restlet.engine.Engine; -import org.restlet.engine.connector.HttpClientHelper; -import org.restlet.engine.connector.HttpServerHelper; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; import java.io.File; import java.nio.file.Files; import java.nio.file.Path; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.restlet.Application; +import org.restlet.Client; +import org.restlet.Component; +import org.restlet.Context; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.Server; +import org.restlet.data.Disposition; +import org.restlet.data.MediaType; +import org.restlet.data.Method; +import org.restlet.data.Protocol; +import org.restlet.data.Status; /** * Unit tests for the FileRepresentation class. @@ -40,9 +48,6 @@ public class FileRepresentationTestCase { @BeforeEach protected void setUpEach() throws Exception { - Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null)); - Engine.getInstance().getRegisteredServers().add(new HttpServerHelper(null)); - component = new Component(); Server server = component.getServers().add(Protocol.HTTP, 0); component.start(); diff --git a/org.restlet/src/test/java/org/restlet/resource/DirectoryTestCase.java b/org.restlet/src/test/java/org/restlet/resource/DirectoryTestCase.java index 8c567cb58a..db70890c28 100644 --- a/org.restlet/src/test/java/org/restlet/resource/DirectoryTestCase.java +++ b/org.restlet/src/test/java/org/restlet/resource/DirectoryTestCase.java @@ -9,36 +9,53 @@ package org.restlet.resource; +import static java.io.File.createTempFile; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.restlet.data.Language.FRENCH; +import static org.restlet.data.Language.SPANISH; +import static org.restlet.data.LocalReference.createFileReference; +import static org.restlet.data.Method.DELETE; +import static org.restlet.data.Method.GET; +import static org.restlet.data.Method.HEAD; +import static org.restlet.data.Method.PUT; +import static org.restlet.data.Protocol.FILE; +import static org.restlet.data.Status.CLIENT_ERROR_BAD_REQUEST; +import static org.restlet.data.Status.CLIENT_ERROR_FORBIDDEN; +import static org.restlet.data.Status.CLIENT_ERROR_METHOD_NOT_ALLOWED; +import static org.restlet.data.Status.CLIENT_ERROR_NOT_FOUND; +import static org.restlet.data.Status.REDIRECTION_SEE_OTHER; +import static org.restlet.data.Status.SUCCESS_CREATED; +import static org.restlet.data.Status.SUCCESS_NO_CONTENT; +import static org.restlet.data.Status.SUCCESS_OK; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.restlet.*; +import org.restlet.Application; +import org.restlet.Component; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.data.Header; +import org.restlet.data.Language; +import org.restlet.data.Metadata; +import org.restlet.data.Method; +import org.restlet.data.Reference; import org.restlet.data.Status; -import org.restlet.data.*; import org.restlet.engine.Engine; -import org.restlet.engine.connector.HttpClientHelper; -import org.restlet.engine.connector.HttpServerHelper; +import org.restlet.engine.adapter.HttpServerHelper; import org.restlet.engine.header.HeaderConstants; import org.restlet.engine.io.IoUtils; import org.restlet.engine.local.FileClientHelper; import org.restlet.engine.util.ReferenceUtils; import org.restlet.representation.StringRepresentation; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; - -import static java.io.File.createTempFile; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.restlet.data.Language.FRENCH; -import static org.restlet.data.Language.SPANISH; -import static org.restlet.data.LocalReference.createFileReference; -import static org.restlet.data.Method.*; -import static org.restlet.data.Protocol.FILE; -import static org.restlet.data.Status.*; - /** * Unit tests for the Directory class. * @@ -80,7 +97,6 @@ public class DirectoryTestCase { public static void setUp() throws Exception { Engine.getInstance().getRegisteredConverters().clear(); Engine.getInstance().registerDefaultConverters(); - Engine.getInstance().getRegisteredClients().add(new HttpClientHelper(null)); Engine.getInstance().getRegisteredClients().add(new FileClientHelper(null)); Engine.getInstance().getRegisteredServers().add(new HttpServerHelper(null)); From fc13d5b6e0824a22ff09de53d57ba6c30aa64960 Mon Sep 17 00:00:00 2001 From: Jerome Louvel <374450+jlouvel@users.noreply.github.com> Date: Sat, 21 Jun 2025 12:04:52 -0400 Subject: [PATCH 07/22] Merged Jetty extension into the core Restlet module - Connectors moved into the Engine package, MultipartRepresentation into API, test cases into equivalent packages - Needs testing and fixing to have this effectively working --- org.restlet.ext.jetty/pom.xml | 60 - org.restlet/pom.xml | 62 +- .../main/java/org/restlet/engine/Engine.java | 2008 +++++++++-------- .../engine/adapter}/JettyClientCall.java | 5 +- .../restlet/engine/adapter}/JettyHandler.java | 8 +- .../engine/adapter}/JettyServerCall.java | 3 +- .../engine/connector}/HttpClientHelper.java | 24 +- .../engine/connector}/HttpServerHelper.java | 2 +- .../engine/connector}/HttpsServerHelper.java | 25 +- .../engine/connector}/JettyServerHelper.java | 27 +- .../RestletSslContextFactoryClient.java | 2 +- .../RestletSslContextFactoryServer.java | 2 +- .../MultiPartRepresentation.java | 4 +- .../engine/connector}/AsyncTestCase.java | 28 +- .../connector}/BaseConnectorsTestCase.java | 10 +- .../ChunkedEncodingPutTestCase.java | 2 +- .../connector}/ChunkedEncodingTestCase.java | 27 +- .../engine/connector}/ConnectorTestCase.java | 2 +- .../connector}/FormDataSetTestCase.java | 2 +- .../engine/connector}/GetChunkedTestCase.java | 23 +- .../connector}/GetQueryParamTestCase.java | 2 +- .../engine/connector}/GetTestCase.java | 2 +- .../HttpTransportProtocolsTestCase.java | 48 +- .../org/restlet/engine/connector}/Lock.java | 2 +- .../MultiPartRepresentationTestCase.java | 4 +- .../engine/connector}/PostPutTestCase.java | 2 +- .../org/restlet/engine/connector/README.md | 32 + .../RemoteClientAddressTestCase.java | 2 +- .../ServerMaxConnectionsTestCase.java | 2 +- .../connector}/ShutdownHookTestCase.java | 26 +- .../connector}/SslBaseConnectorsTestCase.java | 2 +- .../SslClientContextGetTestCase.java | 27 +- .../engine/connector}/SslGetTestCase.java | 20 +- .../AbstractAnnotatedServerResource03.java | 2 +- .../jetty/resource/AnnotatedInterface03.java | 2 +- .../resource/AnnotatedInterface03_01.java | 2 +- .../resource/AnnotatedInterface03_02.java | 2 +- .../resource/AnnotatedResource09TestCase.java | 2 +- .../resource/AnnotatedResource10TestCase.java | 2 +- .../resource/AnnotatedResource11TestCase.java | 2 +- .../resource/JettyConnectorTestCase.java | 6 +- .../engine}/jetty/resource/MyResource09.java | 2 +- .../engine}/jetty/resource/MyResource10.java | 2 +- .../engine}/jetty/resource/MyResource11.java | 2 +- .../engine}/jetty/resource/SIMethod.java | 2 +- .../engine}/jetty/resource/SNIMethod.java | 2 +- .../engine}/jetty/resource/USIMethod.java | 2 +- .../engine}/jetty/resource/USNIMethod.java | 2 +- .../restlet/ext/jetty/connectors/dummy.jks | Bin 0 -> 6709 bytes .../restlet/ext/jetty/connectors/dummy.p12 | Bin 0 -> 2726 bytes 50 files changed, 1363 insertions(+), 1168 deletions(-) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal => org.restlet/src/main/java/org/restlet/engine/adapter}/JettyClientCall.java (98%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal => org.restlet/src/main/java/org/restlet/engine/adapter}/JettyHandler.java (92%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal => org.restlet/src/main/java/org/restlet/engine/adapter}/JettyServerCall.java (98%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty => org.restlet/src/main/java/org/restlet/engine/connector}/HttpClientHelper.java (99%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty => org.restlet/src/main/java/org/restlet/engine/connector}/HttpServerHelper.java (98%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty => org.restlet/src/main/java/org/restlet/engine/connector}/HttpsServerHelper.java (96%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty => org.restlet/src/main/java/org/restlet/engine/connector}/JettyServerHelper.java (97%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal => org.restlet/src/main/java/org/restlet/engine/security}/RestletSslContextFactoryClient.java (97%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal => org.restlet/src/main/java/org/restlet/engine/security}/RestletSslContextFactoryServer.java (98%) rename {org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty => org.restlet/src/main/java/org/restlet/representation}/MultiPartRepresentation.java (98%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty => org.restlet/src/test/java/org/restlet/engine/connector}/AsyncTestCase.java (89%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/BaseConnectorsTestCase.java (92%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/ChunkedEncodingPutTestCase.java (98%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/ChunkedEncodingTestCase.java (89%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/ConnectorTestCase.java (92%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty => org.restlet/src/test/java/org/restlet/engine/connector}/FormDataSetTestCase.java (96%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/GetChunkedTestCase.java (88%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/GetQueryParamTestCase.java (98%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/GetTestCase.java (97%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/HttpTransportProtocolsTestCase.java (97%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty => org.restlet/src/test/java/org/restlet/engine/connector}/Lock.java (96%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty => org.restlet/src/test/java/org/restlet/engine/connector}/MultiPartRepresentationTestCase.java (97%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/PostPutTestCase.java (98%) create mode 100644 org.restlet/src/test/java/org/restlet/engine/connector/README.md rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/RemoteClientAddressTestCase.java (98%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/ServerMaxConnectionsTestCase.java (99%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty => org.restlet/src/test/java/org/restlet/engine/connector}/ShutdownHookTestCase.java (99%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/SslBaseConnectorsTestCase.java (98%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/SslClientContextGetTestCase.java (80%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors => org.restlet/src/test/java/org/restlet/engine/connector}/SslGetTestCase.java (85%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/AbstractAnnotatedServerResource03.java (94%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/AnnotatedInterface03.java (92%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/AnnotatedInterface03_01.java (91%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/AnnotatedInterface03_02.java (91%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/AnnotatedResource09TestCase.java (99%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/AnnotatedResource10TestCase.java (97%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/AnnotatedResource11TestCase.java (97%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/JettyConnectorTestCase.java (95%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/MyResource09.java (98%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/MyResource10.java (90%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/MyResource11.java (93%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/SIMethod.java (93%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/SNIMethod.java (93%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/USIMethod.java (93%) rename {org.restlet.ext.jetty/src/test/java/org/restlet/ext => org.restlet/src/test/java/org/restlet/engine}/jetty/resource/USNIMethod.java (93%) create mode 100644 org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks create mode 100644 org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 diff --git a/org.restlet.ext.jetty/pom.xml b/org.restlet.ext.jetty/pom.xml index bcc9a40ba2..c05ab31420 100644 --- a/org.restlet.ext.jetty/pom.xml +++ b/org.restlet.ext.jetty/pom.xml @@ -15,66 +15,6 @@ Integration with Jetty. - - org.eclipse.jetty - jetty-server - ${lib-jetty-version} - - - org.eclipse.jetty.http2 - jetty-http2-server - ${lib-jetty-version} - - - org.eclipse.jetty - jetty-alpn-server - ${lib-jetty-version} - - - org.eclipse.jetty - jetty-alpn-java-server - ${lib-jetty-version} - - - org.eclipse.jetty.http3 - jetty-http3-server - ${lib-jetty-version} - - - org.eclipse.jetty.quic - jetty-quic-server - ${lib-jetty-version} - - - org.eclipse.jetty - jetty-client - ${lib-jetty-version} - - - org.eclipse.jetty.http2 - jetty-http2-client - ${lib-jetty-version} - - - org.eclipse.jetty.http2 - jetty-http2-client-transport - ${lib-jetty-version} - - - org.eclipse.jetty.http3 - jetty-http3-client - ${lib-jetty-version} - - - org.eclipse.jetty.http3 - jetty-http3-client-transport - ${lib-jetty-version} - - - org.eclipse.jetty - jetty-slf4j-impl - ${lib-jetty-version} - org.restlet org.restlet diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index 90a515c9c2..c57baa30ab 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -15,7 +15,67 @@ Restlet API and Engine - + + org.eclipse.jetty + jetty-server + ${lib-jetty-version} + + + org.eclipse.jetty.http2 + jetty-http2-server + ${lib-jetty-version} + + + org.eclipse.jetty + jetty-alpn-server + ${lib-jetty-version} + + + org.eclipse.jetty + jetty-alpn-java-server + ${lib-jetty-version} + + + org.eclipse.jetty.http3 + jetty-http3-server + ${lib-jetty-version} + + + org.eclipse.jetty.quic + jetty-quic-server + ${lib-jetty-version} + + + org.eclipse.jetty + jetty-client + ${lib-jetty-version} + + + org.eclipse.jetty.http2 + jetty-http2-client + ${lib-jetty-version} + + + org.eclipse.jetty.http2 + jetty-http2-client-transport + ${lib-jetty-version} + + + org.eclipse.jetty.http3 + jetty-http3-client + ${lib-jetty-version} + + + org.eclipse.jetty.http3 + jetty-http3-client-transport + ${lib-jetty-version} + + + org.eclipse.jetty + jetty-slf4j-impl + ${lib-jetty-version} + + org.osgi org.osgi.core ${lib-osgi-version} diff --git a/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java index 81abe244e7..934b10801f 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -9,16 +9,6 @@ package org.restlet.engine; -import org.restlet.Client; -import org.restlet.Context; -import org.restlet.Request; -import org.restlet.Response; -import org.restlet.data.ChallengeScheme; -import org.restlet.data.Method; -import org.restlet.data.Protocol; -import org.restlet.engine.io.IoUtils; -import org.restlet.engine.log.LoggerFacade; - import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -32,6 +22,16 @@ import java.util.logging.LogManager; import java.util.logging.Logger; +import org.restlet.Client; +import org.restlet.Context; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.data.ChallengeScheme; +import org.restlet.data.Method; +import org.restlet.data.Protocol; +import org.restlet.engine.io.IoUtils; +import org.restlet.engine.log.LoggerFacade; + /** * Engine supporting the Restlet API. The engine acts as a registry of various * {@link Helper} types: {@link org.restlet.engine.security.AuthenticatorHelper} @@ -49,961 +49,1055 @@ */ public class Engine { - public static final String DESCRIPTOR = "META-INF/services"; - - public static final String DESCRIPTOR_AUTHENTICATOR = "org.restlet.engine.security.AuthenticatorHelper"; - - public static final String DESCRIPTOR_AUTHENTICATOR_PATH = DESCRIPTOR + "/" + DESCRIPTOR_AUTHENTICATOR; - - public static final String DESCRIPTOR_CLIENT = "org.restlet.engine.ClientHelper"; - - public static final String DESCRIPTOR_CLIENT_PATH = DESCRIPTOR + "/" + DESCRIPTOR_CLIENT; - - public static final String DESCRIPTOR_CONVERTER = "org.restlet.engine.converter.ConverterHelper"; - - public static final String DESCRIPTOR_CONVERTER_PATH = DESCRIPTOR + "/" + DESCRIPTOR_CONVERTER; - - public static final String DESCRIPTOR_PROTOCOL = "org.restlet.engine.ProtocolHelper"; - - public static final String DESCRIPTOR_PROTOCOL_PATH = DESCRIPTOR + "/" + DESCRIPTOR_PROTOCOL; - - public static final String DESCRIPTOR_SERVER = "org.restlet.engine.ServerHelper"; - - public static final String DESCRIPTOR_SERVER_PATH = DESCRIPTOR + "/" + DESCRIPTOR_SERVER; - - /** The registered engine. */ - private static volatile Engine instance = null; + public static final String DESCRIPTOR = "META-INF/services"; - /** The org.restlet log level. */ - private static volatile boolean logConfigured = false; + public static final String DESCRIPTOR_AUTHENTICATOR = "org.restlet.engine.security.AuthenticatorHelper"; - /** The general log formatter. */ - private static volatile Class logFormatter = org.restlet.engine.log.SimplestFormatter.class; + public static final String DESCRIPTOR_AUTHENTICATOR_PATH = DESCRIPTOR + "/" + + DESCRIPTOR_AUTHENTICATOR; - /** The general log level. */ - private static volatile Level logLevel = Level.INFO; + public static final String DESCRIPTOR_CLIENT = "org.restlet.engine.ClientHelper"; - /** Major version number. */ - public static final String MAJOR_NUMBER = "2"; + public static final String DESCRIPTOR_CLIENT_PATH = DESCRIPTOR + "/" + + DESCRIPTOR_CLIENT; - /** Minor version number. */ - public static final String MINOR_NUMBER = "7"; + public static final String DESCRIPTOR_CONVERTER = "org.restlet.engine.converter.ConverterHelper"; - /** Release number. */ - public static final String RELEASE_NUMBER = "-SNAPSHOT"; + public static final String DESCRIPTOR_CONVERTER_PATH = DESCRIPTOR + "/" + + DESCRIPTOR_CONVERTER; - /** The org.restlet log level. */ - private static volatile Level restletLogLevel; + public static final String DESCRIPTOR_PROTOCOL = "org.restlet.engine.ProtocolHelper"; - /** Complete version. */ - public static final String VERSION = MAJOR_NUMBER + '.' + MINOR_NUMBER + RELEASE_NUMBER; + public static final String DESCRIPTOR_PROTOCOL_PATH = DESCRIPTOR + "/" + + DESCRIPTOR_PROTOCOL; - /** Complete version header. */ - public static final String VERSION_HEADER = "Restlet-Framework/" + VERSION; - - /** - * Clears the current Restlet Engine altogether. - */ - public static synchronized void clear() { - instance = null; - } - - /** - * Creates a new standalone thread with local Restlet thread variable properly - * set. - * - * @param runnable The runnable task to execute. - * @param name The thread name. - * @return The thread with proper variables ready to run the given runnable - * task. - */ - public static Thread createThreadWithLocalVariables(final Runnable runnable, String name) { - // Save the thread local variables - final org.restlet.Application currentApplication = org.restlet.Application.getCurrent(); - final Context currentContext = Context.getCurrent(); - final Integer currentVirtualHost = org.restlet.routing.VirtualHost.getCurrent(); - final Response currentResponse = Response.getCurrent(); - - Runnable r = new Runnable() { - - @Override - public void run() { - // Copy the thread local variables - Response.setCurrent(currentResponse); - Context.setCurrent(currentContext); - org.restlet.routing.VirtualHost.setCurrent(currentVirtualHost); - org.restlet.Application.setCurrent(currentApplication); - - try { - // Run the user task - runnable.run(); - } finally { - Engine.clearThreadLocalVariables(); - } - } - - }; - - return new Thread(r, name); - } - - /** - * Clears the thread local variables set by the Restlet API and engine. - */ - public static void clearThreadLocalVariables() { - Response.setCurrent(null); - Context.setCurrent(null); - org.restlet.routing.VirtualHost.setCurrent(null); - org.restlet.Application.setCurrent(null); - } - - /** - * Updates the global log configuration of the JVM programmatically. - */ - public static void configureLog() { - if ((System.getProperty("java.util.logging.config.file") == null) - && (System.getProperty("java.util.logging.config.class") == null)) { - StringBuilder sb = new StringBuilder(); - sb.append("handlers=").append(java.util.logging.ConsoleHandler.class.getCanonicalName()).append('\n'); - - if (getLogLevel() != null) { - sb.append(".level=").append(getLogLevel().getName()).append('\n'); - } - - if (getRestletLogLevel() != null) { - sb.append("org.restlet.level=").append(getRestletLogLevel().getName()).append('\n'); - } - - if (getLogFormatter() != null) { - String handler = java.util.logging.ConsoleHandler.class.getCanonicalName(); - sb.append(handler).append(".formatter=").append(getLogFormatter().getCanonicalName()).append("\n"); - - if (getLogLevel() != null) { - sb.append(handler).append(".level=").append(getLogLevel().getName()).append("\n"); - } - } - - try { - LogManager.getLogManager().readConfiguration(new ByteArrayInputStream(sb.toString().getBytes())); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - logConfigured = true; - } - - /** - * Returns an anonymous logger. By default, it calls {@link #getLogger(String)} - * with a "" name. - * - * @return The logger. - */ - public static Logger getAnonymousLogger() { - return getInstance().getLoggerFacade().getAnonymousLogger(); - } - - /** - * Returns the registered Restlet engine. - * - * @return The registered Restlet engine. - */ - public static synchronized Engine getInstance() { - Engine result = instance; - - if (result == null) { - result = register(); - } - - return result; - } - - /** - * Returns the general log formatter. - * - * @return The general log formatter. - */ - public static Class getLogFormatter() { - return Engine.logFormatter; - } - - /** - * Returns a logger based on the class name of the given object. - * - * @param clazz The parent class. - * @return The logger. - */ - public static Logger getLogger(Class clazz) { - return getInstance().getLoggerFacade().getLogger(clazz); - } - - /** - * Returns a logger based on the class name of the given object. - * - * @param clazz The parent class. - * @param defaultLoggerName The default logger name to use if no one can be - * inferred from the class. - * @return The logger. - */ - public static Logger getLogger(Class clazz, String defaultLoggerName) { - return getInstance().getLoggerFacade().getLogger(clazz, defaultLoggerName); - } - - /** - * Returns a logger based on the class name of the given object. - * - * @param object The parent object. - * @param defaultLoggerName The default logger name to use if no one can be - * inferred from the object class. - * @return The logger. - */ - public static Logger getLogger(Object object, String defaultLoggerName) { - return getInstance().getLoggerFacade().getLogger(object, defaultLoggerName); - } - - /** - * Returns a logger based on the given logger name. - * - * @param loggerName The logger name. - * @return The logger. - */ - public static Logger getLogger(String loggerName) { - return getInstance().getLoggerFacade().getLogger(loggerName); - } - - /** - * Returns the general log level. - * - * @return The general log level. - */ - public static Level getLogLevel() { - return Engine.logLevel; - } - - /** - * Returns the classloader resource for a given name/path. - * - * @param name The name/path to lookup. - * @return The resource URL. - */ - public static java.net.URL getResource(String name) { - return getInstance().getClassLoader().getResource(name); - } - - /** - * Returns the Restlet log level. For loggers with a name starting with - * "org.restlet". - * - * @return The Restlet log level. - */ - public static Level getRestletLogLevel() { - return Engine.restletLogLevel; - } - - /** - * Returns the class object for the given name using the engine classloader. - * - * @param className The class name to lookup. - * @return The class object or null if the class was not found. - * @see #getClassLoader() - */ - public static Class loadClass(String className) throws ClassNotFoundException { - return getInstance().getClassLoader().loadClass(className); - } - - /** - * Registers a new Restlet Engine. - * - * @return The registered engine. - */ - public static synchronized Engine register() { - return register(true); - } - - /** - * Registers a new Restlet Engine. - * - * @param discoverPlugins True if plug-ins should be automatically discovered. - * @return The registered engine. - */ - public static synchronized Engine register(boolean discoverPlugins) { - if (Edition.JEE.isNotCurrentEdition() && !logConfigured) { - configureLog(); - } - - Engine result = new Engine(discoverPlugins); - instance = result; - return result; - } - - /** - * Sets the general log formatter. - * - * @param logFormatter The general log formatter. - */ - public static void setLogFormatter(Class logFormatter) { - Engine.logFormatter = logFormatter; - configureLog(); - } - - /** - * Sets the general log level. Modifies the global JVM's {@link LogManager}. - * - * @param logLevel The general log level. - */ - public static void setLogLevel(Level logLevel) { - Engine.logLevel = logLevel; - configureLog(); - } - - /** - * Sets the Restlet log level. For loggers with a name starting with - * "org.restlet". - * - * @param restletLogLevel The Restlet log level. - */ - public static void setRestletLogLevel(Level restletLogLevel) { - Engine.restletLogLevel = restletLogLevel; - configureLog(); - } - - /** Class loader to use for dynamic class loading. */ - private volatile ClassLoader classLoader; - - /** The logger facade to use. */ - private LoggerFacade loggerFacade; - - /** List of available authenticator helpers. */ - private final List registeredAuthenticators; - - /** List of available client connectors. */ - private final List> registeredClients; - - /** List of available converter helpers. */ - private final List registeredConverters; - - /** List of available protocol helpers. */ - private final List registeredProtocols; - - /** List of available server connectors. */ - private final List> registeredServers; - - /** User class loader to use for dynamic class loading. */ - private volatile ClassLoader userClassLoader; - - /** - * Constructor that will automatically attempt to discover connectors. - */ - public Engine() { - this(true); - } - - /** - * Constructor. - * - * @param discoverHelpers True if helpers should be automatically discovered. - */ - public Engine(boolean discoverHelpers) { - // Prevent engine initialization code from recreating other engines - instance = this; - - // Instantiate the logger facade - this.classLoader = createClassLoader(); - this.userClassLoader = null; - - String loggerFacadeClass = System.getProperty("org.restlet.engine.loggerFacadeClass", - "org.restlet.engine.log.LoggerFacade"); - try { - this.loggerFacade = (LoggerFacade) getClassLoader().loadClass(loggerFacadeClass) - .getDeclaredConstructor().newInstance(); - } catch (Exception e) { - this.loggerFacade = new LoggerFacade(); - this.loggerFacade.getLogger("org.restlet").log(Level.WARNING, "Unable to register the logger facade", e); - } - - this.registeredClients = new CopyOnWriteArrayList<>(); - this.registeredProtocols = new CopyOnWriteArrayList<>(); - - this.registeredServers = new CopyOnWriteArrayList<>(); - this.registeredAuthenticators = new CopyOnWriteArrayList<>(); - this.registeredConverters = new CopyOnWriteArrayList<>(); - - if (discoverHelpers) { - try { - discoverConnectors(); - discoverProtocols(); - - discoverAuthenticators(); - discoverConverters(); - } catch (IOException e) { - Context.getCurrentLogger().log(Level.WARNING, "An error occurred while discovering the engine helpers.", - e); - } - } - } - - /** - * Creates a new class loader. By default, it returns an instance of - * {@link org.restlet.engine.util.EngineClassLoader}. - * - * @return A new class loader. - */ - protected ClassLoader createClassLoader() { - return new org.restlet.engine.util.EngineClassLoader(this); - } - - /** - * Creates a new helper for a given client connector. - * - * @param client The client to help. - * @param helperClass Optional helper class name. - * @return The new helper. - */ - @SuppressWarnings("unchecked") - public org.restlet.engine.connector.ConnectorHelper createHelper(Client client, String helperClass) { - org.restlet.engine.connector.ConnectorHelper result = null; - - if (!client.getProtocols().isEmpty()) { - org.restlet.engine.connector.ConnectorHelper connector = null; - for (final Iterator> iter = getRegisteredClients() - .iterator(); (result == null) && iter.hasNext();) { - connector = iter.next(); - - if (connector.getProtocols().containsAll(client.getProtocols())) { - if ((helperClass == null) || connector.getClass().getCanonicalName().equals(helperClass)) { - try { - result = connector.getClass().getConstructor(Client.class).newInstance(client); - } catch (Exception e) { - Context.getCurrentLogger().log(Level.SEVERE, - "Exception during the instantiation of the client connector.", e); - } - } - } - } - - if (result == null) { - // Couldn't find a matching connector - StringBuilder sb = new StringBuilder(); - sb.append("No available client connector supports the required protocols: "); - - for (Protocol p : client.getProtocols()) { - sb.append("'").append(p.getName()).append("' "); - } - - sb.append(". Please add the JAR of a matching connector to your classpath."); - - if (Edition.ANDROID.isCurrentEdition()) { - sb.append(" Then, register this connector helper manually."); - } - - Context.getCurrentLogger().log(Level.WARNING, sb.toString()); - } - } - - return result; - } - - /** - * Creates a new helper for a given server connector. - * - * @param server The server to help. - * @param helperClass Optional helper class name. - * @return The new helper. - */ - @SuppressWarnings("unchecked") - public org.restlet.engine.connector.ConnectorHelper createHelper(org.restlet.Server server, - String helperClass) { - org.restlet.engine.connector.ConnectorHelper result = null; - - if (!server.getProtocols().isEmpty()) { - org.restlet.engine.connector.ConnectorHelper connector = null; - for (final Iterator> iter = getRegisteredServers() - .iterator(); (result == null) && iter.hasNext();) { - connector = iter.next(); - - if ((helperClass == null) || connector.getClass().getCanonicalName().equals(helperClass)) { - if (connector.getProtocols().containsAll(server.getProtocols())) { - try { - result = connector.getClass().getConstructor(org.restlet.Server.class).newInstance(server); - } catch (Exception e) { - Context.getCurrentLogger().log(Level.SEVERE, - "Exception while instantiation the server connector.", e); - } - } - } - } - - if (result == null) { - // Couldn't find a matching connector - final StringBuilder sb = new StringBuilder(); - sb.append("No available server connector supports the required protocols: "); - - for (final Protocol p : server.getProtocols()) { - sb.append("'").append(p.getName()).append("' "); - } - - sb.append(". Please add the JAR of a matching connector to your classpath."); - - if (Edition.ANDROID.isCurrentEdition()) { - sb.append(" Then, register this connector helper manually."); - } - - Context.getCurrentLogger().log(Level.WARNING, sb.toString()); - } - } - - return result; - } - - /** - * Discovers the authenticator helpers and register the default helpers. - * - * @throws IOException - */ - private void discoverAuthenticators() throws IOException { - registerHelpers(DESCRIPTOR_AUTHENTICATOR_PATH, getRegisteredAuthenticators(), null); - registerDefaultAuthentications(); - } - - /** - * Discovers the server and client connectors and register the default - * connectors. - * - * @throws IOException - */ - private void discoverConnectors() throws IOException { - registerHelpers(DESCRIPTOR_CLIENT_PATH, getRegisteredClients(), Client.class); - registerHelpers(DESCRIPTOR_SERVER_PATH, getRegisteredServers(), org.restlet.Server.class); - registerDefaultConnectors(); - } - - /** - * Discovers the converter helpers and register the default helpers. - * - * @throws IOException - */ - private void discoverConverters() throws IOException { - registerHelpers(DESCRIPTOR_CONVERTER_PATH, getRegisteredConverters(), null); - registerDefaultConverters(); - } - - /** - * Discovers the protocol helpers and register the default helpers. - * - * @throws IOException - */ - private void discoverProtocols() throws IOException { - registerHelpers(DESCRIPTOR_PROTOCOL_PATH, getRegisteredProtocols(), null); - registerDefaultProtocols(); - } - - /** - * Finds the converter helper supporting the given conversion. - * - * @return The converter helper or null. - */ - public org.restlet.engine.converter.ConverterHelper findHelper() { - - return null; - } - - /** - * Finds the authenticator helper supporting the given scheme. - * - * @param challengeScheme The challenge scheme to match. - * @param clientSide Indicates if client side support is required. - * @param serverSide Indicates if server side support is required. - * @return The authenticator helper or null. - */ - public org.restlet.engine.security.AuthenticatorHelper findHelper(ChallengeScheme challengeScheme, - boolean clientSide, boolean serverSide) { - org.restlet.engine.security.AuthenticatorHelper result = null; - List helpers = getRegisteredAuthenticators(); - org.restlet.engine.security.AuthenticatorHelper current; - - for (int i = 0; (result == null) && (i < helpers.size()); i++) { - current = helpers.get(i); - - if (current.getChallengeScheme().equals(challengeScheme) - && ((clientSide && current.isClientSide()) || !clientSide) - && ((serverSide && current.isServerSide()) || !serverSide)) { - result = helpers.get(i); - } - } - - return result; - } - - /** - * Returns the class loader. It uses the delegation model with the Engine - * class's class loader as a parent. If this parent doesn't find a class or - * resource, it then tries the user class loader (via - * {@link #getUserClassLoader()} and finally the - * {@link Thread#getContextClassLoader()}. - * - * @return The engine class loader. - * @see org.restlet.engine.util.EngineClassLoader - */ - public ClassLoader getClassLoader() { - return classLoader; - } - - /** - * Returns the logger facade to use. - * - * @return The logger facade to use. - */ - public LoggerFacade getLoggerFacade() { - return loggerFacade; - } - - /** - * Parses a line to extract the provider class name. - * - * @param line The line to parse. - * @return The provider's class name or an empty string. - */ - private String getProviderClassName(String line) { - final int index = line.indexOf('#'); - if (index != -1) { - line = line.substring(0, index); - } - return line.trim(); - } - - /** - * Returns the list of available authentication helpers. - * - * @return The list of available authentication helpers. - */ - public List getRegisteredAuthenticators() { - return this.registeredAuthenticators; - } - - /** - * Returns the list of available client connectors. - * - * @return The list of available client connectors. - */ - public List> getRegisteredClients() { - return this.registeredClients; - } - - /** - * Returns the list of available converters. - * - * @return The list of available converters. - */ - public List getRegisteredConverters() { - return registeredConverters; - } - - /** - * Returns the list of available protocol connectors. - * - * @return The list of available protocol connectors. - */ - public List getRegisteredProtocols() { - return this.registeredProtocols; - } - - /** - * Returns the list of available server connectors. - * - * @return The list of available server connectors. - */ - public List> getRegisteredServers() { - return this.registeredServers; - } - - /** - * Returns the class loader specified by the user and that should be used in - * priority. - * - * @return The user class loader - */ - public ClassLoader getUserClassLoader() { - return userClassLoader; - } - - /** - * Registers the default authentication helpers. - */ - public void registerDefaultAuthentications() { - getRegisteredAuthenticators().add(new org.restlet.engine.security.HttpBasicHelper()); - } - - /** - * Registers the default client and server connectors. - */ - public void registerDefaultConnectors() { - getRegisteredClients().add(new org.restlet.engine.local.ClapClientHelper(null)); - getRegisteredClients().add(new org.restlet.engine.local.RiapClientHelper(null)); - getRegisteredServers().add(new org.restlet.engine.local.RiapServerHelper(null)); - getRegisteredClients().add(new org.restlet.engine.local.FileClientHelper(null)); - getRegisteredClients().add(new org.restlet.engine.local.ZipClientHelper(null)); - } - - /** - * Registers the default converters. - */ - public void registerDefaultConverters() { - getRegisteredConverters().add(new org.restlet.engine.converter.DefaultConverter()); - getRegisteredConverters().add(new org.restlet.engine.converter.StatusInfoHtmlConverter()); - } - - /** - * Registers the default protocols. - */ - public void registerDefaultProtocols() { - getRegisteredProtocols().add(new org.restlet.engine.connector.HttpProtocolHelper()); - } - - /** - * Registers a helper. - * - * @param classLoader The classloader to use. - * @param provider Bynary name of the helper's class. - * @param helpers The list of helpers to update. - * @param constructorClass The constructor parameter class to look for. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void registerHelper(ClassLoader classLoader, String provider, List helpers, Class constructorClass) { - if ((provider != null) && (!provider.isEmpty())) { - // Instantiate the factory - try { - Class providerClass = classLoader.loadClass(provider); - - if (constructorClass == null) { - helpers.add(providerClass.getDeclaredConstructor().newInstance()); - } else { - helpers.add( - providerClass.getConstructor(constructorClass).newInstance(constructorClass.cast(null))); - } - } catch (Throwable t) { - Context.getCurrentLogger().log(Level.INFO, "Unable to register the helper " + provider, t); - } - } - } - - /** - * Registers a helper. - * - * @param classLoader The classloader to use. - * @param configUrl Configuration URL to parse - * @param helpers The list of helpers to update. - * @param constructorClass The constructor parameter class to look for. - */ - public void registerHelpers(ClassLoader classLoader, java.net.URL configUrl, List helpers, - Class constructorClass) { - try { - java.io.BufferedReader reader = null; - try { - reader = new java.io.BufferedReader(new InputStreamReader(configUrl.openStream(), "utf-8"), - IoUtils.BUFFER_SIZE); - String line = reader.readLine(); - - while (line != null) { - registerHelper(classLoader, getProviderClassName(line), helpers, constructorClass); - line = reader.readLine(); - } - } catch (IOException e) { - Context.getCurrentLogger().log(Level.SEVERE, - "Unable to read the provider descriptor: " + configUrl.toString()); - } finally { - if (reader != null) { - reader.close(); - } - } - } catch (IOException ioe) { - Context.getCurrentLogger().log(Level.SEVERE, "Exception while detecting the helpers.", ioe); - } - } - - /** - * Registers a list of helpers. - * - * @param descriptorPath Classpath to the descriptor file. - * @param helpers The list of helpers to update. - * @param constructorClass The constructor parameter class to look for. - * @throws IOException - */ - public void registerHelpers(String descriptorPath, List helpers, Class constructorClass) throws IOException { - ClassLoader classLoader = getClassLoader(); - Enumeration configUrls = classLoader.getResources(descriptorPath); - - if (configUrls != null) { - for (Enumeration configEnum = configUrls; configEnum.hasMoreElements();) { - registerHelpers(classLoader, configEnum.nextElement(), helpers, constructorClass); - } - } - } - - /** - * Registers a factory that is used by the URL class to create the - * {@link java.net.URLConnection} instances when the - * {@link java.net.URL#openConnection()} or {@link java.net.URL#openStream()} - * methods are invoked. - *

- * The implementation is based on the client dispatcher of the current context, - * as provided by {@link Context#getCurrent()} method. - */ - public void registerUrlFactory() { - // Set up an java.net.URLStreamHandlerFactory for - // proper creation of java.net.URL instances - java.net.URL.setURLStreamHandlerFactory(new java.net.URLStreamHandlerFactory() { - public java.net.URLStreamHandler createURLStreamHandler(String protocol) { - final java.net.URLStreamHandler result = new java.net.URLStreamHandler() { - - @Override - protected java.net.URLConnection openConnection(java.net.URL url) throws IOException { - return new java.net.URLConnection(url) { - - @Override - public void connect() throws IOException { - } - - @Override - public InputStream getInputStream() throws IOException { - InputStream result = null; - - // Retrieve the current context - final Context context = Context.getCurrent(); - - if (context != null) { - Response response = context.getClientDispatcher() - .handle(new Request(Method.GET, this.url.toString())); - - if (response.getStatus().isSuccess()) { - result = response.getEntity().getStream(); - } - } - - return result; - } - }; - } - - }; - - return result; - } - - }); - } - - /** - * Sets the engine class loader. - * - * @param newClassLoader The new user class loader to use. - */ - public void setClassLoader(ClassLoader newClassLoader) { - this.classLoader = newClassLoader; - } - - /** - * Sets the logger facade to use. - * - * @param loggerFacade The logger facade to use. - */ - public void setLoggerFacade(LoggerFacade loggerFacade) { - this.loggerFacade = loggerFacade; - } - - /** - * Sets the list of available authentication helpers. - * - * @param registeredAuthenticators The list of available authentication helpers. - */ - public void setRegisteredAuthenticators( - List registeredAuthenticators) { - synchronized (this.registeredAuthenticators) { - if (registeredAuthenticators != this.registeredAuthenticators) { - this.registeredAuthenticators.clear(); - - if (registeredAuthenticators != null) { - this.registeredAuthenticators.addAll(registeredAuthenticators); - } - } - } - } - - /** - * Sets the list of available client helpers. - * - * @param registeredClients The list of available client helpers. - */ - public void setRegisteredClients(List> registeredClients) { - synchronized (this.registeredClients) { - if (registeredClients != this.registeredClients) { - this.registeredClients.clear(); - - if (registeredClients != null) { - this.registeredClients.addAll(registeredClients); - } - } - } - } - - /** - * Sets the list of available converter helpers. - * - * @param registeredConverters The list of available converter helpers. - */ - public void setRegisteredConverters(List registeredConverters) { - synchronized (this.registeredConverters) { - if (registeredConverters != this.registeredConverters) { - this.registeredConverters.clear(); - - if (registeredConverters != null) { - this.registeredConverters.addAll(registeredConverters); - } - } - } - } - - /** - * Sets the list of available protocol helpers. - * - * @param registeredProtocols The list of available protocol helpers. - */ - public void setRegisteredProtocols(List registeredProtocols) { - synchronized (this.registeredProtocols) { - if (registeredProtocols != this.registeredProtocols) { - this.registeredProtocols.clear(); - - if (registeredProtocols != null) { - this.registeredProtocols.addAll(registeredProtocols); - } - } - } - } - - /** - * Sets the list of available server helpers. - * - * @param registeredServers The list of available server helpers. - */ - public void setRegisteredServers( - List> registeredServers) { - synchronized (this.registeredServers) { - if (registeredServers != this.registeredServers) { - this.registeredServers.clear(); - - if (registeredServers != null) { - this.registeredServers.addAll(registeredServers); - } - } - } - } - - /** - * Sets the user class loader that should used in priority. - * - * @param newClassLoader The new user class loader to use. - */ - public void setUserClassLoader(ClassLoader newClassLoader) { - this.userClassLoader = newClassLoader; - } + public static final String DESCRIPTOR_SERVER = "org.restlet.engine.ServerHelper"; + + public static final String DESCRIPTOR_SERVER_PATH = DESCRIPTOR + "/" + + DESCRIPTOR_SERVER; + + /** The registered engine. */ + private static volatile Engine instance = null; + + /** The org.restlet log level. */ + private static volatile boolean logConfigured = false; + + /** The general log formatter. */ + private static volatile Class logFormatter = org.restlet.engine.log.SimplestFormatter.class; + + /** The general log level. */ + private static volatile Level logLevel = Level.INFO; + + /** Major version number. */ + public static final String MAJOR_NUMBER = "2"; + + /** Minor version number. */ + public static final String MINOR_NUMBER = "7"; + + /** Release number. */ + public static final String RELEASE_NUMBER = "-SNAPSHOT"; + + /** The org.restlet log level. */ + private static volatile Level restletLogLevel; + + /** Complete version. */ + public static final String VERSION = MAJOR_NUMBER + '.' + MINOR_NUMBER + + RELEASE_NUMBER; + + /** Complete version header. */ + public static final String VERSION_HEADER = "Restlet-Framework/" + VERSION; + + /** + * Clears the current Restlet Engine altogether. + */ + public static synchronized void clear() { + instance = null; + } + + /** + * Creates a new standalone thread with local Restlet thread variable + * properly set. + * + * @param runnable The runnable task to execute. + * @param name The thread name. + * @return The thread with proper variables ready to run the given runnable + * task. + */ + public static Thread createThreadWithLocalVariables(final Runnable runnable, + String name) { + // Save the thread local variables + final org.restlet.Application currentApplication = org.restlet.Application + .getCurrent(); + final Context currentContext = Context.getCurrent(); + final Integer currentVirtualHost = org.restlet.routing.VirtualHost + .getCurrent(); + final Response currentResponse = Response.getCurrent(); + + Runnable r = new Runnable() { + + @Override + public void run() { + // Copy the thread local variables + Response.setCurrent(currentResponse); + Context.setCurrent(currentContext); + org.restlet.routing.VirtualHost.setCurrent(currentVirtualHost); + org.restlet.Application.setCurrent(currentApplication); + + try { + // Run the user task + runnable.run(); + } finally { + Engine.clearThreadLocalVariables(); + } + } + + }; + + return new Thread(r, name); + } + + /** + * Clears the thread local variables set by the Restlet API and engine. + */ + public static void clearThreadLocalVariables() { + Response.setCurrent(null); + Context.setCurrent(null); + org.restlet.routing.VirtualHost.setCurrent(null); + org.restlet.Application.setCurrent(null); + } + + /** + * Updates the global log configuration of the JVM programmatically. + */ + public static void configureLog() { + if ((System.getProperty("java.util.logging.config.file") == null) + && (System.getProperty( + "java.util.logging.config.class") == null)) { + StringBuilder sb = new StringBuilder(); + sb.append("handlers=").append( + java.util.logging.ConsoleHandler.class.getCanonicalName()) + .append('\n'); + + if (getLogLevel() != null) { + sb.append(".level=").append(getLogLevel().getName()) + .append('\n'); + } + + if (getRestletLogLevel() != null) { + sb.append("org.restlet.level=") + .append(getRestletLogLevel().getName()).append('\n'); + } + + if (getLogFormatter() != null) { + String handler = java.util.logging.ConsoleHandler.class + .getCanonicalName(); + sb.append(handler).append(".formatter=") + .append(getLogFormatter().getCanonicalName()) + .append("\n"); + + if (getLogLevel() != null) { + sb.append(handler).append(".level=") + .append(getLogLevel().getName()).append("\n"); + } + } + + try { + LogManager.getLogManager().readConfiguration( + new ByteArrayInputStream(sb.toString().getBytes())); + } catch (Throwable t) { + t.printStackTrace(); + } + } + + logConfigured = true; + } + + /** + * Returns an anonymous logger. By default, it calls + * {@link #getLogger(String)} with a "" name. + * + * @return The logger. + */ + public static Logger getAnonymousLogger() { + return getInstance().getLoggerFacade().getAnonymousLogger(); + } + + /** + * Returns the registered Restlet engine. + * + * @return The registered Restlet engine. + */ + public static synchronized Engine getInstance() { + Engine result = instance; + + if (result == null) { + result = register(); + } + + return result; + } + + /** + * Returns the general log formatter. + * + * @return The general log formatter. + */ + public static Class getLogFormatter() { + return Engine.logFormatter; + } + + /** + * Returns a logger based on the class name of the given object. + * + * @param clazz The parent class. + * @return The logger. + */ + public static Logger getLogger(Class clazz) { + return getInstance().getLoggerFacade().getLogger(clazz); + } + + /** + * Returns a logger based on the class name of the given object. + * + * @param clazz The parent class. + * @param defaultLoggerName The default logger name to use if no one can be + * inferred from the class. + * @return The logger. + */ + public static Logger getLogger(Class clazz, String defaultLoggerName) { + return getInstance().getLoggerFacade().getLogger(clazz, + defaultLoggerName); + } + + /** + * Returns a logger based on the class name of the given object. + * + * @param object The parent object. + * @param defaultLoggerName The default logger name to use if no one can be + * inferred from the object class. + * @return The logger. + */ + public static Logger getLogger(Object object, String defaultLoggerName) { + return getInstance().getLoggerFacade().getLogger(object, + defaultLoggerName); + } + + /** + * Returns a logger based on the given logger name. + * + * @param loggerName The logger name. + * @return The logger. + */ + public static Logger getLogger(String loggerName) { + return getInstance().getLoggerFacade().getLogger(loggerName); + } + + /** + * Returns the general log level. + * + * @return The general log level. + */ + public static Level getLogLevel() { + return Engine.logLevel; + } + + /** + * Returns the classloader resource for a given name/path. + * + * @param name The name/path to lookup. + * @return The resource URL. + */ + public static java.net.URL getResource(String name) { + return getInstance().getClassLoader().getResource(name); + } + + /** + * Returns the Restlet log level. For loggers with a name starting with + * "org.restlet". + * + * @return The Restlet log level. + */ + public static Level getRestletLogLevel() { + return Engine.restletLogLevel; + } + + /** + * Returns the class object for the given name using the engine classloader. + * + * @param className The class name to lookup. + * @return The class object or null if the class was not found. + * @see #getClassLoader() + */ + public static Class loadClass(String className) + throws ClassNotFoundException { + return getInstance().getClassLoader().loadClass(className); + } + + /** + * Registers a new Restlet Engine. + * + * @return The registered engine. + */ + public static synchronized Engine register() { + return register(true); + } + + /** + * Registers a new Restlet Engine. + * + * @param discoverPlugins True if plug-ins should be automatically + * discovered. + * @return The registered engine. + */ + public static synchronized Engine register(boolean discoverPlugins) { + if (Edition.JEE.isNotCurrentEdition() && !logConfigured) { + configureLog(); + } + + Engine result = new Engine(discoverPlugins); + instance = result; + return result; + } + + /** + * Sets the general log formatter. + * + * @param logFormatter The general log formatter. + */ + public static void setLogFormatter( + Class logFormatter) { + Engine.logFormatter = logFormatter; + configureLog(); + } + + /** + * Sets the general log level. Modifies the global JVM's {@link LogManager}. + * + * @param logLevel The general log level. + */ + public static void setLogLevel(Level logLevel) { + Engine.logLevel = logLevel; + configureLog(); + } + + /** + * Sets the Restlet log level. For loggers with a name starting with + * "org.restlet". + * + * @param restletLogLevel The Restlet log level. + */ + public static void setRestletLogLevel(Level restletLogLevel) { + Engine.restletLogLevel = restletLogLevel; + configureLog(); + } + + /** Class loader to use for dynamic class loading. */ + private volatile ClassLoader classLoader; + + /** The logger facade to use. */ + private LoggerFacade loggerFacade; + + /** List of available authenticator helpers. */ + private final List registeredAuthenticators; + + /** List of available client connectors. */ + private final List> registeredClients; + + /** List of available converter helpers. */ + private final List registeredConverters; + + /** List of available protocol helpers. */ + private final List registeredProtocols; + + /** List of available server connectors. */ + private final List> registeredServers; + + /** User class loader to use for dynamic class loading. */ + private volatile ClassLoader userClassLoader; + + /** + * Constructor that will automatically attempt to discover connectors. + */ + public Engine() { + this(true); + } + + /** + * Constructor. + * + * @param discoverHelpers True if helpers should be automatically + * discovered. + */ + public Engine(boolean discoverHelpers) { + // Prevent engine initialization code from recreating other engines + instance = this; + + // Instantiate the logger facade + this.classLoader = createClassLoader(); + this.userClassLoader = null; + + String loggerFacadeClass = System.getProperty( + "org.restlet.engine.loggerFacadeClass", + "org.restlet.engine.log.LoggerFacade"); + try { + this.loggerFacade = (LoggerFacade) getClassLoader() + .loadClass(loggerFacadeClass).getDeclaredConstructor() + .newInstance(); + } catch (Exception e) { + this.loggerFacade = new LoggerFacade(); + this.loggerFacade.getLogger("org.restlet").log(Level.WARNING, + "Unable to register the logger facade", e); + } + + this.registeredClients = new CopyOnWriteArrayList<>(); + this.registeredProtocols = new CopyOnWriteArrayList<>(); + + this.registeredServers = new CopyOnWriteArrayList<>(); + this.registeredAuthenticators = new CopyOnWriteArrayList<>(); + this.registeredConverters = new CopyOnWriteArrayList<>(); + + if (discoverHelpers) { + try { + discoverConnectors(); + discoverProtocols(); + + discoverAuthenticators(); + discoverConverters(); + } catch (IOException e) { + Context.getCurrentLogger().log(Level.WARNING, + "An error occurred while discovering the engine helpers.", + e); + } + } + } + + /** + * Creates a new class loader. By default, it returns an instance of + * {@link org.restlet.engine.util.EngineClassLoader}. + * + * @return A new class loader. + */ + protected ClassLoader createClassLoader() { + return new org.restlet.engine.util.EngineClassLoader(this); + } + + /** + * Creates a new helper for a given client connector. + * + * @param client The client to help. + * @param helperClass Optional helper class name. + * @return The new helper. + */ + @SuppressWarnings("unchecked") + public org.restlet.engine.connector.ConnectorHelper createHelper( + Client client, String helperClass) { + org.restlet.engine.connector.ConnectorHelper result = null; + + if (!client.getProtocols().isEmpty()) { + org.restlet.engine.connector.ConnectorHelper connector = null; + for (final Iterator> iter = getRegisteredClients() + .iterator(); (result == null) && iter.hasNext();) { + connector = iter.next(); + + if (connector.getProtocols() + .containsAll(client.getProtocols())) { + if ((helperClass == null) || connector.getClass() + .getCanonicalName().equals(helperClass)) { + try { + result = connector.getClass() + .getConstructor(Client.class) + .newInstance(client); + } catch (Exception e) { + Context.getCurrentLogger().log(Level.SEVERE, + "Exception during the instantiation of the client connector.", + e); + } + } + } + } + + if (result == null) { + // Couldn't find a matching connector + StringBuilder sb = new StringBuilder(); + sb.append( + "No available client connector supports the required protocols: "); + + for (Protocol p : client.getProtocols()) { + sb.append("'").append(p.getName()).append("' "); + } + + sb.append( + ". Please add the JAR of a matching connector to your classpath."); + + if (Edition.ANDROID.isCurrentEdition()) { + sb.append( + " Then, register this connector helper manually."); + } + + Context.getCurrentLogger().log(Level.WARNING, sb.toString()); + } + } + + return result; + } + + /** + * Creates a new helper for a given server connector. + * + * @param server The server to help. + * @param helperClass Optional helper class name. + * @return The new helper. + */ + @SuppressWarnings("unchecked") + public org.restlet.engine.connector.ConnectorHelper createHelper( + org.restlet.Server server, String helperClass) { + org.restlet.engine.connector.ConnectorHelper result = null; + + if (!server.getProtocols().isEmpty()) { + org.restlet.engine.connector.ConnectorHelper connector = null; + for (final Iterator> iter = getRegisteredServers() + .iterator(); (result == null) && iter.hasNext();) { + connector = iter.next(); + + if ((helperClass == null) || connector.getClass() + .getCanonicalName().equals(helperClass)) { + if (connector.getProtocols() + .containsAll(server.getProtocols())) { + try { + result = connector.getClass() + .getConstructor(org.restlet.Server.class) + .newInstance(server); + } catch (Exception e) { + Context.getCurrentLogger().log(Level.SEVERE, + "Exception while instantiation the server connector.", + e); + } + } + } + } + + if (result == null) { + // Couldn't find a matching connector + final StringBuilder sb = new StringBuilder(); + sb.append( + "No available server connector supports the required protocols: "); + + for (final Protocol p : server.getProtocols()) { + sb.append("'").append(p.getName()).append("' "); + } + + sb.append( + ". Please add the JAR of a matching connector to your classpath."); + + if (Edition.ANDROID.isCurrentEdition()) { + sb.append( + " Then, register this connector helper manually."); + } + + Context.getCurrentLogger().log(Level.WARNING, sb.toString()); + } + } + + return result; + } + + /** + * Discovers the authenticator helpers and register the default helpers. + * + * @throws IOException + */ + private void discoverAuthenticators() throws IOException { + registerHelpers(DESCRIPTOR_AUTHENTICATOR_PATH, + getRegisteredAuthenticators(), null); + registerDefaultAuthentications(); + } + + /** + * Discovers the server and client connectors and register the default + * connectors. + * + * @throws IOException + */ + private void discoverConnectors() throws IOException { + registerHelpers(DESCRIPTOR_CLIENT_PATH, getRegisteredClients(), + Client.class); + registerHelpers(DESCRIPTOR_SERVER_PATH, getRegisteredServers(), + org.restlet.Server.class); + registerDefaultConnectors(); + } + + /** + * Discovers the converter helpers and register the default helpers. + * + * @throws IOException + */ + private void discoverConverters() throws IOException { + registerHelpers(DESCRIPTOR_CONVERTER_PATH, getRegisteredConverters(), + null); + registerDefaultConverters(); + } + + /** + * Discovers the protocol helpers and register the default helpers. + * + * @throws IOException + */ + private void discoverProtocols() throws IOException { + registerHelpers(DESCRIPTOR_PROTOCOL_PATH, getRegisteredProtocols(), + null); + registerDefaultProtocols(); + } + + /** + * Finds the converter helper supporting the given conversion. + * + * @return The converter helper or null. + */ + public org.restlet.engine.converter.ConverterHelper findHelper() { + + return null; + } + + /** + * Finds the authenticator helper supporting the given scheme. + * + * @param challengeScheme The challenge scheme to match. + * @param clientSide Indicates if client side support is required. + * @param serverSide Indicates if server side support is required. + * @return The authenticator helper or null. + */ + public org.restlet.engine.security.AuthenticatorHelper findHelper( + ChallengeScheme challengeScheme, boolean clientSide, + boolean serverSide) { + org.restlet.engine.security.AuthenticatorHelper result = null; + List helpers = getRegisteredAuthenticators(); + org.restlet.engine.security.AuthenticatorHelper current; + + for (int i = 0; (result == null) && (i < helpers.size()); i++) { + current = helpers.get(i); + + if (current.getChallengeScheme().equals(challengeScheme) + && ((clientSide && current.isClientSide()) || !clientSide) + && ((serverSide && current.isServerSide()) + || !serverSide)) { + result = helpers.get(i); + } + } + + return result; + } + + /** + * Returns the class loader. It uses the delegation model with the Engine + * class's class loader as a parent. If this parent doesn't find a class or + * resource, it then tries the user class loader (via + * {@link #getUserClassLoader()} and finally the + * {@link Thread#getContextClassLoader()}. + * + * @return The engine class loader. + * @see org.restlet.engine.util.EngineClassLoader + */ + public ClassLoader getClassLoader() { + return classLoader; + } + + /** + * Returns the logger facade to use. + * + * @return The logger facade to use. + */ + public LoggerFacade getLoggerFacade() { + return loggerFacade; + } + + /** + * Parses a line to extract the provider class name. + * + * @param line The line to parse. + * @return The provider's class name or an empty string. + */ + private String getProviderClassName(String line) { + final int index = line.indexOf('#'); + if (index != -1) { + line = line.substring(0, index); + } + return line.trim(); + } + + /** + * Returns the list of available authentication helpers. + * + * @return The list of available authentication helpers. + */ + public List getRegisteredAuthenticators() { + return this.registeredAuthenticators; + } + + /** + * Returns the list of available client connectors. + * + * @return The list of available client connectors. + */ + public List> getRegisteredClients() { + return this.registeredClients; + } + + /** + * Returns the list of available converters. + * + * @return The list of available converters. + */ + public List getRegisteredConverters() { + return registeredConverters; + } + + /** + * Returns the list of available protocol connectors. + * + * @return The list of available protocol connectors. + */ + public List getRegisteredProtocols() { + return this.registeredProtocols; + } + + /** + * Returns the list of available server connectors. + * + * @return The list of available server connectors. + */ + public List> getRegisteredServers() { + return this.registeredServers; + } + + /** + * Returns the class loader specified by the user and that should be used in + * priority. + * + * @return The user class loader + */ + public ClassLoader getUserClassLoader() { + return userClassLoader; + } + + /** + * Registers the default authentication helpers. + */ + public void registerDefaultAuthentications() { + getRegisteredAuthenticators() + .add(new org.restlet.engine.security.HttpBasicHelper()); + } + + /** + * Registers the default client and server connectors. + */ + public void registerDefaultConnectors() { + getRegisteredClients() + .add(new org.restlet.engine.local.ClapClientHelper(null)); + getRegisteredClients() + .add(new org.restlet.engine.local.RiapClientHelper(null)); + getRegisteredServers() + .add(new org.restlet.engine.local.RiapServerHelper(null)); + getRegisteredServers() + .add(new org.restlet.engine.connector.HttpServerHelper(null)); + getRegisteredServers() + .add(new org.restlet.engine.connector.HttpsServerHelper(null)); + getRegisteredClients() + .add(new org.restlet.engine.local.FileClientHelper(null)); + getRegisteredClients() + .add(new org.restlet.engine.local.ZipClientHelper(null)); + getRegisteredClients() + .add(new org.restlet.engine.connector.HttpClientHelper(null)); + } + + /** + * Registers the default converters. + */ + public void registerDefaultConverters() { + getRegisteredConverters() + .add(new org.restlet.engine.converter.DefaultConverter()); + getRegisteredConverters().add( + new org.restlet.engine.converter.StatusInfoHtmlConverter()); + } + + /** + * Registers the default protocols. + */ + public void registerDefaultProtocols() { + getRegisteredProtocols() + .add(new org.restlet.engine.connector.HttpProtocolHelper()); + } + + /** + * Registers a helper. + * + * @param classLoader The classloader to use. + * @param provider Bynary name of the helper's class. + * @param helpers The list of helpers to update. + * @param constructorClass The constructor parameter class to look for. + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public void registerHelper(ClassLoader classLoader, String provider, + List helpers, Class constructorClass) { + if ((provider != null) && (!provider.isEmpty())) { + // Instantiate the factory + try { + Class providerClass = classLoader.loadClass(provider); + + if (constructorClass == null) { + helpers.add(providerClass.getDeclaredConstructor() + .newInstance()); + } else { + helpers.add(providerClass.getConstructor(constructorClass) + .newInstance(constructorClass.cast(null))); + } + } catch (Throwable t) { + Context.getCurrentLogger().log(Level.INFO, + "Unable to register the helper " + provider, t); + } + } + } + + /** + * Registers a helper. + * + * @param classLoader The classloader to use. + * @param configUrl Configuration URL to parse + * @param helpers The list of helpers to update. + * @param constructorClass The constructor parameter class to look for. + */ + public void registerHelpers(ClassLoader classLoader, java.net.URL configUrl, + List helpers, Class constructorClass) { + try { + java.io.BufferedReader reader = null; + try { + reader = new java.io.BufferedReader( + new InputStreamReader(configUrl.openStream(), "utf-8"), + IoUtils.BUFFER_SIZE); + String line = reader.readLine(); + + while (line != null) { + registerHelper(classLoader, getProviderClassName(line), + helpers, constructorClass); + line = reader.readLine(); + } + } catch (IOException e) { + Context.getCurrentLogger().log(Level.SEVERE, + "Unable to read the provider descriptor: " + + configUrl.toString()); + } finally { + if (reader != null) { + reader.close(); + } + } + } catch (IOException ioe) { + Context.getCurrentLogger().log(Level.SEVERE, + "Exception while detecting the helpers.", ioe); + } + } + + /** + * Registers a list of helpers. + * + * @param descriptorPath Classpath to the descriptor file. + * @param helpers The list of helpers to update. + * @param constructorClass The constructor parameter class to look for. + * @throws IOException + */ + public void registerHelpers(String descriptorPath, List helpers, + Class constructorClass) throws IOException { + ClassLoader classLoader = getClassLoader(); + Enumeration configUrls = classLoader + .getResources(descriptorPath); + + if (configUrls != null) { + for (Enumeration configEnum = configUrls; configEnum + .hasMoreElements();) { + registerHelpers(classLoader, configEnum.nextElement(), helpers, + constructorClass); + } + } + } + + /** + * Registers a factory that is used by the URL class to create the + * {@link java.net.URLConnection} instances when the + * {@link java.net.URL#openConnection()} or + * {@link java.net.URL#openStream()} methods are invoked. + *

+ * The implementation is based on the client dispatcher of the current + * context, as provided by {@link Context#getCurrent()} method. + */ + public void registerUrlFactory() { + // Set up an java.net.URLStreamHandlerFactory for + // proper creation of java.net.URL instances + java.net.URL.setURLStreamHandlerFactory( + new java.net.URLStreamHandlerFactory() { + public java.net.URLStreamHandler createURLStreamHandler( + String protocol) { + final java.net.URLStreamHandler result = new java.net.URLStreamHandler() { + + @Override + protected java.net.URLConnection openConnection( + java.net.URL url) throws IOException { + return new java.net.URLConnection(url) { + + @Override + public void connect() throws IOException { + } + + @Override + public InputStream getInputStream() + throws IOException { + InputStream result = null; + + // Retrieve the current context + final Context context = Context + .getCurrent(); + + if (context != null) { + Response response = context + .getClientDispatcher() + .handle(new Request( + Method.GET, + this.url.toString())); + + if (response.getStatus() + .isSuccess()) { + result = response.getEntity() + .getStream(); + } + } + + return result; + } + }; + } + + }; + + return result; + } + + }); + } + + /** + * Sets the engine class loader. + * + * @param newClassLoader The new user class loader to use. + */ + public void setClassLoader(ClassLoader newClassLoader) { + this.classLoader = newClassLoader; + } + + /** + * Sets the logger facade to use. + * + * @param loggerFacade The logger facade to use. + */ + public void setLoggerFacade(LoggerFacade loggerFacade) { + this.loggerFacade = loggerFacade; + } + + /** + * Sets the list of available authentication helpers. + * + * @param registeredAuthenticators The list of available authentication + * helpers. + */ + public void setRegisteredAuthenticators( + List registeredAuthenticators) { + synchronized (this.registeredAuthenticators) { + if (registeredAuthenticators != this.registeredAuthenticators) { + this.registeredAuthenticators.clear(); + + if (registeredAuthenticators != null) { + this.registeredAuthenticators + .addAll(registeredAuthenticators); + } + } + } + } + + /** + * Sets the list of available client helpers. + * + * @param registeredClients The list of available client helpers. + */ + public void setRegisteredClients( + List> registeredClients) { + synchronized (this.registeredClients) { + if (registeredClients != this.registeredClients) { + this.registeredClients.clear(); + + if (registeredClients != null) { + this.registeredClients.addAll(registeredClients); + } + } + } + } + + /** + * Sets the list of available converter helpers. + * + * @param registeredConverters The list of available converter helpers. + */ + public void setRegisteredConverters( + List registeredConverters) { + synchronized (this.registeredConverters) { + if (registeredConverters != this.registeredConverters) { + this.registeredConverters.clear(); + + if (registeredConverters != null) { + this.registeredConverters.addAll(registeredConverters); + } + } + } + } + + /** + * Sets the list of available protocol helpers. + * + * @param registeredProtocols The list of available protocol helpers. + */ + public void setRegisteredProtocols( + List registeredProtocols) { + synchronized (this.registeredProtocols) { + if (registeredProtocols != this.registeredProtocols) { + this.registeredProtocols.clear(); + + if (registeredProtocols != null) { + this.registeredProtocols.addAll(registeredProtocols); + } + } + } + } + + /** + * Sets the list of available server helpers. + * + * @param registeredServers The list of available server helpers. + */ + public void setRegisteredServers( + List> registeredServers) { + synchronized (this.registeredServers) { + if (registeredServers != this.registeredServers) { + this.registeredServers.clear(); + + if (registeredServers != null) { + this.registeredServers.addAll(registeredServers); + } + } + } + } + + /** + * Sets the user class loader that should used in priority. + * + * @param newClassLoader The new user class loader to use. + */ + public void setUserClassLoader(ClassLoader newClassLoader) { + this.userClassLoader = newClassLoader; + } } diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java b/org.restlet/src/main/java/org/restlet/engine/adapter/JettyClientCall.java similarity index 98% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/JettyClientCall.java index 1b15ae956c..0d563ff75c 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyClientCall.java +++ b/org.restlet/src/main/java/org/restlet/engine/adapter/JettyClientCall.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.internal; +package org.restlet.engine.adapter; import java.io.IOException; import java.io.InputStream; @@ -25,9 +25,8 @@ import org.restlet.data.Header; import org.restlet.data.Protocol; import org.restlet.data.Status; -import org.restlet.engine.adapter.ClientCall; +import org.restlet.engine.connector.HttpClientHelper; import org.restlet.engine.header.HeaderConstants; -import org.restlet.ext.jetty.HttpClientHelper; import org.restlet.representation.Representation; import org.restlet.util.Series; diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyHandler.java b/org.restlet/src/main/java/org/restlet/engine/adapter/JettyHandler.java similarity index 92% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyHandler.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/JettyHandler.java index ecbe2033d0..7b46250f03 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyHandler.java +++ b/org.restlet/src/main/java/org/restlet/engine/adapter/JettyHandler.java @@ -7,16 +7,16 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.internal; +package org.restlet.engine.adapter; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.Response; import org.eclipse.jetty.util.Callback; import org.restlet.Server; -import org.restlet.ext.jetty.HttpServerHelper; -import org.restlet.ext.jetty.HttpsServerHelper; -import org.restlet.ext.jetty.JettyServerHelper; +import org.restlet.engine.connector.HttpServerHelper; +import org.restlet.engine.connector.HttpsServerHelper; +import org.restlet.engine.connector.JettyServerHelper; /** * Jetty handler that knows how to convert Jetty calls into Restlet calls. This diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyServerCall.java b/org.restlet/src/main/java/org/restlet/engine/adapter/JettyServerCall.java similarity index 98% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyServerCall.java rename to org.restlet/src/main/java/org/restlet/engine/adapter/JettyServerCall.java index d8fd935300..851256ab1d 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/JettyServerCall.java +++ b/org.restlet/src/main/java/org/restlet/engine/adapter/JettyServerCall.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.internal; +package org.restlet.engine.adapter; import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.io.Connection; @@ -19,7 +19,6 @@ import org.eclipse.jetty.util.Callback; import org.restlet.Server; import org.restlet.data.Header; -import org.restlet.engine.adapter.ServerCall; import org.restlet.engine.header.HeaderConstants; import org.restlet.util.Series; diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java similarity index 99% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpClientHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java index a808f9cf11..b84cda48a9 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpClientHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/connector/HttpClientHelper.java @@ -7,7 +7,16 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.nio.file.Path; +import java.util.Arrays; +import java.util.Optional; +import java.util.concurrent.Executor; +import java.util.logging.Level; import org.eclipse.jetty.client.AuthenticationStore; import org.eclipse.jetty.client.HttpClient; @@ -37,20 +46,11 @@ import org.restlet.Request; import org.restlet.data.Protocol; import org.restlet.engine.adapter.ClientCall; +import org.restlet.engine.adapter.JettyClientCall; +import org.restlet.engine.security.RestletSslContextFactoryClient; import org.restlet.engine.ssl.DefaultSslContextFactory; import org.restlet.engine.ssl.SslUtils; import org.restlet.engine.util.ReferenceUtils; -import org.restlet.ext.jetty.internal.JettyClientCall; -import org.restlet.ext.jetty.internal.RestletSslContextFactoryClient; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.nio.file.Path; -import java.util.Arrays; -import java.util.Optional; -import java.util.concurrent.Executor; -import java.util.logging.Level; /** * HTTP client connector using the Jetty project. Here is the list of parameters that are supported. They should be set diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java similarity index 98% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java index 5df39254c7..ee2a90e82d 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpServerHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/connector/HttpServerHelper.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; import org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory; import org.eclipse.jetty.server.ConnectionFactory; diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpsServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java similarity index 96% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpsServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java index d0dd308c7e..feb2bb2403 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/HttpsServerHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/connector/HttpsServerHelper.java @@ -7,26 +7,31 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import java.util.logging.Level; import org.eclipse.jetty.alpn.server.ALPNServerConnectionFactory; import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory; import org.eclipse.jetty.http3.server.HTTP3ServerConnectionFactory; import org.eclipse.jetty.quic.server.QuicServerConnector; import org.eclipse.jetty.quic.server.ServerQuicConfiguration; -import org.eclipse.jetty.server.*; +import org.eclipse.jetty.server.AbstractConnectionFactory; +import org.eclipse.jetty.server.ConnectionFactory; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.HttpConnectionFactory; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.util.ssl.SslContextFactory; import org.restlet.Server; import org.restlet.data.Protocol; +import org.restlet.engine.security.RestletSslContextFactoryServer; import org.restlet.engine.ssl.DefaultSslContextFactory; -import org.restlet.ext.jetty.internal.RestletSslContextFactoryServer; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Optional; -import java.util.logging.Level; /** * Jetty HTTPS server connector. Here is the list of additional parameters that are supported. They should be set in the diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/connector/JettyServerHelper.java similarity index 97% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java rename to org.restlet/src/main/java/org/restlet/engine/connector/JettyServerHelper.java index 54426591cb..b26d54d7c6 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/JettyServerHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/connector/JettyServerHelper.java @@ -7,11 +7,26 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; + +import java.net.Socket; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.Executor; import org.eclipse.jetty.io.ArrayByteBufferPool; import org.eclipse.jetty.io.ByteBufferPool; -import org.eclipse.jetty.server.*; +import org.eclipse.jetty.server.AbstractNetworkConnector; +import org.eclipse.jetty.server.ConnectionFactory; +import org.eclipse.jetty.server.ConnectionLimit; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.Handler; +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.LowResourceMonitor; +import org.eclipse.jetty.server.Request; +import org.eclipse.jetty.server.Response; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.handler.StatisticsHandler; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.thread.QueuedThreadPool; @@ -19,13 +34,7 @@ import org.eclipse.jetty.util.thread.Scheduler; import org.eclipse.jetty.util.thread.ThreadPool; import org.restlet.Server; -import org.restlet.ext.jetty.internal.JettyServerCall; - -import java.net.Socket; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.concurrent.Executor; +import org.restlet.engine.adapter.JettyServerCall; /** * Abstract Jetty web server connector. Here is the list of parameters that are diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryClient.java b/org.restlet/src/main/java/org/restlet/engine/security/RestletSslContextFactoryClient.java similarity index 97% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryClient.java rename to org.restlet/src/main/java/org/restlet/engine/security/RestletSslContextFactoryClient.java index 0aa811c5aa..83bbba53cd 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryClient.java +++ b/org.restlet/src/main/java/org/restlet/engine/security/RestletSslContextFactoryClient.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.internal; +package org.restlet.engine.security; import java.io.IOException; import java.net.InetAddress; diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryServer.java b/org.restlet/src/main/java/org/restlet/engine/security/RestletSslContextFactoryServer.java similarity index 98% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryServer.java rename to org.restlet/src/main/java/org/restlet/engine/security/RestletSslContextFactoryServer.java index 40f9dcde68..ac4155a644 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/internal/RestletSslContextFactoryServer.java +++ b/org.restlet/src/main/java/org/restlet/engine/security/RestletSslContextFactoryServer.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.internal; +package org.restlet.engine.security; import java.io.IOException; import java.net.InetAddress; diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/MultiPartRepresentation.java b/org.restlet/src/main/java/org/restlet/representation/MultiPartRepresentation.java similarity index 98% rename from org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/MultiPartRepresentation.java rename to org.restlet/src/main/java/org/restlet/representation/MultiPartRepresentation.java index 0a4e1e138a..890b33b1df 100644 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/MultiPartRepresentation.java +++ b/org.restlet/src/main/java/org/restlet/representation/MultiPartRepresentation.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty; +package org.restlet.representation; import java.io.IOException; import java.io.InputStream; @@ -26,8 +26,6 @@ import org.eclipse.jetty.util.Attributes; import org.eclipse.jetty.util.Promise; import org.restlet.data.MediaType; -import org.restlet.representation.InputRepresentation; -import org.restlet.representation.Representation; /** * Input representation that can either parse or generate a multipart form data diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/AsyncTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java similarity index 89% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/AsyncTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java index 2f2c6fea06..28e2556ce2 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/AsyncTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java @@ -7,20 +7,34 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.concurrent.CountDownLatch; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.restlet.*; -import org.restlet.data.*; +import org.restlet.Client; +import org.restlet.Component; +import org.restlet.Context; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.Server; +import org.restlet.Uniform; +import org.restlet.data.MediaType; +import org.restlet.data.Method; +import org.restlet.data.Protocol; +import org.restlet.data.Reference; +import org.restlet.data.Status; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation; -import java.util.concurrent.CountDownLatch; - -import static org.junit.jupiter.api.Assertions.*; - /** * Unit tests for asynchronous queued Request handling. * diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java similarity index 92% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java index d8e6f8d3c9..537464260b 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/BaseConnectorsTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import static org.junit.jupiter.api.DynamicTest.dynamicTest; @@ -23,8 +23,6 @@ import org.restlet.data.Protocol; import org.restlet.engine.Engine; import org.restlet.engine.adapter.HttpServerHelper; -import org.restlet.engine.connector.ClientHelper; -import org.restlet.engine.connector.ServerHelper; /** * Base test case that will call an abstract method for several client/server @@ -131,8 +129,8 @@ private void resetEngine() { } public enum HttpServer { - JETTY_HTTP(new org.restlet.ext.jetty.HttpServerHelper(null)), - JETTY_HTTPS(new org.restlet.ext.jetty.HttpsServerHelper(null)); + JETTY_HTTP(new org.restlet.engine.connector.HttpServerHelper(null)), + JETTY_HTTPS(new org.restlet.engine.connector.HttpsServerHelper(null)); final ServerHelper serverHelper; @@ -142,7 +140,7 @@ public enum HttpServer { } public enum HttpClient { - JETTY(new org.restlet.ext.jetty.HttpClientHelper(null)); + JETTY(new org.restlet.engine.connector.HttpClientHelper(null)); final ClientHelper clientHelper; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingPutTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ChunkedEncodingPutTestCase.java similarity index 98% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingPutTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/ChunkedEncodingPutTestCase.java index 6bdbaa08e8..6300d90c83 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingPutTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ChunkedEncodingPutTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import org.restlet.*; import org.restlet.data.MediaType; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ChunkedEncodingTestCase.java similarity index 89% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/ChunkedEncodingTestCase.java index f0e7a04f78..0521750dfb 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ChunkedEncodingTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ChunkedEncodingTestCase.java @@ -7,10 +7,26 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; -import org.restlet.*; -import org.restlet.data.*; +import static java.lang.String.format; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; + +import java.io.IOException; + +import org.restlet.Application; +import org.restlet.Client; +import org.restlet.Message; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.data.Header; +import org.restlet.data.MediaType; +import org.restlet.data.Method; +import org.restlet.data.Protocol; +import org.restlet.data.Status; import org.restlet.engine.header.HeaderConstants; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation; @@ -19,11 +35,6 @@ import org.restlet.routing.Router; import org.restlet.util.WrapperRepresentation; -import java.io.IOException; - -import static java.lang.String.format; -import static org.junit.jupiter.api.Assertions.*; - /** * This tests the ability of the connectors to handle chunked encoding. * diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ConnectorTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ConnectorTestCase.java similarity index 92% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ConnectorTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/ConnectorTestCase.java index 36b45ff6f0..7b62df1f82 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ConnectorTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ConnectorTestCase.java @@ -1,4 +1,4 @@ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import static java.lang.String.format; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/FormDataSetTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/FormDataSetTestCase.java similarity index 96% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/FormDataSetTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/FormDataSetTestCase.java index 2a3e21efa1..44ed7e81aa 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/FormDataSetTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/FormDataSetTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; import org.junit.jupiter.api.Test; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetChunkedTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/GetChunkedTestCase.java similarity index 88% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetChunkedTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/GetChunkedTestCase.java index ec85ec8285..fc12b16097 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetChunkedTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/GetChunkedTestCase.java @@ -7,10 +7,23 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; -import org.restlet.*; -import org.restlet.data.*; +import static java.lang.String.format; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import org.restlet.Application; +import org.restlet.Client; +import org.restlet.Message; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.data.Header; +import org.restlet.data.MediaType; +import org.restlet.data.Method; +import org.restlet.data.Protocol; +import org.restlet.data.Status; import org.restlet.engine.header.HeaderConstants; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation; @@ -18,10 +31,6 @@ import org.restlet.resource.ServerResource; import org.restlet.routing.Router; -import static java.lang.String.format; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - /** * Test that a simple get works for all the connectors. * diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetQueryParamTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/GetQueryParamTestCase.java similarity index 98% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetQueryParamTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/GetQueryParamTestCase.java index 113fa028c1..8de0c66801 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetQueryParamTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/GetQueryParamTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import org.restlet.*; import org.restlet.data.Form; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/GetTestCase.java similarity index 97% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/GetTestCase.java index b4f6366aaf..7ca389199d 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/GetTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/GetTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import org.restlet.*; import org.restlet.data.Method; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/HttpTransportProtocolsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/HttpTransportProtocolsTestCase.java similarity index 97% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/HttpTransportProtocolsTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/HttpTransportProtocolsTestCase.java index 4472c318c8..6146f29bcb 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/HttpTransportProtocolsTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/HttpTransportProtocolsTestCase.java @@ -7,7 +7,24 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; + +import static java.lang.String.format; +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.stream.Stream; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -16,33 +33,20 @@ import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; -import org.restlet.*; +import org.restlet.Client; +import org.restlet.Context; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.Server; import org.restlet.data.MediaType; import org.restlet.data.Method; import org.restlet.data.Parameter; import org.restlet.data.Protocol; import org.restlet.engine.Engine; import org.restlet.engine.ssl.DefaultSslContextFactory; -import org.restlet.ext.jetty.HttpClientHelper; import org.restlet.util.Series; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.http.HttpClient; -import java.net.http.HttpRequest; -import java.net.http.HttpResponse; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.stream.Stream; - -import static java.lang.String.format; -import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; - /** * Test the support of HTTP2 and HTTP3 transport protocols. */ @@ -73,7 +77,7 @@ class HttpServerTestCase extends HttpTransportProtocolTest { public static void setup() { Engine.clearThreadLocalVariables(); Engine nre = Engine.register(false); - nre.getRegisteredServers().add(0, new org.restlet.ext.jetty.HttpServerHelper(null)); + nre.getRegisteredServers().add(0, new org.restlet.engine.connector.HttpServerHelper(null)); nre.getRegisteredClients().add(0, new HttpClientHelper(null)); } @@ -125,7 +129,7 @@ class HttpsServerTestCase extends HttpTransportProtocolTest { public static void setup() { Engine.clearThreadLocalVariables(); Engine nre = Engine.register(false); - nre.getRegisteredServers().add(0, new org.restlet.ext.jetty.HttpsServerHelper(null)); + nre.getRegisteredServers().add(0, new org.restlet.engine.connector.HttpsServerHelper(null)); nre.getRegisteredClients().add(0, new HttpClientHelper(null)); } diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/Lock.java b/org.restlet/src/test/java/org/restlet/engine/connector/Lock.java similarity index 96% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/Lock.java rename to org.restlet/src/test/java/org/restlet/engine/connector/Lock.java index ec273f2de0..9ae6e934f3 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/Lock.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/Lock.java @@ -1,4 +1,4 @@ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; import java.time.Duration; import java.time.Instant; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/MultiPartRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/MultiPartRepresentationTestCase.java similarity index 97% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/MultiPartRepresentationTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/MultiPartRepresentationTestCase.java index 70a6760edd..c2c6a679ae 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/MultiPartRepresentationTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/MultiPartRepresentationTestCase.java @@ -7,13 +7,12 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import java.io.IOException; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -24,6 +23,7 @@ import org.eclipse.jetty.http.MultiPart.Part; import org.junit.jupiter.api.Test; import org.restlet.data.MediaType; +import org.restlet.representation.MultiPartRepresentation; import org.restlet.representation.StringRepresentation; /** diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/PostPutTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/PostPutTestCase.java similarity index 98% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/PostPutTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/PostPutTestCase.java index fbc273b266..b75f5d3ae2 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/PostPutTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/PostPutTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import static java.lang.String.format; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/README.md b/org.restlet/src/test/java/org/restlet/engine/connector/README.md new file mode 100644 index 0000000000..a430b40dc6 --- /dev/null +++ b/org.restlet/src/test/java/org/restlet/engine/connector/README.md @@ -0,0 +1,32 @@ +# Debug Jetty + +## Add full logs + +[Jetty's documentation](https://jetty.org/docs/jetty/12/programming-guide/troubleshooting/logging.html) (the `org.eclipse.jetty:jetty-slf4j-impl`is already added to the `pom.xml`). + +Programmatically: +``` +System.setProperty("org.eclipse.jetty.LEVEL", "TRACE"); +``` + +Or add a `jetty-logging.properties`: +``` +org.eclipse.jetty.LEVEL=TRACE +org.eclipse.jetty.client.LEVEL=TRACE +``` + +## Debug using JMX +You need to update the current implementation by hand. + +- [activate JMX](https://jetty.org/docs/jetty/12/programming-guide/arch/jmx.html) +The Jetty server is created in class `JettyServerHelper`. + +``` + // Create an MBeanContainer with the platform MBeanServer. + MBeanContainer mbeanContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); + // Add MBeanContainer to the root component. + jettyServer.addBean(mbeanContainer); +``` + +- to [state tracking](https://jetty.org/docs/jetty/12/programming-guide/troubleshooting/state-tracking.html) + You can use [jconsole](https://docs.oracle.com/javase/8/docs/technotes/guides/management/jconsole.html) to check the state of MBean or just run operations on them. diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/RemoteClientAddressTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/RemoteClientAddressTestCase.java similarity index 98% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/RemoteClientAddressTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/RemoteClientAddressTestCase.java index 4d344eeb74..670e8c5755 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/RemoteClientAddressTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/RemoteClientAddressTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import org.restlet.*; import org.restlet.data.MediaType; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ServerMaxConnectionsTestCase.java similarity index 99% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/ServerMaxConnectionsTestCase.java index d3eecac161..f31ddbf75a 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/ServerMaxConnectionsTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ServerMaxConnectionsTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import static java.lang.String.format; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/ShutdownHookTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java similarity index 99% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/ShutdownHookTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java index 892402674f..e9ec423b77 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/ShutdownHookTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java @@ -22,26 +22,30 @@ * Restlet is a registered trademark of Restlet S.A.S. */ -package org.restlet.ext.jetty; +package org.restlet.engine.connector; + +import static java.util.Collections.singletonList; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.time.Duration; +import java.time.Instant; +import java.util.logging.Level; +import java.util.logging.Logger; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.restlet.*; +import org.restlet.Context; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.Server; import org.restlet.data.MediaType; import org.restlet.data.Protocol; import org.restlet.data.Status; import org.restlet.engine.Engine; import org.restlet.resource.ClientResource; -import java.time.Duration; -import java.time.Instant; -import java.util.logging.Level; -import java.util.logging.Logger; - -import static java.util.Collections.singletonList; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - public class ShutdownHookTestCase { private static final Logger LOGGER = Logger.getLogger("ShutdownHookTest"); private static boolean shouldDebug = false; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/SslBaseConnectorsTestCase.java similarity index 98% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/SslBaseConnectorsTestCase.java index 724d344c68..3e38209c5e 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslBaseConnectorsTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/SslBaseConnectorsTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; import java.io.File; import java.io.FileOutputStream; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslClientContextGetTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/SslClientContextGetTestCase.java similarity index 80% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslClientContextGetTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/SslClientContextGetTestCase.java index 67f043cf56..ade864cfd0 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslClientContextGetTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/SslClientContextGetTestCase.java @@ -7,10 +7,22 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; -import org.restlet.*; -import org.restlet.data.*; +import static java.lang.String.format; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.restlet.Application; +import org.restlet.Client; +import org.restlet.Context; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.data.MediaType; +import org.restlet.data.Method; +import org.restlet.data.Parameter; +import org.restlet.data.Protocol; +import org.restlet.data.Status; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation; import org.restlet.representation.Variant; @@ -18,9 +30,6 @@ import org.restlet.routing.Router; import org.restlet.util.Series; -import static java.lang.String.format; -import static org.junit.jupiter.api.Assertions.assertEquals; - /** * Test that a simple get using SSL works for all the connectors. * @@ -40,7 +49,8 @@ protected void doTest(final int serverPort) throws Exception { final Request request = new Request(Method.GET, uri); final Response response = client.handle(request); - assertEquals(Status.SUCCESS_OK, response.getStatus(), response.getStatus().getDescription()); + assertEquals(Status.SUCCESS_OK, response.getStatus(), + response.getStatus().getDescription()); assertEquals("Hello world", response.getEntity().getText()); client.stop(); } @@ -76,7 +86,8 @@ public GetTestResource() { @Override public Representation get(Variant variant) { - return new StringRepresentation("Hello world", MediaType.TEXT_PLAIN); + return new StringRepresentation("Hello world", + MediaType.TEXT_PLAIN); } } diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslGetTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/SslGetTestCase.java similarity index 85% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslGetTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/connector/SslGetTestCase.java index 43d56eab66..af38cacb29 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/connectors/SslGetTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/SslGetTestCase.java @@ -7,19 +7,27 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.connectors; +package org.restlet.engine.connector; -import org.restlet.*; -import org.restlet.data.*; +import static java.lang.String.format; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.restlet.Application; +import org.restlet.Client; +import org.restlet.Context; +import org.restlet.Request; +import org.restlet.Response; +import org.restlet.Restlet; +import org.restlet.data.MediaType; +import org.restlet.data.Method; +import org.restlet.data.Protocol; +import org.restlet.data.Status; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation; import org.restlet.representation.Variant; import org.restlet.resource.ServerResource; import org.restlet.routing.Router; -import static java.lang.String.format; -import static org.junit.jupiter.api.Assertions.assertEquals; - /** * Test that a simple get using SSL works for all the connectors. * diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AbstractAnnotatedServerResource03.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AbstractAnnotatedServerResource03.java similarity index 94% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AbstractAnnotatedServerResource03.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/AbstractAnnotatedServerResource03.java index 1aa3af184b..8916c33028 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AbstractAnnotatedServerResource03.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AbstractAnnotatedServerResource03.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import org.restlet.resource.ServerResource; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03.java similarity index 92% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03.java index b63fa79cfd..53779b8b24 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; /** * Annotated interface that extends {@link AnnotatedInterface03_01} and diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_01.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03_01.java similarity index 91% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_01.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03_01.java index a6d2e57396..0e6132535c 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_01.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03_01.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import org.restlet.resource.Get; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_02.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03_02.java similarity index 91% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_02.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03_02.java index b9e126ad0d..ec12c95fbe 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedInterface03_02.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedInterface03_02.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import org.restlet.resource.Post; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource09TestCase.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource09TestCase.java similarity index 99% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource09TestCase.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource09TestCase.java index ec9c3ee9d2..99c4581845 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource09TestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource09TestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource10TestCase.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource10TestCase.java similarity index 97% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource10TestCase.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource10TestCase.java index 80c3ea082d..d359b07b4f 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource10TestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource10TestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource11TestCase.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource11TestCase.java similarity index 97% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource11TestCase.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource11TestCase.java index 7b3663a1ba..de66cc0779 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/AnnotatedResource11TestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/AnnotatedResource11TestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import static org.junit.jupiter.api.Assertions.assertEquals; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/JettyConnectorTestCase.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/JettyConnectorTestCase.java similarity index 95% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/JettyConnectorTestCase.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/JettyConnectorTestCase.java index 1d013996e6..d13463aa8b 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/JettyConnectorTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/JettyConnectorTestCase.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import java.util.logging.Level; @@ -22,8 +22,8 @@ import org.restlet.data.Method; import org.restlet.data.Protocol; import org.restlet.engine.Engine; -import org.restlet.ext.jetty.HttpClientHelper; -import org.restlet.ext.jetty.HttpServerHelper; +import org.restlet.engine.connector.HttpClientHelper; +import org.restlet.engine.connector.HttpServerHelper; import org.restlet.representation.ObjectRepresentation; /** diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource09.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource09.java similarity index 98% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource09.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource09.java index 8b60e5c9aa..5907c408d7 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource09.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource09.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import org.restlet.data.Form; import org.restlet.resource.ServerResource; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource10.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource10.java similarity index 90% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource10.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource10.java index e71b731097..8057381e01 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource10.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource10.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; /** * Resource that inherits annotated methods. diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource11.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource11.java similarity index 93% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource11.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource11.java index 1290273e8d..bf38331cc4 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/MyResource11.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/MyResource11.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import org.restlet.resource.Get; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SIMethod.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/SIMethod.java similarity index 93% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SIMethod.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/SIMethod.java index d0941d6f4a..559ce70201 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SIMethod.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/SIMethod.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SNIMethod.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/SNIMethod.java similarity index 93% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SNIMethod.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/SNIMethod.java index ec41407e4a..61c28765de 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/SNIMethod.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/SNIMethod.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USIMethod.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/USIMethod.java similarity index 93% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USIMethod.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/USIMethod.java index 667de08fbb..e9edf364ef 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USIMethod.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/USIMethod.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USNIMethod.java b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/USNIMethod.java similarity index 93% rename from org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USNIMethod.java rename to org.restlet/src/test/java/org/restlet/engine/jetty/resource/USNIMethod.java index c5f3e2b8af..68d5fc3f37 100644 --- a/org.restlet.ext.jetty/src/test/java/org/restlet/ext/jetty/resource/USNIMethod.java +++ b/org.restlet/src/test/java/org/restlet/engine/jetty/resource/USNIMethod.java @@ -7,7 +7,7 @@ * Restlet is a registered trademark of QlikTech International AB. */ -package org.restlet.ext.jetty.resource; +package org.restlet.engine.jetty.resource; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks b/org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks new file mode 100644 index 0000000000000000000000000000000000000000..19172998650e1136a115cdfaad31d218b63d7d40 GIT binary patch literal 6709 zcmeHLcT`i^-c6?l451Ajlq%&02t@>>O79>=DIy&yp@SfaNEMMHAjp7J0TBhIcccgc zN)wPS3Q-hA1u4o4>Nxn`yqWKtd9&90<7KU^taI;K=j5Kd_x|nu`~2$jD-Z|-A$<{F zei6P7KEC#LAP|^2Q#5EE1UDDO0|z1Q5VmIZy}~0-*pE*Sce*AX&=l!fM)j| z6ixQ^o)W;pgal*&2@D`EfyGM7T9Sscdxn2)aeVgP{|bhKp!j$YfRBOT@t_`8g}WA3LPIjGx(2e+R(WnRJDk8!779KhBO*!1eEb}f%YXI^Eu(>fq6x-{rd|GKi%?p*gd z!Ot=DIg#~ds2Z<(epW;6iVj?%QnN78=ab4;-^zc?-+$YJ`DTBX@=Tjuv`)p#n#)on zeU{bAs?5Ikhh(XCLIxm*M$APdAW$#}oQKZ>@EHI*=}_2dV2m*O@i37B<$BrM)k{zG zsbpUByvR7n4Y=*z-VZwkoDBcX3D*?!<^R$_5%#=X>fO!IFgO4OgLn2GAL&&?N#|zB z8EJg=BW&9C?Y>XZydV8A43#oXOAN+Di)_Dzb>mE*8SH`7Ki zhnEL;qB|E-hn?p3*FMx8X;KkLj4o4Fb`CL`;_W$jVEm6|g7ftB{fgbQIp47hB?1KK zGZKFLzG4>)`lkm0On$^H1AyMeB_*2L!T9UKMx=Eybilsd%T#CzB|l$hPn?Ty5C#cQ z?Or28!@f-U27M?RqVg5YQh+o@5+fx6h)a{eEWUU6H|QVv>+07DIo+f z7}PuzMnt>E_Vb?zChLJ0Tc`&P9rJ`Rjg6clw_#097Vywp;P7Ls{SbUV#V(cZpr^DZB!2$Nb<57*OppZ1o) z>XA4NK_aVEh)uhL#obUNw%X9n5$6P)NyBUKd~21`C@tti9o;(^!?1MAXv@%n_%jMp zDYr2e5$A3t9WI4LA^1hMbLa!OtOdvBp|g^qH{h4#y@KER;m`{Tc`!Elo321rGUgl8 zS^<0$K>G#VBxL^r@LfG(r`^2(Bgq_M4;8%wMB8|BW%6znb?dOF30;nvAmjmOcBk)$ z`2jxR^uIOXnt8t2-}9OY{{mvtTLy#jK4WydZ;0c~N3nI%Ii@R*7|Up|Pp&xxU}yGy zzBAQ49A6^F?>WuHrZzfGd=pHCJo5QXqYWD!A*;kE@m-fGgXHn}*ZAYw;*J_(^Y0DF zxEHRT!oA77RNTh9oT_${5n7KW8v_bo{agnI^@ z_OtC7%)Qc5x#pv8Wq(K;tyM_nuFijwX>kPZb=AZ1+;(fMyFbcqAdoua$cB2m3P&bq zbe7+-K$mTi6N1}0xGWDph8G#78pPD{_XlQb9wCQS^LO&OPO3@-qgd7U;}$fx^M>`-!R9gfS`XKFGrq_H)pt4grI3YX{3-@xBrzB!i9y3RF#zvn%WeVt z`^7*UizSHx21C*YEJ+)7hk(kD5`+d&yShS&ru;>MRFr;GfPPS%KjQwKx1y4zk#v;P z!jePs`Wg7gq0{7dYspl(9-WWEnKRcyegqp@!g7PT`UY8VZ$Zy7;wsW)p{*cxZ|SWK`qn zI54S`DP^~vB5k>B9k;k#X+5=(GAhyLOXWffQ5gNKDmt*^a+!^^h!>T*+lA<#u6QJ9 zFE3L_aS&U^w$j?mC!3u=jsi+j=>^Z6F}9N;vsUm6cg3v4a`w?TFs_)z+vKzdn~Evr zIrXIMi~aaC$x2i!f6A4pQenvn_1>BDadF(oB0m9kWqr-1nqxT|J4Aiyh?;3yK-i~C zv%D{Rg$yuPal8kQTxGzS^nWbnaxvq}^YVnS#GH-h7xhRp)gTkH2{Ye32PU&Y&MGrM zO$gA^mk>=ff_J0mS_tfcz1-P+8s{(LU%0#|5xaHx980GL=y-88J%{&)MCqdyD5*LN zw!(tYc6fn*Gu@L?jgzz%jpyzP4A~}=3kXM1a`#o0CyA+a$@R_4txhB)zn?rN+kxGB zUQuC`?N%z#Bq)$EMB+XeMB(mfZ|Cmp>GRD7gmjU-YdwkX)g-S;c@P1HfrTI_l2Zl2 z2#~x$ZUpRUy#5X@i#*TRSU9RyR<@6|@pXfvPz9HAzp2!dR6+D(K4&ACUnWX~vWvp0 zUPzgJEH9VF%vsR&>>yaZntWY}yf$_;NWu%lRGHsN*-ts5GgaT)N|if&zghb;?`@DJ zV%+udfB;9CrWtP-aS4>qug!ZBw)N>)*0dvdW<##O;|}e^w*8(HP?~-krRFqj$7q`+ zZ)@)?R$^nbqr9Q%@QPQ;KKr)v#8f2gcsO3RqBO7Gf|ZQg{e<2!)!k>F9Cw#C??`tN zPNI|)+r_DM?)ezE9X-;@oSHGbl!LLshD*a5=+C$@}0{u97 z4*M!h+c_?Di_>N6w49k*t>_ntD|xBN;QnZa+2fUmWXL!ZQ!acf-;&({F)nvHyx5cf zx(|aQACgtBRQ};|s_PndPPFD<)m?x2vv-i#9XJEeI~o+uF1|O{Ub)iW6p^ zHX3K#(yV`SOKaMxtg4U7VVxLiD#{GM|7`W@hn~PKzHBMmUK?Gn3uC~Wv*t-**|MR{ zdj8X75lA)UUXHke7=D&MCwy6soK0vkhLaraDQj_1(fE!hhg57;3)A9KRrYia|FloKZ!Nxv!NJ9! z!BRiMnmp-CMf;w@PLq)ALb7s$|E_rb$I_P+X17L(lfoE)C55rwAt3)_jrzT4_suIq z(Z3QB_`Uo!#ksjDUa7l*9zSnWRJecCEsc%eQl9(agr~Xh7%cE-b>;`Q-Vu`l6UjGr zXrkU)_61WvchhOeIr{Dpm!ThatDFBSpS3Ut?F0fN3{S5o4E03bjZL17!I z0gn8r3`W8@8QJx{96XGTb-0c?csSrl3HH?9IJ?IyvQr8@;(2mT^wd_C^srmthjpYl zAHez5D>4I&za88D$%gEPD=XAPP1^7ogA&#I3Z9tW(FDnfi1Kvw8m3tpPCt8kG=Jg6 z2aa%qlxmlZY0CmW9A!x4O!!3!2G#@wQ(Yyw56zuIpnfp3W2VD+>2-;2n{+Y$(x+95 z@SO5f4l^s;bGJ>e(BG^`Yg!yeupD_mKhx6od_tfs#D8KdgeLZ^3-@=^^uP4~zx4lK zoBmNA4gn(HE&s0_0KE5i{6b?%razLTogV-B4!}1RgrZTV+FTAI-x>y7yX}B4?JQ{w zNkU0oEYfFJQ1=f1Le%)ZUH>Qr6f8Lo&!k)vor=q2{;9E)t{C>&Py$686}cAKuHuhL zfi0J@IP}#Al3ELKj1*(Q#IB{rQ_(oNBJH5b05G4aquJz?-+ z&s+242tCzmeefAhvHX{%c?TX!lr+GTc-je0h!r7L&FTLzl-l&PX zzVH?;phU7$-6<$=OdDNN@)6=SM_G0D-P5;da zKlVnyM0A`1e9l`}{#dj{#Nl-1DjwczD;o#;%$9_S&-HciQ6IhQQ3A1BF127dMml)KHR{5L;Temkp`T=+a&mU<30t=Rs8I#{--pPkA@}AG#sL zWgqP%8MQ-rOq#+{-m7;z@vRq}j<87@(qh)cN?G8ds#NjeZ9vs4tKOca&64J9*)bst zqf*u4I%MGU%1vPdm*YrO%(1wTlR|VNo<7@NQ`y;cTVTe$MoOh&Ta#GFGWc)U3?FL0fQec(EmB6 zlgj>Xo`<4oe^3chm++6+dOfbcF6F~x-^Sjth05!?O|6B7zC{%ElSXf$4Q^V)P3-=a z2r)zp>gUTX;wKG7$G3V-Ql*Wigqrija)tUqXMbPl=gOxk!opna` zWyd9QChR6xC*w5sov>DIfa7lHAM+l*(+1iWfUoN?Ux|lA& zcMBn}g+h%4zSa5k*gbxApDokPR%xI!1HpYT@ou#qmGsdDH_(enmNa=TqSMlN>mh5` z*X^hDTB~>o#LJV)rdw|_`-%pHUKG8|wsZe^T{Yjiwj|4RCn6|6d&JDQu3|o(TcgmV zI4esjPd7wsiYoNA-?B8f>U9QQih$|U1fI2C%kAzL2iTXR;ucGaSS!^(9U8taL64;5 z7Lv~0zO~HB(|R_eS3Dr&>BKV5d`WTrS+mLYJlw``5%lhI&nU#bt7ZQLH8+)r*b}|X z2grqX4W7o5mk279TMU9E9I=1M)lv-Cb_iM}=D$Daw;@G|iy0gRbVIVwm O!@nu+ec}EX!G8c}T%)}J literal 0 HcmV?d00001 diff --git a/org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 b/org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 new file mode 100644 index 0000000000000000000000000000000000000000..94519e717d66bec98a3aa5a44bb3f04bf89e0373 GIT binary patch literal 2726 zcma);XE+;-7RQrFY^AM|RP7QJjgcC!O^6t^m8v~T?M*3SM~xyz&8jU{(W|2 zMp3h+W=M^<_qq4!``l0WemKv0&hLNz=i~o52rP902uOy&Qfrb^2}Gfzh;%>-U_O>w z7L28q`i+qYEQIi15+nzVg=GH5_}}%6oaR3+T52FD9}7|V4P_Aae;g1xgb70OpOF@E z3(U9|xTdxaFB2W7pvEmN+^aemY@q>x;0z!j2ZENI^4}LhR1g4ym7K~l3JtU)0|N!X z4A*zPUTZzAd;w4&)->2FO$KAZquJq!M}dg&WWWp^d)N=)cRxNxZ^F6%rc{%A6BkI< z{xA{6QfVcAA5cZG_14yRQj;;7i{5@W=iJl_NT|EYqWgAmM>VF61%a{BNaXwrlgy3} zm^~bf6oe0v%CQ%W$U7-TBKhEJa547fBI%kq;oZ?Gu1qNky~DPK%XqiG8ZX#FX4ePa z)N$(!KQLFcOXKSYU3KIpx_-W1w8mzo8!Tle4d!ekV)?3DIu4E51%}Y}5MH0qYK_$5 z8j)7k9b$3gCJY(jWc7V?awtuF$T9C;OA>V1tAssm+>ieaaa1KjyU9CI=jsNa^&_ zpWu&OFw+?_n7N%?ZPtGru;HszZ>d7VW|NjXI3NGoGCb&>S^cY|F5)WOb(oEv*2;>iXmC2lEH_Wk!D|EPzYz&ch|COX!QK~_C?OS%Pd^q0x328cUmHgzLd4-oCG;hD9E-&A=$rEJc|X^;cK(FSOTS@QaUOai5N>9;R3< zdr;A(>aF(8QE9fDF)1dRw4d%>V#dGhP?HuYudTSe`<3KiKldvz{UW*8`7Ny;kV?#8 zwG2574_{xj>&hX!n!@iKQ`a{D`U&5cs^oI*NPw`pqk&OxTvMcwL3}Wa#*)!99O!b>vVqlDWK6X! z;;cFY`Z(s%p$Bou6V5bHzDu^Dbt{L3@-zcvnHM%8=!8bJ7KVpVEpM9-M@W*!c^{2s)=6y{t*?t;ZfKjtr6v(SSOWDB*C)tMvnn9%aNgc6eGH()4V_C1ciM` z5+qAEoZMWwx20rY+&MHyv7R>GS;^+|e5kWh&{XOXKNHs1(}ZbI+W z*U`G|U|{<(jTfCwRZ`!YiQGdRxHjN>1oUI9Tcj<0i5ByUd6mPaVXT7TH*)qAT%ZK( z;V2zZDt_O}YPIb&wnajcGqwKW*R+YyesggLWX@bk+8M?_qZqSR5cQ%n9+PtCVu|&5 z>lx35h#Ug;CoZWNMQGWm0WN?5z$1ViAOOMnk919h5q!nK(Z!BKL_!=PCN3c&DK05` z2Z05L{aK{G$N>S4i6z5c=ElieA6x3E|rQWr}w_{I>f4gmjta z=XIjKC~m9Seh5XTmlld8`x&3zy&i>g3#=%ezkt@5mVf6XF2k@M(@EXp_c_r)^O|Cn zXqS>|_Pd{+&6Y0%0&=%X8dtBT3el4+lxyADd+_*Zg7tyRndqhBb$>k!f;*R2st+Dq zeXBy|L`8W|aO3uTfhT*FtozQ&Fjv`Ft`OtX8y*7bC#C?K3Q&iwiXwk;ROxn!7R!2p zb3?VA)x!!uq8DtGq7$=zRFwo{`#{=^f z=1l1g&60NAoAx4m9x#jevH&xErae6tSAZEWapCmN`@% z6bAf(4KMW9UQ!p1!%=K;o(RgdFwF1E_26)MBfe8i0k3_Ekaxx|Jddtyy;%|2X2YBX zUY`Y*BfU5#CzjuZrl_a=bchR6AKRu^epMzqU3i__CYv9d2PP@y+Dd(yS7Q57pgcj& zl)!5nG^hkdF)rv{Gfh`=1mCjlNMcwyny70!RC-1|C+vbxC!(uJ3 zljs!IYPnN5T_GrbE^hS~M1DDIlt8!4Y4@cGzKZ_bm*=@J|=^j;lGDoEVyAU4< zr#tJT%wWa2yiXIJW3MVqBX5Fon~|>cy+oe*C33N~xm6lX7E-L``c8eQ>_C_6a#50_ z{!JI#p~~|5=aGplBY8CO*P2PdAR8WA$10}Ms9kTXdy(6vSuTDGhhmHtJ z1V6{W73BjVgEHP?HCV0)({TC3>K}0*EcVj!ybAT&t(g(r&HHM#eVUEfm~wDBtgIEd z0*`#G_#~mcF>VB=0*$VpdG>tQuYKVOuJrsnuxEU}3AxnwR+fwBg!F`R&AM=6x1IXK z_);w;wz1IbI7cD1GbnGWc8EXpFipDuiY|r>nt5AAG8RR6FV$wIRosk$Oh1t>&~rNA zCT3Z{ILCP*M`Lq5!^td35T#|_+ptt< Date: Sat, 21 Jun 2025 12:08:23 -0400 Subject: [PATCH 08/22] Update changes.md --- changes.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/changes.md b/changes.md index d48df99043..ec89dbd509 100644 --- a/changes.md +++ b/changes.md @@ -3,8 +3,12 @@ Changes log - 2.7 Milestone 2 (??-07-2025) - Misc + - Removed deprecated Servlet extension and related classes in Spring extension + - Removed deprecated methods in Restlet API + - Removed internal HTTP and FTP connectors + - Merged the Jetty client and server HTTP connector into Restlet Engine (new default connectors) - 2.7 Milestone 1 (21-06-2025) - Misc - - Remove deprecated extension Atom, Guice, GWT, JAXB, OData - - Remove edition GWT \ No newline at end of file + - Removed deprecated extension Atom, Guice, GWT, JAXB, OData + - Removed edition GWT From 3de664e463bb15e9c215f810dd9be8c5aa5f5f5a Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sat, 21 Jun 2025 19:22:15 +0200 Subject: [PATCH 09/22] Dropped reference to servlet module in pom.xml --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 2bc7c49c70..9f8262894f 100644 --- a/pom.xml +++ b/pom.xml @@ -61,7 +61,6 @@ 4.3.1 2.0.17 6.2.8 - 6.0.0 3.1.3.RELEASE 2.4.1 @@ -77,7 +76,6 @@ org.restlet.ext.jackson org.restlet.ext.jetty org.restlet.ext.json - org.restlet.ext.servlet org.restlet.ext.slf4j org.restlet.ext.spring org.restlet.ext.thymeleaf From 22ea932d643913aa74b41872427e4f26e2ded440 Mon Sep 17 00:00:00 2001 From: Jerome Louvel <374450+jlouvel@users.noreply.github.com> Date: Wed, 25 Jun 2025 15:34:03 -0400 Subject: [PATCH 10/22] Removed Jetty extension now that its merged in Restlet core module --- org.restlet.ext.jetty/README.md | 32 -------------- org.restlet.ext.jetty/pom.xml | 39 ------------------ .../java/org/restlet/ext/jetty/package.html | 10 ----- .../services/org.restlet.engine.ClientHelper | 1 - .../services/org.restlet.engine.ServerHelper | 2 - .../restlet/ext/jetty/connectors/dummy.jks | Bin 6709 -> 0 bytes .../restlet/ext/jetty/connectors/dummy.p12 | Bin 2726 -> 0 bytes pom.xml | 1 - 8 files changed, 85 deletions(-) delete mode 100644 org.restlet.ext.jetty/README.md delete mode 100644 org.restlet.ext.jetty/pom.xml delete mode 100644 org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/package.html delete mode 100644 org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper delete mode 100644 org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper delete mode 100644 org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks delete mode 100644 org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 diff --git a/org.restlet.ext.jetty/README.md b/org.restlet.ext.jetty/README.md deleted file mode 100644 index a430b40dc6..0000000000 --- a/org.restlet.ext.jetty/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# Debug Jetty - -## Add full logs - -[Jetty's documentation](https://jetty.org/docs/jetty/12/programming-guide/troubleshooting/logging.html) (the `org.eclipse.jetty:jetty-slf4j-impl`is already added to the `pom.xml`). - -Programmatically: -``` -System.setProperty("org.eclipse.jetty.LEVEL", "TRACE"); -``` - -Or add a `jetty-logging.properties`: -``` -org.eclipse.jetty.LEVEL=TRACE -org.eclipse.jetty.client.LEVEL=TRACE -``` - -## Debug using JMX -You need to update the current implementation by hand. - -- [activate JMX](https://jetty.org/docs/jetty/12/programming-guide/arch/jmx.html) -The Jetty server is created in class `JettyServerHelper`. - -``` - // Create an MBeanContainer with the platform MBeanServer. - MBeanContainer mbeanContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); - // Add MBeanContainer to the root component. - jettyServer.addBean(mbeanContainer); -``` - -- to [state tracking](https://jetty.org/docs/jetty/12/programming-guide/troubleshooting/state-tracking.html) - You can use [jconsole](https://docs.oracle.com/javase/8/docs/technotes/guides/management/jconsole.html) to check the state of MBean or just run operations on them. diff --git a/org.restlet.ext.jetty/pom.xml b/org.restlet.ext.jetty/pom.xml deleted file mode 100644 index c05ab31420..0000000000 --- a/org.restlet.ext.jetty/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - 4.0.0 - - org.restlet - org.restlet.parent - 2.7-SNAPSHOT - ../pom.xml - - - org.restlet.ext.jetty - bundle - Restlet Framework - Jetty extension - Integration with Jetty. - - - - org.restlet - org.restlet - ${project.version} - - - org.junit.jupiter - junit-jupiter-params - ${lib-junit-version} - test - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - diff --git a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/package.html b/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/package.html deleted file mode 100644 index 191bebcae5..0000000000 --- a/org.restlet.ext.jetty/src/main/java/org/restlet/ext/jetty/package.html +++ /dev/null @@ -1,10 +0,0 @@ - - -Integration with Jetty 9.4 which is a new implementation of the -popular Jetty web server. - -@since Restlet 1.0 -@see Jetty HTTP server -@see User Guide - Jetty extension - - \ No newline at end of file diff --git a/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper b/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper deleted file mode 100644 index 8e2194353e..0000000000 --- a/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ClientHelper +++ /dev/null @@ -1 +0,0 @@ -org.restlet.ext.jetty.HttpClientHelper diff --git a/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper b/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper deleted file mode 100644 index 2fd5da07d5..0000000000 --- a/org.restlet.ext.jetty/src/main/resources/META-INF/services/org.restlet.engine.ServerHelper +++ /dev/null @@ -1,2 +0,0 @@ -org.restlet.ext.jetty.HttpServerHelper # HTTP -org.restlet.ext.jetty.HttpsServerHelper # HTTPS diff --git a/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks b/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks deleted file mode 100644 index 19172998650e1136a115cdfaad31d218b63d7d40..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6709 zcmeHLcT`i^-c6?l451Ajlq%&02t@>>O79>=DIy&yp@SfaNEMMHAjp7J0TBhIcccgc zN)wPS3Q-hA1u4o4>Nxn`yqWKtd9&90<7KU^taI;K=j5Kd_x|nu`~2$jD-Z|-A$<{F zei6P7KEC#LAP|^2Q#5EE1UDDO0|z1Q5VmIZy}~0-*pE*Sce*AX&=l!fM)j| z6ixQ^o)W;pgal*&2@D`EfyGM7T9Sscdxn2)aeVgP{|bhKp!j$YfRBOT@t_`8g}WA3LPIjGx(2e+R(WnRJDk8!779KhBO*!1eEb}f%YXI^Eu(>fq6x-{rd|GKi%?p*gd z!Ot=DIg#~ds2Z<(epW;6iVj?%QnN78=ab4;-^zc?-+$YJ`DTBX@=Tjuv`)p#n#)on zeU{bAs?5Ikhh(XCLIxm*M$APdAW$#}oQKZ>@EHI*=}_2dV2m*O@i37B<$BrM)k{zG zsbpUByvR7n4Y=*z-VZwkoDBcX3D*?!<^R$_5%#=X>fO!IFgO4OgLn2GAL&&?N#|zB z8EJg=BW&9C?Y>XZydV8A43#oXOAN+Di)_Dzb>mE*8SH`7Ki zhnEL;qB|E-hn?p3*FMx8X;KkLj4o4Fb`CL`;_W$jVEm6|g7ftB{fgbQIp47hB?1KK zGZKFLzG4>)`lkm0On$^H1AyMeB_*2L!T9UKMx=Eybilsd%T#CzB|l$hPn?Ty5C#cQ z?Or28!@f-U27M?RqVg5YQh+o@5+fx6h)a{eEWUU6H|QVv>+07DIo+f z7}PuzMnt>E_Vb?zChLJ0Tc`&P9rJ`Rjg6clw_#097Vywp;P7Ls{SbUV#V(cZpr^DZB!2$Nb<57*OppZ1o) z>XA4NK_aVEh)uhL#obUNw%X9n5$6P)NyBUKd~21`C@tti9o;(^!?1MAXv@%n_%jMp zDYr2e5$A3t9WI4LA^1hMbLa!OtOdvBp|g^qH{h4#y@KER;m`{Tc`!Elo321rGUgl8 zS^<0$K>G#VBxL^r@LfG(r`^2(Bgq_M4;8%wMB8|BW%6znb?dOF30;nvAmjmOcBk)$ z`2jxR^uIOXnt8t2-}9OY{{mvtTLy#jK4WydZ;0c~N3nI%Ii@R*7|Up|Pp&xxU}yGy zzBAQ49A6^F?>WuHrZzfGd=pHCJo5QXqYWD!A*;kE@m-fGgXHn}*ZAYw;*J_(^Y0DF zxEHRT!oA77RNTh9oT_${5n7KW8v_bo{agnI^@ z_OtC7%)Qc5x#pv8Wq(K;tyM_nuFijwX>kPZb=AZ1+;(fMyFbcqAdoua$cB2m3P&bq zbe7+-K$mTi6N1}0xGWDph8G#78pPD{_XlQb9wCQS^LO&OPO3@-qgd7U;}$fx^M>`-!R9gfS`XKFGrq_H)pt4grI3YX{3-@xBrzB!i9y3RF#zvn%WeVt z`^7*UizSHx21C*YEJ+)7hk(kD5`+d&yShS&ru;>MRFr;GfPPS%KjQwKx1y4zk#v;P z!jePs`Wg7gq0{7dYspl(9-WWEnKRcyegqp@!g7PT`UY8VZ$Zy7;wsW)p{*cxZ|SWK`qn zI54S`DP^~vB5k>B9k;k#X+5=(GAhyLOXWffQ5gNKDmt*^a+!^^h!>T*+lA<#u6QJ9 zFE3L_aS&U^w$j?mC!3u=jsi+j=>^Z6F}9N;vsUm6cg3v4a`w?TFs_)z+vKzdn~Evr zIrXIMi~aaC$x2i!f6A4pQenvn_1>BDadF(oB0m9kWqr-1nqxT|J4Aiyh?;3yK-i~C zv%D{Rg$yuPal8kQTxGzS^nWbnaxvq}^YVnS#GH-h7xhRp)gTkH2{Ye32PU&Y&MGrM zO$gA^mk>=ff_J0mS_tfcz1-P+8s{(LU%0#|5xaHx980GL=y-88J%{&)MCqdyD5*LN zw!(tYc6fn*Gu@L?jgzz%jpyzP4A~}=3kXM1a`#o0CyA+a$@R_4txhB)zn?rN+kxGB zUQuC`?N%z#Bq)$EMB+XeMB(mfZ|Cmp>GRD7gmjU-YdwkX)g-S;c@P1HfrTI_l2Zl2 z2#~x$ZUpRUy#5X@i#*TRSU9RyR<@6|@pXfvPz9HAzp2!dR6+D(K4&ACUnWX~vWvp0 zUPzgJEH9VF%vsR&>>yaZntWY}yf$_;NWu%lRGHsN*-ts5GgaT)N|if&zghb;?`@DJ zV%+udfB;9CrWtP-aS4>qug!ZBw)N>)*0dvdW<##O;|}e^w*8(HP?~-krRFqj$7q`+ zZ)@)?R$^nbqr9Q%@QPQ;KKr)v#8f2gcsO3RqBO7Gf|ZQg{e<2!)!k>F9Cw#C??`tN zPNI|)+r_DM?)ezE9X-;@oSHGbl!LLshD*a5=+C$@}0{u97 z4*M!h+c_?Di_>N6w49k*t>_ntD|xBN;QnZa+2fUmWXL!ZQ!acf-;&({F)nvHyx5cf zx(|aQACgtBRQ};|s_PndPPFD<)m?x2vv-i#9XJEeI~o+uF1|O{Ub)iW6p^ zHX3K#(yV`SOKaMxtg4U7VVxLiD#{GM|7`W@hn~PKzHBMmUK?Gn3uC~Wv*t-**|MR{ zdj8X75lA)UUXHke7=D&MCwy6soK0vkhLaraDQj_1(fE!hhg57;3)A9KRrYia|FloKZ!Nxv!NJ9! z!BRiMnmp-CMf;w@PLq)ALb7s$|E_rb$I_P+X17L(lfoE)C55rwAt3)_jrzT4_suIq z(Z3QB_`Uo!#ksjDUa7l*9zSnWRJecCEsc%eQl9(agr~Xh7%cE-b>;`Q-Vu`l6UjGr zXrkU)_61WvchhOeIr{Dpm!ThatDFBSpS3Ut?F0fN3{S5o4E03bjZL17!I z0gn8r3`W8@8QJx{96XGTb-0c?csSrl3HH?9IJ?IyvQr8@;(2mT^wd_C^srmthjpYl zAHez5D>4I&za88D$%gEPD=XAPP1^7ogA&#I3Z9tW(FDnfi1Kvw8m3tpPCt8kG=Jg6 z2aa%qlxmlZY0CmW9A!x4O!!3!2G#@wQ(Yyw56zuIpnfp3W2VD+>2-;2n{+Y$(x+95 z@SO5f4l^s;bGJ>e(BG^`Yg!yeupD_mKhx6od_tfs#D8KdgeLZ^3-@=^^uP4~zx4lK zoBmNA4gn(HE&s0_0KE5i{6b?%razLTogV-B4!}1RgrZTV+FTAI-x>y7yX}B4?JQ{w zNkU0oEYfFJQ1=f1Le%)ZUH>Qr6f8Lo&!k)vor=q2{;9E)t{C>&Py$686}cAKuHuhL zfi0J@IP}#Al3ELKj1*(Q#IB{rQ_(oNBJH5b05G4aquJz?-+ z&s+242tCzmeefAhvHX{%c?TX!lr+GTc-je0h!r7L&FTLzl-l&PX zzVH?;phU7$-6<$=OdDNN@)6=SM_G0D-P5;da zKlVnyM0A`1e9l`}{#dj{#Nl-1DjwczD;o#;%$9_S&-HciQ6IhQQ3A1BF127dMml)KHR{5L;Temkp`T=+a&mU<30t=Rs8I#{--pPkA@}AG#sL zWgqP%8MQ-rOq#+{-m7;z@vRq}j<87@(qh)cN?G8ds#NjeZ9vs4tKOca&64J9*)bst zqf*u4I%MGU%1vPdm*YrO%(1wTlR|VNo<7@NQ`y;cTVTe$MoOh&Ta#GFGWc)U3?FL0fQec(EmB6 zlgj>Xo`<4oe^3chm++6+dOfbcF6F~x-^Sjth05!?O|6B7zC{%ElSXf$4Q^V)P3-=a z2r)zp>gUTX;wKG7$G3V-Ql*Wigqrija)tUqXMbPl=gOxk!opna` zWyd9QChR6xC*w5sov>DIfa7lHAM+l*(+1iWfUoN?Ux|lA& zcMBn}g+h%4zSa5k*gbxApDokPR%xI!1HpYT@ou#qmGsdDH_(enmNa=TqSMlN>mh5` z*X^hDTB~>o#LJV)rdw|_`-%pHUKG8|wsZe^T{Yjiwj|4RCn6|6d&JDQu3|o(TcgmV zI4esjPd7wsiYoNA-?B8f>U9QQih$|U1fI2C%kAzL2iTXR;ucGaSS!^(9U8taL64;5 z7Lv~0zO~HB(|R_eS3Dr&>BKV5d`WTrS+mLYJlw``5%lhI&nU#bt7ZQLH8+)r*b}|X z2grqX4W7o5mk279TMU9E9I=1M)lv-Cb_iM}=D$Daw;@G|iy0gRbVIVwm O!@nu+ec}EX!G8c}T%)}J diff --git a/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 b/org.restlet.ext.jetty/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 deleted file mode 100644 index 94519e717d66bec98a3aa5a44bb3f04bf89e0373..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2726 zcma);XE+;-7RQrFY^AM|RP7QJjgcC!O^6t^m8v~T?M*3SM~xyz&8jU{(W|2 zMp3h+W=M^<_qq4!``l0WemKv0&hLNz=i~o52rP902uOy&Qfrb^2}Gfzh;%>-U_O>w z7L28q`i+qYEQIi15+nzVg=GH5_}}%6oaR3+T52FD9}7|V4P_Aae;g1xgb70OpOF@E z3(U9|xTdxaFB2W7pvEmN+^aemY@q>x;0z!j2ZENI^4}LhR1g4ym7K~l3JtU)0|N!X z4A*zPUTZzAd;w4&)->2FO$KAZquJq!M}dg&WWWp^d)N=)cRxNxZ^F6%rc{%A6BkI< z{xA{6QfVcAA5cZG_14yRQj;;7i{5@W=iJl_NT|EYqWgAmM>VF61%a{BNaXwrlgy3} zm^~bf6oe0v%CQ%W$U7-TBKhEJa547fBI%kq;oZ?Gu1qNky~DPK%XqiG8ZX#FX4ePa z)N$(!KQLFcOXKSYU3KIpx_-W1w8mzo8!Tle4d!ekV)?3DIu4E51%}Y}5MH0qYK_$5 z8j)7k9b$3gCJY(jWc7V?awtuF$T9C;OA>V1tAssm+>ieaaa1KjyU9CI=jsNa^&_ zpWu&OFw+?_n7N%?ZPtGru;HszZ>d7VW|NjXI3NGoGCb&>S^cY|F5)WOb(oEv*2;>iXmC2lEH_Wk!D|EPzYz&ch|COX!QK~_C?OS%Pd^q0x328cUmHgzLd4-oCG;hD9E-&A=$rEJc|X^;cK(FSOTS@QaUOai5N>9;R3< zdr;A(>aF(8QE9fDF)1dRw4d%>V#dGhP?HuYudTSe`<3KiKldvz{UW*8`7Ny;kV?#8 zwG2574_{xj>&hX!n!@iKQ`a{D`U&5cs^oI*NPw`pqk&OxTvMcwL3}Wa#*)!99O!b>vVqlDWK6X! z;;cFY`Z(s%p$Bou6V5bHzDu^Dbt{L3@-zcvnHM%8=!8bJ7KVpVEpM9-M@W*!c^{2s)=6y{t*?t;ZfKjtr6v(SSOWDB*C)tMvnn9%aNgc6eGH()4V_C1ciM` z5+qAEoZMWwx20rY+&MHyv7R>GS;^+|e5kWh&{XOXKNHs1(}ZbI+W z*U`G|U|{<(jTfCwRZ`!YiQGdRxHjN>1oUI9Tcj<0i5ByUd6mPaVXT7TH*)qAT%ZK( z;V2zZDt_O}YPIb&wnajcGqwKW*R+YyesggLWX@bk+8M?_qZqSR5cQ%n9+PtCVu|&5 z>lx35h#Ug;CoZWNMQGWm0WN?5z$1ViAOOMnk919h5q!nK(Z!BKL_!=PCN3c&DK05` z2Z05L{aK{G$N>S4i6z5c=ElieA6x3E|rQWr}w_{I>f4gmjta z=XIjKC~m9Seh5XTmlld8`x&3zy&i>g3#=%ezkt@5mVf6XF2k@M(@EXp_c_r)^O|Cn zXqS>|_Pd{+&6Y0%0&=%X8dtBT3el4+lxyADd+_*Zg7tyRndqhBb$>k!f;*R2st+Dq zeXBy|L`8W|aO3uTfhT*FtozQ&Fjv`Ft`OtX8y*7bC#C?K3Q&iwiXwk;ROxn!7R!2p zb3?VA)x!!uq8DtGq7$=zRFwo{`#{=^f z=1l1g&60NAoAx4m9x#jevH&xErae6tSAZEWapCmN`@% z6bAf(4KMW9UQ!p1!%=K;o(RgdFwF1E_26)MBfe8i0k3_Ekaxx|Jddtyy;%|2X2YBX zUY`Y*BfU5#CzjuZrl_a=bchR6AKRu^epMzqU3i__CYv9d2PP@y+Dd(yS7Q57pgcj& zl)!5nG^hkdF)rv{Gfh`=1mCjlNMcwyny70!RC-1|C+vbxC!(uJ3 zljs!IYPnN5T_GrbE^hS~M1DDIlt8!4Y4@cGzKZ_bm*=@J|=^j;lGDoEVyAU4< zr#tJT%wWa2yiXIJW3MVqBX5Fon~|>cy+oe*C33N~xm6lX7E-L``c8eQ>_C_6a#50_ z{!JI#p~~|5=aGplBY8CO*P2PdAR8WA$10}Ms9kTXdy(6vSuTDGhhmHtJ z1V6{W73BjVgEHP?HCV0)({TC3>K}0*EcVj!ybAT&t(g(r&HHM#eVUEfm~wDBtgIEd z0*`#G_#~mcF>VB=0*$VpdG>tQuYKVOuJrsnuxEU}3AxnwR+fwBg!F`R&AM=6x1IXK z_);w;wz1IbI7cD1GbnGWc8EXpFipDuiY|r>nt5AAG8RR6FV$wIRosk$Oh1t>&~rNA zCT3Z{ILCP*M`Lq5!^td35T#|_+ptt<org.restlet.ext.gson org.restlet.ext.jaas org.restlet.ext.jackson - org.restlet.ext.jetty org.restlet.ext.json org.restlet.ext.slf4j org.restlet.ext.spring From b0213137c5fe83401135fa708c65ec1e2245c9ee Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Fri, 27 Jun 2025 20:21:41 +0200 Subject: [PATCH 11/22] Fix TUs, Upgrade JDK 21 --- .tool-versions | 2 +- org.restlet/pom.xml | 3 + .../main/java/org/restlet/Application.java | 2 +- .../src/main/java/org/restlet/Client.java | 11 +- .../src/main/java/org/restlet/Restlet.java | 3 +- .../org/restlet/data/ChallengeRequest.java | 9 +- .../main/java/org/restlet/data/Cookie.java | 10 +- .../java/org/restlet/data/CookieSetting.java | 10 +- .../java/org/restlet/data/Expectation.java | 9 +- .../main/java/org/restlet/data/Header.java | 6 +- .../main/java/org/restlet/data/Language.java | 3 +- .../java/org/restlet/data/LocalReference.java | 37 +- .../main/java/org/restlet/data/Metadata.java | 4 +- .../main/java/org/restlet/data/Parameter.java | 12 +- .../java/org/restlet/data/ReferenceList.java | 34 +- .../main/java/org/restlet/data/Status.java | 683 ++++++------------ .../src/main/java/org/restlet/data/Tag.java | 22 +- .../main/java/org/restlet/data/Warning.java | 2 +- .../main/java/org/restlet/engine/Edition.java | 3 +- .../main/java/org/restlet/engine/Engine.java | 31 +- .../restlet/engine/adapter/HttpRequest.java | 8 +- .../engine/adapter/HttpServerHelper.java | 22 +- .../restlet/engine/adapter/ServerCall.java | 1 - .../engine/application/ApplicationHelper.java | 2 +- .../restlet/engine/application/Encoder.java | 32 +- .../engine/application/StatusFilter.java | 4 +- .../engine/application/TunnelFilter.java | 26 +- .../engine/component/ComponentHelper.java | 3 +- .../component/ComponentServerDispatcher.java | 5 +- .../engine/converter/ConverterHelper.java | 2 +- .../engine/header/ChallengeRequestReader.java | 2 +- .../restlet/engine/header/CookieReader.java | 10 +- .../engine/header/CookieSettingReader.java | 14 +- .../engine/header/CookieSettingWriter.java | 10 +- .../restlet/engine/header/CookieWriter.java | 8 +- .../engine/header/DispositionReader.java | 2 +- .../engine/header/ExpectationWriter.java | 2 +- .../restlet/engine/header/HeaderReader.java | 34 +- .../restlet/engine/header/HeaderWriter.java | 6 +- .../restlet/engine/header/ProductReader.java | 2 +- .../restlet/engine/header/ProductWriter.java | 2 +- .../restlet/engine/header/RangeReader.java | 38 +- .../restlet/engine/header/WarningWriter.java | 4 +- .../org/restlet/engine/io/PipeStream.java | 2 +- .../restlet/engine/io/WriterOutputStream.java | 3 +- .../engine/local/DirectoryServerResource.java | 37 +- .../engine/local/EntityClientHelper.java | 3 +- .../engine/local/FileClientHelper.java | 23 +- .../org/restlet/engine/log/IdentClient.java | 4 +- .../engine/resource/AnnotationInfo.java | 3 +- .../engine/resource/MethodAnnotationInfo.java | 2 +- .../java/org/restlet/engine/ssl/SslUtils.java | 68 +- .../engine/util/ChildClientDispatcher.java | 8 +- .../engine/util/EngineClassLoader.java | 2 +- .../org/restlet/engine/util/FormReader.java | 4 +- .../org/restlet/engine/util/StringUtils.java | 13 +- .../org/restlet/representation/Variant.java | 9 +- .../java/org/restlet/resource/Directory.java | 2 +- .../org/restlet/resource/ServerResource.java | 8 +- .../main/java/org/restlet/routing/Filter.java | 13 +- .../org/restlet/security/Authenticator.java | 2 +- .../security/CertificateAuthenticator.java | 2 +- .../org/restlet/service/ConverterService.java | 5 +- .../java/org/restlet/service/LogService.java | 4 +- .../main/java/org/restlet/util/RouteList.java | 2 +- .../main/java/org/restlet/util/Series.java | 70 +- .../java/org/restlet/util/ServerList.java | 2 +- .../java/org/restlet/util/ServiceList.java | 2 +- .../engine/connector/AsyncTestCase.java | 37 +- .../connector/BaseConnectorsTestCase.java | 6 +- .../connector/ShutdownHookTestCase.java | 1 - .../FileRepresentationTestCase.java | 2 + .../connectors => engine/connector}/dummy.p12 | Bin .../restlet/ext/jetty/connectors/dummy.jks | Bin 6709 -> 0 bytes pom.xml | 5 +- 75 files changed, 603 insertions(+), 876 deletions(-) rename org.restlet/src/test/resources/org/restlet/{ext/jetty/connectors => engine/connector}/dummy.p12 (100%) delete mode 100644 org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks diff --git a/.tool-versions b/.tool-versions index d18a50e87d..3647e48442 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -java adoptopenjdk-17.0.8+101 +java adoptopenjdk-21.0.2+13.0.LTS maven 3.8.8 diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index c57baa30ab..610999de03 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -100,6 +100,9 @@ src/test/resources true + + **/*.properties + diff --git a/org.restlet/src/main/java/org/restlet/Application.java b/org.restlet/src/main/java/org/restlet/Application.java index 929568ebe0..29715c4108 100644 --- a/org.restlet/src/main/java/org/restlet/Application.java +++ b/org.restlet/src/main/java/org/restlet/Application.java @@ -59,7 +59,7 @@ * @author Jerome Louvel */ public class Application extends Restlet { - private static final ThreadLocal CURRENT = new ThreadLocal(); + private static final ThreadLocal CURRENT = new ThreadLocal<>(); /** * This variable is stored internally as a thread local variable and updated diff --git a/org.restlet/src/main/java/org/restlet/Client.java b/org.restlet/src/main/java/org/restlet/Client.java index 83de7f2605..a5ed7819fa 100644 --- a/org.restlet/src/main/java/org/restlet/Client.java +++ b/org.restlet/src/main/java/org/restlet/Client.java @@ -129,13 +129,10 @@ public void handle(Request request, Response response) { if (getHelper() != null) { getHelper().handle(request, response); } else { - StringBuilder sb = new StringBuilder(); - sb.append( - "No available client connector supports the required protocol: "); - sb.append("'").append(request.getProtocol().getName()).append("'."); - sb.append( - " Please add the JAR of a matching connector to your classpath."); - response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, sb.toString()); + String sb = "No available client connector supports the required protocol: " + + "'" + request.getProtocol().getName() + "'." + + " Please add the JAR of a matching connector to your classpath."; + response.setStatus(Status.CONNECTOR_ERROR_INTERNAL, sb); } } diff --git a/org.restlet/src/main/java/org/restlet/Restlet.java b/org.restlet/src/main/java/org/restlet/Restlet.java index f8241b1819..038dfedfc5 100644 --- a/org.restlet/src/main/java/org/restlet/Restlet.java +++ b/org.restlet/src/main/java/org/restlet/Restlet.java @@ -39,8 +39,7 @@ public abstract class Restlet implements Uniform { */ private static void fireContextChanged(Restlet restlet, Context context) { if (context != null) { - if (context instanceof org.restlet.engine.util.ChildContext) { - org.restlet.engine.util.ChildContext childContext = (org.restlet.engine.util.ChildContext) context; + if (context instanceof org.restlet.engine.util.ChildContext childContext) { if (childContext.getChild() == null) { childContext.setChild(restlet); diff --git a/org.restlet/src/main/java/org/restlet/data/ChallengeRequest.java b/org.restlet/src/main/java/org/restlet/data/ChallengeRequest.java index 67bdb48738..0185a2a026 100644 --- a/org.restlet/src/main/java/org/restlet/data/ChallengeRequest.java +++ b/org.restlet/src/main/java/org/restlet/data/ChallengeRequest.java @@ -65,19 +65,18 @@ public boolean equals(final Object obj) { if (obj == this) { return true; } - if (!(obj instanceof ChallengeRequest)) { + if (!(obj instanceof ChallengeRequest that)) { return false; } - final ChallengeRequest that = (ChallengeRequest) obj; - - return getParameters().equals(that.getParameters()) && Objects.equals(getRealm(), that.getRealm()) + return getParameters().equals(that.getParameters()) + && Objects.equals(getRealm(), that.getRealm()) && Objects.equals(getScheme(), that.getScheme()); } /** * Returns the base URI references that collectively define the protected - * domains for the digest authentication. By default it return a list with a + * domains for the digest authentication. By default, it returns a list with a * single "/" URI reference. * * @return The base URI references. diff --git a/org.restlet/src/main/java/org/restlet/data/Cookie.java b/org.restlet/src/main/java/org/restlet/data/Cookie.java index faee8882dd..4e0e1be791 100644 --- a/org.restlet/src/main/java/org/restlet/data/Cookie.java +++ b/org.restlet/src/main/java/org/restlet/data/Cookie.java @@ -97,15 +97,15 @@ public boolean equals(Object obj) { return true; } - if (!(obj instanceof Cookie)) { + if (!(obj instanceof Cookie that)) { // if obj isn't a cookie or is null don't evaluate further return false; } - Cookie that = (Cookie) obj; - - return Objects.equals(getName(), that.getName()) && Objects.equals(getValue(), that.getValue()) - && (this.version == that.version) && Objects.equals(getDomain(), that.getDomain()) + return Objects.equals(getName(), that.getName()) + && Objects.equals(getValue(), that.getValue()) + && (this.version == that.version) + && Objects.equals(getDomain(), that.getDomain()) && Objects.equals(getPath(), that.getPath()); } diff --git a/org.restlet/src/main/java/org/restlet/data/CookieSetting.java b/org.restlet/src/main/java/org/restlet/data/CookieSetting.java index 54d2ef7667..dacf999fcd 100644 --- a/org.restlet/src/main/java/org/restlet/data/CookieSetting.java +++ b/org.restlet/src/main/java/org/restlet/data/CookieSetting.java @@ -26,7 +26,7 @@ */ public final class CookieSetting extends Cookie { /** - * Indicates whether to restrict cookie access to untrusted parties. Currently + * Indicates whether to restrict cookie access to untrusted parties. Currently, * this toggles the non-standard but widely supported HttpOnly cookie parameter. */ private volatile boolean accessRestricted; @@ -139,13 +139,13 @@ public boolean equals(Object obj) { if (obj == this) { return true; } - if (!(obj instanceof CookieSetting)) { + if (!(obj instanceof CookieSetting that)) { return false; } - CookieSetting that = (CookieSetting) obj; - - return super.equals(obj) && this.maxAge == that.maxAge && this.secure == that.secure + return super.equals(obj) + && this.maxAge == that.maxAge + && this.secure == that.secure && Objects.equals(this.comment, that.comment); } diff --git a/org.restlet/src/main/java/org/restlet/data/Expectation.java b/org.restlet/src/main/java/org/restlet/data/Expectation.java index 1f3f037500..812dc51c3e 100644 --- a/org.restlet/src/main/java/org/restlet/data/Expectation.java +++ b/org.restlet/src/main/java/org/restlet/data/Expectation.java @@ -26,7 +26,7 @@ public final class Expectation implements NamedValue { /** - * Creates a "100-continue" expectation. If a client will wait for a 100 + * Creates a "100-continue" expectation. If a client waits for a 100 * (Continue) provisional response before sending the request body, it MUST send * this expectation. A client MUST NOT send this expectation if it does not * intend to send a request entity. @@ -76,13 +76,12 @@ public boolean equals(Object obj) { return true; } - if (!(obj instanceof Expectation)) { + if (!(obj instanceof Expectation that)) { return false; } - Expectation that = (Expectation) obj; - - return Objects.equals(getName(), that.getName()) && Objects.equals(getValue(), that.getValue()) + return Objects.equals(getName(), that.getName()) + && Objects.equals(getValue(), that.getValue()) && getParameters().equals(that.getParameters()); } diff --git a/org.restlet/src/main/java/org/restlet/data/Header.java b/org.restlet/src/main/java/org/restlet/data/Header.java index eb402016ca..d050d51711 100644 --- a/org.restlet/src/main/java/org/restlet/data/Header.java +++ b/org.restlet/src/main/java/org/restlet/data/Header.java @@ -51,12 +51,12 @@ public boolean equals(Object obj) { if (obj == this) { return true; } - if (!(obj instanceof Header)) { + if (!(obj instanceof Header that)) { return false; } - Header that = (Header) obj; - return Objects.equals(getName(), that.getName()) && Objects.equals(getValue(), that.getValue()); + return Objects.equals(getName(), that.getName()) + && Objects.equals(getValue(), that.getValue()); } /** diff --git a/org.restlet/src/main/java/org/restlet/data/Language.java b/org.restlet/src/main/java/org/restlet/data/Language.java index f94706c609..7c2a4810f4 100644 --- a/org.restlet/src/main/java/org/restlet/data/Language.java +++ b/org.restlet/src/main/java/org/restlet/data/Language.java @@ -188,8 +188,7 @@ public int hashCode() { public boolean includes(Metadata included) { boolean result = equals(ALL) || (included == null) || equals(included); - if (!result && (included instanceof Language)) { - Language includedLanguage = (Language) included; + if (!result && (included instanceof Language includedLanguage)) { if (getPrimaryTag().equals(includedLanguage.getPrimaryTag())) { // Both languages are different diff --git a/org.restlet/src/main/java/org/restlet/data/LocalReference.java b/org.restlet/src/main/java/org/restlet/data/LocalReference.java index ecd7d65914..0f6a74653c 100644 --- a/org.restlet/src/main/java/org/restlet/data/LocalReference.java +++ b/org.restlet/src/main/java/org/restlet/data/LocalReference.java @@ -181,33 +181,16 @@ public static LocalReference createZipReference(Reference zipFile, String entryP * @return The name. */ public static String getAuthorityName(int authority) { - String result = null; - - switch (authority) { - case CLAP_DEFAULT: - result = ""; - break; - case CLAP_CLASS: - result = "class"; - break; - case CLAP_SYSTEM: - result = "system"; - break; - case CLAP_THREAD: - result = "thread"; - break; - case RIAP_APPLICATION: - result = "application"; - break; - case RIAP_COMPONENT: - result = "component"; - break; - case RIAP_HOST: - result = "host"; - break; - } - - return result; + return switch (authority) { + case CLAP_DEFAULT -> ""; + case CLAP_CLASS -> "class"; + case CLAP_SYSTEM -> "system"; + case CLAP_THREAD -> "thread"; + case RIAP_APPLICATION -> "application"; + case RIAP_COMPONENT -> "component"; + case RIAP_HOST -> "host"; + default -> null; + }; } /** diff --git a/org.restlet/src/main/java/org/restlet/data/Metadata.java b/org.restlet/src/main/java/org/restlet/data/Metadata.java index 7c6dc3015e..1063cb541c 100644 --- a/org.restlet/src/main/java/org/restlet/data/Metadata.java +++ b/org.restlet/src/main/java/org/restlet/data/Metadata.java @@ -120,8 +120,8 @@ public int hashCode() { * @see #includes(Metadata) */ public boolean isCompatible(Metadata otherMetadata) { - boolean result = (otherMetadata != null) && (includes(otherMetadata) || otherMetadata.includes(this)); - return result; + return (otherMetadata != null) + && (includes(otherMetadata) || otherMetadata.includes(this)); } /** diff --git a/org.restlet/src/main/java/org/restlet/data/Parameter.java b/org.restlet/src/main/java/org/restlet/data/Parameter.java index 743c35942f..8334d8d17f 100644 --- a/org.restlet/src/main/java/org/restlet/data/Parameter.java +++ b/org.restlet/src/main/java/org/restlet/data/Parameter.java @@ -123,13 +123,13 @@ public boolean equals(Object obj) { if (obj == this) { return true; } - if (!(obj instanceof Parameter)) { - return false; - } + if (obj instanceof Parameter that) { + return Objects.equals(getName(), that.getName()) + && Objects.equals(getValue(), that.getValue()); + } + return false; - Parameter that = (Parameter) obj; - return Objects.equals(getName(), that.getName()) && Objects.equals(getValue(), that.getValue()); - } + } /* * (non-Javadoc) diff --git a/org.restlet/src/main/java/org/restlet/data/ReferenceList.java b/org.restlet/src/main/java/org/restlet/data/ReferenceList.java index 9bd7ba9e38..4aae2679ce 100644 --- a/org.restlet/src/main/java/org/restlet/data/ReferenceList.java +++ b/org.restlet/src/main/java/org/restlet/data/ReferenceList.java @@ -60,30 +60,24 @@ public ReferenceList(List delegate) { * @throws IOException */ public ReferenceList(Representation uriList) throws IOException { - BufferedReader br = null; - try { - br = new BufferedReader(uriList.getReader(), IoUtils.BUFFER_SIZE); + try (BufferedReader br = new BufferedReader(uriList.getReader(), IoUtils.BUFFER_SIZE)) { - String line = br.readLine(); + String line = br.readLine(); - // Checks if the list reference is specified as the first comment. - if ((line != null) && line.startsWith("#")) { - setIdentifier(new Reference(line.substring(1).trim())); - line = br.readLine(); - } + // Checks if the list reference is specified as the first comment. + if ((line != null) && line.startsWith("#")) { + setIdentifier(new Reference(line.substring(1).trim())); + line = br.readLine(); + } - while (line != null) { - if (!line.startsWith("#")) { - add(new Reference(line.trim())); - } + while (line != null) { + if (!line.startsWith("#")) { + add(new Reference(line.trim())); + } - line = br.readLine(); - } - } finally { - if (br != null) { - br.close(); - } - } + line = br.readLine(); + } + } } /** diff --git a/org.restlet/src/main/java/org/restlet/data/Status.java b/org.restlet/src/main/java/org/restlet/data/Status.java index 7b90f6e2d7..afdb361208 100644 --- a/org.restlet/src/main/java/org/restlet/data/Status.java +++ b/org.restlet/src/main/java/org/restlet/data/Status.java @@ -24,7 +24,7 @@ public final class Status { private static final String BASE_RESTLET = "https://javadoc.io/static/org.restlet/org.restlet/" + Engine.VERSION + "/"; /** - * The request could not be understood by the server due to malformed syntax. + * The server could not understand the request due to malformed syntax. * * @see HTTP @@ -642,118 +642,60 @@ public static boolean isSuccess(int code) { * @return The associated status. */ public static Status valueOf(int code) { - switch (code) { - case 100: - return INFO_CONTINUE; - case 101: - return INFO_SWITCHING_PROTOCOL; - case 110: - return INFO_STALE_RESPONSE; - case 111: - return INFO_REVALIDATION_FAILED; - case 112: - return INFO_DISCONNECTED_OPERATION; - case 113: - return INFO_HEURISTIC_EXPIRATION; - case 199: - return INFO_MISC_WARNING; - - case 200: - return SUCCESS_OK; - case 201: - return SUCCESS_CREATED; - case 202: - return SUCCESS_ACCEPTED; - case 203: - return SUCCESS_NON_AUTHORITATIVE; - case 204: - return SUCCESS_NO_CONTENT; - case 205: - return SUCCESS_RESET_CONTENT; - case 206: - return SUCCESS_PARTIAL_CONTENT; - case 214: - return SUCCESS_TRANSFORMATION_APPLIED; - case 299: - return SUCCESS_MISC_PERSISTENT_WARNING; - - case 300: - return REDIRECTION_MULTIPLE_CHOICES; - case 301: - return REDIRECTION_PERMANENT; - case 302: - return REDIRECTION_FOUND; - case 303: - return REDIRECTION_SEE_OTHER; - case 304: - return REDIRECTION_NOT_MODIFIED; - case 305: - return REDIRECTION_USE_PROXY; - case 307: - return REDIRECTION_TEMPORARY; - - case 400: - return CLIENT_ERROR_BAD_REQUEST; - case 401: - return CLIENT_ERROR_UNAUTHORIZED; - case 402: - return CLIENT_ERROR_PAYMENT_REQUIRED; - case 403: - return CLIENT_ERROR_FORBIDDEN; - case 404: - return CLIENT_ERROR_NOT_FOUND; - case 405: - return CLIENT_ERROR_METHOD_NOT_ALLOWED; - case 406: - return CLIENT_ERROR_NOT_ACCEPTABLE; - case 407: - return CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED; - case 408: - return CLIENT_ERROR_REQUEST_TIMEOUT; - case 409: - return CLIENT_ERROR_CONFLICT; - case 410: - return CLIENT_ERROR_GONE; - case 411: - return CLIENT_ERROR_LENGTH_REQUIRED; - case 412: - return CLIENT_ERROR_PRECONDITION_FAILED; - case 413: - return CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE; - case 414: - return CLIENT_ERROR_REQUEST_URI_TOO_LONG; - case 415: - return CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE; - case 416: - return CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE; - case 417: - return CLIENT_ERROR_EXPECTATION_FAILED; - case 429: - return CLIENT_ERROR_TOO_MANY_REQUESTS; - - case 500: - return SERVER_ERROR_INTERNAL; - case 501: - return SERVER_ERROR_NOT_IMPLEMENTED; - case 502: - return SERVER_ERROR_BAD_GATEWAY; - case 503: - return SERVER_ERROR_SERVICE_UNAVAILABLE; - case 504: - return SERVER_ERROR_GATEWAY_TIMEOUT; - case 505: - return SERVER_ERROR_VERSION_NOT_SUPPORTED; - - case 1000: - return CONNECTOR_ERROR_CONNECTION; - case 1001: - return CONNECTOR_ERROR_COMMUNICATION; - case 1002: - return CONNECTOR_ERROR_INTERNAL; - - default: - return new Status(code); - } + return switch (code) { + case 100 -> INFO_CONTINUE; + case 101 -> INFO_SWITCHING_PROTOCOL; + case 110 -> INFO_STALE_RESPONSE; + case 111 -> INFO_REVALIDATION_FAILED; + case 112 -> INFO_DISCONNECTED_OPERATION; + case 113 -> INFO_HEURISTIC_EXPIRATION; + case 199 -> INFO_MISC_WARNING; + case 200 -> SUCCESS_OK; + case 201 -> SUCCESS_CREATED; + case 202 -> SUCCESS_ACCEPTED; + case 203 -> SUCCESS_NON_AUTHORITATIVE; + case 204 -> SUCCESS_NO_CONTENT; + case 205 -> SUCCESS_RESET_CONTENT; + case 206 -> SUCCESS_PARTIAL_CONTENT; + case 214 -> SUCCESS_TRANSFORMATION_APPLIED; + case 299 -> SUCCESS_MISC_PERSISTENT_WARNING; + case 300 -> REDIRECTION_MULTIPLE_CHOICES; + case 301 -> REDIRECTION_PERMANENT; + case 302 -> REDIRECTION_FOUND; + case 303 -> REDIRECTION_SEE_OTHER; + case 304 -> REDIRECTION_NOT_MODIFIED; + case 305 -> REDIRECTION_USE_PROXY; + case 307 -> REDIRECTION_TEMPORARY; + case 400 -> CLIENT_ERROR_BAD_REQUEST; + case 401 -> CLIENT_ERROR_UNAUTHORIZED; + case 402 -> CLIENT_ERROR_PAYMENT_REQUIRED; + case 403 -> CLIENT_ERROR_FORBIDDEN; + case 404 -> CLIENT_ERROR_NOT_FOUND; + case 405 -> CLIENT_ERROR_METHOD_NOT_ALLOWED; + case 406 -> CLIENT_ERROR_NOT_ACCEPTABLE; + case 407 -> CLIENT_ERROR_PROXY_AUTHENTIFICATION_REQUIRED; + case 408 -> CLIENT_ERROR_REQUEST_TIMEOUT; + case 409 -> CLIENT_ERROR_CONFLICT; + case 410 -> CLIENT_ERROR_GONE; + case 411 -> CLIENT_ERROR_LENGTH_REQUIRED; + case 412 -> CLIENT_ERROR_PRECONDITION_FAILED; + case 413 -> CLIENT_ERROR_REQUEST_ENTITY_TOO_LARGE; + case 414 -> CLIENT_ERROR_REQUEST_URI_TOO_LONG; + case 415 -> CLIENT_ERROR_UNSUPPORTED_MEDIA_TYPE; + case 416 -> CLIENT_ERROR_REQUESTED_RANGE_NOT_SATISFIABLE; + case 417 -> CLIENT_ERROR_EXPECTATION_FAILED; + case 429 -> CLIENT_ERROR_TOO_MANY_REQUESTS; + case 500 -> SERVER_ERROR_INTERNAL; + case 501 -> SERVER_ERROR_NOT_IMPLEMENTED; + case 502 -> SERVER_ERROR_BAD_GATEWAY; + case 503 -> SERVER_ERROR_SERVICE_UNAVAILABLE; + case 504 -> SERVER_ERROR_GATEWAY_TIMEOUT; + case 505 -> SERVER_ERROR_VERSION_NOT_SUPPORTED; + case 1000 -> CONNECTOR_ERROR_CONNECTION; + case 1001 -> CONNECTOR_ERROR_COMMUNICATION; + case 1002 -> CONNECTOR_ERROR_INTERNAL; + default -> new Status(code); + }; } /** The specification code. */ @@ -962,118 +904,85 @@ public String getDescription() { return this.description; } - switch (this.code) { - case 100: - return "The client should continue with its request"; - case 101: - return "The server is willing to change the application protocol being used on this connection"; - case 110: - return "MUST be included whenever the returned response is stale"; - case 111: - return "MUST be included if a cache returns a stale response because an attempt to revalidate the response failed, due to an inability to reach the server"; - case 112: - return "SHOULD be included if the cache is intentionally disconnected from the rest of the network for a period of time"; - case 113: - return "MUST be included if the cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours"; - case 199: - return "The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action, besides presenting the warning to the user"; - - case 200: - return "The request has succeeded"; - case 201: - return "The request has been fulfilled and resulted in a new resource being created"; - case 202: - return "The request has been accepted for processing, but the processing has not been completed"; - case 203: - return "The returned meta-information is not the definitive set as available from the origin server"; - case 204: - return "The server has fulfilled the request but does not need to return an entity-body, and might want to return updated meta-information"; - case 205: - return "The server has fulfilled the request and the user agent should reset the document view which caused the request to be sent"; - case 206: - return "The server has fulfilled the partial get request for the resource"; - case 214: - return "MUST be added by an intermediate cache or proxy if it applies any transformation changing the content-coding (as specified in the Content-Encoding header) or media-type (as specified in the Content-Type header) of the response, or the entity-body of the response, unless this Warning code already appears in the response"; - case 299: - return "The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action"; - - case 300: - return "The requested resource corresponds to any one of a set of representations"; - case 301: - return "The requested resource has been assigned a new permanent URI"; - case 302: - return "The requested resource can be found under a different URI"; - case 303: - return "The response to the request can be found under a different URI"; - case 304: - return "The client has performed a conditional GET request and the document has not been modified"; - case 305: - return "The requested resource must be accessed through the proxy given by the location field"; - case 307: - return "The requested resource resides temporarily under a different URI"; - - case 400: - return "The request could not be understood by the server due to malformed syntax"; - case 401: - return "The request requires user authentication"; - case 402: - return "This code is reserved for future use"; - case 403: - return "The server understood the request, but is refusing to fulfill it"; - case 404: - return "The server has not found anything matching the request URI"; - case 405: - return "The method specified in the request is not allowed for the resource identified by the request URI"; - case 406: - return "The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request"; - case 407: - return "This code is similar to Unauthorized, but indicates that the client must first authenticate itself with the proxy"; - case 408: - return "The client did not produce a request within the time that the server was prepared to wait"; - case 409: - return "The request could not be completed due to a conflict with the current state of the resource"; - case 410: - return "The requested resource is no longer available at the server and no forwarding address is known"; - case 411: - return "The server refuses to accept the request without a defined content length"; - case 412: - return "The precondition given in one or more of the request header fields evaluated to false when it was tested on the server"; - case 413: - return "The server is refusing to process a request because the request entity is larger than the server is willing or able to process"; - case 414: - return "The server is refusing to service the request because the request URI is longer than the server is willing to interpret"; - case 415: - return "The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method"; - case 416: - return "For byte ranges, this means that the first byte position were greater than the current length of the selected resource"; - case 417: - return "The expectation given in the request header could not be met by this server"; - case 429: - return "The server is refusing to service the request because the user has sent too many requests in a given amount of time (\"rate limiting\")"; - - case 500: - return "The server encountered an unexpected condition which prevented it from fulfilling the request"; - case 501: - return "The server does not support the functionality required to fulfill the request"; - case 502: - return "The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request"; - case 503: - return "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server"; - case 504: - return "The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request"; - case 505: - return "The server does not support, or refuses to support, the protocol version that was used in the request message"; - - case 1000: - return "The connector failed to connect to the server"; - case 1001: - return "The connector failed to complete the communication with the server"; - case 1002: - return "The connector encountered an unexpected condition which prevented it from fulfilling the request"; - } - - return null; - } + return switch (this.code) { + case 100 -> "The client should continue with its request"; + case 101 -> "The server is willing to change the application protocol being used on this connection"; + case 110 -> "MUST be included whenever the returned response is stale"; + case 111 -> + "MUST be included if a cache returns a stale response because an attempt to revalidate the response failed, due to an inability to reach the server"; + case 112 -> + "SHOULD be included if the cache is intentionally disconnected from the rest of the network for a period of time"; + case 113 -> + "MUST be included if the cache heuristically chose a freshness lifetime greater than 24 hours and the response's age is greater than 24 hours"; + case 199 -> + "The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action, besides presenting the warning to the user"; + case 200 -> "The request has succeeded"; + case 201 -> "The request has been fulfilled and resulted in a new resource being created"; + case 202 -> "The request has been accepted for processing, but the processing has not been completed"; + case 203 -> "The returned meta-information is not the definitive set as available from the origin server"; + case 204 -> + "The server has fulfilled the request but does not need to return an entity-body, and might want to return updated meta-information"; + case 205 -> + "The server has fulfilled the request and the user agent should reset the document view which caused the request to be sent"; + case 206 -> "The server has fulfilled the partial get request for the resource"; + case 214 -> + "MUST be added by an intermediate cache or proxy if it applies any transformation changing the content-coding (as specified in the Content-Encoding header) or media-type (as specified in the Content-Type header) of the response, or the entity-body of the response, unless this Warning code already appears in the response"; + case 299 -> + "The warning text MAY include arbitrary information to be presented to a human user, or logged. A system receiving this warning MUST NOT take any automated action"; + case 300 -> "The requested resource corresponds to any one of a set of representations"; + case 301 -> "The requested resource has been assigned a new permanent URI"; + case 302 -> "The requested resource can be found under a different URI"; + case 303 -> "The response to the request can be found under a different URI"; + case 304 -> "The client has performed a conditional GET request and the document has not been modified"; + case 305 -> "The requested resource must be accessed through the proxy given by the location field"; + case 307 -> "The requested resource resides temporarily under a different URI"; + case 400 -> "The request could not be understood by the server due to malformed syntax"; + case 401 -> "The request requires user authentication"; + case 402 -> "This code is reserved for future use"; + case 403 -> "The server understood the request, but is refusing to fulfill it"; + case 404 -> "The server has not found anything matching the request URI"; + case 405 -> + "The method specified in the request is not allowed for the resource identified by the request URI"; + case 406 -> + "The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request"; + case 407 -> + "This code is similar to Unauthorized, but indicates that the client must first authenticate itself with the proxy"; + case 408 -> "The client did not produce a request within the time that the server was prepared to wait"; + case 409 -> "The request could not be completed due to a conflict with the current state of the resource"; + case 410 -> + "The requested resource is no longer available at the server and no forwarding address is known"; + case 411 -> "The server refuses to accept the request without a defined content length"; + case 412 -> + "The precondition given in one or more of the request header fields evaluated to false when it was tested on the server"; + case 413 -> + "The server is refusing to process a request because the request entity is larger than the server is willing or able to process"; + case 414 -> + "The server is refusing to service the request because the request URI is longer than the server is willing to interpret"; + case 415 -> + "The server is refusing to service the request because the entity of the request is in a format not supported by the requested resource for the requested method"; + case 416 -> + "For byte ranges, this means that the first byte position were greater than the current length of the selected resource"; + case 417 -> "The expectation given in the request header could not be met by this server"; + case 429 -> + "The server is refusing to service the request because the user has sent too many requests in a given amount of time (\"rate limiting\")"; + case 500 -> "The server encountered an unexpected condition which prevented it from fulfilling the request"; + case 501 -> "The server does not support the functionality required to fulfill the request"; + case 502 -> + "The server, while acting as a gateway or proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request"; + case 503 -> + "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server"; + case 504 -> + "The server, while acting as a gateway or proxy, did not receive a timely response from the upstream server specified by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server (e.g. DNS) it needed to access in attempting to complete the request"; + case 505 -> + "The server does not support, or refuses to support, the protocol version that was used in the request message"; + case 1000 -> "The connector failed to connect to the server"; + case 1001 -> "The connector failed to complete the communication with the server"; + case 1002 -> + "The connector encountered an unexpected condition which prevented it from fulfilling the request"; + default -> null; + }; + + } /** * Returns the reason phrase of this status. When supported by the HTTP server @@ -1087,118 +996,62 @@ public String getReasonPhrase() { return this.reasonPhrase; } - switch (this.code) { - case 100: - return "Continue"; - case 101: - return "Switching Protocols"; - case 110: - return "Response is stale"; - case 111: - return "Revalidation failed"; - case 112: - return "Disconnected operation"; - case 113: - return "Heuristic expiration"; - case 199: - return "Miscellaneous warning"; - - case 200: - return "OK"; - case 201: - return "Created"; - case 202: - return "Accepted"; - case 203: - return "Non-Authoritative Information"; - case 204: - return "No Content"; - case 205: - return "Reset Content"; - case 206: - return "Partial Content"; - case 214: - return "Transformation applied"; - case 299: - return "Miscellaneous persistent warning"; - - case 300: - return "Multiple Choices"; - case 301: - return "Moved Permanently"; - case 302: - return "Found"; - case 303: - return "See Other"; - case 304: - return "Not Modified"; - case 305: - return "Use Proxy"; - case 307: - return "Temporary Redirect"; - - case 400: - return "Bad Request"; - case 401: - return "Unauthorized"; - case 402: - return "Payment Required"; - case 403: - return "Forbidden"; - case 404: - return "Not Found"; - case 405: - return "Method Not Allowed"; - case 406: - return "Not Acceptable"; - case 407: - return "Proxy Authentication Required"; - case 408: - return "Request Timeout"; - case 409: - return "Conflict"; - case 410: - return "Gone"; - case 411: - return "Length Required"; - case 412: - return "Precondition Failed"; - case 413: - return "Request Entity Too Large"; - case 414: - return "Request URI Too Long"; - case 415: - return "Unsupported Media Type"; - case 416: - return "Requested Range Not Satisfiable"; - case 417: - return "Expectation Failed"; - case 429: - return "Too Many Requests"; - - case 500: - return "Internal Server Error"; - case 501: - return "Not Implemented"; - case 502: - return "Bad Gateway"; - case 503: - return "Service Unavailable"; - case 504: - return "Gateway Timeout"; - case 505: - return "Version Not Supported"; - - case 1000: - return "Connection Error"; - case 1001: - return "Communication Error"; - case 1002: - return "Internal Connector Error"; - } - - return null; - } + return switch (this.code) { + case 100 -> "Continue"; + case 101 -> "Switching Protocols"; + case 110 -> "Response is stale"; + case 111 -> "Revalidation failed"; + case 112 -> "Disconnected operation"; + case 113 -> "Heuristic expiration"; + case 199 -> "Miscellaneous warning"; + case 200 -> "OK"; + case 201 -> "Created"; + case 202 -> "Accepted"; + case 203 -> "Non-Authoritative Information"; + case 204 -> "No Content"; + case 205 -> "Reset Content"; + case 206 -> "Partial Content"; + case 214 -> "Transformation applied"; + case 299 -> "Miscellaneous persistent warning"; + case 300 -> "Multiple Choices"; + case 301 -> "Moved Permanently"; + case 302 -> "Found"; + case 303 -> "See Other"; + case 304 -> "Not Modified"; + case 305 -> "Use Proxy"; + case 307 -> "Temporary Redirect"; + case 400 -> "Bad Request"; + case 401 -> "Unauthorized"; + case 402 -> "Payment Required"; + case 403 -> "Forbidden"; + case 404 -> "Not Found"; + case 405 -> "Method Not Allowed"; + case 406 -> "Not Acceptable"; + case 407 -> "Proxy Authentication Required"; + case 408 -> "Request Timeout"; + case 409 -> "Conflict"; + case 410 -> "Gone"; + case 411 -> "Length Required"; + case 412 -> "Precondition Failed"; + case 413 -> "Request Entity Too Large"; + case 414 -> "Request URI Too Long"; + case 415 -> "Unsupported Media Type"; + case 416 -> "Requested Range Not Satisfiable"; + case 417 -> "Expectation Failed"; + case 429 -> "Too Many Requests"; + case 500 -> "Internal Server Error"; + case 501 -> "Not Implemented"; + case 502 -> "Bad Gateway"; + case 503 -> "Service Unavailable"; + case 504 -> "Gateway Timeout"; + case 505 -> "Version Not Supported"; + case 1000 -> "Connection Error"; + case 1001 -> "Communication Error"; + case 1002 -> "Internal Connector Error"; + default -> null; + }; + + } /** * Returns the related error or exception. @@ -1219,112 +1072,56 @@ public String getUri() { return this.uri; } - switch (this.code) { - case 100: - return BASE_HTTP + "#sec10.1.1"; - case 101: - return BASE_HTTP + "#sec10.1.2"; - case 110: - case 111: - case 112: - case 113: - case 199: - case 214: - case 299: - return "http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46"; - - case 200: - return BASE_HTTP + "#sec10.2.1"; - case 201: - return BASE_HTTP + "#sec10.2.2"; - case 202: - return BASE_HTTP + "#sec10.2.3"; - case 203: - return BASE_HTTP + "#sec10.2.4"; - case 204: - return BASE_HTTP + "#sec10.2.5"; - case 205: - return BASE_HTTP + "#sec10.2.6"; - case 206: - return BASE_HTTP + "#sec10.2.7"; - - case 300: - return BASE_HTTP + "#sec10.3.1"; - case 301: - return BASE_HTTP + "#sec10.3.2"; - case 302: - return BASE_HTTP + "#sec10.3.3"; - case 303: - return BASE_HTTP + "#sec10.3.4"; - case 304: - return BASE_HTTP + "#sec10.3.5"; - case 305: - return BASE_HTTP + "#sec10.3.6"; - case 307: - return BASE_HTTP + "#sec10.3.8"; - - case 400: - return BASE_HTTP + "#sec10.4.1"; - case 401: - return BASE_HTTP + "#sec10.4.2"; - case 402: - return BASE_HTTP + "#sec10.4.3"; - case 403: - return BASE_HTTP + "#sec10.4.4"; - case 404: - return BASE_HTTP + "#sec10.4.5"; - case 405: - return BASE_HTTP + "#sec10.4.6"; - case 406: - return BASE_HTTP + "#sec10.4.7"; - case 407: - return BASE_HTTP + "#sec10.4.8"; - case 408: - return BASE_HTTP + "#sec10.4.9"; - case 409: - return BASE_HTTP + "#sec10.4.10"; - case 410: - return BASE_HTTP + "#sec10.4.11"; - case 411: - return BASE_HTTP + "#sec10.4.12"; - case 412: - return BASE_HTTP + "#sec10.4.13"; - case 413: - return BASE_HTTP + "#sec10.4.14"; - case 414: - return BASE_HTTP + "#sec10.4.15"; - case 415: - return BASE_HTTP + "#sec10.4.16"; - case 416: - return BASE_HTTP + "#sec10.4.17"; - case 417: - return BASE_HTTP + "#sec10.4.18"; - case 429: - return BASE_ADDED_HTTP + "#section-4"; - - case 500: - return BASE_HTTP + "#sec10.5.1"; - case 501: - return BASE_HTTP + "#sec10.5.2"; - case 502: - return BASE_HTTP + "#sec10.5.3"; - case 503: - return BASE_HTTP + "#sec10.5.4"; - case 504: - return BASE_HTTP + "#sec10.5.5"; - case 505: - return BASE_HTTP + "#sec10.5.6"; - - case 1000: - return BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_CONNECTION"; - case 1001: - return BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_COMMUNICATION"; - case 1002: - return BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_INTERNAL"; - } - - return null; - } + return switch (this.code) { + case 100 -> BASE_HTTP + "#sec10.1.1"; + case 101 -> BASE_HTTP + "#sec10.1.2"; + case 110, 111, 112, 113, 199, 214, 299 -> "http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46"; + case 200 -> BASE_HTTP + "#sec10.2.1"; + case 201 -> BASE_HTTP + "#sec10.2.2"; + case 202 -> BASE_HTTP + "#sec10.2.3"; + case 203 -> BASE_HTTP + "#sec10.2.4"; + case 204 -> BASE_HTTP + "#sec10.2.5"; + case 205 -> BASE_HTTP + "#sec10.2.6"; + case 206 -> BASE_HTTP + "#sec10.2.7"; + case 300 -> BASE_HTTP + "#sec10.3.1"; + case 301 -> BASE_HTTP + "#sec10.3.2"; + case 302 -> BASE_HTTP + "#sec10.3.3"; + case 303 -> BASE_HTTP + "#sec10.3.4"; + case 304 -> BASE_HTTP + "#sec10.3.5"; + case 305 -> BASE_HTTP + "#sec10.3.6"; + case 307 -> BASE_HTTP + "#sec10.3.8"; + case 400 -> BASE_HTTP + "#sec10.4.1"; + case 401 -> BASE_HTTP + "#sec10.4.2"; + case 402 -> BASE_HTTP + "#sec10.4.3"; + case 403 -> BASE_HTTP + "#sec10.4.4"; + case 404 -> BASE_HTTP + "#sec10.4.5"; + case 405 -> BASE_HTTP + "#sec10.4.6"; + case 406 -> BASE_HTTP + "#sec10.4.7"; + case 407 -> BASE_HTTP + "#sec10.4.8"; + case 408 -> BASE_HTTP + "#sec10.4.9"; + case 409 -> BASE_HTTP + "#sec10.4.10"; + case 410 -> BASE_HTTP + "#sec10.4.11"; + case 411 -> BASE_HTTP + "#sec10.4.12"; + case 412 -> BASE_HTTP + "#sec10.4.13"; + case 413 -> BASE_HTTP + "#sec10.4.14"; + case 414 -> BASE_HTTP + "#sec10.4.15"; + case 415 -> BASE_HTTP + "#sec10.4.16"; + case 416 -> BASE_HTTP + "#sec10.4.17"; + case 417 -> BASE_HTTP + "#sec10.4.18"; + case 429 -> BASE_ADDED_HTTP + "#section-4"; + case 500 -> BASE_HTTP + "#sec10.5.1"; + case 501 -> BASE_HTTP + "#sec10.5.2"; + case 502 -> BASE_HTTP + "#sec10.5.3"; + case 503 -> BASE_HTTP + "#sec10.5.4"; + case 504 -> BASE_HTTP + "#sec10.5.5"; + case 505 -> BASE_HTTP + "#sec10.5.6"; + case 1000 -> BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_CONNECTION"; + case 1001 -> BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_COMMUNICATION"; + case 1002 -> BASE_RESTLET + "org/restlet/data/Status.html#CONNECTOR_ERROR_INTERNAL"; + default -> null; + }; + + } /** {@inheritDoc} */ @Override diff --git a/org.restlet/src/main/java/org/restlet/data/Tag.java b/org.restlet/src/main/java/org/restlet/data/Tag.java index 0ef0ffc731..a008d74e44 100644 --- a/org.restlet/src/main/java/org/restlet/data/Tag.java +++ b/org.restlet/src/main/java/org/restlet/data/Tag.java @@ -124,18 +124,16 @@ public boolean equals(final Object object) { * @return True if both tags are equal. */ public boolean equals(final Object object, boolean checkWeakness) { - if (!(object instanceof Tag)) { - return false; - } - - final Tag that = (Tag) object; - - if (checkWeakness && that.isWeak() != isWeak()) { - return false; - } - - return Objects.equals(getName(), that.getName()); - } + if (object instanceof Tag that) { + if (checkWeakness && that.isWeak() != isWeak()) { + return false; + } + + return Objects.equals(getName(), that.getName()); + } else { + return false; + } + } /** * Returns tag formatted as an HTTP tag string. diff --git a/org.restlet/src/main/java/org/restlet/data/Warning.java b/org.restlet/src/main/java/org/restlet/data/Warning.java index 60377d4422..ef337faee7 100644 --- a/org.restlet/src/main/java/org/restlet/data/Warning.java +++ b/org.restlet/src/main/java/org/restlet/data/Warning.java @@ -23,7 +23,7 @@ */ public class Warning { - /** The agent. Typically a caching agent. */ + /** The agent. Typically, a caching agent. */ private volatile String agent; /** The warning date. */ diff --git a/org.restlet/src/main/java/org/restlet/engine/Edition.java b/org.restlet/src/main/java/org/restlet/engine/Edition.java index 61038a00cf..d265706824 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Edition.java +++ b/org.restlet/src/main/java/org/restlet/engine/Edition.java @@ -17,10 +17,9 @@ public enum Edition { /** - * Android mobile OS, JEE, JSE, OSGI. + * Android mobile OS, JSE. */ ANDROID("Android", "Android", "Android"), - JEE("Java Enterprise Edition", "Java EE", "JEE"), JSE("Java Standard Edition", "Java SE", "JSE"); /** The current engine edition. */ diff --git a/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java index 934b10801f..d59075ce4c 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -14,6 +14,7 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.util.Enumeration; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; @@ -350,7 +351,7 @@ public static synchronized Engine register() { * @return The registered engine. */ public static synchronized Engine register(boolean discoverPlugins) { - if (Edition.JEE.isNotCurrentEdition() && !logConfigured) { + if (!logConfigured) { configureLog(); } @@ -499,7 +500,7 @@ public org.restlet.engine.connector.ConnectorHelper createHelper( .iterator(); (result == null) && iter.hasNext();) { connector = iter.next(); - if (connector.getProtocols() + if (new HashSet<>(connector.getProtocols()) .containsAll(client.getProtocols())) { if ((helperClass == null) || connector.getClass() .getCanonicalName().equals(helperClass)) { @@ -561,7 +562,7 @@ public org.restlet.engine.connector.ConnectorHelper createHe if ((helperClass == null) || connector.getClass() .getCanonicalName().equals(helperClass)) { - if (connector.getProtocols() + if (new HashSet<>(connector.getProtocols()) .containsAll(server.getProtocols())) { try { result = connector.getClass() @@ -677,9 +678,8 @@ public org.restlet.engine.security.AuthenticatorHelper findHelper( current = helpers.get(i); if (current.getChallengeScheme().equals(challengeScheme) - && ((clientSide && current.isClientSide()) || !clientSide) - && ((serverSide && current.isServerSide()) - || !serverSide)) { + && (!clientSide || current.isClientSide()) + && (!serverSide || current.isServerSide())) { result = helpers.get(i); } } @@ -910,16 +910,15 @@ public void registerHelpers(String descriptorPath, List helpers, .getResources(descriptorPath); if (configUrls != null) { - for (Enumeration configEnum = configUrls; configEnum - .hasMoreElements();) { - registerHelpers(classLoader, configEnum.nextElement(), helpers, + while (configUrls.hasMoreElements()) { + registerHelpers(classLoader, configUrls.nextElement(), helpers, constructorClass); } } } /** - * Registers a factory that is used by the URL class to create the + * Registers a factory used by the URL class to create the * {@link java.net.URLConnection} instances when the * {@link java.net.URL#openConnection()} or * {@link java.net.URL#openStream()} methods are invoked. @@ -934,7 +933,7 @@ public void registerUrlFactory() { new java.net.URLStreamHandlerFactory() { public java.net.URLStreamHandler createURLStreamHandler( String protocol) { - final java.net.URLStreamHandler result = new java.net.URLStreamHandler() { + return new java.net.URLStreamHandler() { @Override protected java.net.URLConnection openConnection( @@ -948,7 +947,7 @@ public void connect() throws IOException { @Override public InputStream getInputStream() throws IOException { - InputStream result = null; + InputStream result1 = null; // Retrieve the current context final Context context = Context @@ -963,19 +962,17 @@ public InputStream getInputStream() if (response.getStatus() .isSuccess()) { - result = response.getEntity() + result1 = response.getEntity() .getStream(); } } - return result; + return result1; } }; } }; - - return result; } }); @@ -1092,7 +1089,7 @@ public void setRegisteredServers( } /** - * Sets the user class loader that should used in priority. + * Sets the user class loader that should be used in priority. * * @param newClassLoader The new user class loader to use. */ diff --git a/org.restlet/src/main/java/org/restlet/engine/adapter/HttpRequest.java b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpRequest.java index 98c7e3b833..699c747d2f 100644 --- a/org.restlet/src/main/java/org/restlet/engine/adapter/HttpRequest.java +++ b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpRequest.java @@ -296,10 +296,10 @@ public ClientInfo getClientInfo() { .getValues(HeaderConstants.HEADER_X_FORWARDED_FOR); if (header != null) { final String[] addresses = header.split(","); - for (int i = 0; i < addresses.length; i++) { - String address = addresses[i].trim(); - result.getForwardedAddresses().add(address); - } + for (String s : addresses) { + String address = s.trim(); + result.getForwardedAddresses().add(address); + } } } } diff --git a/org.restlet/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java index 458b19a7a2..70f94db627 100644 --- a/org.restlet/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/adapter/HttpServerHelper.java @@ -85,22 +85,16 @@ public ServerAdapter getAdapter() { "org.restlet.engine.adapter.ServerAdapter"); this.adapter = (ServerAdapter) Engine.loadClass(adapterClass).getConstructor(Context.class) .newInstance(getContext()); - } catch (IllegalArgumentException e) { - getLogger().log(Level.SEVERE, "Unable to create the HTTP server adapter", e); - } catch (SecurityException e) { - getLogger().log(Level.SEVERE, "Unable to create the HTTP server adapter", e); - } catch (InstantiationException e) { - getLogger().log(Level.SEVERE, "Unable to create the HTTP server adapter", e); - } catch (IllegalAccessException e) { - getLogger().log(Level.SEVERE, "Unable to create the HTTP server adapter", e); - } catch (InvocationTargetException e) { - getLogger().log(Level.SEVERE, "Unable to create the HTTP server adapter", e); - } catch (NoSuchMethodException e) { - getLogger().log(Level.SEVERE, "Unable to create the HTTP server adapter", e); - } catch (ClassNotFoundException e) { + } catch (IllegalArgumentException + | SecurityException + | InstantiationException + | IllegalAccessException + | InvocationTargetException + | NoSuchMethodException + | ClassNotFoundException e) { getLogger().log(Level.SEVERE, "Unable to create the HTTP server adapter", e); } - } + } return this.adapter; } diff --git a/org.restlet/src/main/java/org/restlet/engine/adapter/ServerCall.java b/org.restlet/src/main/java/org/restlet/engine/adapter/ServerCall.java index 98645a67c2..5a73ff07cc 100644 --- a/org.restlet/src/main/java/org/restlet/engine/adapter/ServerCall.java +++ b/org.restlet/src/main/java/org/restlet/engine/adapter/ServerCall.java @@ -92,7 +92,6 @@ public void flushBuffers() throws IOException { * Returns the chain of client SSL certificates, if available and accessible. * * @return The chain of client SSL certificates, if available and accessible. - * @throws SSLPeerUnverifiedException */ public List getCertificates() { return null; diff --git a/org.restlet/src/main/java/org/restlet/engine/application/ApplicationHelper.java b/org.restlet/src/main/java/org/restlet/engine/application/ApplicationHelper.java index b88531650b..f204bab732 100644 --- a/org.restlet/src/main/java/org/restlet/engine/application/ApplicationHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/application/ApplicationHelper.java @@ -102,7 +102,7 @@ public synchronized void start() throws Exception { getLogger().fine( "By default, an application should be attached to a parent component in order to let application's outbound root handle calls properly."); setOutboundNext(new Restlet() { - Map clients = new ConcurrentHashMap(); + final Map clients = new ConcurrentHashMap(); @Override public void handle(Request request, Response response) { diff --git a/org.restlet/src/main/java/org/restlet/engine/application/Encoder.java b/org.restlet/src/main/java/org/restlet/engine/application/Encoder.java index cb9737f7b8..a4736ba441 100644 --- a/org.restlet/src/main/java/org/restlet/engine/application/Encoder.java +++ b/org.restlet/src/main/java/org/restlet/engine/application/Encoder.java @@ -127,22 +127,22 @@ public Encoding getBestEncoding(ClientInfo client) { Preference currentPref = null; float bestScore = 0F; - for (Iterator iter = getSupportedEncodings().iterator(); iter.hasNext();) { - currentEncoding = iter.next(); - - for (Iterator> iter2 = client.getAcceptedEncodings().iterator(); iter2.hasNext();) { - currentPref = iter2.next(); - - if (currentPref.getMetadata().equals(Encoding.ALL) - || currentPref.getMetadata().equals(currentEncoding)) { - // A match was found, compute its score - if (currentPref.getQuality() > bestScore) { - bestScore = currentPref.getQuality(); - bestEncoding = currentEncoding; - } - } - } - } + for (Encoding encoding : getSupportedEncodings()) { + currentEncoding = encoding; + + for (Preference encodingPreference : client.getAcceptedEncodings()) { + currentPref = encodingPreference; + + if (currentPref.getMetadata().equals(Encoding.ALL) + || currentPref.getMetadata().equals(currentEncoding)) { + // A match was found, compute its score + if (currentPref.getQuality() > bestScore) { + bestScore = currentPref.getQuality(); + bestEncoding = currentEncoding; + } + } + } + } return bestEncoding; } diff --git a/org.restlet/src/main/java/org/restlet/engine/application/StatusFilter.java b/org.restlet/src/main/java/org/restlet/engine/application/StatusFilter.java index a1c6e02438..1b8254939d 100644 --- a/org.restlet/src/main/java/org/restlet/engine/application/StatusFilter.java +++ b/org.restlet/src/main/java/org/restlet/engine/application/StatusFilter.java @@ -111,13 +111,15 @@ protected int doHandle(Request request, Response response) { } catch (Throwable throwable) { Status status = getStatusService().toStatus(throwable, request, response); - Level level = Level.INFO; + final Level level; if (status.isServerError()) { level = Level.WARNING; } else if (status.isConnectorError()) { level = Level.INFO; } else if (status.isClientError()) { level = Level.FINE; + } else { + level = Level.FINE; } getLogger().log(level, "Exception or error caught by status service", throwable); diff --git a/org.restlet/src/main/java/org/restlet/engine/application/TunnelFilter.java b/org.restlet/src/main/java/org/restlet/engine/application/TunnelFilter.java index 43b538232e..69b7a008d9 100644 --- a/org.restlet/src/main/java/org/restlet/engine/application/TunnelFilter.java +++ b/org.restlet/src/main/java/org/restlet/engine/application/TunnelFilter.java @@ -561,20 +561,18 @@ private void processUserAgent(Request request) { * @param metadata The metadata to use. */ private void updateMetadata(ClientInfo clientInfo, Metadata metadata) { - if (metadata != null) { - if (metadata instanceof CharacterSet) { - clientInfo.getAcceptedCharacterSets().clear(); - clientInfo.getAcceptedCharacterSets().add(new Preference<>((CharacterSet) metadata)); - } else if (metadata instanceof Encoding) { - clientInfo.getAcceptedEncodings().clear(); - clientInfo.getAcceptedEncodings().add(new Preference<>((Encoding) metadata)); - } else if (metadata instanceof Language) { - clientInfo.getAcceptedLanguages().clear(); - clientInfo.getAcceptedLanguages().add(new Preference<>((Language) metadata)); - } else if (metadata instanceof MediaType) { - clientInfo.getAcceptedMediaTypes().clear(); - clientInfo.getAcceptedMediaTypes().add(new Preference<>((MediaType) metadata)); - } + if (metadata instanceof CharacterSet) { + clientInfo.getAcceptedCharacterSets().clear(); + clientInfo.getAcceptedCharacterSets().add(new Preference<>((CharacterSet) metadata)); + } else if (metadata instanceof Encoding) { + clientInfo.getAcceptedEncodings().clear(); + clientInfo.getAcceptedEncodings().add(new Preference<>((Encoding) metadata)); + } else if (metadata instanceof Language) { + clientInfo.getAcceptedLanguages().clear(); + clientInfo.getAcceptedLanguages().add(new Preference<>((Language) metadata)); + } else if (metadata instanceof MediaType) { + clientInfo.getAcceptedMediaTypes().clear(); + clientInfo.getAcceptedMediaTypes().add(new Preference<>((MediaType) metadata)); } } diff --git a/org.restlet/src/main/java/org/restlet/engine/component/ComponentHelper.java b/org.restlet/src/main/java/org/restlet/engine/component/ComponentHelper.java index 4e7a6ce5a1..d8d5d75c2c 100644 --- a/org.restlet/src/main/java/org/restlet/engine/component/ComponentHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/component/ComponentHelper.java @@ -57,8 +57,7 @@ private boolean checkVirtualHost(VirtualHost host) throws Exception { for (Route route : host.getRoutes()) { Restlet next = route.getNext(); - if (next instanceof Application) { - Application application = (Application) next; + if (next instanceof Application application) { if (application.getConnectorService() != null) { if (application.getConnectorService().getClientProtocols() != null) { diff --git a/org.restlet/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java b/org.restlet/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java index ebc3dd74e6..ea7b943387 100644 --- a/org.restlet/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java +++ b/org.restlet/src/main/java/org/restlet/engine/component/ComponentServerDispatcher.java @@ -49,11 +49,10 @@ public int beforeHandle(Request request, Response response) { @Override protected int doHandle(Request request, Response response) { - int result = CONTINUE; - // Ask the server router to actually handle the call + // Ask the server router to actually handle the call getComponentContext().getComponentHelper().getServerRouter().handle(request, response); - return result; + return CONTINUE; } /** diff --git a/org.restlet/src/main/java/org/restlet/engine/converter/ConverterHelper.java b/org.restlet/src/main/java/org/restlet/engine/converter/ConverterHelper.java index 15ff41d6a3..2c814d059f 100644 --- a/org.restlet/src/main/java/org/restlet/engine/converter/ConverterHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/converter/ConverterHelper.java @@ -55,7 +55,7 @@ protected List> addObjectClass(List> objectClasses, Class o protected List addVariant(List variants, VariantInfo userVariant) { if (userVariant != null) { if (variants == null) { - variants = new ArrayList(); + variants = new ArrayList<>(); } variants.add(userVariant); diff --git a/org.restlet/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java b/org.restlet/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java index 4a90958189..2d99dc67b1 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/ChallengeRequestReader.java @@ -38,7 +38,7 @@ public ChallengeRequest readValue() throws IOException { ChallengeRequest result = null; // The challenge is that this header is a comma separated lst of - // challenges, and that each challenges is also a comma separated list, + // challenges, and that each challenge is also a comma separated list, // but of parameters. skipSpaces(); if (peek() != -1) { diff --git a/org.restlet/src/main/java/org/restlet/engine/header/CookieReader.java b/org.restlet/src/main/java/org/restlet/engine/header/CookieReader.java index 1f71ab7a0d..02ef717ef5 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/CookieReader.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/CookieReader.java @@ -77,10 +77,10 @@ private Parameter readPair(boolean readAttribute) throws IOException { nextChar = read(); if (readingName) { - if ((HeaderUtils.isSpace(nextChar)) && (nameBuffer.length() == 0)) { + if ((HeaderUtils.isSpace(nextChar)) && (nameBuffer.isEmpty())) { // Skip spaces } else if ((nextChar == -1) || (nextChar == ';') || (nextChar == ',')) { - if (nameBuffer.length() > 0) { + if (!nameBuffer.isEmpty()) { // End of pair with no value result = Parameter.create(nameBuffer, null); } else if (nextChar == -1) { @@ -91,7 +91,7 @@ private Parameter readPair(boolean readAttribute) throws IOException { } else if (nextChar == '=') { readingName = false; } else if (HeaderUtils.isTokenChar(nextChar) || (this.globalVersion < 1)) { - if (readAttribute && nextChar != '$' && (nameBuffer.length() == 0)) { + if (readAttribute && nextChar != '$' && (nameBuffer.isEmpty())) { unread(); nextChar = -1; } else { @@ -103,12 +103,12 @@ private Parameter readPair(boolean readAttribute) throws IOException { } } else { // reading value - if ((HeaderUtils.isSpace(nextChar)) && (valueBuffer.length() == 0)) { + if ((HeaderUtils.isSpace(nextChar)) && (valueBuffer.isEmpty())) { // Skip spaces } else if ((nextChar == -1) || (nextChar == ';')) { // End of pair result = Parameter.create(nameBuffer, valueBuffer); - } else if ((nextChar == '"') && (valueBuffer.length() == 0)) { + } else if ((nextChar == '"') && (valueBuffer.isEmpty())) { // Step back unread(); valueBuffer.append(readQuotedString()); diff --git a/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingReader.java b/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingReader.java index 16a1bac49b..ba363166e2 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingReader.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingReader.java @@ -54,7 +54,7 @@ public class CookieSettingReader extends HeaderReader { * * @param cookieSetting * @return the CookieSetting parsed from the String - * @throws IllegalArgumentException Thrown if the String can not be parsed as + * @throws IllegalArgumentException Thrown if the String cannot be parsed as * CookieSetting. */ public static CookieSetting read(String cookieSetting) throws IllegalArgumentException { @@ -108,10 +108,10 @@ private Parameter readPair() throws IOException { nextChar = read(); if (readingName) { - if ((HeaderUtils.isSpace(nextChar)) && (nameBuffer.length() == 0)) { + if ((HeaderUtils.isSpace(nextChar)) && (nameBuffer.isEmpty())) { // Skip spaces } else if ((nextChar == -1) || (nextChar == ';') || (nextChar == ',')) { - if (nameBuffer.length() > 0) { + if (!nameBuffer.isEmpty()) { // End of pair with no value result = Parameter.create(nameBuffer, null); } else if (nextChar == -1) { @@ -129,12 +129,12 @@ private Parameter readPair() throws IOException { } } else { // reading value - if ((HeaderUtils.isSpace(nextChar)) && (valueBuffer.length() == 0)) { + if ((HeaderUtils.isSpace(nextChar)) && (valueBuffer.isEmpty())) { // Skip spaces } else if ((nextChar == -1) || (nextChar == ';')) { // End of pair result = Parameter.create(nameBuffer, valueBuffer); - } else if ((nextChar == '"') && (valueBuffer.length() == 0)) { + } else if ((nextChar == '"') && (valueBuffer.isEmpty())) { // Step back unread(); valueBuffer.append(readQuotedString()); @@ -201,7 +201,7 @@ public CookieSetting readValue() throws IOException { } } else if (pair.getName().equalsIgnoreCase(NAME_SET_MAX_AGE)) { try { - result.setMaxAge(Integer.valueOf(pair.getValue())); + result.setMaxAge(Integer.parseInt(pair.getValue())); } catch (NumberFormatException numberFormatException) { result.setMaxAge(Integer.MAX_VALUE); Context.getCurrentLogger().warning("Unable to parse the cookie setting max-age value \"" @@ -218,7 +218,7 @@ public CookieSetting readValue() throws IOException { result.setAccessRestricted(true); } } else if (pair.getName().equalsIgnoreCase(NAME_SET_VERSION)) { - result.setVersion(Integer.valueOf(pair.getValue())); + result.setVersion(Integer.parseInt(pair.getValue())); } else { // Unexpected special attribute // Silently ignore it as it may have been introduced by new specifications diff --git a/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingWriter.java index 6ae88f2027..0b11bb34ac 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingWriter.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/CookieSettingWriter.java @@ -48,14 +48,14 @@ public CookieSettingWriter append(CookieSetting cookieSetting) throws IllegalArg String value = cookieSetting.getValue(); int version = cookieSetting.getVersion(); - if ((name == null) || (name.length() == 0)) { + if ((name == null) || (name.isEmpty())) { throw new IllegalArgumentException("Can't write cookie. Invalid name detected"); } append(name).append('='); // Append the value - if ((value != null) && (value.length() > 0)) { + if ((value != null) && (!value.isEmpty())) { appendValue(value, version); } @@ -68,7 +68,7 @@ public CookieSettingWriter append(CookieSetting cookieSetting) throws IllegalArg // Append the path String path = cookieSetting.getPath(); - if ((path != null) && (path.length() > 0)) { + if ((path != null) && (!path.isEmpty())) { append("; Path="); if (version == 0) { @@ -106,7 +106,7 @@ public CookieSettingWriter append(CookieSetting cookieSetting) throws IllegalArg // Append the domain String domain = cookieSetting.getDomain(); - if ((domain != null) && (domain.length() > 0)) { + if ((domain != null) && (!domain.isEmpty())) { append("; Domain="); appendValue(domain.toLowerCase(), version); } @@ -125,7 +125,7 @@ public CookieSettingWriter append(CookieSetting cookieSetting) throws IllegalArg if (version > 0) { String comment = cookieSetting.getComment(); - if ((comment != null) && (comment.length() > 0)) { + if ((comment != null) && (!comment.isEmpty())) { append("; Comment="); appendValue(comment, version); } diff --git a/org.restlet/src/main/java/org/restlet/engine/header/CookieWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/CookieWriter.java index cc40da25ef..e812e42ba7 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/CookieWriter.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/CookieWriter.java @@ -68,14 +68,14 @@ public CookieWriter append(Cookie cookie) throws IllegalArgumentException { String value = cookie.getValue(); int version = cookie.getVersion(); - if ((name == null) || (name.length() == 0)) { + if ((name == null) || (name.isEmpty())) { throw new IllegalArgumentException("Can't write cookie. Invalid name detected"); } appendValue(name, 0).append('='); // Append the value - if ((value != null) && (value.length() > 0)) { + if ((value != null) && (!value.isEmpty())) { appendValue(value, version); } @@ -83,7 +83,7 @@ public CookieWriter append(Cookie cookie) throws IllegalArgumentException { // Append the path String path = cookie.getPath(); - if ((path != null) && (path.length() > 0)) { + if ((path != null) && (!path.isEmpty())) { append("; $Path="); appendQuotedString(path); } @@ -91,7 +91,7 @@ public CookieWriter append(Cookie cookie) throws IllegalArgumentException { // Append the domain String domain = cookie.getDomain(); - if ((domain != null) && (domain.length() > 0)) { + if ((domain != null) && (!domain.isEmpty())) { append("; $Domain="); appendQuotedString(domain); } diff --git a/org.restlet/src/main/java/org/restlet/engine/header/DispositionReader.java b/org.restlet/src/main/java/org/restlet/engine/header/DispositionReader.java index 37e857182d..e23228807a 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/DispositionReader.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/DispositionReader.java @@ -35,7 +35,7 @@ public Disposition readValue() throws IOException { Disposition result = null; String type = readToken(); - if (type.length() > 0) { + if (!type.isEmpty()) { result = new Disposition(); result.setType(type); diff --git a/org.restlet/src/main/java/org/restlet/engine/header/ExpectationWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/ExpectationWriter.java index 8fbc4b23f3..1b200bb3d0 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/ExpectationWriter.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/ExpectationWriter.java @@ -33,7 +33,7 @@ public static String write(List expectations) { @Override public ExpectationWriter append(Expectation expectation) { - if ((expectation.getName() != null) && (expectation.getName().length() > 0)) { + if ((expectation.getName() != null) && (!expectation.getName().isEmpty())) { appendExtension(expectation); if (!expectation.getParameters().isEmpty()) { diff --git a/org.restlet/src/main/java/org/restlet/engine/header/HeaderReader.java b/org.restlet/src/main/java/org/restlet/engine/header/HeaderReader.java index 4ea632f01d..c5b2794fae 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/HeaderReader.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/HeaderReader.java @@ -42,7 +42,7 @@ public class HeaderReader { * @param resultClass The named value class to return. * @return The new named value. */ - private static final > NV createNamedValue(Class resultClass, String name) { + private static > NV createNamedValue(Class resultClass, String name) { return createNamedValue(resultClass, name, null); } @@ -89,7 +89,7 @@ public static Date readDate(String date, boolean cookie) { public static Header readHeader(CharSequence header) throws IOException { Header result = null; - if (header.length() > 0) { + if (!header.isEmpty()) { // Detect the end of headers int start = 0; int index = 0; @@ -221,7 +221,7 @@ public static Header readHeader(InputStream is, StringBuilder sb) throws IOExcep */ public HeaderReader(String header) { this.header = header; - this.index = ((header == null) || (header.length() == 0)) ? -1 : 0; + this.index = ((header == null) || (header.isEmpty())) ? -1 : 0; this.mark = index; } @@ -435,20 +435,20 @@ public > NV readNamedValue(Class resultClass) String name = readToken(); int nextChar = read(); - if (name.length() > 0) { - if (nextChar == '=') { - // The parameter has a value - result = createNamedValue(resultClass, name, readActualNamedValue()); - } else { - // The parameter has not value - unread(); - result = createNamedValue(resultClass, name); - } - } else { - throw new IOException("Parameter or extension has no name. Please check your value"); - } - - return result; + if (name.isEmpty()) { + throw new IOException("Parameter or extension has no name. Please check your value"); + } else { + if (nextChar == '=') { + // The parameter has a value + result = createNamedValue(resultClass, name, readActualNamedValue()); + } else { + // The parameter has no value + unread(); + result = createNamedValue(resultClass, name); + } + } + + return result; } /** diff --git a/org.restlet/src/main/java/org/restlet/engine/header/HeaderWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/HeaderWriter.java index 1c7c547046..c46c82332e 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/HeaderWriter.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/HeaderWriter.java @@ -154,10 +154,10 @@ public HeaderWriter appendExtension(NamedValue extension) { * @return This writer. */ public HeaderWriter appendExtension(String name, String value) { - if ((name != null) && (name.length() > 0)) { + if ((name != null) && (!name.isEmpty())) { append(name); - if ((value != null) && (value.length() > 0)) { + if ((value != null) && (!value.isEmpty())) { append("="); if (HeaderUtils.isToken(value)) { @@ -214,7 +214,7 @@ public HeaderWriter appendQuotedPair(char character) { * @return This writer. */ public HeaderWriter appendQuotedString(String content) { - if ((content != null) && (content.length() > 0)) { + if ((content != null) && (!content.isEmpty())) { append('"'); char c; diff --git a/org.restlet/src/main/java/org/restlet/engine/header/ProductReader.java b/org.restlet/src/main/java/org/restlet/engine/header/ProductReader.java index ae13ef82f3..b8a4a7470c 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/ProductReader.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/ProductReader.java @@ -103,7 +103,7 @@ public static List read(String userAgent) throws IllegalArgumentExcepti version = versionBuilder.toString(); result.add(new Product(token, version, null)); } else { - if (insideToken && (tokenBuilder.length() > 0)) { + if (insideToken && (!tokenBuilder.isEmpty())) { token = tokenBuilder.toString(); result.add(new Product(token, null, null)); } diff --git a/org.restlet/src/main/java/org/restlet/engine/header/ProductWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/ProductWriter.java index 25f18ebc49..ba90f6cb4d 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/ProductWriter.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/ProductWriter.java @@ -33,7 +33,7 @@ public static String write(List products) { for (Iterator iterator = products.iterator(); iterator.hasNext();) { Product product = iterator.next(); - if ((product.getName() == null) || (product.getName().length() == 0)) { + if ((product.getName() == null) || (product.getName().isEmpty())) { throw new IllegalArgumentException("Product name cannot be null."); } diff --git a/org.restlet/src/main/java/org/restlet/engine/header/RangeReader.java b/org.restlet/src/main/java/org/restlet/engine/header/RangeReader.java index dc117a4d34..f82a34cbee 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/RangeReader.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/RangeReader.java @@ -64,25 +64,25 @@ public static List read(String rangeHeader) { rangeHeader = rangeHeader.substring(prefix.length()); String[] array = rangeHeader.split(","); - for (int i = 0; i < array.length; i++) { - String value = array[i].trim(); - long index = 0; - long length = 0; - if (value.startsWith("-")) { - index = Range.INDEX_LAST; - length = Long.parseLong(value.substring(1)); - } else if (value.endsWith("-")) { - index = Long.parseLong(value.substring(0, value.length() - 1)); - length = Range.SIZE_MAX; - } else { - String[] tab = value.split("-"); - if (tab.length == 2) { - index = Long.parseLong(tab[0]); - length = Long.parseLong(tab[1]) - index + 1; - } - } - result.add(new Range(index, length)); - } + for (String s : array) { + String value = s.trim(); + long index = 0; + long length = 0; + if (value.startsWith("-")) { + index = Range.INDEX_LAST; + length = Long.parseLong(value.substring(1)); + } else if (value.endsWith("-")) { + index = Long.parseLong(value.substring(0, value.length() - 1)); + length = Range.SIZE_MAX; + } else { + String[] tab = value.split("-"); + if (tab.length == 2) { + index = Long.parseLong(tab[0]); + length = Long.parseLong(tab[1]) - index + 1; + } + } + result.add(new Range(index, length)); + } } return result; diff --git a/org.restlet/src/main/java/org/restlet/engine/header/WarningWriter.java b/org.restlet/src/main/java/org/restlet/engine/header/WarningWriter.java index 4d1891f7b0..3d7f3348b8 100644 --- a/org.restlet/src/main/java/org/restlet/engine/header/WarningWriter.java +++ b/org.restlet/src/main/java/org/restlet/engine/header/WarningWriter.java @@ -40,11 +40,11 @@ public WarningWriter append(Warning warning) { throw new IllegalArgumentException("Can't write warning. Invalid status code detected"); } - if ((agent == null) || (agent.length() == 0)) { + if ((agent == null) || (agent.isEmpty())) { throw new IllegalArgumentException("Can't write warning. Invalid agent detected"); } - if ((text == null) || (text.length() == 0)) { + if ((text == null) || (text.isEmpty())) { throw new IllegalArgumentException("Can't write warning. Invalid text detected"); } diff --git a/org.restlet/src/main/java/org/restlet/engine/io/PipeStream.java b/org.restlet/src/main/java/org/restlet/engine/io/PipeStream.java index e7027e017e..d81151b765 100644 --- a/org.restlet/src/main/java/org/restlet/engine/io/PipeStream.java +++ b/org.restlet/src/main/java/org/restlet/engine/io/PipeStream.java @@ -57,7 +57,7 @@ public int read() throws IOException { throw new IOException("Timeout while reading from the queue-based input stream"); } else { this.endReached = (value == -1); - return value.intValue(); + return value; } } catch (InterruptedException ie) { throw new IOException("Interruption occurred while writing in the queue"); diff --git a/org.restlet/src/main/java/org/restlet/engine/io/WriterOutputStream.java b/org.restlet/src/main/java/org/restlet/engine/io/WriterOutputStream.java index e22ec6a456..b184bf6d49 100644 --- a/org.restlet/src/main/java/org/restlet/engine/io/WriterOutputStream.java +++ b/org.restlet/src/main/java/org/restlet/engine/io/WriterOutputStream.java @@ -17,6 +17,7 @@ import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; /** * Output stream wrapping a character writer. @@ -40,7 +41,7 @@ public class WriterOutputStream extends OutputStream { */ public WriterOutputStream(Writer writer, CharacterSet characterSet) { this.writer = writer; - this.charSet = (characterSet == null) ? Charset.forName("ISO-8859-1") : characterSet.toCharset(); + this.charSet = (characterSet == null) ? StandardCharsets.ISO_8859_1 : characterSet.toCharset(); } @Override diff --git a/org.restlet/src/main/java/org/restlet/engine/local/DirectoryServerResource.java b/org.restlet/src/main/java/org/restlet/engine/local/DirectoryServerResource.java index 6c3153a6a2..35c2ce4a27 100644 --- a/org.restlet/src/main/java/org/restlet/engine/local/DirectoryServerResource.java +++ b/org.restlet/src/main/java/org/restlet/engine/local/DirectoryServerResource.java @@ -460,32 +460,29 @@ protected Response getRepresentation(String resourceUri, MediaType acceptedMedia } /** - * Allows to sort the list of representations set by the resource. + * Allows sorting the list of representations set by the resource. * * @return A Comparator instance imposing a sort order of representations or * null if no special order is wanted. */ private Comparator getRepresentationsComparator() { // Sort the list of representations by their identifier. - Comparator identifiersComparator = new Comparator() { - public int compare(Representation rep0, Representation rep1) { - boolean bRep0Null = (rep0.getLocationRef() == null); - boolean bRep1Null = (rep1.getLocationRef() == null); - - if (bRep0Null && bRep1Null) { - return 0; - } - if (bRep0Null) { - return -1; - } - if (bRep1Null) { - return 1; - } - - return rep0.getLocationRef().getLastSegment().compareTo(rep1.getLocationRef().getLastSegment()); - } - }; - return identifiersComparator; + return (rep0, rep1) -> { + boolean bRep0Null = (rep0.getLocationRef() == null); + boolean bRep1Null = (rep1.getLocationRef() == null); + + if (bRep0Null && bRep1Null) { + return 0; + } + if (bRep0Null) { + return -1; + } + if (bRep1Null) { + return 1; + } + + return rep0.getLocationRef().getLastSegment().compareTo(rep1.getLocationRef().getLastSegment()); + }; } /** diff --git a/org.restlet/src/main/java/org/restlet/engine/local/EntityClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/EntityClientHelper.java index a045b994be..b23b57e479 100644 --- a/org.restlet/src/main/java/org/restlet/engine/local/EntityClientHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/local/EntityClientHelper.java @@ -50,9 +50,8 @@ public EntityClientHelper(Client client) { */ public Reference createReference(String scheme, String encodedParentDirPath, String encodedEntityName, String decodedVariantName) { - Reference result = new Reference(scheme + "://" + encodedParentDirPath + "/" + return new Reference(scheme + "://" + encodedParentDirPath + "/" + getReencodedVariantEntityName(encodedEntityName, decodedVariantName)); - return result; } /** diff --git a/org.restlet/src/main/java/org/restlet/engine/local/FileClientHelper.java b/org.restlet/src/main/java/org/restlet/engine/local/FileClientHelper.java index 000e290012..965ec5f7bc 100644 --- a/org.restlet/src/main/java/org/restlet/engine/local/FileClientHelper.java +++ b/org.restlet/src/main/java/org/restlet/engine/local/FileClientHelper.java @@ -25,10 +25,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; +import java.util.*; import static java.lang.String.format; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; @@ -116,7 +113,7 @@ private boolean checkMetadataConsistency(String fileName, Representation represe // "var" contains the theoretical correct metadata if (!var.getLanguages().isEmpty() && !representation.getLanguages().isEmpty() - && !var.getLanguages().containsAll(representation.getLanguages())) { + && !new HashSet<>(var.getLanguages()).containsAll(representation.getLanguages())) { return false; } @@ -126,7 +123,7 @@ private boolean checkMetadataConsistency(String fileName, Representation represe } if (!var.getEncodings().isEmpty() && !representation.getEncodings().isEmpty() - && !var.getEncodings().containsAll(representation.getEncodings())) { + && !new HashSet<>(var.getEncodings()).containsAll(representation.getEncodings())) { return false; } } @@ -567,22 +564,18 @@ private void updateFileExtension(StringBuilder fileName, Metadata metadata) { boolean defaultMetadata = true; if (getMetadataService() != null) { - if (metadata instanceof Language) { - Language language = (Language) metadata; + if (metadata instanceof Language language) { defaultMetadata = language.equals(getMetadataService().getDefaultLanguage()); - } else if (metadata instanceof MediaType) { - MediaType mediaType = (MediaType) metadata; + } else if (metadata instanceof MediaType mediaType) { defaultMetadata = mediaType.equals(getMetadataService().getDefaultMediaType()); - } else if (metadata instanceof CharacterSet) { - CharacterSet characterSet = (CharacterSet) metadata; + } else if (metadata instanceof CharacterSet characterSet) { defaultMetadata = characterSet.equals(getMetadataService().getDefaultCharacterSet()); - } else if (metadata instanceof Encoding) { - Encoding encoding = (Encoding) metadata; + } else if (metadata instanceof Encoding encoding) { defaultMetadata = encoding.equals(getMetadataService().getDefaultEncoding()); } } - // We only add extension for metadata that differs from default ones + // We only add an extension for metadata that differs from default ones if (!defaultMetadata) { String extension = getMetadataService().getExtension(metadata); diff --git a/org.restlet/src/main/java/org/restlet/engine/log/IdentClient.java b/org.restlet/src/main/java/org/restlet/engine/log/IdentClient.java index f4f33e3e2e..7b42ad3c24 100644 --- a/org.restlet/src/main/java/org/restlet/engine/log/IdentClient.java +++ b/org.restlet/src/main/java/org/restlet/engine/log/IdentClient.java @@ -53,9 +53,7 @@ public IdentClient(String clientAddress, int clientPort, int serverPort) { BufferedReader in = null; try { // Compose the IDENT request - final StringBuilder sb = new StringBuilder(); - sb.append(clientPort).append(" , ").append(serverPort).append("\r\n"); - final String request = sb.toString(); + final String request = clientPort + " , " + serverPort + "\r\n"; // Send the request to the remote server socket = new Socket(); diff --git a/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationInfo.java b/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationInfo.java index ab0334c0ea..6c883cab02 100644 --- a/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationInfo.java +++ b/org.restlet/src/main/java/org/restlet/engine/resource/AnnotationInfo.java @@ -195,8 +195,7 @@ protected Class getJavaActualType(Class initialType, Type genericType) { Class result = initialType; try { - if (genericType instanceof TypeVariable) { - TypeVariable genericTypeVariable = (TypeVariable) genericType; + if (genericType instanceof TypeVariable genericTypeVariable) { String genericTypeName = genericTypeVariable.getName(); result = getJavaActualType(getJavaClass(), genericTypeName); } diff --git a/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java b/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java index 28582170b3..43d91bab05 100644 --- a/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java +++ b/org.restlet/src/main/java/org/restlet/engine/resource/MethodAnnotationInfo.java @@ -251,7 +251,7 @@ private List getVariants(MetadataService metadataService, String annota StringTokenizer stExtension = new StringTokenizer(variantValue, "\\+"); while (stExtension.hasMoreTokens()) { String extension = stExtension.nextToken().trim(); - if (extension == null) { + if (extension.isEmpty()) { continue; } diff --git a/org.restlet/src/main/java/org/restlet/engine/ssl/SslUtils.java b/org.restlet/src/main/java/org/restlet/engine/ssl/SslUtils.java index 5a6d505904..14474389e3 100644 --- a/org.restlet/src/main/java/org/restlet/engine/ssl/SslUtils.java +++ b/org.restlet/src/main/java/org/restlet/engine/ssl/SslUtils.java @@ -52,41 +52,39 @@ public static Integer extractKeySize(String sslCipherSuite) { * 8 8 RC4_40 Stream 5 16 40 0 N/A RC4_128 Stream 16 16 128 0 N/A DES40_CBC * Block 5 8 40 8 8 DES_CBC Block 8 8 56 8 8 3DES_EDE_CBC Block 24 24 168 8 8 */ - if (encAlgorithm != null) { - if (encAlgorithm.startsWith("NULL_")) { - keySize = Integer.valueOf(0); - } else if (encAlgorithm.startsWith("IDEA_CBC_")) { - keySize = Integer.valueOf(128); - } else if (encAlgorithm.startsWith("RC2_CBC_40_")) { - keySize = Integer.valueOf(40); - } else if (encAlgorithm.startsWith("RC4_40_")) { - keySize = Integer.valueOf(40); - } else if (encAlgorithm.startsWith("RC4_128_")) { - keySize = Integer.valueOf(128); - } else if (encAlgorithm.startsWith("DES40_CBC_")) { - keySize = Integer.valueOf(40); - } else if (encAlgorithm.startsWith("DES_CBC_")) { - keySize = Integer.valueOf(56); - } else if (encAlgorithm.startsWith("3DES_EDE_CBC_")) { - keySize = Integer.valueOf(168); - } else { - final StringTokenizer st = new StringTokenizer(encAlgorithm, "_"); - - while (st.hasMoreTokens()) { - try { - keySize = Integer.valueOf(st.nextToken()); - break; - } catch (NumberFormatException e) { - // Tokens that are not integers are ignored. - } - } - } - - if (keySize != null) { - keySizesCache.put(sslCipherSuite, keySize); - } - } - } + if (encAlgorithm.startsWith("NULL_")) { + keySize = 0; + } else if (encAlgorithm.startsWith("IDEA_CBC_")) { + keySize = 128; + } else if (encAlgorithm.startsWith("RC2_CBC_40_")) { + keySize = 40; + } else if (encAlgorithm.startsWith("RC4_40_")) { + keySize = 40; + } else if (encAlgorithm.startsWith("RC4_128_")) { + keySize = 128; + } else if (encAlgorithm.startsWith("DES40_CBC_")) { + keySize = 40; + } else if (encAlgorithm.startsWith("DES_CBC_")) { + keySize = 56; + } else if (encAlgorithm.startsWith("3DES_EDE_CBC_")) { + keySize = 168; + } else { + final StringTokenizer st = new StringTokenizer(encAlgorithm, "_"); + + while (st.hasMoreTokens()) { + try { + keySize = Integer.valueOf(st.nextToken()); + break; + } catch (NumberFormatException e) { +// Tokens that are not integers are ignored. + } + } + } + + if (keySize != null) { + keySizesCache.put(sslCipherSuite, keySize); + } + } } return keySize; diff --git a/org.restlet/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java b/org.restlet/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java index 550322edcb..c3101106c8 100644 --- a/org.restlet/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java +++ b/org.restlet/src/main/java/org/restlet/engine/util/ChildClientDispatcher.java @@ -58,8 +58,8 @@ public int doHandle(Request request, Response response) { LocalReference cr = new LocalReference(request.getResourceRef()); if (cr.getRiapAuthorityType() == LocalReference.RIAP_APPLICATION) { - if ((getChildContext() != null) && (getChildContext().getChild() instanceof Application)) { - Application application = (Application) getChildContext().getChild(); + if ((getChildContext() != null) + && (getChildContext().getChild() instanceof Application application)) { request.getResourceRef().setBaseRef(request.getResourceRef().getHostIdentifier()); application.getInboundRoot().handle(request, response); } @@ -73,8 +73,8 @@ public int doHandle(Request request, Response response) { result = STOP; } } else { - if ((getChildContext() != null) && (getChildContext().getChild() instanceof Application)) { - Application application = (Application) getChildContext().getChild(); + if ((getChildContext() != null) + && (getChildContext().getChild() instanceof Application application)) { if (!application.getConnectorService().getClientProtocols().contains(protocol)) { getLogger().fine( diff --git a/org.restlet/src/main/java/org/restlet/engine/util/EngineClassLoader.java b/org.restlet/src/main/java/org/restlet/engine/util/EngineClassLoader.java index 93646727ff..ab92cdb16b 100644 --- a/org.restlet/src/main/java/org/restlet/engine/util/EngineClassLoader.java +++ b/org.restlet/src/main/java/org/restlet/engine/util/EngineClassLoader.java @@ -149,7 +149,7 @@ public Enumeration getResources(String name) throws IOException { while (allUrls.hasMoreElements()) { url = allUrls.nextElement(); - if (result.indexOf(url) == -1) { + if (!result.contains(url)) { result.add(url); } } diff --git a/org.restlet/src/main/java/org/restlet/engine/util/FormReader.java b/org.restlet/src/main/java/org/restlet/engine/util/FormReader.java index 3311119a0d..bdc8c28732 100644 --- a/org.restlet/src/main/java/org/restlet/engine/util/FormReader.java +++ b/org.restlet/src/main/java/org/restlet/engine/util/FormReader.java @@ -223,13 +223,13 @@ public Parameter readNextParameter() throws IOException { if (readingName) { if (nextChar == '=') { - if (nameBuffer.length() > 0) { + if (!nameBuffer.isEmpty()) { readingName = false; } else { throw new IOException("Empty parameter name detected. Please check your form data"); } } else if (endOfCurrentParameterReached(nextChar)) { - if (nameBuffer.length() > 0) { + if (!nameBuffer.isEmpty()) { result = FormUtils.create(nameBuffer, null, this.decode, this.characterSet); } else if (nextChar == -1) { // Do nothing return null preference diff --git a/org.restlet/src/main/java/org/restlet/engine/util/StringUtils.java b/org.restlet/src/main/java/org/restlet/engine/util/StringUtils.java index 44deac01b6..d836193698 100644 --- a/org.restlet/src/main/java/org/restlet/engine/util/StringUtils.java +++ b/org.restlet/src/main/java/org/restlet/engine/util/StringUtils.java @@ -9,6 +9,7 @@ package org.restlet.engine.util; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -76,17 +77,17 @@ public Integer getNumericValue() { */ private static class CharacterEntitySolver { /** Map of names of entities according to their numeric value. */ - private String[] toName; + private final String[] toName; /** Map of numeric values of entities according to their name. */ - private Map toValue; + private final Map toValue; /** * Constructor. */ public CharacterEntitySolver() { toName = new String[10000]; - toValue = new HashMap(); + toValue = new HashMap<>(); } /** @@ -450,7 +451,7 @@ public static String firstUpper(String string) { public static byte[] getAsciiBytes(String string) { if (string != null) { try { - return string.getBytes("US-ASCII"); + return string.getBytes(StandardCharsets.US_ASCII); } catch (Exception e) { // Should not happen. return null; @@ -470,7 +471,7 @@ public static byte[] getAsciiBytes(String string) { public static byte[] getLatin1Bytes(String string) { if (string != null) { try { - return string.getBytes("ISO-8859-1"); + return string.getBytes(StandardCharsets.ISO_8859_1); } catch (Exception e) { // Should not happen. return null; @@ -569,7 +570,7 @@ public static String htmlUnescape(String str) { } else { Integer val = html40Entities.getValue(entityName); if (val != null) { - entityValue = val.intValue(); + entityValue = val; } } if (entityValue == -1) { diff --git a/org.restlet/src/main/java/org/restlet/representation/Variant.java b/org.restlet/src/main/java/org/restlet/representation/Variant.java index 0c282886ee..ca352585ca 100644 --- a/org.restlet/src/main/java/org/restlet/representation/Variant.java +++ b/org.restlet/src/main/java/org/restlet/representation/Variant.java @@ -13,10 +13,7 @@ import org.restlet.engine.util.SystemUtils; import org.restlet.util.WrapperList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; +import java.util.*; /** * Descriptor for available representations of a resource. It contains all the @@ -337,13 +334,13 @@ public boolean includes(Variant other) { // Compare the languages if (result) { result = (getLanguages().isEmpty()) || getLanguages().contains(Language.ALL) - || getLanguages().containsAll(other.getLanguages()); + || new HashSet<>(getLanguages()).containsAll(other.getLanguages()); } // Compare the encodings if (result) { result = (getEncodings().isEmpty()) || getEncodings().contains(Encoding.ALL) - || getEncodings().containsAll(other.getEncodings()); + || new HashSet<>(getEncodings()).containsAll(other.getEncodings()); } return result; diff --git a/org.restlet/src/main/java/org/restlet/resource/Directory.java b/org.restlet/src/main/java/org/restlet/resource/Directory.java index 5eceaa9e1e..6411a01d85 100644 --- a/org.restlet/src/main/java/org/restlet/resource/Directory.java +++ b/org.restlet/src/main/java/org/restlet/resource/Directory.java @@ -191,7 +191,7 @@ public Representation getIndexRepresentation(Variant variant, ReferenceList inde * @return The variant representations of a directory. */ public List getIndexVariants(ReferenceList indexContent) { - final List result = new ArrayList(); + final List result = new ArrayList<>(); result.add(new Variant(MediaType.TEXT_HTML)); result.add(new Variant(MediaType.TEXT_URI_LIST)); return result; diff --git a/org.restlet/src/main/java/org/restlet/resource/ServerResource.java b/org.restlet/src/main/java/org/restlet/resource/ServerResource.java index a1e2270ac7..6b822a8c8a 100644 --- a/org.restlet/src/main/java/org/restlet/resource/ServerResource.java +++ b/org.restlet/src/main/java/org/restlet/resource/ServerResource.java @@ -479,9 +479,7 @@ && getRequestEntity().getSize() != 0) { result = toRepresentation(resultObject, variant); } - } catch (IllegalArgumentException e) { - throw new ResourceException(e); - } catch (IllegalAccessException e) { + } catch (IllegalArgumentException | IllegalAccessException | IOException e) { throw new ResourceException(e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof ResourceException) { @@ -489,11 +487,9 @@ && getRequestEntity().getSize() != 0) { } throw new ResourceException(e.getTargetException()); - } catch (IOException e) { - throw new ResourceException(e); } - return result; + return result; } /** diff --git a/org.restlet/src/main/java/org/restlet/routing/Filter.java b/org.restlet/src/main/java/org/restlet/routing/Filter.java index 106d35b53c..500bec7cb3 100644 --- a/org.restlet/src/main/java/org/restlet/routing/Filter.java +++ b/org.restlet/src/main/java/org/restlet/routing/Filter.java @@ -162,15 +162,10 @@ public final void handle(Request request, Response response) { switch (beforeHandle(request, response)) { case CONTINUE: - switch (doHandle(request, response)) { - case CONTINUE: - afterHandle(request, response); - break; - - default: - // Stop the processing - break; - } + // Stop the processing + if (doHandle(request, response) == CONTINUE) { + afterHandle(request, response); + } break; case SKIP: diff --git a/org.restlet/src/main/java/org/restlet/security/Authenticator.java b/org.restlet/src/main/java/org/restlet/security/Authenticator.java index ef835aed97..1f47571a2c 100644 --- a/org.restlet/src/main/java/org/restlet/security/Authenticator.java +++ b/org.restlet/src/main/java/org/restlet/security/Authenticator.java @@ -251,7 +251,7 @@ protected int unauthenticated(Request request, Response response) { if (request.getChallengeResponse() != null && loggable) { getLogger().log(Level.FINE, - "The authentication failed for the identifer \"" + request.getChallengeResponse().getIdentifier() + "The authentication failed for the identifier \"" + request.getChallengeResponse().getIdentifier() + "\" using the " + request.getChallengeResponse().getScheme() + " scheme."); } diff --git a/org.restlet/src/main/java/org/restlet/security/CertificateAuthenticator.java b/org.restlet/src/main/java/org/restlet/security/CertificateAuthenticator.java index df5339143f..d5863072f8 100644 --- a/org.restlet/src/main/java/org/restlet/security/CertificateAuthenticator.java +++ b/org.restlet/src/main/java/org/restlet/security/CertificateAuthenticator.java @@ -102,7 +102,7 @@ protected boolean authenticate(Request request, Response response) { List certchain = request.getClientInfo().getCertificates(); List principals = getPrincipals(certchain); - if ((principals != null) && (principals.size() > 0)) { + if ((principals != null) && (!principals.isEmpty())) { request.getClientInfo().getPrincipals().addAll(principals); User user = getUser(principals.get(0)); diff --git a/org.restlet/src/main/java/org/restlet/service/ConverterService.java b/org.restlet/src/main/java/org/restlet/service/ConverterService.java index 12b63901b9..4490a30a83 100644 --- a/org.restlet/src/main/java/org/restlet/service/ConverterService.java +++ b/org.restlet/src/main/java/org/restlet/service/ConverterService.java @@ -174,7 +174,7 @@ public Object toObject(Representation source) throws IOException { */ public T toObject(Representation source, Class target, Resource resource) throws IOException { T result = null; - boolean loggable = (resource == null) ? true : resource.isLoggable(); + boolean loggable = resource == null || resource.isLoggable(); if ((source != null) && source.isAvailable() && (source.getSize() != 0)) { ConverterHelper ch = ConverterUtils.getBestHelper(source, target, resource); @@ -187,8 +187,7 @@ public T toObject(Representation source, Class target, Resource resource) result = ch.toObject(source, target, resource); - if (result instanceof Representation) { - Representation resultRepresentation = (Representation) result; + if (result instanceof Representation resultRepresentation) { // Copy the variant metadata resultRepresentation.setCharacterSet(source.getCharacterSet()); diff --git a/org.restlet/src/main/java/org/restlet/service/LogService.java b/org.restlet/src/main/java/org/restlet/service/LogService.java index 9dadbf8ac5..179ba44088 100644 --- a/org.restlet/src/main/java/org/restlet/service/LogService.java +++ b/org.restlet/src/main/java/org/restlet/service/LogService.java @@ -304,8 +304,8 @@ public boolean isIdentityCheck() { * @return True if the call should be logged during the processing chain. */ public boolean isLoggable(Request request) { - return (getLoggableTemplate() == null) ? true - : getLoggableTemplate().match(request.getResourceRef().getTargetRef().toString()) > 0; + return getLoggableTemplate() == null + || getLoggableTemplate().match(request.getResourceRef().getTargetRef().toString()) > 0; } /** diff --git a/org.restlet/src/main/java/org/restlet/util/RouteList.java b/org.restlet/src/main/java/org/restlet/util/RouteList.java index d46f478162..13063307f2 100644 --- a/org.restlet/src/main/java/org/restlet/util/RouteList.java +++ b/org.restlet/src/main/java/org/restlet/util/RouteList.java @@ -169,7 +169,7 @@ public synchronized Route getRandom(Request request, Response response, float re boolean loopedAround = false; do { - if ((j == length) && (loopedAround == false)) { + if ((j == length) && (!loopedAround)) { j = 0; loopedAround = true; } diff --git a/org.restlet/src/main/java/org/restlet/util/Series.java b/org.restlet/src/main/java/org/restlet/util/Series.java index e143afd028..e622ed12e8 100644 --- a/org.restlet/src/main/java/org/restlet/util/Series.java +++ b/org.restlet/src/main/java/org/restlet/util/Series.java @@ -98,40 +98,40 @@ public void copyTo(Map params) { NamedValue param; Object currentValue = null; - for (Iterator iter = iterator(); iter.hasNext();) { - param = iter.next(); - - if (params.containsKey(param.getName())) { - currentValue = params.get(param.getName()); - - if (currentValue != null) { - List values = null; - - if (currentValue instanceof List) { - // Multiple values already found for this entry - values = (List) currentValue; - } else { - // Second value found for this entry - // Create a list of values - values = new ArrayList(); - values.add(currentValue); - params.put(param.getName(), values); - } - - if (param.getValue() == null) { - values.add(Series.EMPTY_VALUE); - } else { - values.add(param.getValue()); - } - } else { - if (param.getValue() == null) { - params.put(param.getName(), Series.EMPTY_VALUE); - } else { - params.put(param.getName(), param.getValue()); - } - } - } - } + for (T t : this) { + param = t; + + if (params.containsKey(param.getName())) { + currentValue = params.get(param.getName()); + + if (currentValue != null) { + List values = null; + + if (currentValue instanceof List) { + // Multiple values already found for this entry + values = (List) currentValue; + } else { + // Second value found for this entry + // Create a list of values + values = new ArrayList(); + values.add(currentValue); + params.put(param.getName(), values); + } + + if (param.getValue() == null) { + values.add(Series.EMPTY_VALUE); + } else { + values.add(param.getValue()); + } + } else { + if (param.getValue() == null) { + params.put(param.getName(), Series.EMPTY_VALUE); + } else { + params.put(param.getName(), param.getValue()); + } + } + } + } } /** @@ -354,7 +354,7 @@ public String[] getValuesArray(String name, boolean ignoreCase, String defaultVa String[] result = null; List params = subList(name, ignoreCase); - if ((params.size() == 0) && (defaultValue != null)) { + if ((params.isEmpty()) && (defaultValue != null)) { result = new String[1]; result[0] = defaultValue; } else { diff --git a/org.restlet/src/main/java/org/restlet/util/ServerList.java b/org.restlet/src/main/java/org/restlet/util/ServerList.java index 1b6edad7df..d6a25f00bc 100644 --- a/org.restlet/src/main/java/org/restlet/util/ServerList.java +++ b/org.restlet/src/main/java/org/restlet/util/ServerList.java @@ -36,7 +36,7 @@ public final class ServerList extends WrapperList { * @param next The next Restlet of added servers. */ public ServerList(Context context, Restlet next) { - super(new CopyOnWriteArrayList()); + super(new CopyOnWriteArrayList<>()); this.context = context; this.next = next; } diff --git a/org.restlet/src/main/java/org/restlet/util/ServiceList.java b/org.restlet/src/main/java/org/restlet/util/ServiceList.java index eb6b0d2104..83033213ae 100644 --- a/org.restlet/src/main/java/org/restlet/util/ServiceList.java +++ b/org.restlet/src/main/java/org/restlet/util/ServiceList.java @@ -33,7 +33,7 @@ public final class ServiceList extends WrapperList { * @param context The context. */ public ServiceList(Context context) { - super(new CopyOnWriteArrayList()); + super(new CopyOnWriteArrayList<>()); this.context = context; } diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java index 28e2556ce2..7507c1b5b8 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java @@ -32,6 +32,7 @@ import org.restlet.data.Protocol; import org.restlet.data.Reference; import org.restlet.data.Status; +import org.restlet.engine.Engine; import org.restlet.representation.Representation; import org.restlet.representation.StringRepresentation; @@ -61,26 +62,23 @@ private boolean responseEntityExpected(Method method) { private void testCall(Context context, int count, Method method) throws Exception { final CountDownLatch latch = new CountDownLatch(count); - final Uniform responseHandler = new Uniform() { - @Override - public void handle(Request request, Response response) { - String item = request.getResourceRef().getQueryAsForm() - .getFirstValue("item"); - - try { - assertEquals(item, Integer.toString(response.getAge())); - if (responseEntityExpected(request.getMethod())) { - assertEquals(Status.SUCCESS_OK, response.getStatus()); - assertTrue(response.isEntityAvailable()); - assertNotNull(response.getEntityAsText()); - } else { - assertEquals(Status.SUCCESS_NO_CONTENT, - response.getStatus()); - assertFalse(response.isEntityAvailable()); - } - } finally { - latch.countDown(); + final Uniform responseHandler = (request, response) -> { + String item = request.getResourceRef().getQueryAsForm() + .getFirstValue("item"); + + try { + assertEquals(item, Integer.toString(response.getAge())); + if (responseEntityExpected(request.getMethod())) { + assertEquals(Status.SUCCESS_OK, response.getStatus()); + assertTrue(response.isEntityAvailable()); + assertNotNull(response.getEntityAsText()); + } else { + assertEquals(Status.SUCCESS_NO_CONTENT, + response.getStatus()); + assertFalse(response.isEntityAvailable()); } + } finally { + latch.countDown(); } }; @@ -103,6 +101,7 @@ public void handle(Request request, Response response) { @BeforeEach protected void setUpEach() throws Exception { + Engine.register(true); // Create components clientComponent = new Component(); originComponent = new Component(); diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java index 537464260b..02ea56460b 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java @@ -79,13 +79,11 @@ private void runTest(final HttpServer server, final HttpClient client) throws Exception { if (shouldDebug()) { System.setProperty("org.eclipse.jetty.LEVEL", "TRACE"); - System.setProperty( - "sun.net.www.protocol.http.HttpURLConnection.LEVEL", "ALL"); } - initEngine(server, client); - start(); try { + initEngine(server, client); + start(); doTest(port); } finally { stop(); diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java index e9ec423b77..4076d6cad3 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java @@ -254,7 +254,6 @@ private Server startServer(final boolean graceful, final Duration timeout, final if (shouldDebug) { server.getContext().getParameters().add("tracing", "true"); System.setProperty("org.eclipse.jetty.LEVEL", "TRACE"); - System.setProperty("sun.net.www.protocol.http.HttpURLConnection.LEVEL", "ALL"); Engine.setLogLevel(Level.FINE); } diff --git a/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java index dd23429cb6..4090cd4f38 100644 --- a/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java +++ b/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java @@ -32,6 +32,7 @@ import org.restlet.data.Method; import org.restlet.data.Protocol; import org.restlet.data.Status; +import org.restlet.engine.Engine; /** * Unit tests for the FileRepresentation class. @@ -48,6 +49,7 @@ public class FileRepresentationTestCase { @BeforeEach protected void setUpEach() throws Exception { + Engine.register(true); component = new Component(); Server server = component.getServers().add(Protocol.HTTP, 0); component.start(); diff --git a/org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 b/org.restlet/src/test/resources/org/restlet/engine/connector/dummy.p12 similarity index 100% rename from org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.p12 rename to org.restlet/src/test/resources/org/restlet/engine/connector/dummy.p12 diff --git a/org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks b/org.restlet/src/test/resources/org/restlet/ext/jetty/connectors/dummy.jks deleted file mode 100644 index 19172998650e1136a115cdfaad31d218b63d7d40..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6709 zcmeHLcT`i^-c6?l451Ajlq%&02t@>>O79>=DIy&yp@SfaNEMMHAjp7J0TBhIcccgc zN)wPS3Q-hA1u4o4>Nxn`yqWKtd9&90<7KU^taI;K=j5Kd_x|nu`~2$jD-Z|-A$<{F zei6P7KEC#LAP|^2Q#5EE1UDDO0|z1Q5VmIZy}~0-*pE*Sce*AX&=l!fM)j| z6ixQ^o)W;pgal*&2@D`EfyGM7T9Sscdxn2)aeVgP{|bhKp!j$YfRBOT@t_`8g}WA3LPIjGx(2e+R(WnRJDk8!779KhBO*!1eEb}f%YXI^Eu(>fq6x-{rd|GKi%?p*gd z!Ot=DIg#~ds2Z<(epW;6iVj?%QnN78=ab4;-^zc?-+$YJ`DTBX@=Tjuv`)p#n#)on zeU{bAs?5Ikhh(XCLIxm*M$APdAW$#}oQKZ>@EHI*=}_2dV2m*O@i37B<$BrM)k{zG zsbpUByvR7n4Y=*z-VZwkoDBcX3D*?!<^R$_5%#=X>fO!IFgO4OgLn2GAL&&?N#|zB z8EJg=BW&9C?Y>XZydV8A43#oXOAN+Di)_Dzb>mE*8SH`7Ki zhnEL;qB|E-hn?p3*FMx8X;KkLj4o4Fb`CL`;_W$jVEm6|g7ftB{fgbQIp47hB?1KK zGZKFLzG4>)`lkm0On$^H1AyMeB_*2L!T9UKMx=Eybilsd%T#CzB|l$hPn?Ty5C#cQ z?Or28!@f-U27M?RqVg5YQh+o@5+fx6h)a{eEWUU6H|QVv>+07DIo+f z7}PuzMnt>E_Vb?zChLJ0Tc`&P9rJ`Rjg6clw_#097Vywp;P7Ls{SbUV#V(cZpr^DZB!2$Nb<57*OppZ1o) z>XA4NK_aVEh)uhL#obUNw%X9n5$6P)NyBUKd~21`C@tti9o;(^!?1MAXv@%n_%jMp zDYr2e5$A3t9WI4LA^1hMbLa!OtOdvBp|g^qH{h4#y@KER;m`{Tc`!Elo321rGUgl8 zS^<0$K>G#VBxL^r@LfG(r`^2(Bgq_M4;8%wMB8|BW%6znb?dOF30;nvAmjmOcBk)$ z`2jxR^uIOXnt8t2-}9OY{{mvtTLy#jK4WydZ;0c~N3nI%Ii@R*7|Up|Pp&xxU}yGy zzBAQ49A6^F?>WuHrZzfGd=pHCJo5QXqYWD!A*;kE@m-fGgXHn}*ZAYw;*J_(^Y0DF zxEHRT!oA77RNTh9oT_${5n7KW8v_bo{agnI^@ z_OtC7%)Qc5x#pv8Wq(K;tyM_nuFijwX>kPZb=AZ1+;(fMyFbcqAdoua$cB2m3P&bq zbe7+-K$mTi6N1}0xGWDph8G#78pPD{_XlQb9wCQS^LO&OPO3@-qgd7U;}$fx^M>`-!R9gfS`XKFGrq_H)pt4grI3YX{3-@xBrzB!i9y3RF#zvn%WeVt z`^7*UizSHx21C*YEJ+)7hk(kD5`+d&yShS&ru;>MRFr;GfPPS%KjQwKx1y4zk#v;P z!jePs`Wg7gq0{7dYspl(9-WWEnKRcyegqp@!g7PT`UY8VZ$Zy7;wsW)p{*cxZ|SWK`qn zI54S`DP^~vB5k>B9k;k#X+5=(GAhyLOXWffQ5gNKDmt*^a+!^^h!>T*+lA<#u6QJ9 zFE3L_aS&U^w$j?mC!3u=jsi+j=>^Z6F}9N;vsUm6cg3v4a`w?TFs_)z+vKzdn~Evr zIrXIMi~aaC$x2i!f6A4pQenvn_1>BDadF(oB0m9kWqr-1nqxT|J4Aiyh?;3yK-i~C zv%D{Rg$yuPal8kQTxGzS^nWbnaxvq}^YVnS#GH-h7xhRp)gTkH2{Ye32PU&Y&MGrM zO$gA^mk>=ff_J0mS_tfcz1-P+8s{(LU%0#|5xaHx980GL=y-88J%{&)MCqdyD5*LN zw!(tYc6fn*Gu@L?jgzz%jpyzP4A~}=3kXM1a`#o0CyA+a$@R_4txhB)zn?rN+kxGB zUQuC`?N%z#Bq)$EMB+XeMB(mfZ|Cmp>GRD7gmjU-YdwkX)g-S;c@P1HfrTI_l2Zl2 z2#~x$ZUpRUy#5X@i#*TRSU9RyR<@6|@pXfvPz9HAzp2!dR6+D(K4&ACUnWX~vWvp0 zUPzgJEH9VF%vsR&>>yaZntWY}yf$_;NWu%lRGHsN*-ts5GgaT)N|if&zghb;?`@DJ zV%+udfB;9CrWtP-aS4>qug!ZBw)N>)*0dvdW<##O;|}e^w*8(HP?~-krRFqj$7q`+ zZ)@)?R$^nbqr9Q%@QPQ;KKr)v#8f2gcsO3RqBO7Gf|ZQg{e<2!)!k>F9Cw#C??`tN zPNI|)+r_DM?)ezE9X-;@oSHGbl!LLshD*a5=+C$@}0{u97 z4*M!h+c_?Di_>N6w49k*t>_ntD|xBN;QnZa+2fUmWXL!ZQ!acf-;&({F)nvHyx5cf zx(|aQACgtBRQ};|s_PndPPFD<)m?x2vv-i#9XJEeI~o+uF1|O{Ub)iW6p^ zHX3K#(yV`SOKaMxtg4U7VVxLiD#{GM|7`W@hn~PKzHBMmUK?Gn3uC~Wv*t-**|MR{ zdj8X75lA)UUXHke7=D&MCwy6soK0vkhLaraDQj_1(fE!hhg57;3)A9KRrYia|FloKZ!Nxv!NJ9! z!BRiMnmp-CMf;w@PLq)ALb7s$|E_rb$I_P+X17L(lfoE)C55rwAt3)_jrzT4_suIq z(Z3QB_`Uo!#ksjDUa7l*9zSnWRJecCEsc%eQl9(agr~Xh7%cE-b>;`Q-Vu`l6UjGr zXrkU)_61WvchhOeIr{Dpm!ThatDFBSpS3Ut?F0fN3{S5o4E03bjZL17!I z0gn8r3`W8@8QJx{96XGTb-0c?csSrl3HH?9IJ?IyvQr8@;(2mT^wd_C^srmthjpYl zAHez5D>4I&za88D$%gEPD=XAPP1^7ogA&#I3Z9tW(FDnfi1Kvw8m3tpPCt8kG=Jg6 z2aa%qlxmlZY0CmW9A!x4O!!3!2G#@wQ(Yyw56zuIpnfp3W2VD+>2-;2n{+Y$(x+95 z@SO5f4l^s;bGJ>e(BG^`Yg!yeupD_mKhx6od_tfs#D8KdgeLZ^3-@=^^uP4~zx4lK zoBmNA4gn(HE&s0_0KE5i{6b?%razLTogV-B4!}1RgrZTV+FTAI-x>y7yX}B4?JQ{w zNkU0oEYfFJQ1=f1Le%)ZUH>Qr6f8Lo&!k)vor=q2{;9E)t{C>&Py$686}cAKuHuhL zfi0J@IP}#Al3ELKj1*(Q#IB{rQ_(oNBJH5b05G4aquJz?-+ z&s+242tCzmeefAhvHX{%c?TX!lr+GTc-je0h!r7L&FTLzl-l&PX zzVH?;phU7$-6<$=OdDNN@)6=SM_G0D-P5;da zKlVnyM0A`1e9l`}{#dj{#Nl-1DjwczD;o#;%$9_S&-HciQ6IhQQ3A1BF127dMml)KHR{5L;Temkp`T=+a&mU<30t=Rs8I#{--pPkA@}AG#sL zWgqP%8MQ-rOq#+{-m7;z@vRq}j<87@(qh)cN?G8ds#NjeZ9vs4tKOca&64J9*)bst zqf*u4I%MGU%1vPdm*YrO%(1wTlR|VNo<7@NQ`y;cTVTe$MoOh&Ta#GFGWc)U3?FL0fQec(EmB6 zlgj>Xo`<4oe^3chm++6+dOfbcF6F~x-^Sjth05!?O|6B7zC{%ElSXf$4Q^V)P3-=a z2r)zp>gUTX;wKG7$G3V-Ql*Wigqrija)tUqXMbPl=gOxk!opna` zWyd9QChR6xC*w5sov>DIfa7lHAM+l*(+1iWfUoN?Ux|lA& zcMBn}g+h%4zSa5k*gbxApDokPR%xI!1HpYT@ou#qmGsdDH_(enmNa=TqSMlN>mh5` z*X^hDTB~>o#LJV)rdw|_`-%pHUKG8|wsZe^T{Yjiwj|4RCn6|6d&JDQu3|o(TcgmV zI4esjPd7wsiYoNA-?B8f>U9QQih$|U1fI2C%kAzL2iTXR;ucGaSS!^(9U8taL64;5 z7Lv~0zO~HB(|R_eS3Dr&>BKV5d`WTrS+mLYJlw``5%lhI&nU#bt7ZQLH8+)r*b}|X z2grqX4W7o5mk279TMU9E9I=1M)lv-Cb_iM}=D$Daw;@G|iy0gRbVIVwm O!@nu+ec}EX!G8c}T%)}J diff --git a/pom.xml b/pom.xml index 4a51407fb3..bcd879e51c 100644 --- a/pom.xml +++ b/pom.xml @@ -42,10 +42,11 @@ false - 17 + 21 ${java.version} ${java.version} UTF-8 + UTF-8 UTF-8 -Xdoclint:none @@ -64,7 +65,7 @@ 3.1.3.RELEASE 2.4.1 - 5.13.1 + 5.13.2 From 0c8493220954e42e038a16e1a772e718cb30616d Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Fri, 27 Jun 2025 20:47:09 +0200 Subject: [PATCH 12/22] Fix TUs, Upgrade JDK 21 --- org.restlet/pom.xml | 5 +---- pom.xml | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index 610999de03..6ded98fec5 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -98,11 +98,8 @@ - src/test/resources + ${basedir}/src/test/resources true - - **/*.properties - diff --git a/pom.xml b/pom.xml index bcd879e51c..a3a5fac93e 100644 --- a/pom.xml +++ b/pom.xml @@ -293,6 +293,11 @@ maven-resources-plugin + + + p12 + + maven-install-plugin From 02638f244a2f2757ee027b5c2e4e201829a4ee82 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Fri, 27 Jun 2025 20:56:28 +0200 Subject: [PATCH 13/22] Fix JDK for github actions --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 28e3cd8f00..ca4e5e8d87 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,7 +11,7 @@ concurrency: ${{ github.repository }}-${{ github.workflow }}-${{ github.event.number || github.head_ref || github.run_id || github.sha }} cancel-in-progress: true env: - JAVA_VERSION: 17 + JAVA_VERSION: 21 jobs: build: runs-on: ubuntu-latest From 35f9818a8e0eb843da159d73ee737b95205ccfd6 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Fri, 27 Jun 2025 20:56:53 +0200 Subject: [PATCH 14/22] Fix JDK for github actions --- .github/workflows/publish-central.yaml | 2 +- .github/workflows/publish-github-packages.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-central.yaml b/.github/workflows/publish-central.yaml index a0b7de4820..11a64caba6 100644 --- a/.github/workflows/publish-central.yaml +++ b/.github/workflows/publish-central.yaml @@ -8,7 +8,7 @@ concurrency: ${{ github.repository }}-${{ github.workflow }}-${{ github.event.number || github.head_ref || github.run_id || github.sha }} cancel-in-progress: true env: - JAVA_VERSION: 17 + JAVA_VERSION: 21 jobs: publish-central: runs-on: ubuntu-latest diff --git a/.github/workflows/publish-github-packages.yaml b/.github/workflows/publish-github-packages.yaml index 22b07fa730..d49f4f850a 100644 --- a/.github/workflows/publish-github-packages.yaml +++ b/.github/workflows/publish-github-packages.yaml @@ -8,7 +8,7 @@ concurrency: ${{ github.repository }}-${{ github.workflow }}-${{ github.event.number || github.head_ref || github.run_id || github.sha }} cancel-in-progress: true env: - JAVA_VERSION: 17 + JAVA_VERSION: 21 jobs: publish-gh-packages: runs-on: ubuntu-latest From 50b9de3b7bd85be62b61043e3f7de46a406effc2 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Fri, 27 Jun 2025 21:00:03 +0200 Subject: [PATCH 15/22] Fix TUs --- org.restlet/src/test/java/org/restlet/Bug1145TestCase.java | 2 ++ .../java/org/restlet/engine/connector/ShutdownHookTestCase.java | 1 + 2 files changed, 3 insertions(+) diff --git a/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java b/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java index 8878e0d63d..9f68b77711 100644 --- a/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java +++ b/org.restlet/src/test/java/org/restlet/Bug1145TestCase.java @@ -21,6 +21,7 @@ import org.restlet.data.Method; import org.restlet.data.Protocol; import org.restlet.data.Status; +import org.restlet.engine.Engine; import org.restlet.representation.StringRepresentation; public class Bug1145TestCase { @@ -43,6 +44,7 @@ public void handle(Request request, Response response) { @BeforeEach public void setUpEach() throws Exception { + Engine.register(true); this.client = new Client(Protocol.HTTP); this.component = new Component(); diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java index 4076d6cad3..c9243782e0 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java @@ -53,6 +53,7 @@ public class ShutdownHookTestCase { @BeforeAll public static void setUp() { LOGGER.setLevel(Level.INFO); + Engine.register(true); } /** From 4d1ba9ba497d1d49ee3fc561bee8b90fe768b215 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Fri, 27 Jun 2025 21:09:08 +0200 Subject: [PATCH 16/22] Hide some tests --- .../restlet/engine/connector/ShutdownHookTestCase.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java index c9243782e0..49b41fc404 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java @@ -78,7 +78,7 @@ public void whenServerIsNotHandlingRequestThenItStopsImmediately() throws Except * * This is done by making a request froze, then stopping the server, and checking that it didn't wait. */ - @Test + // FIXME @Test public void whenServerIsHandlingBlockingRequestThenItStopsImmediately() throws Exception { // Given a server resource that takes 1 min to send a response final Lock lock = new Lock("Server"); @@ -113,7 +113,7 @@ public void whenServerIsHandlingBlockingRequestThenItStopsImmediately() throws E * * This is done by making a request froze, then stopping the server, and checking that it waited the expected amount of time before shutting down. */ - @Test + // FIXME @Test public void whenServerIsHandlingBlockingRequestThenItGracefullyWaitsFor1SecondBeforeStopping() throws Exception { // Given a server resource that takes 1 min to send a response final Lock serverLock = new Lock("Server"); @@ -148,7 +148,7 @@ public void whenServerIsHandlingBlockingRequestThenItGracefullyWaitsFor1SecondBe * * This is done by making a request froze, then stopping the server, and checking that a new request is not taken into account. */ - @Test + // FIXME @Test public void whenServerIsHandlingBlockingRequestThenItRefusesNewRequest() throws Exception { // Given a server resource that takes 1 min to send a response final Lock lock = new Lock("Server"); @@ -185,7 +185,7 @@ public void whenServerIsHandlingBlockingRequestThenItRefusesNewRequest() throws * * This is done by making a request froze for a short amount of time, then stopping the server, and checking that the request has been handled. */ - @Test + // FIXME @Test public void whenServerIsHandlingLongRequestThenRequestIsHandledCorrectlyBeforeStopping() throws Exception { // Given a server resource that takes 1 sec to send a response final Lock lock = new Lock("Server"); From f2966c76d408516d366a75d8990f5b72a510a65e Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sun, 29 Jun 2025 19:46:28 +0200 Subject: [PATCH 17/22] Clean unit tests --- .../engine/connector/AsyncTestCase.java | 2 ++ .../connector/BaseConnectorsTestCase.java | 5 ++-- .../HttpTransportProtocolsTestCase.java | 5 ++++ .../connector/ShutdownHookTestCase.java | 23 +++++++++++++------ .../connector/SslBaseConnectorsTestCase.java | 4 ++++ .../DigesterRepresentationTestCase.java | 3 +++ .../FileRepresentationTestCase.java | 2 ++ .../org/restlet/routing/RedirectTestCase.java | 15 ++++++++++++ 8 files changed, 50 insertions(+), 9 deletions(-) diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java index 7507c1b5b8..765a2a5222 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/AsyncTestCase.java @@ -101,6 +101,7 @@ private void testCall(Context context, int count, Method method) throws Exceptio @BeforeEach protected void setUpEach() throws Exception { + Engine.clearThreadLocalVariables(); Engine.register(true); // Create components clientComponent = new Component(); @@ -188,5 +189,6 @@ protected void tearDownEach() throws Exception { // Stop the components clientComponent.stop(); originComponent.stop(); + Engine.clearThreadLocalVariables(); } } diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java index 02ea56460b..994fdd02a3 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/BaseConnectorsTestCase.java @@ -113,7 +113,7 @@ private void initEngine(HttpServer server, HttpClient client) { if (shouldDebug()) { Engine.setLogLevel(Level.FINE); } - + Engine.clearThreadLocalVariables(); Engine nre = Engine.register(false); nre.getRegisteredServers().add(server.serverHelper); nre.getRegisteredClients().add(client.clientHelper); @@ -123,7 +123,8 @@ private void initEngine(HttpServer server, HttpClient client) { private void resetEngine() { // Restore a clean engine - org.restlet.engine.Engine.register(); + Engine.register(); + Engine.clearThreadLocalVariables(); } public enum HttpServer { diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/HttpTransportProtocolsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/HttpTransportProtocolsTestCase.java index 6146f29bcb..c38802a01d 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/HttpTransportProtocolsTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/HttpTransportProtocolsTestCase.java @@ -81,6 +81,11 @@ public static void setup() { nre.getRegisteredClients().add(0, new HttpClientHelper(null)); } + @BeforeAll + public static void tearDown() { + Engine.clearThreadLocalVariables(); + } + @Override Server newServer(String httpTransportProtocolOption) { final Context context = new Context(); diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java index 49b41fc404..4806cf8331 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/ShutdownHookTestCase.java @@ -33,7 +33,9 @@ import java.util.logging.Level; import java.util.logging.Logger; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.restlet.Context; import org.restlet.Request; @@ -50,9 +52,16 @@ public class ShutdownHookTestCase { private static final Logger LOGGER = Logger.getLogger("ShutdownHookTest"); private static boolean shouldDebug = false; - @BeforeAll - public static void setUp() { - LOGGER.setLevel(Level.INFO); + @BeforeEach + public void setUp() { + LOGGER.setLevel(Level.FINE); + Engine.clearThreadLocalVariables(); + Engine.register(true); + } + + @AfterEach + public void tearDown() { + Engine.clearThreadLocalVariables(); Engine.register(true); } @@ -78,7 +87,7 @@ public void whenServerIsNotHandlingRequestThenItStopsImmediately() throws Except * * This is done by making a request froze, then stopping the server, and checking that it didn't wait. */ - // FIXME @Test + @Test public void whenServerIsHandlingBlockingRequestThenItStopsImmediately() throws Exception { // Given a server resource that takes 1 min to send a response final Lock lock = new Lock("Server"); @@ -113,7 +122,7 @@ public void whenServerIsHandlingBlockingRequestThenItStopsImmediately() throws E * * This is done by making a request froze, then stopping the server, and checking that it waited the expected amount of time before shutting down. */ - // FIXME @Test + @Test public void whenServerIsHandlingBlockingRequestThenItGracefullyWaitsFor1SecondBeforeStopping() throws Exception { // Given a server resource that takes 1 min to send a response final Lock serverLock = new Lock("Server"); @@ -148,7 +157,7 @@ public void whenServerIsHandlingBlockingRequestThenItGracefullyWaitsFor1SecondBe * * This is done by making a request froze, then stopping the server, and checking that a new request is not taken into account. */ - // FIXME @Test + @Test public void whenServerIsHandlingBlockingRequestThenItRefusesNewRequest() throws Exception { // Given a server resource that takes 1 min to send a response final Lock lock = new Lock("Server"); @@ -185,7 +194,7 @@ public void whenServerIsHandlingBlockingRequestThenItRefusesNewRequest() throws * * This is done by making a request froze for a short amount of time, then stopping the server, and checking that the request has been handled. */ - // FIXME @Test + @Test public void whenServerIsHandlingLongRequestThenRequestIsHandledCorrectlyBeforeStopping() throws Exception { // Given a server resource that takes 1 sec to send a response final Lock lock = new Lock("Server"); diff --git a/org.restlet/src/test/java/org/restlet/engine/connector/SslBaseConnectorsTestCase.java b/org.restlet/src/test/java/org/restlet/engine/connector/SslBaseConnectorsTestCase.java index 3e38209c5e..705558ec6d 100644 --- a/org.restlet/src/test/java/org/restlet/engine/connector/SslBaseConnectorsTestCase.java +++ b/org.restlet/src/test/java/org/restlet/engine/connector/SslBaseConnectorsTestCase.java @@ -24,6 +24,7 @@ import org.restlet.Server; import org.restlet.data.Parameter; import org.restlet.data.Protocol; +import org.restlet.engine.Engine; import org.restlet.engine.io.IoUtils; import org.restlet.util.Series; @@ -45,6 +46,8 @@ public abstract class SslBaseConnectorsTestCase extends BaseConnectorsTestCase { @BeforeAll public static void globalSetUp() throws IOException { + Engine.clearThreadLocalVariables(); + Engine.register(); testKeystoreFile = Files .createTempFile("sslBaseConnectorsTest", KEYSTORE_FILE_NAME) .toFile(); @@ -114,6 +117,7 @@ protected static void tearDown() { testKeystoreFile.delete(); // Restore a clean engine + Engine.clearThreadLocalVariables(); org.restlet.engine.Engine.register(); } diff --git a/org.restlet/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java index 39b9825090..a4a67f5268 100644 --- a/org.restlet/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java +++ b/org.restlet/src/test/java/org/restlet/representation/DigesterRepresentationTestCase.java @@ -37,6 +37,7 @@ public class DigesterRepresentationTestCase { @BeforeEach protected void setUpEach() throws Exception { + Engine.clearThreadLocalVariables(); Engine.register(); component = new Component(); final Server server = component.getServers().add(Protocol.HTTP, 0); @@ -47,6 +48,8 @@ protected void setUpEach() throws Exception { @AfterEach protected void tearDownEach() throws Exception { + Engine.clearThreadLocalVariables(); + Engine.register(); component.stop(); component = null; } diff --git a/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java b/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java index 4090cd4f38..6dbb6d3ca2 100644 --- a/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java +++ b/org.restlet/src/test/java/org/restlet/representation/FileRepresentationTestCase.java @@ -49,6 +49,7 @@ public class FileRepresentationTestCase { @BeforeEach protected void setUpEach() throws Exception { + Engine.clearThreadLocalVariables(); Engine.register(true); component = new Component(); Server server = component.getServers().add(Protocol.HTTP, 0); @@ -62,6 +63,7 @@ protected void setUpEach() throws Exception { @AfterEach protected void tearDownEach() throws Exception { + Engine.clearThreadLocalVariables(); component.stop(); component = null; } diff --git a/org.restlet/src/test/java/org/restlet/routing/RedirectTestCase.java b/org.restlet/src/test/java/org/restlet/routing/RedirectTestCase.java index 57aa444395..528c3c04ee 100644 --- a/org.restlet/src/test/java/org/restlet/routing/RedirectTestCase.java +++ b/org.restlet/src/test/java/org/restlet/routing/RedirectTestCase.java @@ -9,11 +9,14 @@ package org.restlet.routing; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.restlet.*; import org.restlet.data.MediaType; import org.restlet.data.Method; import org.restlet.data.Protocol; +import org.restlet.engine.Engine; import org.restlet.representation.StringRepresentation; import static java.lang.String.format; @@ -36,6 +39,18 @@ private void testCall(Context context, Method method, String uri) response.getEntity().write(System.out); } + @BeforeEach + public void setUp() { + Engine.clearThreadLocalVariables(); + Engine.register(); + } + + @AfterEach + public void tearDown() { + Engine.clearThreadLocalVariables(); + Engine.register(); + } + /** * Tests the cookies parsing. */ From b9fcd5926de13125cc80d042da932bd0edb4fef2 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sun, 29 Jun 2025 20:17:18 +0200 Subject: [PATCH 18/22] Bumped version 2.7.0-m2 --- org.restlet.ext.crypto/pom.xml | 2 +- org.restlet.ext.freemarker/pom.xml | 2 +- org.restlet.ext.gson/pom.xml | 2 +- org.restlet.ext.jaas/pom.xml | 2 +- org.restlet.ext.jackson/pom.xml | 2 +- org.restlet.ext.json/pom.xml | 2 +- org.restlet.ext.slf4j/pom.xml | 2 +- org.restlet.ext.spring/pom.xml | 2 +- org.restlet.ext.thymeleaf/pom.xml | 2 +- org.restlet.ext.velocity/pom.xml | 2 +- org.restlet.ext.xml/pom.xml | 2 +- org.restlet/pom.xml | 2 +- pom.xml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/org.restlet.ext.crypto/pom.xml b/org.restlet.ext.crypto/pom.xml index 36b0448377..9b29d09c3f 100644 --- a/org.restlet.ext.crypto/pom.xml +++ b/org.restlet.ext.crypto/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.freemarker/pom.xml b/org.restlet.ext.freemarker/pom.xml index 2a9f036de3..5fff5136b0 100644 --- a/org.restlet.ext.freemarker/pom.xml +++ b/org.restlet.ext.freemarker/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.gson/pom.xml b/org.restlet.ext.gson/pom.xml index a63298ec40..b7621dc77d 100644 --- a/org.restlet.ext.gson/pom.xml +++ b/org.restlet.ext.gson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.jaas/pom.xml b/org.restlet.ext.jaas/pom.xml index 02cbc42dc9..5d4b96a7cf 100644 --- a/org.restlet.ext.jaas/pom.xml +++ b/org.restlet.ext.jaas/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.jackson/pom.xml b/org.restlet.ext.jackson/pom.xml index 8bb4505f79..45832c5630 100644 --- a/org.restlet.ext.jackson/pom.xml +++ b/org.restlet.ext.jackson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.json/pom.xml b/org.restlet.ext.json/pom.xml index 60aca3af9c..e24df06efb 100644 --- a/org.restlet.ext.json/pom.xml +++ b/org.restlet.ext.json/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.slf4j/pom.xml b/org.restlet.ext.slf4j/pom.xml index 04cc137b84..fea52c894b 100644 --- a/org.restlet.ext.slf4j/pom.xml +++ b/org.restlet.ext.slf4j/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.spring/pom.xml b/org.restlet.ext.spring/pom.xml index ecc42cd90a..3756f77df1 100644 --- a/org.restlet.ext.spring/pom.xml +++ b/org.restlet.ext.spring/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.thymeleaf/pom.xml b/org.restlet.ext.thymeleaf/pom.xml index 4f55c634a9..234aac0825 100644 --- a/org.restlet.ext.thymeleaf/pom.xml +++ b/org.restlet.ext.thymeleaf/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.velocity/pom.xml b/org.restlet.ext.velocity/pom.xml index 143e0d805b..2180b523af 100644 --- a/org.restlet.ext.velocity/pom.xml +++ b/org.restlet.ext.velocity/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet.ext.xml/pom.xml b/org.restlet.ext.xml/pom.xml index 4b85af553a..5c73b26917 100644 --- a/org.restlet.ext.xml/pom.xml +++ b/org.restlet.ext.xml/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index 6ded98fec5..1b544f07f3 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 ../pom.xml diff --git a/pom.xml b/pom.xml index a3a5fac93e..433709ae76 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7-SNAPSHOT + 2.7.0-m2 pom Restlet Framework - Parent From 26d41d8428d7acc18352142ae803416c107a451d Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sun, 29 Jun 2025 20:23:40 +0200 Subject: [PATCH 19/22] Bumped version 2.7.0-m2 --- changes.md | 2 +- org.restlet/src/main/java/org/restlet/engine/Engine.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/changes.md b/changes.md index ec89dbd509..97c3073a45 100644 --- a/changes.md +++ b/changes.md @@ -1,7 +1,7 @@ Changes log =========== -- 2.7 Milestone 2 (??-07-2025) +- 2.7 Milestone 2 (29-07-2025) - Misc - Removed deprecated Servlet extension and related classes in Spring extension - Removed deprecated methods in Restlet API diff --git a/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java index d59075ce4c..cf474648b7 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -96,7 +96,7 @@ public class Engine { public static final String MINOR_NUMBER = "7"; /** Release number. */ - public static final String RELEASE_NUMBER = "-SNAPSHOT"; + public static final String RELEASE_NUMBER = ".0-m2"; /** The org.restlet log level. */ private static volatile Level restletLogLevel; From 84848c117e924e07bb5103a204605c3d4d56ed0c Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sun, 29 Jun 2025 20:26:39 +0200 Subject: [PATCH 20/22] Bumped version 2.7.0-SNAPSHOT --- changes.md | 4 +++- org.restlet.ext.crypto/pom.xml | 2 +- org.restlet.ext.freemarker/pom.xml | 2 +- org.restlet.ext.gson/pom.xml | 2 +- org.restlet.ext.jaas/pom.xml | 2 +- org.restlet.ext.jackson/pom.xml | 2 +- org.restlet.ext.json/pom.xml | 2 +- org.restlet.ext.slf4j/pom.xml | 2 +- org.restlet.ext.spring/pom.xml | 2 +- org.restlet.ext.thymeleaf/pom.xml | 2 +- org.restlet.ext.velocity/pom.xml | 2 +- org.restlet.ext.xml/pom.xml | 2 +- org.restlet/pom.xml | 2 +- org.restlet/src/main/java/org/restlet/engine/Engine.java | 2 +- pom.xml | 2 +- 15 files changed, 17 insertions(+), 15 deletions(-) diff --git a/changes.md b/changes.md index 97c3073a45..559a27efa8 100644 --- a/changes.md +++ b/changes.md @@ -1,7 +1,9 @@ Changes log =========== -- 2.7 Milestone 2 (29-07-2025) +- 2.7 Milestone 3 (??-??-2025) + +- 2.7 Milestone 2 (29-06-2025) - Misc - Removed deprecated Servlet extension and related classes in Spring extension - Removed deprecated methods in Restlet API diff --git a/org.restlet.ext.crypto/pom.xml b/org.restlet.ext.crypto/pom.xml index 9b29d09c3f..d132e66ac0 100644 --- a/org.restlet.ext.crypto/pom.xml +++ b/org.restlet.ext.crypto/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.freemarker/pom.xml b/org.restlet.ext.freemarker/pom.xml index 5fff5136b0..86fee2b38e 100644 --- a/org.restlet.ext.freemarker/pom.xml +++ b/org.restlet.ext.freemarker/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.gson/pom.xml b/org.restlet.ext.gson/pom.xml index b7621dc77d..89bb356a94 100644 --- a/org.restlet.ext.gson/pom.xml +++ b/org.restlet.ext.gson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jaas/pom.xml b/org.restlet.ext.jaas/pom.xml index 5d4b96a7cf..a961b39f4e 100644 --- a/org.restlet.ext.jaas/pom.xml +++ b/org.restlet.ext.jaas/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jackson/pom.xml b/org.restlet.ext.jackson/pom.xml index 45832c5630..efd957f9f7 100644 --- a/org.restlet.ext.jackson/pom.xml +++ b/org.restlet.ext.jackson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.json/pom.xml b/org.restlet.ext.json/pom.xml index e24df06efb..16d5c4e73a 100644 --- a/org.restlet.ext.json/pom.xml +++ b/org.restlet.ext.json/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.slf4j/pom.xml b/org.restlet.ext.slf4j/pom.xml index fea52c894b..5b7df3f144 100644 --- a/org.restlet.ext.slf4j/pom.xml +++ b/org.restlet.ext.slf4j/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.spring/pom.xml b/org.restlet.ext.spring/pom.xml index 3756f77df1..5a07e7265f 100644 --- a/org.restlet.ext.spring/pom.xml +++ b/org.restlet.ext.spring/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.thymeleaf/pom.xml b/org.restlet.ext.thymeleaf/pom.xml index 234aac0825..0b53adeacd 100644 --- a/org.restlet.ext.thymeleaf/pom.xml +++ b/org.restlet.ext.thymeleaf/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.velocity/pom.xml b/org.restlet.ext.velocity/pom.xml index 2180b523af..3bd4912387 100644 --- a/org.restlet.ext.velocity/pom.xml +++ b/org.restlet.ext.velocity/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.xml/pom.xml b/org.restlet.ext.xml/pom.xml index 5c73b26917..ed8a299bb1 100644 --- a/org.restlet.ext.xml/pom.xml +++ b/org.restlet.ext.xml/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index 1b544f07f3..07623512b8 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT ../pom.xml diff --git a/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java index cf474648b7..e915ca0344 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -96,7 +96,7 @@ public class Engine { public static final String MINOR_NUMBER = "7"; /** Release number. */ - public static final String RELEASE_NUMBER = ".0-m2"; + public static final String RELEASE_NUMBER = ".0-SNAPSHOT"; /** The org.restlet log level. */ private static volatile Level restletLogLevel; diff --git a/pom.xml b/pom.xml index 433709ae76..9b16b769e9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-m2 + 2.7.0-SNAPSHOT pom Restlet Framework - Parent From f67bdfea4d732f0c2e5d51aa38857d9a88017b89 Mon Sep 17 00:00:00 2001 From: Thierry Boileau Date: Sun, 29 Jun 2025 20:37:12 +0200 Subject: [PATCH 21/22] Bumped version 3.0.0-SNAPSHOT --- changes.md | 14 +------------- org.restlet.ext.crypto/pom.xml | 2 +- org.restlet.ext.freemarker/pom.xml | 2 +- org.restlet.ext.gson/pom.xml | 2 +- org.restlet.ext.jaas/pom.xml | 2 +- org.restlet.ext.jackson/pom.xml | 2 +- org.restlet.ext.json/pom.xml | 2 +- org.restlet.ext.slf4j/pom.xml | 2 +- org.restlet.ext.spring/pom.xml | 2 +- org.restlet.ext.thymeleaf/pom.xml | 2 +- org.restlet.ext.velocity/pom.xml | 2 +- org.restlet.ext.xml/pom.xml | 2 +- org.restlet/pom.xml | 2 +- .../src/main/java/org/restlet/engine/Engine.java | 4 ++-- pom.xml | 2 +- 15 files changed, 16 insertions(+), 28 deletions(-) diff --git a/changes.md b/changes.md index 559a27efa8..1449380e53 100644 --- a/changes.md +++ b/changes.md @@ -1,16 +1,4 @@ Changes log =========== -- 2.7 Milestone 3 (??-??-2025) - -- 2.7 Milestone 2 (29-06-2025) - - Misc - - Removed deprecated Servlet extension and related classes in Spring extension - - Removed deprecated methods in Restlet API - - Removed internal HTTP and FTP connectors - - Merged the Jetty client and server HTTP connector into Restlet Engine (new default connectors) - -- 2.7 Milestone 1 (21-06-2025) - - Misc - - Removed deprecated extension Atom, Guice, GWT, JAXB, OData - - Removed edition GWT +- 3.0 Milestone 1 (??-??-2025) diff --git a/org.restlet.ext.crypto/pom.xml b/org.restlet.ext.crypto/pom.xml index d132e66ac0..eb4fa1a640 100644 --- a/org.restlet.ext.crypto/pom.xml +++ b/org.restlet.ext.crypto/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.freemarker/pom.xml b/org.restlet.ext.freemarker/pom.xml index 86fee2b38e..cec2065a2b 100644 --- a/org.restlet.ext.freemarker/pom.xml +++ b/org.restlet.ext.freemarker/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.gson/pom.xml b/org.restlet.ext.gson/pom.xml index 89bb356a94..0ed1f59e91 100644 --- a/org.restlet.ext.gson/pom.xml +++ b/org.restlet.ext.gson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jaas/pom.xml b/org.restlet.ext.jaas/pom.xml index a961b39f4e..dfc08aa389 100644 --- a/org.restlet.ext.jaas/pom.xml +++ b/org.restlet.ext.jaas/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.jackson/pom.xml b/org.restlet.ext.jackson/pom.xml index efd957f9f7..71595a89c3 100644 --- a/org.restlet.ext.jackson/pom.xml +++ b/org.restlet.ext.jackson/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.json/pom.xml b/org.restlet.ext.json/pom.xml index 16d5c4e73a..496e261fe2 100644 --- a/org.restlet.ext.json/pom.xml +++ b/org.restlet.ext.json/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.slf4j/pom.xml b/org.restlet.ext.slf4j/pom.xml index 5b7df3f144..1203ac9ca2 100644 --- a/org.restlet.ext.slf4j/pom.xml +++ b/org.restlet.ext.slf4j/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.spring/pom.xml b/org.restlet.ext.spring/pom.xml index 5a07e7265f..4c3d03455e 100644 --- a/org.restlet.ext.spring/pom.xml +++ b/org.restlet.ext.spring/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.thymeleaf/pom.xml b/org.restlet.ext.thymeleaf/pom.xml index 0b53adeacd..d5b998e62a 100644 --- a/org.restlet.ext.thymeleaf/pom.xml +++ b/org.restlet.ext.thymeleaf/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.velocity/pom.xml b/org.restlet.ext.velocity/pom.xml index 3bd4912387..b9347f71d5 100644 --- a/org.restlet.ext.velocity/pom.xml +++ b/org.restlet.ext.velocity/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet.ext.xml/pom.xml b/org.restlet.ext.xml/pom.xml index ed8a299bb1..b3bc8ca136 100644 --- a/org.restlet.ext.xml/pom.xml +++ b/org.restlet.ext.xml/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet/pom.xml b/org.restlet/pom.xml index 07623512b8..aca7014a21 100644 --- a/org.restlet/pom.xml +++ b/org.restlet/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml diff --git a/org.restlet/src/main/java/org/restlet/engine/Engine.java b/org.restlet/src/main/java/org/restlet/engine/Engine.java index e915ca0344..8ee249c90b 100644 --- a/org.restlet/src/main/java/org/restlet/engine/Engine.java +++ b/org.restlet/src/main/java/org/restlet/engine/Engine.java @@ -90,10 +90,10 @@ public class Engine { private static volatile Level logLevel = Level.INFO; /** Major version number. */ - public static final String MAJOR_NUMBER = "2"; + public static final String MAJOR_NUMBER = "3"; /** Minor version number. */ - public static final String MINOR_NUMBER = "7"; + public static final String MINOR_NUMBER = "0"; /** Release number. */ public static final String RELEASE_NUMBER = ".0-SNAPSHOT"; diff --git a/pom.xml b/pom.xml index 9b16b769e9..78fc9585d8 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.restlet org.restlet.parent - 2.7.0-SNAPSHOT + 3.0.0-SNAPSHOT pom Restlet Framework - Parent From 1dac5c58ed136abd3d9b2912f0a1a5c341064fb2 Mon Sep 17 00:00:00 2001 From: Jerome Louvel <374450+jlouvel@users.noreply.github.com> Date: Thu, 3 Jul 2025 01:02:43 +0200 Subject: [PATCH 22/22] Update readme.md --- readme.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/readme.md b/readme.md index e0a6fc2c9a..49c6a80cbd 100644 --- a/readme.md +++ b/readme.md @@ -6,9 +6,13 @@ Launched in 2005, Restlet Framework is the first open source project that embraced REST in the Java world. -Since its inception, its Java API has closely matched the concepts and terminology of the REST architecture style as well as the HTTP protocol. It includes powerful and dynamic routing and security features, as well as fully unified way to develop both web clients, web servers or both at the same time. Its power and maturity gives you an alternative to developing directly with the Servlet API or with the JAX-RS API. +## Overview + +Launched in 2005, Restlet Framework is the first open source project that embraced REST in the Java world. + +Since its inception, its Java API has closely matched the concepts and terminology of the REST architecture style as well as the HTTP protocol. It includes powerful and dynamic routing and security features, as well as fully unified way to develop both web clients, web servers or both at the same time. Its power and maturity gives you an alternative to developing with the Servlet API or with the JAX-RS API. -While Restlet applications can still be deployed in Servlet containers, they can also run directly in JVMs with minimal dependencies, resulting in a small footprint suitable for microservices. Restlet Framework is available in a Java edition compatible with Java SE/EE, GAE, OSGi and Android environments, as well as in a separate GWT edition. It offers several extensions for common use cases and can be easily extended if needed. +Restlet applications run directly in JVMs with minimal dependencies, resulting in a small footprint suitable for microservices running in a service mesh. It offers several extensions for common use cases and can be easily extended if needed. ![](https://avatars.githubusercontent.com/u/374452?s=400&u=191f2eada671b2a07f61782cf638bdda0ccb6d3f&v=4) @@ -18,8 +22,8 @@ To learn more about Restlet Framework, please have a look at the following resou * [Download](https://restlet.talend.com/downloads/current/) * [Tutorials](https://restlet.talend.com/documentation/tutorials/2.7/) -* [User Guide](https://restlet.talend.com/documentation/user-guide/2.7/) -* [JavaDocs](https://restlet.talend.com/documentation/javadocs/2.7/) +* [User Guide](https://restlet.talend.com/documentation/user-guide/2.7/introduction/overview/) +* [JavaDocs](https://javadoc.io/doc/org.restlet/org.restlet/latest/index.html) * [Change Log](https://restlet.talend.com/documentation/2.7/changelog) * [Issues](https://github.com/restlet/restlet-framework-java/issues) * [Discussions](https://github.com/restlet/restlet-framework-java/discussions)