From fdd80a7e5b6cc8e579d965e8acf79edd660acc6e Mon Sep 17 00:00:00 2001 From: Thomas Mortagne Date: Wed, 8 Nov 2023 16:38:27 +0100 Subject: [PATCH 01/11] [misc] Fix wrong StringUtils --- .../internal/averagerating/XObjectAverageRatingManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/src/main/java/org/xwiki/ratings/internal/averagerating/XObjectAverageRatingManager.java b/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/src/main/java/org/xwiki/ratings/internal/averagerating/XObjectAverageRatingManager.java index 08cb67e9baee..8df19deaab17 100644 --- a/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/src/main/java/org/xwiki/ratings/internal/averagerating/XObjectAverageRatingManager.java +++ b/xwiki-platform-core/xwiki-platform-ratings/xwiki-platform-ratings-api/src/main/java/org/xwiki/ratings/internal/averagerating/XObjectAverageRatingManager.java @@ -29,8 +29,8 @@ import javax.inject.Named; import javax.inject.Provider; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.solr.common.StringUtils; import org.xwiki.bridge.DocumentAccessBridge; import org.xwiki.bridge.DocumentModelBridge; import org.xwiki.component.annotation.Component; From 8a7283f5dfe0a84388e1ec8e7324fe153327fcb9 Mon Sep 17 00:00:00 2001 From: Thomas Mortagne Date: Thu, 9 Nov 2023 15:44:55 +0100 Subject: [PATCH 02/11] XWIKI-20477: Upgrade to Solr 9.4.1 and Lucene 9.8.0 XWIKI-12955: Upgrade to JAX-RS 2.1.6 (JSR370) XWIKI-21709: Upgrade to Jetty Client 10.0.19 XWIKI-12674: Replace Restlet with Jersey --- pom.xml | 256 ++++++++-------- xwiki-platform-core/pom.xml | 97 ++++++- .../AbstractAnnotationsRESTResource.java | 130 +++++++++ .../internal/AnnotationsRESTResource.java | 111 +------ .../AnnotationsTranslationRESTResource.java | 11 +- ...FormUrlEncodedAnnotationRequestReader.java | 46 +-- .../pom.xml | 9 +- .../AttachmentValidationExceptionMapper.java | 5 +- .../internal/DefaultAttachmentValidator.java | 6 +- .../FileSizeAttachmentValidationStep.java | 8 +- .../MimetypeAttachmentValidationStep.java | 7 +- .../FileSizeAttachmentValidationStepTest.java | 4 +- .../MimetypeAttachmentValidationStepTest.java | 7 +- .../org/xwiki/ckeditor/test/ui/ImageIT.java | 9 +- .../ExtensionIndexSolrCoreInitializer.java | 2 +- .../xwiki/test/ui/extension/ExtensionIT.java | 12 +- .../xwiki-platform-icon-rest-api/pom.xml | 4 +- .../xwiki-platform-icon-rest-default/pom.xml | 5 + .../xwiki-platform-image-style-rest/pom.xml | 14 +- .../image/style/rest/ImageStylesResource.java | 8 +- .../internal/DefaultImageStylesResource.java | 31 +- .../DefaultImageStylesResourceTest.java | 13 +- .../image/style/test/ui/ImageStyleIT.java | 4 +- .../xwiki-platform-livedata-rest/pom.xml | 16 +- .../DefaultLiveDataEntriesResourceTest.java | 14 +- .../DefaultLiveDataEntryResourceTest.java | 4 +- .../pom.xml | 4 +- .../pom.xml | 6 + .../xwiki-platform-netflux-rest/pom.xml | 14 +- .../rest/NotificationsResource.java | 30 +- .../DefaultNotificationsResource.java | 21 +- .../web/XWikiContextInitializationFilter.java | 9 +- .../internal/RatingSolrCoreInitializer.java | 9 +- .../R120901000XWIKI17761DataMigration.java | 14 +- .../SolrDocumentMigration120900000.java | 18 +- .../pom.xml | 4 + .../ExtensionVersionFileRESTResource.java | 46 +-- .../xwiki-platform-rest/pom.xml | 1 + .../xwiki-platform-rest-api/pom.xml | 8 +- .../attachments/AttachmentsResource.java | 2 - .../xwiki-platform-rest-jersey/pom.xml | 87 ++++++ .../internal/JerseyReloadListener.java} | 30 +- .../internal/JerseyServletContainer.java | 164 +++++++++++ .../RestletJacksonContextResolver.java | 63 ++++ .../internal/XWikiInjectionManager.java | 274 ++++++++++++++++++ .../XWikiInjectionManagerFactory.java | 59 ++++ .../jersey/internal/XWikiRESTServlet.java | 100 +++++++ .../main/resources/META-INF/components.txt | 3 + ...ey.internal.inject.InjectionManagerFactory | 1 + .../xwiki-platform-rest-server/pom.xml | 45 +-- .../main/java/org/xwiki/rest/JAXRSUtils.java | 62 ++++ .../java/org/xwiki/rest/XWikiResource.java | 28 -- .../internal/ComponentsObjectFactory.java | 96 ------ .../org/xwiki/rest/internal/Constants.java | 15 +- .../rest/internal/DefaultJAXRSUtils.java | 142 +++++++++ .../rest/internal/JaxRsServletProvider.java | 70 ----- .../org/xwiki/rest/internal/ModelFactory.java | 107 ++++--- .../internal/PreMatchingRequestFilter.java | 272 +++++++++++++++++ .../xwiki/rest/internal/ResponseFilter.java | 80 +++++ .../java/org/xwiki/rest/internal/Utils.java | 10 +- .../org/xwiki/rest/internal/XWikiFilter.java | 146 ---------- .../rest/internal/XWikiJaxRsApplication.java | 75 ----- .../XWikiRestletJaxRsApplication.java | 96 ------ .../rest/internal/XWikiRestletServlet.java | 151 ---------- .../internal/XWikiSetupCleanupFilter.java | 129 --------- .../exceptions/ExceptionExceptionMapper.java | 117 -------- .../exceptions/XWikiRestExceptionMapper.java | 8 +- .../comments/FormUrlEncodedCommentReader.java | 43 +-- .../objects/FormUrlEncodedObjectReader.java | 53 +--- .../objects/FormUrlEncodedPropertyReader.java | 47 +-- .../pages/FormUrlEncodedPageReader.java | 38 +-- .../tags/FormUrlEncodedTagsReader.java | 67 ++--- .../attachments/AttachmentsResourceImpl.java | 54 ++-- .../AbstractEntityRestURLGenerator.java | 5 +- .../resources/DocumentRestURLGenerator.java | 9 +- .../url/resources/SpaceRestURLGenerator.java | 2 +- .../main/resources/META-INF/components.txt | 9 +- .../main/resources/java-logging.properties | 8 - .../resources/templates/rest/exception.vm | 29 -- .../ExceptionExceptionMapperTest.java | 144 --------- .../AttachmentsResourceImplTest.java | 59 ++-- .../DocumentRestURLGeneratorTest.java | 9 + .../rest/templates/RestExceptionPageTest.java | 64 ---- .../org/xwiki/rest/test/SpacesResourceIT.java | 5 +- .../org/xwiki/rest/test/WikisResourceIT.java | 5 +- .../rest/test/framework/AbstractHttpIT.java | 47 +-- .../xwiki-platform-search-solr-api/pom.xml | 25 +- .../solr/AbstractSolrCoreInitializer.java | 255 ++++++++++------ .../main/java/org/xwiki/search/solr/Solr.java | 18 ++ .../search/solr/SolrCoreInitializer.java | 27 ++ .../org/xwiki/search/solr/XWikiSolrCore.java} | 29 +- .../search/solr/internal/AbstractSolr.java | 194 +++++++++++-- .../search/solr/internal/DefaultSolr.java | 8 + .../internal/DefaultSolrConfiguration.java | 2 +- .../solr/internal/DefaultXWikiSolrCore.java | 68 +++++ .../search/solr/internal/EmbeddedSolr.java | 48 +-- .../search/solr/internal/RemoteSolr.java | 100 +++++-- .../search/solr/internal/SolrSchemaUtils.java | 250 ++++++++++++---- ...5000XWIKI20575XWIKI20619DataMigration.java | 23 +- .../DocumentSolrReferenceResolver.java | 5 +- .../ObjectSolrReferenceResolver.java | 5 +- .../reference/SpaceSolrReferenceResolver.java | 4 +- .../reference/WikiSolrReferenceResolver.java | 4 +- .../EmbeddedSolrInitializationTest.java | 24 +- .../search/solr/internal/RemoteSolrTest.java | 10 +- .../xwiki-platform-search-solr-server/pom.xml | 2 +- .../pom.xml | 51 ++-- .../src/main/assembly/distribution.xml | 47 +++ .../src/main/resources/conf/currency.xml | 0 .../src/main/resources/conf/elevate.xml | 0 .../resources/conf/lang/contractions_ca.txt | 0 .../resources/conf/lang/contractions_fr.txt | 0 .../resources/conf/lang/contractions_ga.txt | 0 .../resources/conf/lang/contractions_it.txt | 0 .../resources/conf/lang/hyphenations_ga.txt | 0 .../main/resources/conf/lang/stemdict_nl.txt | 0 .../main/resources/conf/lang/stoptags_ja.txt | 0 .../main/resources/conf/lang/stopwords_ar.txt | 0 .../main/resources/conf/lang/stopwords_bg.txt | 0 .../main/resources/conf/lang/stopwords_ca.txt | 0 .../main/resources/conf/lang/stopwords_cz.txt | 0 .../main/resources/conf/lang/stopwords_da.txt | 0 .../main/resources/conf/lang/stopwords_de.txt | 0 .../main/resources/conf/lang/stopwords_el.txt | 0 .../main/resources/conf/lang/stopwords_en.txt | 0 .../main/resources/conf/lang/stopwords_es.txt | 0 .../main/resources/conf/lang/stopwords_et.txt | 0 .../main/resources/conf/lang/stopwords_eu.txt | 0 .../main/resources/conf/lang/stopwords_fa.txt | 0 .../main/resources/conf/lang/stopwords_fi.txt | 0 .../main/resources/conf/lang/stopwords_fr.txt | 0 .../main/resources/conf/lang/stopwords_ga.txt | 0 .../main/resources/conf/lang/stopwords_gl.txt | 0 .../main/resources/conf/lang/stopwords_hi.txt | 0 .../main/resources/conf/lang/stopwords_hu.txt | 0 .../main/resources/conf/lang/stopwords_hy.txt | 0 .../main/resources/conf/lang/stopwords_id.txt | 0 .../main/resources/conf/lang/stopwords_it.txt | 0 .../main/resources/conf/lang/stopwords_ja.txt | 0 .../main/resources/conf/lang/stopwords_lv.txt | 0 .../main/resources/conf/lang/stopwords_nl.txt | 0 .../main/resources/conf/lang/stopwords_no.txt | 0 .../main/resources/conf/lang/stopwords_pt.txt | 0 .../resources/conf/lang/stopwords_pt_BR.txt | 0 .../main/resources/conf/lang/stopwords_ro.txt | 0 .../main/resources/conf/lang/stopwords_ru.txt | 0 .../main/resources/conf/lang/stopwords_sk.txt | 0 .../main/resources/conf/lang/stopwords_sv.txt | 0 .../main/resources/conf/lang/stopwords_th.txt | 0 .../main/resources/conf/lang/stopwords_tr.txt | 0 .../main/resources/conf/lang/userdict_ja.txt | 0 .../src/main/resources/conf/managed-schema | 0 .../resources/conf/mapping-FoldToASCII.txt | 0 .../conf/mapping-ISOLatin1Accent.txt | 0 .../src/main/resources/conf/protwords.txt | 0 .../src/main/resources/conf/solrconfig.xml | 2 +- .../src/main/resources/conf/spellings.txt | 0 .../src/main/resources/conf/stopwords.txt | 0 .../src/main/resources/conf/synonyms.txt | 0 .../src/main/resources/conf/update-script.js | 0 .../src/main/resources/core.properties | 0 .../xwiki-platform-test-docker/pom.xml | 5 + .../xwiki-platform-test-integration/pom.xml | 4 - .../xwiki-platform-test-rest/pom.xml | 4 - .../org/xwiki/test/extension/JobExecutor.java | 7 +- .../xwiki-platform-test-ui/pom.xml | 9 + .../java/org/xwiki/test/ui/TestUtils.java | 91 +++--- .../src/main/webapp/WEB-INF/web.xml | 13 +- .../xwiki-platform-wiki-rest-api/pom.xml | 4 + xwiki-platform-distribution/pom.xml | 2 + .../pom.xml | 3 +- .../pom.xml | 7 +- .../pom.xml | 14 +- .../src/deb/control/control | 4 +- .../src/deb/control/postinst | 4 - .../src/deb/control/postrm | 11 - .../pom.xml | 118 +++++--- .../pom.xml | 48 ++- .../src/deb/control/control | 2 +- .../src/deb/control/postinst | 1 + .../src/deb/control/postrm | 1 + .../pom.xml | 36 +++ .../src/deb/control/control | 2 +- .../src/deb/control/postinst | 1 + .../src/deb/control/postrm | 1 + .../pom.xml | 36 +++ .../src/deb/control/control | 2 +- .../src/deb/control/postinst | 1 + .../src/deb/control/postrm | 1 + .../pom.xml | 38 +++ .../src/deb/control/control | 4 +- .../src/deb/control/postinst | 1 + .../src/deb/control/postrm | 1 + .../pom.xml | 119 -------- .../src/deb/control/postinst | 18 -- .../src/deb/control/postrm | 13 - .../pom.xml | 119 -------- .../src/deb/control/postinst | 18 -- .../src/deb/control/postrm | 13 - .../src/deb/control/postinst | 18 -- .../src/deb/control/postrm | 13 - .../pom.xml | 125 -------- .../src/deb/control/postinst | 20 -- .../src/deb/control/postrm | 13 - .../framework/AbstractEscapingTest.java | 2 +- .../pom.xml | 5 + .../org/xwiki/tool/provision/InstallMojo.java | 6 +- 207 files changed, 3363 insertions(+), 2962 deletions(-) create mode 100644 xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AbstractAnnotationsRESTResource.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/pom.xml rename xwiki-platform-core/xwiki-platform-rest/{xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/JaxRsServletReloader.java => xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/JerseyReloadListener.java} (83%) create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/JerseyServletContainer.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/RestletJacksonContextResolver.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/XWikiInjectionManager.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/XWikiInjectionManagerFactory.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/java/org/xwiki/rest/jersey/internal/XWikiRESTServlet.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/resources/META-INF/components.txt create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-jersey/src/main/resources/META-INF/services/org.glassfish.jersey.internal.inject.InjectionManagerFactory create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/JAXRSUtils.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/ComponentsObjectFactory.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/DefaultJAXRSUtils.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/JaxRsServletProvider.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/PreMatchingRequestFilter.java create mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/ResponseFilter.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/XWikiFilter.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/XWikiJaxRsApplication.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/XWikiRestletJaxRsApplication.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/XWikiRestletServlet.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/XWikiSetupCleanupFilter.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/exceptions/ExceptionExceptionMapper.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/resources/java-logging.properties delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/resources/templates/rest/exception.vm delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/test/java/org/xwiki/rest/internal/exceptions/ExceptionExceptionMapperTest.java delete mode 100644 xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/test/java/org/xwiki/rest/templates/RestExceptionPageTest.java rename xwiki-platform-core/{xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/Constants.java => xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/src/main/java/org/xwiki/search/solr/XWikiSolrCore.java} (60%) create mode 100644 xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/src/main/java/org/xwiki/search/solr/internal/DefaultXWikiSolrCore.java rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/pom.xml (78%) create mode 100644 xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/xwiki-platform-search-solr-server-core-search/src/main/assembly/distribution.xml rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/currency.xml (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/elevate.xml (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/contractions_ca.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/contractions_fr.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/contractions_ga.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/contractions_it.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/hyphenations_ga.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stemdict_nl.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stoptags_ja.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_ar.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_bg.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_ca.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_cz.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_da.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_de.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_el.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_en.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_es.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_et.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_eu.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_fa.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_fi.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_fr.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_ga.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_gl.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_hi.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_hu.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_hy.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_id.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_it.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_ja.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_lv.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_nl.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_no.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_pt.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_pt_BR.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_ro.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_ru.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_sk.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_sv.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_th.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/stopwords_tr.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/lang/userdict_ja.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/managed-schema (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/mapping-FoldToASCII.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/mapping-ISOLatin1Accent.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/protwords.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/solrconfig.xml (99%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/spellings.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/stopwords.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/synonyms.txt (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/conf/update-script.js (100%) rename xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-server/{xwiki-platform-search-solr-server-core => xwiki-platform-search-solr-server-core-search}/src/main/resources/core.properties (100%) delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-all/src/deb/control/postinst delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-all/src/deb/control/postrm rename xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/{xwiki-platform-distribution-debian-solr-ratings => xwiki-platform-distribution-debian-solr-cores}/pom.xml (50%) rename xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/resources/BrowserAuthenticationResource.java => xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-events/pom.xml (52%) rename xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/{xwiki-platform-distribution-debian-solr-events => xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-events}/src/deb/control/control (86%) create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-events/src/deb/control/postinst create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-events/src/deb/control/postrm create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-extension_index/pom.xml rename xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/{xwiki-platform-distribution-debian-solr-ratings => xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-extension_index}/src/deb/control/control (86%) create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-extension_index/src/deb/control/postinst create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-extension_index/src/deb/control/postrm create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-ratings/pom.xml rename xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/{xwiki-platform-distribution-debian-solr-extension_index => xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-ratings}/src/deb/control/control (83%) create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-ratings/src/deb/control/postinst create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-ratings/src/deb/control/postrm create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-search/pom.xml rename xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/{xwiki-platform-distribution-debian-solr-search => xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-search}/src/deb/control/control (69%) create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-search/src/deb/control/postinst create mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-cores/xwiki-platform-distribution-debian-solr-core-search/src/deb/control/postrm delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-events/pom.xml delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-events/src/deb/control/postinst delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-events/src/deb/control/postrm delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-extension_index/pom.xml delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-extension_index/src/deb/control/postinst delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-extension_index/src/deb/control/postrm delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-ratings/src/deb/control/postinst delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-ratings/src/deb/control/postrm delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-search/pom.xml delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-search/src/deb/control/postinst delete mode 100644 xwiki-platform-distribution/xwiki-platform-distribution-debian/xwiki-platform-distribution-debian-solr/xwiki-platform-distribution-debian-solr-search/src/deb/control/postrm diff --git a/pom.xml b/pom.xml index a073e074adf4..2614ac6b5b5e 100644 --- a/pom.xml +++ b/pom.xml @@ -56,16 +56,17 @@ 2.9.1 2.0.30 2.1.5 - - 9.4.53.v20231009 10.0.19 + ${jetty.server.version} ${jetty.client.version} 4.1.105.Final 5.6.15.Final 3.3.5 1.4.2 - 8.11.2 + 9.4.1 + 9.8.0 + 2.41 + 2.6.1 3.9.1 @@ -750,99 +751,6 @@ 4.2.1 - - - org.restlet.jse - org.restlet.ext.jaxrs - ${restlet.version} - - - - javax.xml.stream - stax-api - - - - org.restlet.lib.org.json - org.restlet.jse - - - - javax.mail - mail - - - - javax.ws.rs - javax.ws.rs-api - - - - jaxb-impl - com.sun.xml.bind - - - - json - org.json - - - - - - org.restlet.jse - org.restlet.ext.jackson - ${restlet.version} - runtime - - - - org.codehaus.woodstox - woodstox-core-asl - - - - - - org.restlet.jse - org.restlet.ext.jaxb - ${restlet.version} - runtime - - - - stax-api - javax.xml.stream - - - - jaxb-impl - com.sun.xml.bind - - - - - org.restlet.jse - org.restlet - ${restlet.version} - - - org.restlet.jee - org.restlet.ext.servlet - ${restlet.version} - - - - org.restlet.jee - org.restlet - - - - com.google.re2j @@ -1013,35 +921,16 @@ org.apache.solr solr-solrj ${solr.version} - - - - org.codehaus.woodstox - woodstox-core-asl - - - - org.eclipse.jetty - * - - - org.eclipse.jetty.http2 - * - - org.apache.solr solr-core ${solr.version} - + - org.codehaus.woodstox - woodstox-core-asl + org.glassfish.hk2.external + jakarta.inject @@ -1060,10 +949,6 @@ io.dropwizard.metrics metrics-jvm - - org.restlet.jee - * - org.eclipse.jetty * @@ -1073,13 +958,9 @@ * - org.apache.hadoop + org.eclipse.jetty.toolchain * - - org.bitbucket.b_c - jose4j - org.apache.logging.log4j @@ -1087,6 +968,11 @@ + + org.apache.lucene + lucene-backward-codecs + ${lucene.version} + org.xerial.snappy snappy-java @@ -1124,6 +1010,112 @@ zookeeper-jute ${zookeeper.version} + + + org.glassfish.jersey.containers + jersey-container-servlet + ${jersey.version} + + + + org.glassfish.hk2.external + jakarta.inject + + + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey.version} + + + org.glassfish.jersey.core + jersey-common + ${jersey.version} + + + + org.glassfish.hk2.external + jakarta.inject + + + + + org.glassfish.jersey.core + jersey-server + ${jersey.version} + + + + org.glassfish.hk2.external + jakarta.inject + + + + + org.glassfish.jersey.media + jersey-media-jaxb + ${jersey.version} + + + + org.glassfish.hk2.external + jakarta.inject + + + + + org.glassfish.jersey.media + jersey-media-json-binding + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey.version} + + + org.glassfish.hk2 + hk2-api + ${hk2.version} + + + + org.glassfish.hk2.external + jakarta.inject + + + org.glassfish.hk2.external + aopalliance-repackaged + + + + + org.glassfish.hk2 + hk2-locator + ${hk2.version} + + + + org.glassfish.hk2.external + jakarta.inject + + + org.glassfish.hk2.external + aopalliance-repackaged + + + + + aopalliance + aopalliance + 1.0 + @@ -1513,6 +1505,14 @@ org.apache.groovy:groovy-dateutil org.codehaus.groovy:groovy-dateutil + + javax.inject:javax.inject + org.glassfish.hk2.external:jakarta.inject + + + aopalliance:aopalliance + org.glassfish.hk2.external:aopalliance-repackaged + diff --git a/xwiki-platform-core/pom.xml b/xwiki-platform-core/pom.xml index f1c2a2f43612..79d678b51904 100644 --- a/xwiki-platform-core/pom.xml +++ b/xwiki-platform-core/pom.xml @@ -125,9 +125,100 @@ Single justification example: --> - - - + + Was never meant to be an API. + highlight + + + true + java.field.removed + field org.xwiki.search.solr.AbstractSolrCoreInitializer.fields + + + true + java.field.removed + field org.xwiki.search.solr.AbstractSolrCoreInitializer.types + + + true + java.field.visibilityReduced + field org.xwiki.search.solr.AbstractSolrCoreInitializer.solrSchemaUtils + field org.xwiki.search.solr.AbstractSolrCoreInitializer.solrSchemaUtils + protected + private + + + + + Should have never been public in the first place and is deprecated since 9.8RC1. + highlight + + + true + java.class.removed + class org.xwiki.rest.Constants + + + + + Not runtime breakages from REST API point of view and not supposed to be called in Java + highlight + + + true + java.method.numberOfParametersChanged + method javax.ws.rs.core.Response org.xwiki.notifications.rest.NotificationsResource::postNotifications() throws java.lang.Exception + method javax.ws.rs.core.Response org.xwiki.notifications.rest.NotificationsResource::postNotifications(java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String) throws java.lang.Exception + + + true + java.method.returnTypeChanged + method java.util.Map<java.lang.String, java.lang.String> org.xwiki.image.style.rest.ImageStylesResource::getDefaultStyleIdentifier(java.lang.String, java.lang.String) throws org.xwiki.image.style.ImageStyleException + method javax.ws.rs.core.Response org.xwiki.image.style.rest.ImageStylesResource::getDefaultStyleIdentifier(java.lang.String, java.lang.String) throws org.xwiki.image.style.ImageStyleException + + + true + java.annotation.added + parameter javax.ws.rs.core.Response org.xwiki.rest.resources.attachments.AttachmentsResource::addAttachment(java.lang.String, java.lang.String, java.lang.String, ===javax.mail.Multipart===, java.lang.Boolean, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException, org.xwiki.attachment.validation.AttachmentValidationException + parameter javax.ws.rs.core.Response org.xwiki.rest.resources.attachments.AttachmentsResource::addAttachment(java.lang.String, java.lang.String, java.lang.String, ===java.lang.Boolean===, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException, org.xwiki.attachment.validation.AttachmentValidationException + @javax.ws.rs.DefaultValue("false") + + + true + java.annotation.added + parameter javax.ws.rs.core.Response org.xwiki.rest.resources.attachments.AttachmentsResource::addAttachment(java.lang.String, java.lang.String, java.lang.String, ===javax.mail.Multipart===, java.lang.Boolean, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException, org.xwiki.attachment.validation.AttachmentValidationException + parameter javax.ws.rs.core.Response org.xwiki.rest.resources.attachments.AttachmentsResource::addAttachment(java.lang.String, java.lang.String, java.lang.String, ===java.lang.Boolean===, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException, org.xwiki.attachment.validation.AttachmentValidationException + @javax.ws.rs.QueryParam("prettyNames") + + + true + java.annotation.attributeValueChanged + parameter javax.ws.rs.core.Response org.xwiki.rest.resources.attachments.AttachmentsResource::addAttachment(java.lang.String, java.lang.String, java.lang.String, javax.mail.Multipart, ===java.lang.Boolean===, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException, org.xwiki.attachment.validation.AttachmentValidationException + parameter javax.ws.rs.core.Response org.xwiki.rest.resources.attachments.AttachmentsResource::addAttachment(java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, ===java.lang.Boolean===) throws org.xwiki.rest.XWikiRestException, org.xwiki.attachment.validation.AttachmentValidationException + javax.ws.rs.QueryParam + value + "prettyNames" + "createPage" + + + true + java.method.numberOfParametersChanged + method javax.ws.rs.core.Response org.xwiki.rest.resources.attachments.AttachmentsResource::addAttachment(java.lang.String, java.lang.String, java.lang.String, javax.mail.Multipart, java.lang.Boolean, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException, org.xwiki.attachment.validation.AttachmentValidationException + method javax.ws.rs.core.Response org.xwiki.rest.resources.attachments.AttachmentsResource::addAttachment(java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean) throws org.xwiki.rest.XWikiRestException, org.xwiki.attachment.validation.AttachmentValidationException + + + + + Very specific to Restlet and not supposed to be called in Java + highlight + + + true + java.method.removed + method java.lang.String org.xwiki.rest.XWikiResource::getUriTemplate() + + + diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AbstractAnnotationsRESTResource.java b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AbstractAnnotationsRESTResource.java new file mode 100644 index 000000000000..73effcbee685 --- /dev/null +++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AbstractAnnotationsRESTResource.java @@ -0,0 +1,130 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.xwiki.annotation.rest.internal; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.Response.Status; + +import org.apache.commons.lang3.StringUtils; +import org.xwiki.annotation.AnnotationServiceException; +import org.xwiki.annotation.rest.model.jaxb.AnnotationAddRequest; +import org.xwiki.annotation.rest.model.jaxb.AnnotationField; +import org.xwiki.annotation.rest.model.jaxb.AnnotationFieldCollection; +import org.xwiki.annotation.rest.model.jaxb.AnnotationRequest; +import org.xwiki.annotation.rest.model.jaxb.AnnotationResponse; +import org.xwiki.model.reference.DocumentReference; + +import com.xpn.xwiki.XWikiException; + +/** + * @version $Id$ + * @since 16.1.0RC1 + */ +public abstract class AbstractAnnotationsRESTResource extends AbstractAnnotationRESTResource +{ + /** + * Request parameter to request a field in an annotation request. + */ + private static final String ANNOTATION_REQUEST_REQUESTED_FIELD_PARAMETER = "request_field"; + + /** + * Request parameter prefix for a filter in an annotation request. + */ + private static final String ANNOTATION_REQUEST_FILTER_PARAMETER_PREFIX = "filter_"; + + protected Response getAnnotatedContent(DocumentReference documentReference) + { + try { + // Initialize the context with the correct value. + updateContext(documentReference); + + String documentName = this.referenceSerializer.serialize(documentReference); + + // check access to this function + if (!this.annotationRightService.canViewAnnotatedTarget(documentName, getXWikiUser())) { + throw new WebApplicationException(Status.UNAUTHORIZED); + } + + // Manually construct the Annotation request entity + MultivaluedMap parameters = this.uriInfo.getQueryParameters(); + AnnotationRequest request = new AnnotationRequest(); + AnnotationFieldCollection fields = new AnnotationFieldCollection(); + List annotationFields = new ArrayList<>(); + AnnotationRequest.Request requestedFields = new AnnotationRequest.Request(); + for (Map.Entry> entry : parameters.entrySet()) { + String name = entry.getKey(); + if (StringUtils.startsWith(name, ANNOTATION_REQUEST_FILTER_PARAMETER_PREFIX)) { + for (String value : entry.getValue()) { + AnnotationField field = new AnnotationField(); + field.setName(StringUtils.substringAfter(name, ANNOTATION_REQUEST_FILTER_PARAMETER_PREFIX)); + field.setValue(value); + annotationFields.add(field); + } + } else if (StringUtils.equals(name, ANNOTATION_REQUEST_REQUESTED_FIELD_PARAMETER)) { + requestedFields.getFields().addAll(entry.getValue()); + } + } + request.setRequest(requestedFields); + fields.getFields().addAll(annotationFields); + request.setFilter(fields); + + AnnotationResponse response = getSuccessResponseWithAnnotatedContent(documentName, request); + return Response.ok(response).build(); + } catch (AnnotationServiceException | XWikiException e) { + getLogger().error(e.getMessage(), e); + return Response.ok(getErrorResponse(e)).build(); + } + } + + protected AnnotationResponse postAnnotation(DocumentReference documentReference, AnnotationAddRequest request) + { + try { + // Initialize the context with the correct value. + updateContext(documentReference); + + String documentName = this.referenceSerializer.serialize(documentReference); + + // check access to this function + if (!this.annotationRightService.canAddAnnotation(documentName, getXWikiUser())) { + throw new WebApplicationException(Status.UNAUTHORIZED); + } + + // add the annotation + Map annotationMetadata = getMap(request.getAnnotation()); + + this.handleTemporaryUploadedFiles(documentReference, annotationMetadata); + this.annotationService.addAnnotation(documentName, request.getSelection(), request.getSelectionContext(), + request.getSelectionOffset(), getXWikiUser(), annotationMetadata); + this.cleanTemporaryUploadedFiles(documentReference); + + // and then return the annotated content, as specified by the annotation request + return getSuccessResponseWithAnnotatedContent(documentName, request); + } catch (AnnotationServiceException | XWikiException e) { + getLogger().error(e.getMessage(), e); + return getErrorResponse(e); + } + } +} diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AnnotationsRESTResource.java b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AnnotationsRESTResource.java index d158e06261a9..5cd4c4501fe5 100644 --- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AnnotationsRESTResource.java +++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AnnotationsRESTResource.java @@ -19,37 +19,20 @@ */ package org.xwiki.annotation.rest.internal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; - import javax.inject.Named; import javax.inject.Singleton; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; -import javax.ws.rs.core.Response.Status; -import org.apache.commons.lang3.StringUtils; -import org.restlet.Request; -import org.restlet.data.Form; -import org.xwiki.annotation.AnnotationServiceException; import org.xwiki.annotation.rest.model.jaxb.AnnotationAddRequest; -import org.xwiki.annotation.rest.model.jaxb.AnnotationField; -import org.xwiki.annotation.rest.model.jaxb.AnnotationFieldCollection; -import org.xwiki.annotation.rest.model.jaxb.AnnotationRequest; import org.xwiki.annotation.rest.model.jaxb.AnnotationResponse; import org.xwiki.component.annotation.Component; import org.xwiki.model.reference.DocumentReference; import org.xwiki.rest.XWikiRestException; -import com.xpn.xwiki.XWikiException; - /** * @version $Id$ * @since 2.3M1 @@ -58,18 +41,8 @@ @Named("org.xwiki.annotation.rest.internal.AnnotationsRESTResource") @Path("/wikis/{wikiName}/spaces/{spaceName: .+}/pages/{pageName}/annotations") @Singleton -public class AnnotationsRESTResource extends AbstractAnnotationRESTResource +public class AnnotationsRESTResource extends AbstractAnnotationsRESTResource { - /** - * Request parameter to request a field in an annotation request. - */ - private static final String ANNOTATION_REQUEST_REQUESTED_FIELD_PARAMETER = "request_field"; - - /** - * Request parameter prefix for a filter in an annotation request. - */ - private static final String ANNOTATION_REQUEST_FILTER_PARAMETER_PREFIX = "filter_"; - /** * @param wiki the wiki of the document to get annotations for * @param space the space of the document to get annotations for @@ -87,54 +60,6 @@ public Response doGetAnnotatedContent(@PathParam("spaceName") String space, @Pat return getAnnotatedContent(documentReference); } - protected Response getAnnotatedContent(DocumentReference documentReference) - { - try { - // Initialize the context with the correct value. - updateContext(documentReference); - - String documentName = this.referenceSerializer.serialize(documentReference); - - // check access to this function - if (!this.annotationRightService.canViewAnnotatedTarget(documentName, getXWikiUser())) { - throw new WebApplicationException(Status.UNAUTHORIZED); - } - - // Manually construct the Annotation request entity - // Historically it used to be passed as method argument, but this only worked because of a bug in - // earlier version of Restlet (1.1.x) ; the JAX-RS specification explicitly states that such entity - // parameters "[are] mapped from the request entity body.", and thus cannot be passed to a GET resource. - // See paragraph 3.3.2.1 "Entity Parameters" of JAX-RS 1.1 specification. - Form form = Request.getCurrent().getResourceRef().getQueryAsForm(); - AnnotationRequest request = new AnnotationRequest(); - AnnotationFieldCollection fields = new AnnotationFieldCollection(); - List annotationFields = new ArrayList<>(); - AnnotationRequest.Request requestedFields = new AnnotationRequest.Request(); - for (String name : form.getNames()) { - if (StringUtils.startsWith(name, ANNOTATION_REQUEST_FILTER_PARAMETER_PREFIX)) { - for (String value : form.getValuesArray(name)) { - AnnotationField field = new AnnotationField(); - field.setName(StringUtils.substringAfter(name, ANNOTATION_REQUEST_FILTER_PARAMETER_PREFIX)); - field.setValue(value); - annotationFields.add(field); - } - } else if (StringUtils.equals(name, ANNOTATION_REQUEST_REQUESTED_FIELD_PARAMETER)) { - requestedFields.getFields().addAll(Arrays.asList(form.getValuesArray(name))); - } - } - request.setRequest(requestedFields); - fields.getFields().addAll(annotationFields); - request.setFilter(fields); - - AnnotationResponse response = getSuccessResponseWithAnnotatedContent(documentName, request); - // make this content expire now because cacheControl is not implemented in this version of restlet - return Response.ok(response).expires(new Date()).build(); - } catch (AnnotationServiceException | XWikiException e) { - getLogger().error(e.getMessage(), e); - return Response.ok(getErrorResponse(e)).build(); - } - } - /** * Add annotation to a given page. * @@ -146,40 +71,10 @@ protected Response getAnnotatedContent(DocumentReference documentReference) * @throws XWikiRestException when failing to parse space */ @POST - public AnnotationResponse doPostAnnotation(@PathParam("wikiName") String wiki, - @PathParam("spaceName") String space, @PathParam("pageName") String page, AnnotationAddRequest request) - throws XWikiRestException + public AnnotationResponse doPostAnnotation(@PathParam("wikiName") String wiki, @PathParam("spaceName") String space, + @PathParam("pageName") String page, AnnotationAddRequest request) throws XWikiRestException { DocumentReference documentReference = new DocumentReference(wiki, parseSpaceSegments(space), page); return postAnnotation(documentReference, request); } - - protected AnnotationResponse postAnnotation(DocumentReference documentReference, AnnotationAddRequest request) - { - try { - // Initialize the context with the correct value. - updateContext(documentReference); - - String documentName = this.referenceSerializer.serialize(documentReference); - - // check access to this function - if (!this.annotationRightService.canAddAnnotation(documentName, getXWikiUser())) { - throw new WebApplicationException(Status.UNAUTHORIZED); - } - - // add the annotation - Map annotationMetadata = getMap(request.getAnnotation()); - - this.handleTemporaryUploadedFiles(documentReference, annotationMetadata); - this.annotationService.addAnnotation(documentName, request.getSelection(), request.getSelectionContext(), - request.getSelectionOffset(), getXWikiUser(), annotationMetadata); - this.cleanTemporaryUploadedFiles(documentReference); - - // and then return the annotated content, as specified by the annotation request - return getSuccessResponseWithAnnotatedContent(documentName, request); - } catch (AnnotationServiceException | XWikiException e) { - getLogger().error(e.getMessage(), e); - return getErrorResponse(e); - } - } } diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AnnotationsTranslationRESTResource.java b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AnnotationsTranslationRESTResource.java index 608c310d4ea3..9b53f2427294 100644 --- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AnnotationsTranslationRESTResource.java +++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/AnnotationsTranslationRESTResource.java @@ -45,7 +45,7 @@ @Named("org.xwiki.annotation.rest.internal.AnnotationsTranslationRESTResource") @Path("/wikis/{wikiName}/spaces/{spaceName: .+}/pages/{pageName}/translations/{language}/annotations") @Singleton -public class AnnotationsTranslationRESTResource extends AnnotationsRESTResource +public class AnnotationsTranslationRESTResource extends AbstractAnnotationsRESTResource { /** * @param wiki the wiki of the document to get annotations for @@ -61,8 +61,8 @@ public class AnnotationsTranslationRESTResource extends AnnotationsRESTResource public Response doGetAnnotatedContent(@PathParam("spaceName") String space, @PathParam("pageName") String page, @PathParam("wikiName") String wiki, @PathParam("language") String language) throws XWikiRestException { - DocumentReference documentReference = new DocumentReference(wiki, parseSpaceSegments(space), page, - LocaleUtils.toLocale(language, Locale.ROOT)); + DocumentReference documentReference = + new DocumentReference(wiki, parseSpaceSegments(space), page, LocaleUtils.toLocale(language, Locale.ROOT)); return getAnnotatedContent(documentReference); } @@ -78,9 +78,8 @@ public Response doGetAnnotatedContent(@PathParam("spaceName") String space, @Pat * @throws XWikiRestException when failing to parse space */ @POST - public AnnotationResponse doPostAnnotation(@PathParam("wikiName") String wiki, - @PathParam("spaceName") String space, @PathParam("pageName") String page, - @PathParam("language") String language, AnnotationAddRequest request) + public AnnotationResponse doPostAnnotation(@PathParam("wikiName") String wiki, @PathParam("spaceName") String space, + @PathParam("pageName") String page, @PathParam("language") String language, AnnotationAddRequest request) throws XWikiRestException { DocumentReference documentReference = new DocumentReference(wiki, parseSpaceSegments(space), page); diff --git a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/representations/AbstractFormUrlEncodedAnnotationRequestReader.java b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/representations/AbstractFormUrlEncodedAnnotationRequestReader.java index 0303700b7f1b..9a6f4d75910c 100644 --- a/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/representations/AbstractFormUrlEncodedAnnotationRequestReader.java +++ b/xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-rest/src/main/java/org/xwiki/annotation/rest/internal/representations/AbstractFormUrlEncodedAnnotationRequestReader.java @@ -23,22 +23,19 @@ import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; +import java.util.List; import java.util.Map; -import javax.servlet.http.HttpServletRequest; +import javax.inject.Inject; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyReader; -import org.restlet.Request; -import org.restlet.data.Form; -import org.restlet.ext.servlet.ServletUtils; -import org.restlet.representation.InputRepresentation; -import org.restlet.representation.Representation; import org.xwiki.annotation.rest.model.jaxb.AnnotationField; import org.xwiki.annotation.rest.model.jaxb.AnnotationRequest; import org.xwiki.annotation.rest.model.jaxb.ObjectFactory; +import org.xwiki.rest.JAXRSUtils; import org.xwiki.rest.XWikiRestComponent; /** @@ -64,6 +61,9 @@ public abstract class AbstractFormUrlEncodedAnnotationRequestReader type, Type genericType, Annotation[] annotations, Med MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { + MultivaluedMap form = this.jaxrs.readForm(mediaType, annotations, entityStream); + ObjectFactory objectFactory = new ObjectFactory(); T annotationRequest = getReadObjectInstance(objectFactory); - Representation representation = - new InputRepresentation(entityStream, org.restlet.data.MediaType.APPLICATION_WWW_FORM); - Form form = new Form(representation); - - /* - * If the form is empty then it might have happened that some filter has invalidated the entity stream. Try to - * read data using getParameter() - */ - if (!form.getNames().isEmpty()) { - for (String paramName : form.getNames()) { - for (String paramValue : form.getValuesArray(paramName)) { - saveField(annotationRequest, paramName, paramValue, objectFactory); - } - } - } else { - HttpServletRequest httpServletRequest = ServletUtils.getRequest(Request.getCurrent()); - - for (Map.Entry entry : httpServletRequest.getParameterMap().entrySet()) { - // FIXME: this needs to be done right, it can interfere with the custom parameters names - // skip method & media parameters, used by REST to carry its own parameters - if ("method".equals(entry.getKey()) || "media".equals(entry.getKey())) { - continue; - } - - // save all the values of this field, one by one - String[] paramValues = entry.getValue(); - for (String value : paramValues) { - saveField(annotationRequest, entry.getKey(), value, objectFactory); - } + for (Map.Entry> entry : form.entrySet()) { + for (String value : entry.getValue()) { + saveField(annotationRequest, entry.getKey(), value, objectFactory); } } diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/pom.xml b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/pom.xml index 295abe9eafd9..b3dfc5a70d2c 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/pom.xml @@ -37,8 +37,8 @@ - javax.ws.rs - jsr311-api + jakarta.ws.rs + jakarta.ws.rs-api org.xwiki.platform @@ -67,5 +67,10 @@ ${commons.version} test + + javax.servlet + javax.servlet-api + test + diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/AttachmentValidationExceptionMapper.java b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/AttachmentValidationExceptionMapper.java index 42d9da6b3526..230cfc5e3e96 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/AttachmentValidationExceptionMapper.java +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/AttachmentValidationExceptionMapper.java @@ -21,6 +21,7 @@ import javax.inject.Named; import javax.inject.Singleton; +import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; @@ -30,8 +31,6 @@ import org.xwiki.component.annotation.Component; import org.xwiki.rest.XWikiRestComponent; -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - /** * Exception mapper for {@link AttachmentValidationException}. * @@ -55,7 +54,7 @@ public Response toResponse(AttachmentValidationException exception) return Response .serverError() .entity(entity.toString()) - .type(APPLICATION_JSON) + .type(MediaType.APPLICATION_JSON_TYPE) .status(exception.getHttpStatus()) .build(); } diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/DefaultAttachmentValidator.java b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/DefaultAttachmentValidator.java index a12d46cde156..889446bd88dc 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/DefaultAttachmentValidator.java +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/DefaultAttachmentValidator.java @@ -26,6 +26,7 @@ import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; +import javax.ws.rs.core.Response; import org.xwiki.attachment.AttachmentAccessWrapper; import org.xwiki.attachment.validation.AttachmentValidationConfiguration; @@ -38,8 +39,6 @@ import org.xwiki.component.manager.ComponentLookupException; import org.xwiki.component.manager.ComponentManager; -import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; - /** * Default implementation of {@link AttachmentValidator}. Check for the file size and mimetype of a given file. The * configuration values are retrieved using {@link AttachmentValidationConfiguration}. @@ -86,7 +85,8 @@ public void validateAttachment(AttachmentAccessWrapper wrapper) throws Attachmen } catch (ComponentLookupException e) { throw new AttachmentValidationException( String.format("Failed to resolve the [%s] components.", AttachmentValidationStep.class), e, - SC_INTERNAL_SERVER_ERROR, "attachment.validation.attachmentValidationStep.error"); + Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), + "attachment.validation.attachmentValidationStep.error"); } } } diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/step/FileSizeAttachmentValidationStep.java b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/step/FileSizeAttachmentValidationStep.java index d6a7498a3c25..9dde2e9e74ec 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/step/FileSizeAttachmentValidationStep.java +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/step/FileSizeAttachmentValidationStep.java @@ -25,6 +25,7 @@ import javax.inject.Named; import javax.inject.Provider; import javax.inject.Singleton; +import javax.ws.rs.core.Response; import org.xwiki.attachment.AttachmentAccessWrapper; import org.xwiki.attachment.validation.AttachmentValidationException; @@ -35,7 +36,6 @@ import static com.xpn.xwiki.plugin.fileupload.FileUploadPlugin.UPLOAD_DEFAULT_MAXSIZE; import static com.xpn.xwiki.plugin.fileupload.FileUploadPlugin.UPLOAD_MAXSIZE_PARAMETER; -import static javax.servlet.http.HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE; import static org.apache.commons.io.FileUtils.byteCountToDisplaySize; /** @@ -62,9 +62,9 @@ public void validate(AttachmentAccessWrapper wrapper) throws AttachmentValidatio { long uploadMaxSize = getUploadMaxSize(); if (wrapper.getSize() > uploadMaxSize) { - throw new AttachmentValidationException("File size too big", SC_REQUEST_ENTITY_TOO_LARGE, - "attachment.validation.filesize.rejected", List.of(byteCountToDisplaySize(uploadMaxSize)), - "fileuploadislarge"); + throw new AttachmentValidationException("File size too big", + Response.Status.REQUEST_ENTITY_TOO_LARGE.getStatusCode(), "attachment.validation.filesize.rejected", + List.of(byteCountToDisplaySize(uploadMaxSize)), "fileuploadislarge"); } } diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/step/MimetypeAttachmentValidationStep.java b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/step/MimetypeAttachmentValidationStep.java index 20dce2bc8925..ee395de609e2 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/step/MimetypeAttachmentValidationStep.java +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/main/java/org/xwiki/attachment/validation/internal/step/MimetypeAttachmentValidationStep.java @@ -27,6 +27,7 @@ import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; +import javax.ws.rs.core.Response; import org.slf4j.Logger; import org.xwiki.attachment.AttachmentAccessWrapper; @@ -36,8 +37,6 @@ import org.xwiki.component.annotation.Component; import org.xwiki.tika.internal.TikaUtils; -import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; -import static javax.servlet.http.HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE; import static org.apache.commons.lang.exception.ExceptionUtils.getRootCauseMessage; /** @@ -75,12 +74,12 @@ public void validate(AttachmentAccessWrapper wrapper) throws AttachmentValidatio if (hasAllowedMimetypes && !checkMimetype(allowedMimetypes, mimeType) || hasBlockerMimetypes && checkMimetype(blockerMimetypes, mimeType)) { throw new AttachmentValidationException(String.format("Invalid mimetype [%s]", mimeType), - SC_UNSUPPORTED_MEDIA_TYPE, "attachment.validation.mimetype.rejected", + Response.Status.UNSUPPORTED_MEDIA_TYPE.getStatusCode(), "attachment.validation.mimetype.rejected", List.of(allowedMimetypes, blockerMimetypes), null); } } catch (IOException e) { throw new AttachmentValidationException(String.format("Failed to read the input stream for [%s]", wrapper), - e, SC_INTERNAL_SERVER_ERROR, "attachment.validation.inputStream.error"); + e, Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), "attachment.validation.inputStream.error"); } } diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/test/java/org/xwiki/attachment/validation/internal/step/FileSizeAttachmentValidationStepTest.java b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/test/java/org/xwiki/attachment/validation/internal/step/FileSizeAttachmentValidationStepTest.java index 189c02e27af2..bb12b23a21a4 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/test/java/org/xwiki/attachment/validation/internal/step/FileSizeAttachmentValidationStepTest.java +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/test/java/org/xwiki/attachment/validation/internal/step/FileSizeAttachmentValidationStepTest.java @@ -22,6 +22,7 @@ import java.util.List; import javax.inject.Provider; +import javax.ws.rs.core.Response; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -37,7 +38,6 @@ import static com.xpn.xwiki.plugin.fileupload.FileUploadPlugin.UPLOAD_DEFAULT_MAXSIZE; import static com.xpn.xwiki.plugin.fileupload.FileUploadPlugin.UPLOAD_MAXSIZE_PARAMETER; -import static javax.servlet.http.HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.mock; @@ -82,7 +82,7 @@ void validateAttachmentTooLarge() () -> this.validationStep.validate(attachmentAccessWrapper)); assertEquals("File size too big", exception.getMessage()); - assertEquals(SC_REQUEST_ENTITY_TOO_LARGE, exception.getHttpStatus()); + assertEquals(Response.Status.REQUEST_ENTITY_TOO_LARGE.getStatusCode(), exception.getHttpStatus()); assertEquals("attachment.validation.filesize.rejected", exception.getTranslationKey()); assertEquals(List.of("42 bytes"), exception.getTranslationParameters()); assertEquals("fileuploadislarge", exception.getContextMessage()); diff --git a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/test/java/org/xwiki/attachment/validation/internal/step/MimetypeAttachmentValidationStepTest.java b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/test/java/org/xwiki/attachment/validation/internal/step/MimetypeAttachmentValidationStepTest.java index a6dd6570d2f3..7b8cee9d63f6 100644 --- a/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/test/java/org/xwiki/attachment/validation/internal/step/MimetypeAttachmentValidationStepTest.java +++ b/xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-validation/xwiki-platform-attachment-validation-default/src/test/java/org/xwiki/attachment/validation/internal/step/MimetypeAttachmentValidationStepTest.java @@ -22,6 +22,8 @@ import java.io.InputStream; import java.util.List; +import javax.ws.rs.core.Response; + import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; @@ -34,7 +36,6 @@ import org.xwiki.test.junit5.mockito.InjectMockComponents; import org.xwiki.test.junit5.mockito.MockComponent; -import static javax.servlet.http.HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -75,7 +76,7 @@ void validateMimetypePlainTextBlocked(String blockerMimetype) throws Exception () -> this.validationStep.validate(wrapper)); assertEquals("Invalid mimetype [text/plain]", exception.getMessage()); - assertEquals(SC_UNSUPPORTED_MEDIA_TYPE, exception.getHttpStatus()); + assertEquals(Response.Status.UNSUPPORTED_MEDIA_TYPE.getStatusCode(), exception.getHttpStatus()); assertEquals("attachment.validation.mimetype.rejected", exception.getTranslationKey()); assertEquals(List.of(List.of(), List.of(blockerMimetype)), exception.getTranslationParameters()); assertNull(exception.getContextMessage()); @@ -97,7 +98,7 @@ void validateMimetypePlainTextAllowed(String blockerMimetype) throws Exception () -> this.validationStep.validate(wrapper)); assertEquals("Invalid mimetype [text/plain]", exception.getMessage()); - assertEquals(SC_UNSUPPORTED_MEDIA_TYPE, exception.getHttpStatus()); + assertEquals(Response.Status.UNSUPPORTED_MEDIA_TYPE.getStatusCode(), exception.getHttpStatus()); assertEquals("attachment.validation.mimetype.rejected", exception.getTranslationKey()); assertEquals(List.of(List.of(blockerMimetype), List.of()), exception.getTranslationParameters()); assertNull(exception.getContextMessage()); diff --git a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-test/xwiki-platform-ckeditor-test-docker/src/test/it/org/xwiki/ckeditor/test/ui/ImageIT.java b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-test/xwiki-platform-ckeditor-test-docker/src/test/it/org/xwiki/ckeditor/test/ui/ImageIT.java index aa4f9db2006a..b8b657f55ec7 100644 --- a/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-test/xwiki-platform-ckeditor-test-docker/src/test/it/org/xwiki/ckeditor/test/ui/ImageIT.java +++ b/xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-test/xwiki-platform-ckeditor-test-docker/src/test/it/org/xwiki/ckeditor/test/ui/ImageIT.java @@ -65,7 +65,14 @@ * @version $Id$ * @since 14.7RC1 */ -@UITest +@UITest( + extraJARs = { + // It's currently not possible to install a JAR contributing a Hibernate mapping file as an Extension. Thus + // we need to provide the JAR inside WEB-INF/lib. See https://jira.xwiki.org/browse/XWIKI-8271 + "org.xwiki.platform:xwiki-platform-notifications-filters-default" + }, + resolveExtraJARs = true +) class ImageIT extends AbstractCKEditorIT { diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-index/src/main/java/org/xwiki/extension/index/internal/ExtensionIndexSolrCoreInitializer.java b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-index/src/main/java/org/xwiki/extension/index/internal/ExtensionIndexSolrCoreInitializer.java index abb49e422b2a..a0d2f88a8698 100644 --- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-index/src/main/java/org/xwiki/extension/index/internal/ExtensionIndexSolrCoreInitializer.java +++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-index/src/main/java/org/xwiki/extension/index/internal/ExtensionIndexSolrCoreInitializer.java @@ -260,7 +260,7 @@ protected void migrateSchema(long cversion) throws SolrException if (cversion >= SCHEMA_VERSION_15_6) { // Cleanup previously required field from the index. try { - this.client.deleteByQuery("is_installed:[* TO *] OR is_from_environment:[* TO *]"); + this.core.getClient().deleteByQuery("is_installed:[* TO *] OR is_from_environment:[* TO *]"); } catch (SolrServerException | IOException e) { throw new SolrException("Failed to cleanup is_installed field", e); } diff --git a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-test/xwiki-platform-extension-test-tests/src/test/java/org/xwiki/test/ui/extension/ExtensionIT.java b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-test/xwiki-platform-extension-test-tests/src/test/java/org/xwiki/test/ui/extension/ExtensionIT.java index 3db533a44ccc..0c9d534896e6 100644 --- a/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-test/xwiki-platform-extension-test-tests/src/test/java/org/xwiki/test/ui/extension/ExtensionIT.java +++ b/xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-test/xwiki-platform-extension-test-tests/src/test/java/org/xwiki/test/ui/extension/ExtensionIT.java @@ -210,15 +210,15 @@ public void testSimpleSearch() + "looking for, you can use the Advanced Search form above.", searchResults.getNoResultsMessage()); // Test a search query with only a few results (only one page). - searchResults = searchBar.search("restlet"); + searchResults = searchBar.search("groovy"); assertNull(searchResults.getNoResultsMessage()); assertNull(searchResults.getPagination()); assertTrue(searchResults.getDisplayedResultsCount() > 1); ExtensionPane extension = searchResults.getExtension(0); assertEquals("core", extension.getStatus()); - assertTrue("Can't find [restlet] in the name of the extension [" + extension.getId() + "] (" - + extension.getName() + ")", extension.getName().toLowerCase().contains("restlet")); + assertTrue("Can't find [groovy] in the name of the extension [" + extension.getId() + "] (" + + extension.getName() + ")", extension.getName().toLowerCase().contains("groovy")); } /** @@ -229,15 +229,15 @@ public void testAdvancedSearch() { ExtensionAdministrationPage adminPage = ExtensionAdministrationPage.gotoCoreExtensions(); - SearchResultsPane searchResults = adminPage.getSearchBar().search("restlet"); + SearchResultsPane searchResults = adminPage.getSearchBar().search("groovy"); String version = searchResults.getExtension(0).getVersion(); - searchResults = new SimpleSearchPane().clickAdvancedSearch().search("org.restlet.jse:org.restlet", version); + searchResults = new SimpleSearchPane().clickAdvancedSearch().search("org.apache.groovy:groovy", version); assertEquals(1, searchResults.getDisplayedResultsCount()); assertNull(searchResults.getNoResultsMessage()); ExtensionPane extension = searchResults.getExtension(0); assertEquals("core", extension.getStatus()); - assertTrue(extension.getName().toLowerCase().contains("restlet")); + assertTrue(extension.getName().toLowerCase().contains("groovy")); assertEquals(version, extension.getVersion()); searchResults = new SimpleSearchPane().clickAdvancedSearch().search("foo", "bar"); diff --git a/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-rest/xwiki-platform-icon-rest-api/pom.xml b/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-rest/xwiki-platform-icon-rest-api/pom.xml index 9b06557a205c..87b9f04f631d 100644 --- a/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-rest/xwiki-platform-icon-rest-api/pom.xml +++ b/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-rest/xwiki-platform-icon-rest-api/pom.xml @@ -37,8 +37,8 @@ - javax.ws.rs - jsr311-api + jakarta.ws.rs + jakarta.ws.rs-api org.xwiki.commons diff --git a/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-rest/xwiki-platform-icon-rest-default/pom.xml b/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-rest/xwiki-platform-icon-rest-default/pom.xml index fb2b255270a7..ab5baf48e8d8 100644 --- a/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-rest/xwiki-platform-icon-rest-default/pom.xml +++ b/xwiki-platform-core/xwiki-platform-icon/xwiki-platform-icon-rest/xwiki-platform-icon-rest-default/pom.xml @@ -69,5 +69,10 @@ ${commons.version} test + + org.glassfish.jersey.core + jersey-common + test + \ No newline at end of file diff --git a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/pom.xml b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/pom.xml index 41408dce61f2..04ccc281f012 100644 --- a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/pom.xml +++ b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/pom.xml @@ -39,8 +39,8 @@ - javax.ws.rs - jsr311-api + jakarta.ws.rs + jakarta.ws.rs-api org.xwiki.commons @@ -69,5 +69,15 @@ ${commons.version} test + + org.glassfish.jersey.core + jersey-common + test + + + javax.servlet + javax.servlet-api + test + diff --git a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/src/main/java/org/xwiki/image/style/rest/ImageStylesResource.java b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/src/main/java/org/xwiki/image/style/rest/ImageStylesResource.java index 3c346535f10e..66ac23380f86 100644 --- a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/src/main/java/org/xwiki/image/style/rest/ImageStylesResource.java +++ b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/src/main/java/org/xwiki/image/style/rest/ImageStylesResource.java @@ -19,12 +19,11 @@ */ package org.xwiki.image.style.rest; -import java.util.Map; - import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; import org.xwiki.image.style.ImageStyleException; import org.xwiki.image.style.rest.model.jaxb.Styles; @@ -58,7 +57,6 @@ public interface ImageStylesResource */ @GET @Path("/default") - Map getDefaultStyleIdentifier(@PathParam("wikiName") String wikiName, - @QueryParam("documentReference") String documentReference) - throws ImageStyleException; + Response getDefaultStyleIdentifier(@PathParam("wikiName") String wikiName, + @QueryParam("documentReference") String documentReference) throws ImageStyleException; } diff --git a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/src/main/java/org/xwiki/image/style/rest/internal/DefaultImageStylesResource.java b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/src/main/java/org/xwiki/image/style/rest/internal/DefaultImageStylesResource.java index 3dd53f47ca55..e71e04fefc8e 100644 --- a/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/src/main/java/org/xwiki/image/style/rest/internal/DefaultImageStylesResource.java +++ b/xwiki-platform-core/xwiki-platform-image/xwiki-platform-image-style/xwiki-platform-image-style-rest/src/main/java/org/xwiki/image/style/rest/internal/DefaultImageStylesResource.java @@ -26,8 +26,8 @@ import javax.inject.Inject; import javax.inject.Named; -import javax.inject.Provider; import javax.inject.Singleton; +import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; import org.xwiki.component.annotation.Component; @@ -40,10 +40,6 @@ import org.xwiki.image.style.rest.model.jaxb.Styles; import org.xwiki.rest.XWikiRestComponent; -import com.xpn.xwiki.XWikiContext; - -import static javax.ws.rs.core.Response.Status.NO_CONTENT; - /** * Default image style rest endpoint implementation. * @@ -61,9 +57,6 @@ public class DefaultImageStylesResource implements ImageStylesResource, XWikiRes @Inject private ImageStyleManager imageStyleManager; - @Inject - private Provider contextProvider; - @Override public Styles getStyles(String wikiName) throws ImageStyleException { @@ -73,30 +66,25 @@ public Styles getStyles(String wikiName) throws ImageStyleException } @Override - public Map getDefaultStyleIdentifier(String wikiName, String documentReference) - throws ImageStyleException + public Response getDefaultStyleIdentifier(String wikiName, String documentReference) throws ImageStyleException { String defaultStyle = this.imageStyleConfiguration.getDefaultStyle(wikiName, documentReference); boolean forceDefaultStyle = this.imageStyleConfiguration.getForceDefaultStyle(wikiName, documentReference); - Map response; + Response response; if (StringUtils.isEmpty(defaultStyle)) { - this.contextProvider.get().getResponse().setStatus(NO_CONTENT.getStatusCode()); - response = Map.of(); + response = Response.ok(Map.of()).build(); } else { - response = Map.of( - "defaultStyle", defaultStyle, - "forceDefaultStyle", Boolean.toString(forceDefaultStyle) - ); + response = Response + .ok(Map.of("defaultStyle", defaultStyle, "forceDefaultStyle", Boolean.toString(forceDefaultStyle))) + .build(); } + return response; } private List