From 1e1383f1842d30dcb2590faaba6d34624d19d7d5 Mon Sep 17 00:00:00 2001 From: dahome-211 <79881602+dahome-211@users.noreply.github.com> Date: Tue, 2 Mar 2021 04:59:27 +0300 Subject: [PATCH 01/11] dahome211@gmail.com Dahome211 --- .github/workflows/android.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..6025979 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,23 @@ +name: Android CI + +on: + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build From e1335f9ff2bf163f7ecefa7a454d2772f6ae450c Mon Sep 17 00:00:00 2001 From: dahome-211 <79881602+dahome-211@users.noreply.github.com> Date: Tue, 2 Mar 2021 05:00:20 +0300 Subject: [PATCH 02/11] Delete android.yml --- .github/workflows/android.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml deleted file mode 100644 index 6025979..0000000 --- a/.github/workflows/android.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Android CI - -on: - push: - branches: [ develop ] - pull_request: - branches: [ develop ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build From 659d2092fce492ceba74697870525f2738b76732 Mon Sep 17 00:00:00 2001 From: dahome-211 <79881602+dahome-211@users.noreply.github.com> Date: Tue, 2 Mar 2021 05:01:19 +0300 Subject: [PATCH 03/11] Delete xpages-runtime-example/src/main/webapp/WEB-INF directory --- .../src/main/webapp/WEB-INF/faces-config.xml | 431 ------------------ .../src/main/webapp/WEB-INF/ibm-web-ext.xml | 32 -- .../src/main/webapp/WEB-INF/web.xml | 25 - .../src/main/webapp/WEB-INF/xsp.properties | 27 -- 4 files changed, 515 deletions(-) delete mode 100644 xpages-runtime-example/src/main/webapp/WEB-INF/faces-config.xml delete mode 100644 xpages-runtime-example/src/main/webapp/WEB-INF/ibm-web-ext.xml delete mode 100644 xpages-runtime-example/src/main/webapp/WEB-INF/web.xml delete mode 100644 xpages-runtime-example/src/main/webapp/WEB-INF/xsp.properties diff --git a/xpages-runtime-example/src/main/webapp/WEB-INF/faces-config.xml b/xpages-runtime-example/src/main/webapp/WEB-INF/faces-config.xml deleted file mode 100644 index 73cd7dd..0000000 --- a/xpages-runtime-example/src/main/webapp/WEB-INF/faces-config.xml +++ /dev/null @@ -1,431 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/xpages-runtime-example/src/main/webapp/WEB-INF/ibm-web-ext.xml b/xpages-runtime-example/src/main/webapp/WEB-INF/ibm-web-ext.xml deleted file mode 100644 index 13e93a3..0000000 --- a/xpages-runtime-example/src/main/webapp/WEB-INF/ibm-web-ext.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - diff --git a/xpages-runtime-example/src/main/webapp/WEB-INF/web.xml b/xpages-runtime-example/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 40beb69..0000000 --- a/xpages-runtime-example/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - XPages Runtime - diff --git a/xpages-runtime-example/src/main/webapp/WEB-INF/xsp.properties b/xpages-runtime-example/src/main/webapp/WEB-INF/xsp.properties deleted file mode 100644 index f411dea..0000000 --- a/xpages-runtime-example/src/main/webapp/WEB-INF/xsp.properties +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright © 2019-2020 Jesse Gallagher -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -xsp.ajax.renderwholetree=false -xsp.client.script.radioCheckbox.ie.onchange.trigger=early-onclick -xsp.csrf.protection=true -xsp.persistence.mode=basic -xsp.resources.aggregate=true -xsp.error.page.default=true -xsp.state.persistence.directory=/tmp -xsp.html.page.encoding=UTF-8 -#xsp.library.depends=com.ibm.xsp.core.library,com.ibm.xsp.extsn.library,com.ibm.xsp.designer.library -xsp.client.script.dojo.version=1.9.7 -xsp.theme=oneuiv3.0.2 \ No newline at end of file From 8a20583a1384743227d5506ff85272d051afed87 Mon Sep 17 00:00:00 2001 From: dahome-211 <79881602+dahome-211@users.noreply.github.com> Date: Tue, 2 Mar 2021 05:01:35 +0300 Subject: [PATCH 04/11] Delete .gitignore --- xpages-runtime-example/src/main/webapp/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 xpages-runtime-example/src/main/webapp/.gitignore diff --git a/xpages-runtime-example/src/main/webapp/.gitignore b/xpages-runtime-example/src/main/webapp/.gitignore deleted file mode 100644 index 3385916..0000000 --- a/xpages-runtime-example/src/main/webapp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/META-INF/ From 6914b850801cc627f9af0e94b2e322e5f98d5708 Mon Sep 17 00:00:00 2001 From: dahome-211 <79881602+dahome-211@users.noreply.github.com> Date: Tue, 2 Mar 2021 05:02:00 +0300 Subject: [PATCH 05/11] Delete LibertyTest.java --- .../src/main/java/xsp/LibertyTest.java | 169 ------------------ 1 file changed, 169 deletions(-) delete mode 100644 xpages-runtime-example/src/main/java/xsp/LibertyTest.java diff --git a/xpages-runtime-example/src/main/java/xsp/LibertyTest.java b/xpages-runtime-example/src/main/java/xsp/LibertyTest.java deleted file mode 100644 index 8dafc66..0000000 --- a/xpages-runtime-example/src/main/java/xsp/LibertyTest.java +++ /dev/null @@ -1,169 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * Generated file. - * - * LibertyTest.java - */ -package xsp; - -import com.ibm.xsp.page.compiled.AbstractCompiledPage; -import com.ibm.xsp.page.compiled.AbstractCompiledPageDispatcher; -import javax.faces.component.UIComponent; -import javax.faces.context.FacesContext; -import com.ibm.xsp.page.compiled.NoSuchComponentException; -import com.ibm.xsp.page.compiled.PageExpressionEvaluator; -import java.lang.String; -import com.ibm.xsp.component.UIViewRootEx2; -import com.ibm.xsp.component.UIPassThroughTag; -import com.ibm.xsp.component.xp.XspOutputText; -import java.lang.Object; -import javax.faces.el.ValueBinding; -import com.ibm.xsp.component.xp.XspDiv; -import com.ibm.xsp.component.xp.XspCommandButton; -import com.ibm.xsp.component.xp.XspEventHandler; - -@SuppressWarnings("all") -public class LibertyTest extends AbstractCompiledPageDispatcher{ - - public LibertyTest() { - super("3.0"); - } - - protected AbstractCompiledPage createPage(int pageIndex) { - return new LibertyTestPage(); - } - - public static class LibertyTestPage extends AbstractCompiledPage { - - private static final ComponentInfo[] s_infos = new ComponentInfo[]{ - ComponentInfo.EMPTY_NORMAL, // 0 text - new ComponentInfo(true, new int[]{0}), // 1 p - ComponentInfo.EMPTY_NORMAL, // 2 text2 - ComponentInfo.EMPTY_NORMAL, // 3 text3 - new ComponentInfo(false, new int[]{2, 3}), // 4 "refresher" - ComponentInfo.EMPTY_NORMAL, // 5 eventHandler - new ComponentInfo(false, new int[]{5}), // 6 "clickme" - new ComponentInfo(false, new int[]{1, 4, 6}), // 7 view - }; - - public LibertyTestPage() { - super(7, s_infos ); - } - - public int getComponentForId(String id) throws NoSuchComponentException { - if( "refresher".equals(id) ) - return 4; - if( "clickme".equals(id) ) - return 6; - return -1; - } - - public UIComponent createComponent(int id, FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) - throws NoSuchComponentException { - switch (id) { - case 7: - return createView(context, parent, evaluator); - case 1: - return createP(context, parent, evaluator); - case 0: - return createText(context, parent, evaluator); - case 4: - return createRefresher(context, parent, evaluator); - case 2: - return createText2(context, parent, evaluator); - case 3: - return createText3(context, parent, evaluator); - case 6: - return createClickme(context, parent, evaluator); - case 5: - return createEventHandler(context, parent, evaluator); - } - throw new NoSuchComponentException(id); - } - - private UIComponent createView(FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) { - UIViewRootEx2 result = new UIViewRootEx2(); - initViewRoot(result); - return result; - } - - private UIComponent createP(FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) { - UIPassThroughTag component = new UIPassThroughTag(); - component.setTag("p"); - return component; - } - - private UIComponent createText(FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) { - XspOutputText result = new XspOutputText(); - String sourceId = "/xp:view[1]/p[1]/xp:text[1]/@value"; - String valueExpr = "I\'m an XPage, running on #{facesContext.externalContext.request.session.servletContext.serverInfo}, which implements Servlet #{facesContext.externalContext.request.session.servletContext.majorVersion}.#{facesContext.externalContext.request.session.servletContext.minorVersion}"; - ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class); - result.setValueBinding("value", value); - return result; - } - - private UIComponent createRefresher(FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) { - XspDiv result = new XspDiv(); - setId(result, "refresher"); - return result; - } - - private UIComponent createText2(FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) { - XspOutputText result = new XspOutputText(); - String sourceId = "refresher/xp:text[1]/@value"; - String valueExpr = "#{javascript:facesContext.getApplication().getFactoryLookup().getFactory(\'javascript\')}"; - ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class); - result.setValueBinding("value", value); - return result; - } - - private UIComponent createText3(FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) { - XspOutputText result = new XspOutputText(); - String sourceId = "refresher/xp:text[2]/@value"; - String valueExpr = "#{javascript:new Date().getTime()}"; - ValueBinding value = evaluator.createValueBinding(result, valueExpr, sourceId,Object.class); - result.setValueBinding("value", value); - return result; - } - - private UIComponent createClickme(FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) { - XspCommandButton result = new XspCommandButton(); - setId(result, "clickme"); - result.setValue("Click me"); - return result; - } - - private UIComponent createEventHandler(FacesContext context, - UIComponent parent, PageExpressionEvaluator evaluator) { - XspEventHandler result = new XspEventHandler(); - result.setEvent("onclick"); - result.setRefreshId("refresher"); - result.setRefreshMode("partial"); - result.setSubmit(true); - return result; - } - - } -} From da77bd20c99387eddf23fc26b0838af357cca67d Mon Sep 17 00:00:00 2001 From: dahome-211 <79881602+dahome-211@users.noreply.github.com> Date: Tue, 2 Mar 2021 05:03:41 +0300 Subject: [PATCH 06/11] Rename README.md to Dahome211 --- README.md => Dahome211 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README.md => Dahome211 (100%) diff --git a/README.md b/Dahome211 similarity index 100% rename from README.md rename to Dahome211 From ec6712beb54cc90948a63015075152690f196fca Mon Sep 17 00:00:00 2001 From: dahome-211 Date: Tue, 2 Mar 2021 05:43:05 +0300 Subject: [PATCH 07/11] Delete xpages-runtime-example directory --- xpages-runtime-example/.gitignore | 2 -- xpages-runtime-example/pom.xml | 45 ------------------------------- 2 files changed, 47 deletions(-) delete mode 100644 xpages-runtime-example/.gitignore delete mode 100644 xpages-runtime-example/pom.xml diff --git a/xpages-runtime-example/.gitignore b/xpages-runtime-example/.gitignore deleted file mode 100644 index 00d2ab7..0000000 --- a/xpages-runtime-example/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/.apt_generated/ -/.apt_generated_tests/ diff --git a/xpages-runtime-example/pom.xml b/xpages-runtime-example/pom.xml deleted file mode 100644 index 7d6ea94..0000000 --- a/xpages-runtime-example/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - 4.0.0 - org.openntf.xpages - xpages-runtime-example - 1.3.0-SNAPSHOT - war - - - false - 1.8 - 1.8 - - - - - javax.servlet - javax.servlet-api - 4.0.0 - provided - - - - org.openntf.xpages - xpages-runtime - ${project.version} - - - - - xpages-runtime-example - - - - org.apache.maven.plugins - maven-deploy-plugin - 2.7 - - - true - - - - - \ No newline at end of file From 7363053bb4ae0bbb6dcc88ad01b0cd6d23a6419f Mon Sep 17 00:00:00 2001 From: dahome-211 Date: Tue, 2 Mar 2021 05:43:26 +0300 Subject: [PATCH 08/11] Delete xpages-webapp-support directory --- xpages-webapp-support/license.txt | 13 - xpages-webapp-support/pom.xml | 342 -------------- .../xpages-runtime-domino/pom.xml | 85 ---- .../domino/JakartaDominoContextListener.java | 83 ---- .../domino/JakartaDominoXPagesServlet.java | 106 ----- .../ServletHttpServletResponseAdapter.java | 188 -------- .../adapter/ServletHttpSessionAdapter.java | 121 ----- .../platform/JakartaDominoPlatform.java | 215 --------- .../JakartaDominoPlatformFactory.java | 26 -- .../JakartaDominoServletRequestWrapper.java | 413 ----------------- .../services/com.ibm.commons.platform.Factory | 1 - xpages-webapp-support/xpages-runtime/pom.xml | 196 -------- .../factory/JakartaDojoLibraryFactory.java | 276 ----------- .../runtime/JakartaAppExecutionContext.java | 70 --- .../xpages/runtime/JakartaApplication.java | 25 - .../runtime/JakartaFacesApplication.java | 96 ---- .../JakartaFacesApplicationFactory.java | 36 -- .../JakartaGlobalFacesResourceServlet.java | 54 --- .../xpages/runtime/JakartaXPagesServlet.java | 64 --- .../context/JakartaExternalContext.java | 154 ------- .../runtime/context/JakartaFacesContext.java | 38 -- .../context/JakartaFacesContextFactory.java | 39 -- .../interpreter/DynamicPageDriver.java | 276 ----------- .../JakartaConfigureCoreListener.java | 43 -- .../listener/JakartaContextListener.java | 31 -- .../runtime/osgi/ActivatorNameProvider.java | 24 - .../osgi/DefaultActivatorNameProvider.java | 58 --- .../xpages/runtime/osgi/MockBundle.java | 275 ----------- .../runtime/osgi/MockBundleContext.java | 186 -------- .../runtime/osgi/OSGiEnvironmentListener.java | 37 -- .../xpages/runtime/osgi/OSGiPatcher.java | 48 -- .../runtime/platform/JakartaPlatform.java | 150 ------ .../platform/JakartaPlatformFactory.java | 26 -- .../runtime/JakartaFacesController.java | 33 -- .../JakartaFacesControllerFactory.java | 31 -- .../runtime/servlet/JakartaFacesServlet.java | 30 -- .../runtime/servlet/JakartaServlet.java | 130 ------ .../servlet/ModuleResourceServlet.java | 25 - .../openntf/xpages/runtime/util/XSPUtil.java | 108 ----- .../xpages/runtime/vfs/ClasspathVFS.java | 193 -------- .../xpages/runtime/vfs/NopVFSFile.java | 95 ---- .../xpages/runtime/vfs/UrlVFSFile.java | 118 ----- .../wrapper/JakartaPrintWriterWrapper.java | 33 -- .../wrapper/JakartaServletConfigWrapper.java | 48 -- .../wrapper/JakartaServletContextWrapper.java | 369 --------------- .../JakartaServletContextWrapperWrapper.java | 53 --- .../JakartaServletOutputStreamWrapper.java | 133 ------ .../wrapper/JakartaServletRequestWrapper.java | 431 ------------------ .../JakartaServletResponseWrapper.java | 203 --------- .../xpages/runtime/xsp/JakartaBootStrap.java | 138 ------ .../runtime/xsp/JakartaFacesClassLoader.java | 27 -- .../runtime/xsp/JakartaFacesPageDriver.java | 25 - .../runtime/xsp/JakartaFactoryLookup.java | 73 --- .../runtime/xsp/JakartaSourceFileManager.java | 117 ----- .../runtime/xsp/JakartaViewHandler.java | 27 -- .../xsp/JakartaXspSourceClassLoader.java | 45 -- .../runtime/xsp/LibraryWeightComparator.java | 61 --- .../META-INF/jakarta-faces-config.xml | 27 -- .../resources/META-INF/platformPlugins.txt | 9 - .../services/com.ibm.commons.platform.Factory | 1 - ...gner.runtime.extensions.JavaScriptProvider | 1 - .../com.ibm.xsp.GlobalResourceProvider | 2 - .../services/com.ibm.xsp.RequestParameters | 1 - .../com.ibm.xsp.adapter.servletFactory | 2 - .../com.ibm.xsp.context.DojoLibraryFactory | 1 - ...om.ibm.xsp.core.events.ApplicationListener | 1 - .../com.ibm.xsp.extlib.DumpAccessorFactory | 6 - ...xtlib.controls.DynamicColumnBuilderFactory | 1 - ...m.ibm.xsp.extlib.device.DeviceDataProvider | 1 - ...onal.jdbc.datasource.IFileJdbcPoolProvider | 2 - .../services/com.ibm.xsp.minifier.loader | 2 - .../com.ibm.xsp.renderkit.ContentTypeRenderer | 1 - ...om.ibm.xsp.resource.DojoModulePathResource | 1 - .../services/com.ibm.xsp.runtime.resources | 1 - .../com.ibm.xsp.stylekit.StyleKitFactory | 2 - .../com.ibm.xsp.stylekit.ThemeExtension | 1 - ....xpages.runtime.osgi.ActivatorNameProvider | 1 - .../xsp-maven-plugin/pom.xml | 124 ----- .../xsp/maven/transpiler/Messages.java | 21 - .../NonVerifyingPathClassLoader.java | 138 ------ .../maven/transpiler/TranspileXspMojo.java | 270 ----------- .../xsp/maven/transpiler/TranspilerUtil.java | 136 ------ .../xsp/maven/transpiler/XspTranspiler.java | 227 --------- .../m2e/lifecycle-mapping-metadata.xml | 34 -- .../resources/META-INF/plexus/components.xml | 22 - .../xsp/maven/transpiler/messages.properties | 8 - 86 files changed, 7385 deletions(-) delete mode 100644 xpages-webapp-support/license.txt delete mode 100644 xpages-webapp-support/pom.xml delete mode 100644 xpages-webapp-support/xpages-runtime-domino/pom.xml delete mode 100644 xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/JakartaDominoContextListener.java delete mode 100644 xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/JakartaDominoXPagesServlet.java delete mode 100644 xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/adapter/ServletHttpServletResponseAdapter.java delete mode 100644 xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/adapter/ServletHttpSessionAdapter.java delete mode 100644 xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/platform/JakartaDominoPlatform.java delete mode 100644 xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/platform/JakartaDominoPlatformFactory.java delete mode 100644 xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/wrapper/JakartaDominoServletRequestWrapper.java delete mode 100644 xpages-webapp-support/xpages-runtime-domino/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory delete mode 100644 xpages-webapp-support/xpages-runtime/pom.xml delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/com/ibm/xsp/dojo/factory/JakartaDojoLibraryFactory.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaAppExecutionContext.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaApplication.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaFacesApplication.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaFacesApplicationFactory.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaGlobalFacesResourceServlet.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaXPagesServlet.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaExternalContext.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaFacesContext.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaFacesContextFactory.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/interpreter/DynamicPageDriver.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/listener/JakartaConfigureCoreListener.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/listener/JakartaContextListener.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/ActivatorNameProvider.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/DefaultActivatorNameProvider.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/MockBundle.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/MockBundleContext.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/OSGiEnvironmentListener.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/OSGiPatcher.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/platform/JakartaPlatform.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/platform/JakartaPlatformFactory.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/runtime/JakartaFacesController.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/runtime/JakartaFacesControllerFactory.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/JakartaFacesServlet.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/JakartaServlet.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/ModuleResourceServlet.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/util/XSPUtil.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/ClasspathVFS.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/NopVFSFile.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/UrlVFSFile.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaPrintWriterWrapper.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletConfigWrapper.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletContextWrapper.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletContextWrapperWrapper.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletOutputStreamWrapper.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletRequestWrapper.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletResponseWrapper.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaBootStrap.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFacesClassLoader.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFacesPageDriver.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFactoryLookup.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaSourceFileManager.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaViewHandler.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaXspSourceClassLoader.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/LibraryWeightComparator.java delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/jakarta-faces-config.xml delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/platformPlugins.txt delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.designer.runtime.extensions.JavaScriptProvider delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.GlobalResourceProvider delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.RequestParameters delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.adapter.servletFactory delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.context.DojoLibraryFactory delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.core.events.ApplicationListener delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.DumpAccessorFactory delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.controls.DynamicColumnBuilderFactory delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.device.DeviceDataProvider delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.relational.jdbc.datasource.IFileJdbcPoolProvider delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.minifier.loader delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.renderkit.ContentTypeRenderer delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.resource.DojoModulePathResource delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.runtime.resources delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.StyleKitFactory delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.ThemeExtension delete mode 100644 xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/org.openntf.xpages.runtime.osgi.ActivatorNameProvider delete mode 100644 xpages-webapp-support/xsp-maven-plugin/pom.xml delete mode 100644 xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/Messages.java delete mode 100644 xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/NonVerifyingPathClassLoader.java delete mode 100644 xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspileXspMojo.java delete mode 100644 xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspilerUtil.java delete mode 100644 xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/XspTranspiler.java delete mode 100644 xpages-webapp-support/xsp-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml delete mode 100644 xpages-webapp-support/xsp-maven-plugin/src/main/resources/META-INF/plexus/components.xml delete mode 100644 xpages-webapp-support/xsp-maven-plugin/src/main/resources/org/openntf/xsp/maven/transpiler/messages.properties diff --git a/xpages-webapp-support/license.txt b/xpages-webapp-support/license.txt deleted file mode 100644 index d041b7e..0000000 --- a/xpages-webapp-support/license.txt +++ /dev/null @@ -1,13 +0,0 @@ -Copyright © ${project.inceptionYear}-${copyrightYear} ${owner} - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file diff --git a/xpages-webapp-support/pom.xml b/xpages-webapp-support/pom.xml deleted file mode 100644 index 91c68fa..0000000 --- a/xpages-webapp-support/pom.xml +++ /dev/null @@ -1,342 +0,0 @@ - - - 4.0.0 - org.openntf.xpages - xpages-webapp-support - 1.3.0-SNAPSHOT - pom - - 2019 - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - Jesse Gallagher - jesse@frostillic.us - - - - - 1.8 - 1.8 - UTF-8 - UTF-8 - - com.hcl.xsp.p2 - [10.0.0,) - [3.8.0,) - - - - xpages-runtime - xpages-runtime-domino - xsp-maven-plugin - - - - 3.0.1 - - - - - artifactory.openntf.org - artifactory.openntf.org - https://artifactory.openntf.org/openntf - - - - - - artifactory.openntf.org - artifactory.openntf.org - https://artifactory.openntf.org/openntf - - - - - - - jakarta.servlet - jakarta.servlet-api - 4.0.4 - - - - ${xpages-groupId} - org.eclipse.osgi - ${equinox-version} - - - ${xpages-groupId} - org.eclipse.core.runtime - ${equinox-version} - - - ${xpages-groupId} - org.eclipse.equinox.common - ${equinox-version} - - - ${xpages-groupId} - org.eclipse.equinox.registry - [3.6.0,) - - - - ${xpages-groupId} - com.ibm.icu - [56.0.0,) - - - - ${xpages-groupId} - com.ibm.designer.lib.jsf - ${xpages-version} - - - - ${xpages-groupId} - com.ibm.xsp.core - ${xpages-version} - lwpd.xsp.core - - - ${xpages-groupId} - com.ibm.xsp.extsn - ${xpages-version} - lwpd.xsp.extsn - - - ${xpages-groupId} - com.ibm.commons - ${xpages-version} - lwpd.commons - - - ${xpages-groupId} - com.ibm.commons.vfs - ${xpages-version} - lwpd.commons.vfs - - - ${xpages-groupId} - com.ibm.jscript - ${xpages-version} - - - ${xpages-groupId} - com.ibm.xsp.designer - ${xpages-version} - lwpd.xsp.designer - - - ${xpages-groupId} - com.ibm.designer.runtime - ${xpages-version} - lwpd.runtime.designer - - - ${xpages-groupId} - com.ibm.designer.runtime.directory - ${xpages-version} - lwpd.runtime.directory - - - ${xpages-groupId} - com.ibm.commons.xml - ${xpages-version} - lwpd.commons.xml - - - - - ${xpages-groupId} - com.ibm.xsp.dojo - ${xpages-version} - xsp.dojo - - - ${xpages-groupId} - com.ibm.xsp.theme.oneui.idx - ${xpages-version} - xsp.theme.oneui.idx - - - ${xpages-groupId} - com.ibm.xsp.theme.oneuiv302 - ${xpages-version} - xsp.theme.oneuiv302 - - - - - ${xpages-groupId} - com.ibm.xsp.extlib - ${xpages-version} - - - ${xpages-groupId} - com.ibm.xsp.extlib.core - ${xpages-version} - - - ${xpages-groupId} - com.ibm.xsp.extlib.controls - ${xpages-version} - - - ${xpages-groupId} - com.ibm.xsp.extlib.oneui - ${xpages-version} - - - ${xpages-groupId} - com.ibm.xsp.theme.bootstrap - ${xpages-version} - - - ${xpages-groupId} - com.ibm.xsp.extlib.mobile - ${xpages-version} - - - ${xpages-groupId} - com.ibm.xsp.extlib.domino - ${xpages-version} - - - ${xpages-groupId} - com.ibm.xsp.extlib.relational - ${xpages-version} - - - ${xpages-groupId} - com.ibm.commons.jdbc - ${xpages-version} - lwpd.commons.jdbc - - - - - ${xpages-groupId} - com.ibm.xsp.domino - ${xpages-version} - lwpd.xsp.domino - - - ${xpages-groupId} - com.ibm.domino.napi - ${xpages-version} - lwpd.domino.napi - - - ${xpages-groupId} - com.ibm.domino.xsp.adapter - ${xpages-version} - lwpd.domino.adapter - - - ${xpages-groupId} - com.ibm.domino.xsp.adapter.nsf - ${xpages-version} - lwpd.domino.adapter.nsf - - - ${xpages-groupId} - com.ibm.notes.java.api.win32.linux - [9.0.1,) - Notes - - - ${xpages-groupId} - com.ibm.domino.xsp.bootstrap - ${xpages-version} - xsp.domino.bridge - - - ${xpages-groupId} - com.ibm.xsp.http.bootstrap - ${xpages-version} - - - ${xpages-groupId} - com.ibm.domino.services - ${xpages-version} - - - - - com.ibm.xsp.extlib.bazaar - com.ibm.xsp.extlibx.bazaar - 2.0.6 - - - com.ibm.xsp.extlib.bazaar - com.ibm.xsp.extlibx.bazaar.interpreter - 2.0.6 - - - - - - - - com.mycila - license-maven-plugin - 3.0 - - true -
license.txt
- - **/pom.xml - **/README - src/test/resources/** - src/main/resources/** - src/main/java/xsp/** - **/platformPlugins.txt - - - Jesse Gallagher - 2020 - -
-
-
-
- - - - p2-layout-resolver - - - notes-platform - - - - - - com.hcl.xsp.p2 - ${notes-platform} - p2 - - - - - - - org.openntf.maven - p2-layout-resolver - 1.2.0 - true - - - - - -
\ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime-domino/pom.xml b/xpages-webapp-support/xpages-runtime-domino/pom.xml deleted file mode 100644 index 393d48b..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - 4.0.0 - - org.openntf.xpages - xpages-webapp-support - 1.3.0-SNAPSHOT - - xpages-runtime-domino - - - - ${project.groupId} - xpages-runtime - ${project.version} - - - - jakarta.servlet - jakarta.servlet-api - provided - - - - - ${xpages-groupId} - com.ibm.xsp.domino - lwpd.xsp.domino - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - ${xpages-groupId} - com.ibm.domino.napi - lwpd.domino.napi - - - ${xpages-groupId} - com.ibm.domino.xsp.adapter - lwpd.domino.adapter - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - ${xpages-groupId} - com.ibm.domino.xsp.adapter.nsf - lwpd.domino.adapter.nsf - - - ${xpages-groupId} - com.ibm.notes.java.api.win32.linux - Notes - - - ${xpages-groupId} - com.ibm.domino.xsp.bootstrap - xsp.domino.bridge - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - ${xpages-groupId} - com.ibm.xsp.http.bootstrap - - - ${xpages-groupId} - com.ibm.domino.services - - - diff --git a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/JakartaDominoContextListener.java b/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/JakartaDominoContextListener.java deleted file mode 100644 index 59cc23e..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/JakartaDominoContextListener.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.domino; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.net.URL; -import java.net.URLConnection; -import java.net.URLStreamHandler; -import java.net.URLStreamHandlerFactory; -import java.security.AccessController; -import java.security.PrivilegedAction; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; - -import org.openntf.xpages.runtime.domino.platform.JakartaDominoPlatform; -import org.openntf.xpages.runtime.wrapper.JakartaServletContextWrapper; - -import com.ibm.commons.util.StringUtil; -import com.ibm.domino.napi.c.C; -import com.ibm.domino.xsp.module.nsf.NotesURL; - -import lotus.notes.NotesThread; - -@WebListener -public class JakartaDominoContextListener implements ServletContextListener { - @Override - public void contextInitialized(ServletContextEvent sce) { - NotesThread t = new NotesThread(() -> { - C.initLibrary(null); - - JakartaDominoPlatform.initContext(new JakartaServletContextWrapper(sce.getServletContext())); - - final URLStreamHandlerFactory delegate = AccessController.doPrivileged((PrivilegedAction) () -> { - URLStreamHandlerFactory d; - try { - // This is set by the Equinox dependency, which we definitely don't want - Field facField = URL.class.getDeclaredField("factory"); //$NON-NLS-1$ - facField.setAccessible(true); - d = (URLStreamHandlerFactory)facField.get(null); - facField.set(null, null); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - return d; - }); - - URL.setURLStreamHandlerFactory(protocol -> { - if("xspnsf".equals(StringUtil.toString(protocol))) { //$NON-NLS-1$ - return new URLStreamHandler() { - @Override - protected URLConnection openConnection(URL u) throws IOException { - return NotesURL.getInstance().openConnection(u); - } - }; - } else { - return delegate.createURLStreamHandler(protocol); - } - }); - }); - t.run(); - try { - t.join(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } -} diff --git a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/JakartaDominoXPagesServlet.java b/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/JakartaDominoXPagesServlet.java deleted file mode 100644 index 420e30b..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/JakartaDominoXPagesServlet.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.domino; - -import com.ibm.commons.util.StringUtil; -import com.ibm.designer.runtime.domino.adapter.LCDEnvironment; -import com.ibm.designer.runtime.domino.bootstrap.BootstrapEnvironment; -import com.ibm.designer.runtime.domino.bootstrap.RequestContext; -import com.ibm.designer.runtime.domino.bootstrap.adapter.HttpServletRequestAdapter; -import com.ibm.designer.runtime.domino.bootstrap.adapter.HttpServletResponseAdapter; -import com.ibm.designer.runtime.domino.bootstrap.adapter.HttpSessionAdapter; -import com.ibm.xsp.acl.NoAccessSignal; -import com.ibm.xsp.webapp.DesignerFacesServlet; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.openntf.xpages.runtime.domino.adapter.ServletHttpServletResponseAdapter; -import org.openntf.xpages.runtime.domino.adapter.ServletHttpSessionAdapter; -import org.openntf.xpages.runtime.domino.wrapper.JakartaDominoServletRequestWrapper; -import org.openntf.xpages.runtime.wrapper.JakartaServletRequestWrapper; - -import java.io.IOException; - -@WebServlet(urlPatterns="*.nsf") -public class JakartaDominoXPagesServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - public static ServletConfig servletConfig; - - private DesignerFacesServlet delegate; - private LCDEnvironment lcdEnvironment; - - public JakartaDominoXPagesServlet() { - -// try { -// // TODO figure out what else to init to get it to work in an alternate context path. -// // Currently, XPages are generated with absolute "/xsp" URLs -// // This could be done with UrlProcessors in RequestCustomizers -// this.lcdEnvironment = new LCDEnvironment(); -// this.lcdEnvironment.initialize(); -// } catch(Throwable t) { -// t.printStackTrace(); -// throw new RuntimeException(t); -// } - } - - @Override - public void init(ServletConfig config) throws ServletException { - servletConfig = config; - BootstrapEnvironment.getInstance().setGlobalContextPath(config.getServletContext().getContextPath(), true); - this.lcdEnvironment = LCDEnvironment.getInstance(); - - this.delegate = new DesignerFacesServlet(); - delegate.init(config); - } - - @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - String pathInfo = req.getRequestURI(); - int nsfIndex = pathInfo.indexOf(".nsf"); //$NON-NLS-1$ - if(lcdEnvironment != null && (nsfIndex > -1 || true)) { - // Pass NSF requests to the stock LCD processor. The advantage here is that it takes care of - // everything. However, it also doesn't take into account the various Liberty adapters, so - // the actual environment is semi-forced down to a crappier Servlet level - String contextPath = StringUtil.toString(req.getContextPath()); - String path = pathInfo.substring(contextPath.length()); - RequestContext requestContext = new RequestContext(contextPath, path); - HttpSessionAdapter sessionAdapter = new ServletHttpSessionAdapter(req.getSession()); - HttpServletRequestAdapter requestAdapter = new JakartaDominoServletRequestWrapper(req); - HttpServletResponseAdapter responseAdapter = new ServletHttpServletResponseAdapter(resp); - try { - lcdEnvironment.service(requestContext, sessionAdapter, requestAdapter, responseAdapter); - } catch(NoAccessSignal s) { - // TODO see if this can signal the container for form-based auth - resp.setHeader("WWW-Authenticate", "Basic realm=\"XPagesRuntime\""); //$NON-NLS-1$ //$NON-NLS-2$ - resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, "You must log in"); //$NON-NLS-1$ - } - } else { - // In-app XPage - delegate.service(new JakartaServletRequestWrapper(req), resp); - } - } - - @Override - public void destroy() { - delegate.destroy(); - } -} diff --git a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/adapter/ServletHttpServletResponseAdapter.java b/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/adapter/ServletHttpServletResponseAdapter.java deleted file mode 100644 index 4394bad..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/adapter/ServletHttpServletResponseAdapter.java +++ /dev/null @@ -1,188 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.domino.adapter; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Collection; -import java.util.Locale; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; - -import com.ibm.designer.runtime.domino.bootstrap.adapter.HttpServletResponseAdapter; - -public class ServletHttpServletResponseAdapter implements HttpServletResponseAdapter { - - private final HttpServletResponse delegate; - - public ServletHttpServletResponseAdapter(HttpServletResponse delegate) { - this.delegate = delegate; - } - - public void addCookie(Cookie cookie) { - delegate.addCookie(cookie); - } - - public boolean containsHeader(String name) { - return delegate.containsHeader(name); - } - - public String encodeURL(String url) { - return delegate.encodeURL(url); - } - - public String getCharacterEncoding() { - return delegate.getCharacterEncoding(); - } - - public String encodeRedirectURL(String url) { - return delegate.encodeRedirectURL(url); - } - - public String getContentType() { - return delegate.getContentType(); - } - - @SuppressWarnings("deprecation") - public String encodeUrl(String url) { - return delegate.encodeUrl(url); - } - - @SuppressWarnings("deprecation") - public String encodeRedirectUrl(String url) { - return delegate.encodeRedirectUrl(url); - } - - public void sendError(int sc, String msg) throws IOException { - delegate.sendError(sc, msg); - } - - public ServletOutputStream getOutputStream() throws IOException { - return delegate.getOutputStream(); - } - - public PrintWriter getWriter() throws IOException { - return delegate.getWriter(); - } - - public void sendError(int sc) throws IOException { - delegate.sendError(sc); - } - - public void setCharacterEncoding(String charset) { - delegate.setCharacterEncoding(charset); - } - - public void sendRedirect(String location) throws IOException { - delegate.sendRedirect(location); - } - - public void setDateHeader(String name, long date) { - delegate.setDateHeader(name, date); - } - - public void setContentLength(int len) { - delegate.setContentLength(len); - } - - public void setContentLengthLong(long len) { - delegate.setContentLengthLong(len); - } - - public void addDateHeader(String name, long date) { - delegate.addDateHeader(name, date); - } - - public void setContentType(String type) { - delegate.setContentType(type); - } - - public void setHeader(String name, String value) { - delegate.setHeader(name, value); - } - - public void addHeader(String name, String value) { - delegate.addHeader(name, value); - } - - public void setBufferSize(int size) { - delegate.setBufferSize(size); - } - - public void setIntHeader(String name, int value) { - delegate.setIntHeader(name, value); - } - - public void addIntHeader(String name, int value) { - delegate.addIntHeader(name, value); - } - - public void setStatus(int sc) { - delegate.setStatus(sc); - } - - public int getBufferSize() { - return delegate.getBufferSize(); - } - - public void flushBuffer() throws IOException { - delegate.flushBuffer(); - } - - @SuppressWarnings("deprecation") - public void setStatus(int sc, String sm) { - delegate.setStatus(sc, sm); - } - - public void resetBuffer() { - delegate.resetBuffer(); - } - - public int getStatus() { - return delegate.getStatus(); - } - - public boolean isCommitted() { - return delegate.isCommitted(); - } - - public String getHeader(String name) { - return delegate.getHeader(name); - } - - public void reset() { - delegate.reset(); - } - - public Collection getHeaders(String name) { - return delegate.getHeaders(name); - } - - public void setLocale(Locale loc) { - delegate.setLocale(loc); - } - - public Collection getHeaderNames() { - return delegate.getHeaderNames(); - } - - public Locale getLocale() { - return delegate.getLocale(); - } - -} diff --git a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/adapter/ServletHttpSessionAdapter.java b/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/adapter/ServletHttpSessionAdapter.java deleted file mode 100644 index dd72b62..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/adapter/ServletHttpSessionAdapter.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.domino.adapter; - -import java.util.Enumeration; - -import javax.servlet.ServletContext; -import javax.servlet.http.HttpSessionContext; - -import javax.servlet.http.HttpSession; - -import com.ibm.designer.runtime.domino.bootstrap.adapter.HttpSessionAdapter; - -@SuppressWarnings("deprecation") -public class ServletHttpSessionAdapter implements HttpSessionAdapter { - private final HttpSession delegate; - - public ServletHttpSessionAdapter(HttpSession delegate) { - this.delegate = delegate; - } - - @Override - public Object getAttribute(String var1) { - return delegate.getAttribute(var1); - } - - @Override - public Enumeration getAttributeNames() { - return delegate.getAttributeNames(); - } - - @Override - public long getCreationTime() { - return delegate.getCreationTime(); - } - - @Override - public String getId() { - return delegate.getId(); - } - - @Override - public long getLastAccessedTime() { - return delegate.getLastAccessedTime(); - } - - @Override - public int getMaxInactiveInterval() { - return delegate.getMaxInactiveInterval(); - } - - @Override - public ServletContext getServletContext() { -// return new LibertyServletContextWrapper(delegate.getServletContext()); - return delegate.getServletContext(); - } - - @Override - public HttpSessionContext getSessionContext() { - return delegate.getSessionContext(); - } - - @Override - public Object getValue(String var1) { - return delegate.getValue(var1); - } - - @Override - public String[] getValueNames() { - return delegate.getValueNames(); - } - - @Override - public void invalidate() { - delegate.invalidate(); - } - - @Override - public boolean isNew() { - return delegate.isNew(); - } - - @Override - public void putValue(String var1, Object var2) { - delegate.putValue(var1, var2); - } - - @Override - public void removeAttribute(String var1) { - delegate.removeAttribute(var1); - } - - @Override - public void removeValue(String var1) { - delegate.removeValue(var1); - } - - @Override - public void setAttribute(String var1, Object var2) { - delegate.setAttribute(var1, var2); - } - - @Override - public void setMaxInactiveInterval(int var1) { - delegate.setMaxInactiveInterval(var1); - } - -} diff --git a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/platform/JakartaDominoPlatform.java b/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/platform/JakartaDominoPlatform.java deleted file mode 100644 index a35386e..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/platform/JakartaDominoPlatform.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.domino.platform; - -import java.io.File; -import java.util.Properties; - -import javax.servlet.ServletContext; - -import org.openntf.xpages.runtime.JakartaAppExecutionContext; -import org.openntf.xpages.runtime.JakartaApplication; - -import com.ibm.commons.util.StringUtil; -import com.ibm.designer.runtime.Application.IApplicationFinder; -import com.ibm.designer.runtime.ApplicationException; -import com.ibm.domino.napi.c.C; -import com.ibm.domino.napi.c.Os; -import com.ibm.domino.xsp.module.nsf.platform.AbstractNotesDominoPlatform; -import com.ibm.domino.xsp.module.nsf.platform.JSDebuggerRuntime; -import com.ibm.jscript.JSContext; -import com.ibm.xsp.domino.context.DominoDojo; -import com.ibm.xsp.model.domino.DominoUtils; - -import lotus.notes.NotesThread; - -public class JakartaDominoPlatform extends AbstractNotesDominoPlatform { - private static ServletContext servletContext; - - public static void initContext(ServletContext servletContext) { - JakartaDominoPlatform.servletContext = servletContext; - } - - public static final String DOMINO_ROOT_PREFIX = "domino"; //$NON-NLS-1$ - public static final String DOMINO_RESOURCE_ROOT = "/.ibmxspres/domino"; //$NON-NLS-1$ - private File installationDirectory; - private File dataDirectory; - private File sharedDataDirectory; - private File userDataDirectory; - private File propertiesDirectory; - private File xspDirectory; - private File nsfDirectory; - private File styleKitsDirectory; - private File serverDirectory; - private File dominoDirectory; - private File notesIconsDirectory; - private File jsDirectory; - private Properties xspProperties; - - public JakartaDominoPlatform() { - NotesThread t = new NotesThread(() -> { - C.initLibrary(null); - - installationDirectory = new File(Os.OSGetExecutableDirectory()); - dataDirectory = new File(Os.OSGetDataDirectory()); - sharedDataDirectory = new File(Os.OSGetSharedDataDirectory()); - userDataDirectory = dataDirectory; - propertiesDirectory = new File(dataDirectory, "properties"); //$NON-NLS-1$ - xspDirectory = new File(installationDirectory, "xsp"); //$NON-NLS-1$ - nsfDirectory = new File(xspDirectory, "nsf"); //$NON-NLS-1$ - styleKitsDirectory = new File(nsfDirectory, "themes"); //$NON-NLS-1$ - serverDirectory = new File(dataDirectory, StringUtil.replace(AbstractNotesDominoPlatform.DOMINO_ROOT_PREFIX + "/java/xsp", '/', File.separatorChar)); //$NON-NLS-1$ - dominoDirectory = new File(dataDirectory, StringUtil.replace(AbstractNotesDominoPlatform.DOMINO_ROOT_PREFIX + "/html", '/', File.separatorChar)); //$NON-NLS-1$ - notesIconsDirectory = new File(dataDirectory, StringUtil.replace(AbstractNotesDominoPlatform.DOMINO_ROOT_PREFIX + "/icons", '/', File.separatorChar)); //$NON-NLS-1$ - jsDirectory = new File(dataDirectory, AbstractNotesDominoPlatform.DOMINO_ROOT_PREFIX + "/js/"); //$NON-NLS-1$ - this.xspProperties = this.loadStaticProperties(); - DominoDojo.installDominoFactory(this.jsDirectory); - this.initJSEngine(); - }); - t.run(); - try { - t.join(); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - - protected void initJSEngine() { - JSContext.ENABLE_JSDEBUGGER = this.isJavaDebugEnabled() && this.isJavaScriptDebugEnabled(); - if (JSContext.ENABLE_JSDEBUGGER) { - JSContext.setDebuggerRuntime(new JSDebuggerRuntime()); - } - - } - - protected boolean isJavaDebugEnabled() { - String var1 = DominoUtils.getEnvironmentString(AbstractNotesDominoPlatform.PROP_JAVADEBUG); - return var1 != null ? StringUtil.equals(var1.trim(), "1") : false; //$NON-NLS-1$ - } - - protected boolean isJavaScriptDebugEnabled() { - String var1 = DominoUtils.getEnvironmentString(AbstractNotesDominoPlatform.PROP_JAVASCRIPTDEBUG); - return var1 != null ? StringUtil.equals(var1.trim(), "1") : false; //$NON-NLS-1$ - } - -// @Override - protected Properties loadStaticProperties() { - return new Properties(); - } - - @Override - public Object getObject(String s) { - if("com.ibm.xsp.designer.ApplicationFinder".equals(s)) { //$NON-NLS-1$ - return (IApplicationFinder) () -> { - if(app == null) { - JakartaAppExecutionContext ctx = getAppExecutionContext(); - app = new JakartaApplication(ctx); - } - return app; - }; - } else { - return super.getObject(s); - } - } - - private JakartaAppExecutionContext execContext; - private JakartaApplication app; - - private JakartaAppExecutionContext getAppExecutionContext() { - if(execContext == null) { - try { - execContext = new JakartaAppExecutionContext(servletContext); - } catch (ApplicationException e) { - throw new RuntimeException(e); - } - } - return execContext; - } - - @Override - public File getInstallationDirectory() { - return installationDirectory; - } - - @Override - public File getResourcesDirectory() { - return nsfDirectory; - } - - public File getGlobalResourceFile(String path) { - if(path.startsWith("/stylekits/")) { //$NON-NLS-1$ - return new File(styleKitsDirectory, path.substring("/stylekits/".length())); //$NON-NLS-1$ - } - if(path.startsWith("/server/")) { //$NON-NLS-1$ - return new File(serverDirectory, path.substring("/server/".length())); //$NON-NLS-1$ - } - if(path.startsWith("/domino/")) { //$NON-NLS-1$ - return new File(dominoDirectory, path.substring("/domino/".length())); //$NON-NLS-1$ - } - if(path.startsWith("/global/")) { //$NON-NLS-1$ - return new File(serverDirectory, path.substring("/global/".length())); //$NON-NLS-1$ - } - if(path.startsWith("/properties/")) { //$NON-NLS-1$ - - if (userDataDirectory != null) { - File localFile = new File(userDataDirectory, "properties/" + path.substring("/properties/".length())); //$NON-NLS-1$ //$NON-NLS-2$ - if (localFile.exists()) { - return localFile; - } - } - - if (sharedDataDirectory != null) { - File localFile = new File(sharedDataDirectory, "properties/" + path.substring("/properties/".length())); //$NON-NLS-1$ //$NON-NLS-2$ - if (localFile.exists()) { - return localFile; - } - } - - return new File(propertiesDirectory, path.substring("/properties/".length())); //$NON-NLS-1$ - } - if(path.startsWith("/icons/")) { //$NON-NLS-1$ - return new File(notesIconsDirectory, path.substring("/icons/".length())); //$NON-NLS-1$ - } - return super.getGlobalResourceFile(path); - } - - @Override - public String getProperty(String prop) { - String var2; - if (this.xspProperties != null) { - var2 = this.xspProperties.getProperty(prop); - if (StringUtil.isNotEmpty(var2)) { - return var2; - } - } - return super.getProperty(prop); - } - - @Override - public boolean isPlatform(String name) { - if("Domino".equals(name)) { //$NON-NLS-1$ - // Sure I am - return true; - } else { - return false; - } - } - - @Override - public File getNotesIconsDirectory() { - return this.notesIconsDirectory; - } -} diff --git a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/platform/JakartaDominoPlatformFactory.java b/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/platform/JakartaDominoPlatformFactory.java deleted file mode 100644 index 2ba9343..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/platform/JakartaDominoPlatformFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.domino.platform; - -import com.ibm.commons.Platform; -import com.ibm.commons.platform.IPlatformFactory; - -public class JakartaDominoPlatformFactory implements IPlatformFactory { - @Override - public Platform createPlatform() { - return new JakartaDominoPlatform(); - } -} diff --git a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/wrapper/JakartaDominoServletRequestWrapper.java b/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/wrapper/JakartaDominoServletRequestWrapper.java deleted file mode 100644 index d5035ee..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/src/main/java/org/openntf/xpages/runtime/domino/wrapper/JakartaDominoServletRequestWrapper.java +++ /dev/null @@ -1,413 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.domino.wrapper; - -import javax.servlet.*; -import javax.servlet.http.*; - -import org.openntf.xpages.runtime.wrapper.JakartaServletContextWrapper; - -import com.ibm.designer.runtime.domino.bootstrap.adapter.HttpServletRequestAdapter; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.security.Principal; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Locale; -import java.util.Map; - -public class JakartaDominoServletRequestWrapper implements HttpServletRequest, HttpServletRequestAdapter { - private final HttpServletRequest delegate; - - private Principal overridePrincipal; - - public JakartaDominoServletRequestWrapper(HttpServletRequest delegate) { - this.delegate = delegate; - } - - @Override - public Principal getUserPrincipal() { - if(this.overridePrincipal != null) { - return this.overridePrincipal; - } - Principal d = delegate.getUserPrincipal(); - if(d == null) { - return new Principal() { - @Override - public String getName() { - return "Anonymous"; //$NON-NLS-1$ - } - }; - } - return d; - } - - @Override - public ServletContext getServletContext() { - return new JakartaServletContextWrapper(delegate.getServletContext()); - } - - @Override - public String getAuthType() { - return delegate.getAuthType(); - } - - @Override - public Cookie[] getCookies() { - return delegate.getCookies(); - } - - @Override - public long getDateHeader(String name) { - return delegate.getDateHeader(name); - } - - @Override - public String getHeader(String name) { - return delegate.getHeader(name); - } - - @Override - public Enumeration getHeaders(String name) { - return delegate.getHeaders(name); - } - - @Override - public Enumeration getHeaderNames() { - return delegate.getHeaderNames(); - } - - @Override - public int getIntHeader(String name) { - return delegate.getIntHeader(name); - } - - @Override - public String getMethod() { - return delegate.getMethod(); - } - - @Override - public String getPathInfo() { - return delegate.getPathInfo(); - } - - @Override - public String getPathTranslated() { - return delegate.getPathTranslated(); - } - - @Override - public String getContextPath() { - return delegate.getContextPath(); - } - - @Override - public String getQueryString() { - return delegate.getQueryString(); - } - - @Override - public String getRemoteUser() { - return delegate.getRemoteUser(); - } - - @Override - public boolean isUserInRole(String role) { - return delegate.isUserInRole(role); - } - - @Override - public String getRequestedSessionId() { - return delegate.getRequestedSessionId(); - } - - @Override - public String getRequestURI() { - return delegate.getRequestURI(); - } - - @Override - public StringBuffer getRequestURL() { - return delegate.getRequestURL(); - } - - @Override - public String getServletPath() { - return delegate.getServletPath(); - } - - @Override - public HttpSession getSession(boolean create) { - return delegate.getSession(create); - } - - @Override - public HttpSession getSession() { - return delegate.getSession(); - } - - @Override - public String changeSessionId() { - return delegate.changeSessionId(); - } - - @Override - public boolean isRequestedSessionIdValid() { - return delegate.isRequestedSessionIdValid(); - } - - @Override - public boolean isRequestedSessionIdFromCookie() { - return delegate.isRequestedSessionIdFromCookie(); - } - - @Override - public boolean isRequestedSessionIdFromURL() { - return delegate.isRequestedSessionIdFromURL(); - } - - @SuppressWarnings("deprecation") - @Override - public boolean isRequestedSessionIdFromUrl() { - return delegate.isRequestedSessionIdFromUrl(); - } - - @Override - public boolean authenticate(HttpServletResponse response) throws IOException, ServletException { - return delegate.authenticate(response); - } - - @Override - public void login(String username, String password) throws ServletException { - delegate.login(username, password); - } - - @Override - public void logout() throws ServletException { - delegate.logout(); - } - - @Override - public Collection getParts() throws IOException, ServletException { - return delegate.getParts(); - } - - @Override - public Part getPart(String name) throws IOException, ServletException { - return delegate.getPart(name); - } - - @Override - public T upgrade(Class handlerClass) throws IOException, ServletException { - return delegate.upgrade(handlerClass); - } - - @Override - public Object getAttribute(String name) { - return delegate.getAttribute(name); - } - - @Override - public Enumeration getAttributeNames() { - return delegate.getAttributeNames(); - } - - @Override - public String getCharacterEncoding() { - return delegate.getCharacterEncoding(); - } - - @Override - public void setCharacterEncoding(String env) throws UnsupportedEncodingException { - delegate.setCharacterEncoding(env); - } - - @Override - public int getContentLength() { - return delegate.getContentLength(); - } - - @Override - public long getContentLengthLong() { - return delegate.getContentLengthLong(); - } - - @Override - public String getContentType() { - return delegate.getContentType(); - } - - @Override - public ServletInputStream getInputStream() throws IOException { - return delegate.getInputStream(); - } - - @Override - public String getParameter(String name) { - return delegate.getParameter(name); - } - - @Override - public Enumeration getParameterNames() { - return delegate.getParameterNames(); - } - - @Override - public String[] getParameterValues(String name) { - return delegate.getParameterValues(name); - } - - @Override - public Map getParameterMap() { - return delegate.getParameterMap(); - } - - @Override - public String getProtocol() { - return delegate.getProtocol(); - } - - @Override - public String getScheme() { - return delegate.getScheme(); - } - - @Override - public String getServerName() { - return delegate.getServerName(); - } - - @Override - public int getServerPort() { - return delegate.getServerPort(); - } - - @Override - public BufferedReader getReader() throws IOException { - return delegate.getReader(); - } - - @Override - public String getRemoteAddr() { - return delegate.getRemoteAddr(); - } - - @Override - public String getRemoteHost() { - return delegate.getRemoteHost(); - } - - @Override - public void setAttribute(String name, Object o) { - delegate.setAttribute(name, o); - } - - @Override - public void removeAttribute(String name) { - delegate.removeAttribute(name); - } - - @Override - public Locale getLocale() { - return delegate.getLocale(); - } - - @Override - public Enumeration getLocales() { - return delegate.getLocales(); - } - - @Override - public boolean isSecure() { - return delegate.isSecure(); - } - - @Override - public RequestDispatcher getRequestDispatcher(String path) { - return delegate.getRequestDispatcher(path); - } - - @SuppressWarnings("deprecation") - @Override - public String getRealPath(String path) { - return delegate.getRealPath(path); - } - - @Override - public int getRemotePort() { - return delegate.getRemotePort(); - } - - @Override - public String getLocalName() { - return delegate.getLocalName(); - } - - @Override - public String getLocalAddr() { - return delegate.getLocalAddr(); - } - - @Override - public int getLocalPort() { - return delegate.getLocalPort(); - } - - @Override - public AsyncContext startAsync() throws IllegalStateException { - return delegate.startAsync(); - } - - @Override - public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException { - return delegate.startAsync(servletRequest, servletResponse); - } - - @Override - public boolean isAsyncStarted() { - return delegate.isAsyncStarted(); - } - - @Override - public boolean isAsyncSupported() { - return delegate.isAsyncSupported(); - } - - @Override - public AsyncContext getAsyncContext() { - return delegate.getAsyncContext(); - } - - @Override - public DispatcherType getDispatcherType() { - return delegate.getDispatcherType(); - } - - @Override - public String getConversationId() { - // TODO ??? - return delegate.getRequestedSessionId(); - } - - @Override - public void setUserPrincipal(Principal var1) { -// System.out.println("Setting user principal to " + var1); - this.overridePrincipal = var1; - } -} diff --git a/xpages-webapp-support/xpages-runtime-domino/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory b/xpages-webapp-support/xpages-runtime-domino/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory deleted file mode 100644 index 59c131e..0000000 --- a/xpages-webapp-support/xpages-runtime-domino/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory +++ /dev/null @@ -1 +0,0 @@ -org.openntf.xpages.runtime.domino.platform.JakartaDominoPlatformFactory \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/pom.xml b/xpages-webapp-support/xpages-runtime/pom.xml deleted file mode 100644 index 5e8d557..0000000 --- a/xpages-webapp-support/xpages-runtime/pom.xml +++ /dev/null @@ -1,196 +0,0 @@ - - 4.0.0 - - org.openntf.xpages - xpages-webapp-support - 1.3.0-SNAPSHOT - - xpages-runtime - - - - jakarta.servlet - jakarta.servlet-api - provided - - - - - ${xpages-groupId} - org.eclipse.osgi - - - ${xpages-groupId} - org.eclipse.core.runtime - - - ${xpages-groupId} - org.eclipse.equinox.common - - - ${xpages-groupId} - org.eclipse.equinox.registry - - - - ${xpages-groupId} - com.ibm.icu - - - - - ${xpages-groupId} - com.ibm.designer.lib.jsf - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - - - ${xpages-groupId} - com.ibm.xsp.core - lwpd.xsp.core - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - ${xpages-groupId} - com.ibm.xsp.extsn - lwpd.xsp.extsn - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - ${xpages-groupId} - com.ibm.commons - lwpd.commons - - - ${xpages-groupId} - com.ibm.commons.vfs - lwpd.commons.vfs - - - ${xpages-groupId} - com.ibm.jscript - - - ${xpages-groupId} - com.ibm.xsp.designer - lwpd.xsp.designer - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - ${xpages-groupId} - com.ibm.designer.runtime - lwpd.runtime.designer - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - ${xpages-groupId} - com.ibm.designer.runtime.directory - lwpd.runtime.directory - - - ${xpages-groupId} - com.ibm.commons.xml - lwpd.commons.xml - - - - - ${xpages-groupId} - com.ibm.xsp.dojo - xsp.dojo - - - ${xpages-groupId} - com.ibm.xsp.theme.oneui.idx - xsp.theme.oneui.idx - - - ${xpages-groupId} - com.ibm.xsp.theme.oneuiv302 - xsp.theme.oneuiv302 - - - - - ${xpages-groupId} - com.ibm.xsp.extlib - - - ${xpages-groupId} - com.ibm.pvc.servlet - - - - - ${xpages-groupId} - com.ibm.xsp.extlib.core - - - ${xpages-groupId} - com.ibm.xsp.extlib.controls - - - ${xpages-groupId} - com.ibm.xsp.extlib.oneui - - - ${xpages-groupId} - com.ibm.xsp.theme.bootstrap - - - ${xpages-groupId} - com.ibm.xsp.extlib.mobile - - - ${xpages-groupId} - com.ibm.xsp.extlib.domino - - - ${xpages-groupId} - com.ibm.xsp.extlib.relational - - - ${xpages-groupId} - com.ibm.commons.jdbc - lwpd.commons.jdbc - - - - - com.ibm.xsp.extlib.bazaar - com.ibm.xsp.extlibx.bazaar - - - com.ibm.xsp.extlib.bazaar - com.ibm.xsp.extlibx.bazaar.interpreter - - - \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/com/ibm/xsp/dojo/factory/JakartaDojoLibraryFactory.java b/xpages-webapp-support/xpages-runtime/src/main/java/com/ibm/xsp/dojo/factory/JakartaDojoLibraryFactory.java deleted file mode 100644 index 1cf065e..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/com/ibm/xsp/dojo/factory/JakartaDojoLibraryFactory.java +++ /dev/null @@ -1,276 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.ibm.xsp.dojo.factory; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.List; -import java.util.Map; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.ServiceReference; - -import com.ibm.commons.Platform; -import com.ibm.commons.util.StringUtil; -import com.ibm.commons.util.io.StreamUtil; -import com.ibm.xsp.context.DojoLibrary; -import com.ibm.xsp.context.DojoLibraryFactory; -import com.ibm.xsp.core.Version; - -public class JakartaDojoLibraryFactory extends DojoLibraryFactory { - private static boolean isdev; - private static File devDojoStream; - - public JakartaDojoLibraryFactory() { - } - - @SuppressWarnings("deprecation") - private static String findVersionTag() { - BufferedReader var0 = null; - - String var6; - try { - URL var2 = JakartaDojoLibraryFactory.class.getResource("/resources/dojo-src-version.txt"); //$NON-NLS-1$ - if (var2 == null) { - devDojoStream = findDevSourceDir(); - if (devDojoStream != null) { - File var3 = new File(devDojoStream, "dojo.01\\dojo-src\\lwp\\version.txt"); //$NON-NLS-1$ - if (var3.exists()) { - isdev = true; - var2 = var3.toURL(); - } - } - } - - if (var2 == null) { - return "0.0.0"; //$NON-NLS-1$ - } - - var0 = new BufferedReader(new InputStreamReader(var2.openStream())); - String var13 = var0.readLine(); - if (var13 == null || var13.length() <= 0) { - return "0.0.0"; //$NON-NLS-1$ - } - - int var4 = var13.indexOf(45); - if (-1 != var4) { - var13 = var13.substring(0, var4); - } - - try { - Version.parseVersion(var13); - var6 = var13; - } catch (IllegalArgumentException var10) { - return "0.0.0"; //$NON-NLS-1$ - } - } catch (IOException var11) { - var11.printStackTrace(); - return "0.0.0"; //$NON-NLS-1$ - } finally { - StreamUtil.close(var0); - } - - return var6; - } - - private static File findDevSourceDir() { - String var0 = Platform.getInstance().getProperty("xsp.dev.dojostream"); //$NON-NLS-1$ - - if (StringUtil.isNotEmpty(var0)) { - File var1 = new File(var0); - if (var1.exists()) { - return var1; - } - } - - return null; - } - - private Bundle mockBundle() { - return new Bundle() { - @Override - public int getState() { - return 0; - } - - @Override - public void start(int i) throws BundleException { - - } - - @Override - public void start() throws BundleException { - - } - - @Override - public void stop(int i) throws BundleException { - - } - - @Override - public void stop() throws BundleException { - - } - - @Override - public void update(InputStream inputStream) throws BundleException { - - } - - @Override - public void update() throws BundleException { - - } - - @Override - public void uninstall() throws BundleException { - - } - - @Override - public Dictionary getHeaders() { - return null; - } - - @Override - public long getBundleId() { - return 0; - } - - @Override - public String getLocation() { - return null; - } - - @Override - public ServiceReference[] getRegisteredServices() { - return new ServiceReference[0]; - } - - @Override - public ServiceReference[] getServicesInUse() { - return new ServiceReference[0]; - } - - @Override - public boolean hasPermission(Object o) { - return false; - } - - @Override - public URL getResource(String s) { - return JakartaDojoLibraryFactory.class.getResource(s); - } - - @Override - public Dictionary getHeaders(String s) { - return null; - } - - @Override - public String getSymbolicName() { - return null; - } - - @Override - public Class loadClass(String s) throws ClassNotFoundException { - return null; - } - - @Override - public Enumeration getResources(String s) throws IOException { - return null; - } - - @Override - public Enumeration getEntryPaths(String s) { - return null; - } - - @Override - public URL getEntry(String s) { - return null; - } - - @Override - public long getLastModified() { - return 0; - } - - @Override - public Enumeration findEntries(String s, String s1, boolean b) { - return null; - } - - @Override - public BundleContext getBundleContext() { - return null; - } - - @Override - public Map> getSignerCertificates(int i) { - return null; - } - - @Override - public org.osgi.framework.Version getVersion() { - return null; - } - - @Override - public A adapt(Class aClass) { - return null; - } - - @Override - public File getDataFile(String s) { - return null; - } - - @Override - public int compareTo(Bundle o) { - return 0; - } - }; - } - - public Collection getLibraries() { - String var2 = findVersionTag(); - String var3 = "/resources/dojo-version"; //$NON-NLS-1$ - List var4 = new ArrayList(); - if (isdev) { - var4.add(new DevDojo(devDojoStream, mockBundle(), var2, var3)); - var4.add(new DevDojo(devDojoStream, mockBundle(), var2 + "-u", var3)); //$NON-NLS-1$ - } else { - var4.add(new IbmBundleDojo(mockBundle(), var2, var3)); - var4.add(new IbmBundleDojo(mockBundle(), var2 + "-u", var3)); //$NON-NLS-1$ - } - - return var4; - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaAppExecutionContext.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaAppExecutionContext.java deleted file mode 100644 index c196643..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaAppExecutionContext.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime; - -import com.ibm.commons.vfs.VFS; -import com.ibm.commons.vfs.VFSException; -import com.ibm.designer.runtime.ApplicationException; -import com.ibm.designer.runtime.server.ServletExecutionContext; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; - -import javax.servlet.ServletContext; - -import org.openntf.xpages.runtime.vfs.ClasspathVFS; - -public class JakartaAppExecutionContext extends ServletExecutionContext { - private String appDirectory; - private final VFS vfs; - - public JakartaAppExecutionContext(ServletContext servletContext) throws ApplicationException { - super("Jakarta App", "jakartaApp", servletContext); //$NON-NLS-1$ //$NON-NLS-2$ - - try { - this.vfs = new ClasspathVFS(this); - } catch (VFSException e) { - throw new ApplicationException(e); - } - } - - public String getApplicationDirectory() { - ServletContext servletContext = getServletContext(); - if (this.appDirectory == null && servletContext != null) { - this.appDirectory = servletContext.getRealPath("."); //$NON-NLS-1$ - if (this.appDirectory != null) { - File var1 = new File(this.appDirectory + File.separator + "WEB-INF"); //$NON-NLS-1$ - if (!var1.exists()) { - try { - URL var2 = servletContext.getResource(System.getProperty("user.dir")); //$NON-NLS-1$ - if(var2 != null) { - this.appDirectory = this.appDirectory + var2.getFile(); - } - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - } - } - return this.appDirectory; - } - - @Override - public VFS getVFS() { - return this.vfs; - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaApplication.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaApplication.java deleted file mode 100644 index e1b5769..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaApplication.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime; - -import com.ibm.designer.runtime.Application; -import com.ibm.designer.runtime.IAppExecutionContext; - -public class JakartaApplication extends Application { - public JakartaApplication(IAppExecutionContext iAppExecutionContext) { - super(iAppExecutionContext); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaFacesApplication.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaFacesApplication.java deleted file mode 100644 index bc2f792..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaFacesApplication.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime; - -import java.io.IOException; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.logging.Logger; - -import javax.faces.application.Application; -import javax.faces.application.ViewHandler; - -import com.ibm.xsp.application.DesignerApplicationEx; -import com.ibm.xsp.factory.FactoryLookup; - -@SuppressWarnings("unused") -public class JakartaFacesApplication extends DesignerApplicationEx { - private static final Logger log = Logger.getLogger(JakartaFacesApplication.class.getName()); - - private FactoryLookup factoryLookup; - private ViewHandler viewHandler; - - protected JakartaFacesApplication(Application application) { - super(application); - -// try { -// Field factoryLookupField = ApplicationExImpl.class.getDeclaredField("_factoryLookup"); -// factoryLookupField.setAccessible(true); -// factoryLookupField.set(this, getFactoryLookup()); -// } catch (Exception e) { -// e.printStackTrace(); -// } - } - - - - -// @Override -// public synchronized ViewHandler getViewHandler() { -// if (this.viewHandler == null) { -// ViewHandler sup = super.getViewHandler(); -// if (!(sup instanceof ViewHandlerEx)) { -// FacesClassLoader cl = new JakartaFacesClassLoader(getDesignerApplication()); -// FacesPageDriver driver = new JakartaFacesPageDriver(cl); -// ViewHandlerExImpl result = new ViewHandlerExImpl(sup); -// result.setPageDriver(driver); -// this.viewHandler = result; -// } else { -// this.viewHandler = sup; -// } -// } -// return this.viewHandler; -// } - -// @Override -// public FactoryLookup getFactoryLookup() { -// if (this.factoryLookup == null) { -// this.factoryLookup = new JakartaFactoryLookup(super.getFactoryLookup()); -// } -// return this.factoryLookup; -// } - -// @Override -// public String getApplicationProperty(String s, String s1) { -// String prop = super.getApplicationProperty(s, s1); -// return prop; -// } -// - @Override - protected ResourceBundle loadResourceBundle(String s, Locale locale) throws IOException { - ResourceBundle result = super.loadResourceBundle(s, locale); - if(result == null) { - result = ResourceBundle.getBundle(s, locale, Thread.currentThread().getContextClassLoader()); - } - return result; - } - -// @Override -// public List findServices(String s) { -// List svc = super.findServices(s); -// return svc; -// } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaFacesApplicationFactory.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaFacesApplicationFactory.java deleted file mode 100644 index dba6787..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaFacesApplicationFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime; - -import com.ibm.xsp.application.ApplicationEx; -import com.ibm.xsp.application.DesignerApplicationFactoryImpl; - -import javax.faces.application.Application; -import javax.faces.application.ApplicationFactory; - -public class JakartaFacesApplicationFactory extends DesignerApplicationFactoryImpl { - public JakartaFacesApplicationFactory(ApplicationFactory factory) { - super(factory); - } - - public JakartaFacesApplicationFactory() { - } - - @Override - protected ApplicationEx createApplicationInstance(Application application) { - return new JakartaFacesApplication(application); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaGlobalFacesResourceServlet.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaGlobalFacesResourceServlet.java deleted file mode 100644 index c2078c9..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaGlobalFacesResourceServlet.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.annotation.WebServlet; - -import com.ibm.xsp.webapp.DesignerGlobalResourceServlet; - -@WebServlet(urlPatterns="/xsp/.ibmxspres/*") -public class JakartaGlobalFacesResourceServlet extends DesignerGlobalResourceServlet { - private static final long serialVersionUID = 1L; - - @Override - public void service(ServletRequest var1, ServletResponse var2) throws ServletException, IOException { - try { - super.service(var1, var2); - } catch(IOException e) { - if("Broken pipe".equals(e.getMessage())) { //$NON-NLS-1$ - // Ignore - } else { - throw e; - } - } catch(Throwable t) { - // May be wrapped - if(t.getCause() instanceof IOException) { - if("Broken pipe".equals(t.getCause().getMessage())) { //$NON-NLS-1$ - // Ignore - } else { - throw t; - } - } else { - throw t; - } - } - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaXPagesServlet.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaXPagesServlet.java deleted file mode 100644 index 7982feb..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/JakartaXPagesServlet.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime; - -import java.io.IOException; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.openntf.xpages.runtime.platform.JakartaPlatform; -import org.openntf.xpages.runtime.wrapper.JakartaServletConfigWrapper; -import org.openntf.xpages.runtime.wrapper.JakartaServletRequestWrapper; - -import com.ibm.xsp.webapp.DesignerFacesServlet; - -//@WebServlet(urlPatterns="*.xsp") -public class JakartaXPagesServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - public static ServletConfig servletConfig; - - private DesignerFacesServlet delegate; - - public JakartaXPagesServlet() { - } - - @Override - public void init(ServletConfig config) throws ServletException { - servletConfig = config; - - this.delegate = new DesignerFacesServlet(); - - ServletConfig conf = new JakartaServletConfigWrapper(config); - JakartaPlatform.initContext(conf.getServletContext()); - delegate.init(conf); - } - - @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - HttpServletRequest wrap = new JakartaServletRequestWrapper(req); - delegate.service(wrap, resp); - } - - @Override - public void destroy() { - delegate.destroy(); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaExternalContext.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaExternalContext.java deleted file mode 100644 index 312aa7c..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaExternalContext.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.context; - -import java.io.InputStream; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.faces.context.ExternalContext; -import javax.faces.context.FacesContext; -import javax.servlet.http.HttpServletRequest; - -import org.openntf.xpages.runtime.platform.JakartaPlatform; - -import com.ibm.commons.util.StringUtil; -import com.ibm.xsp.application.ApplicationEx; -import com.ibm.xsp.context.ExternalContextEx; -import com.sun.faces.RIConstants; - -public class JakartaExternalContext extends ExternalContextEx { - public JakartaExternalContext(ExternalContext delegate) { - super(delegate); - } - - @Override - public String encodeResourceURL(String var1) { - String result = super.encodeResourceURL(var1); - // Patch around the parent's "/xsp" prefix - // TODO do this more intelligently - if(result.startsWith("/xsp/")) { //$NON-NLS-1$ - result = JakartaPlatform.getServletContext().getContextPath() + result; - } - - pushIfPossibleAndNecessary(result); - - return result; - } - - @Override - public InputStream getResourceAsStream(String res) { - InputStream is = super.getResourceAsStream(res); - // Mobile app compatibility - if(is == null && res != null && res.startsWith("/WEB-INF/")) { //$NON-NLS-1$ - is = super.getResourceAsStream("/DARWINO-INF/" + res.substring("/WEB-INF/".length())); //$NON-NLS-1$ //$NON-NLS-2$ - - if(is == null) { - is = super.getResourceAsStream(res.substring("/WEB-INF/".length())); //$NON-NLS-1$ - } - } - return is; - } - - // Based on https://github.com/eclipse-ee4j/mojarra/blob/475fb3e88edd2f939d0378c23012277c82d1f7fe/impl/src/main/java/com/sun/faces/context/ExternalContextImpl.java - // Licensed under the EPL 2.0 - - private static final String PUSH_SUPPORTED_ATTRIBUTE_NAME = RIConstants.FACES_PREFIX + "ExternalContextImpl.PUSH_SUPPORTED"; //$NON-NLS-1$ - public static final String PUSH_RESOURCE_URLS_KEY_NAME = RIConstants.FACES_PREFIX + "resourceUrls"; //$NON-NLS-1$ - public static final String XSP_ENABLE_PUSH = "xsp.http2.push"; //$NON-NLS-1$ - - private void pushIfPossibleAndNecessary(String result) { - FacesContext context = FacesContext.getCurrentInstance(); - - if ("false".equals(ApplicationEx.getInstance(context).getProperty(XSP_ENABLE_PUSH, "true"))) { //$NON-NLS-1$ //$NON-NLS-2$ - return; - } - - ExternalContext extContext = context.getExternalContext(); - HttpServletRequest req = (HttpServletRequest) extContext.getRequest(); - Object val; - - // 1. check the request cache - if (null != (val = req.getAttribute(PUSH_SUPPORTED_ATTRIBUTE_NAME))) { - if (!(Boolean) val) { - return; - } - } - - // 2. Not in the request cache, see if PushBuilder is available in the container - // Not available in XPages's JSF fork -// ApplicationAssociate associate = ApplicationAssociate.getInstance(extContext); -// if (!associate.isPushBuilderSupported()) { -// // At least we won't have to hit the ApplicationAssociate every time on this request. -// attrs.putIfAbsent(PUSH_SUPPORTED_ATTRIBUTE_NAME, FALSE); -// return; -// } - - // 3. Don't bother trying to push if we've already pushed this URL for this - // request - @SuppressWarnings("unchecked") - Set resourceUrls = (Set) req.getAttribute(PUSH_RESOURCE_URLS_KEY_NAME); - if (resourceUrls == null) { - resourceUrls = new HashSet<>(); - req.setAttribute(PUSH_RESOURCE_URLS_KEY_NAME, resourceUrls); - } - if (resourceUrls.contains(result)) { - return; - } - resourceUrls.add(result); - - // 4. At this point we know - // a) the container has PushBuilder - // b) we haven't pushed this URL for this request before - Object pbObj = getPushBuilder(context, extContext); - if (pbObj != null) { - // and now we also know c) there was no If-Modified-Since header - ((javax.servlet.http.PushBuilder) pbObj).path(result).push(); - } - - } - - private Object getPushBuilder(FacesContext context, ExternalContext extContext) { - javax.servlet.http.PushBuilder result = null; - - Object requestObj = extContext.getRequest(); - if (requestObj instanceof HttpServletRequest) { - HttpServletRequest hreq = (HttpServletRequest) requestObj; - Object val; - boolean isPushSupported = false; - - // Try to pull value from the request cache - if ((val = hreq.getAttribute(PUSH_SUPPORTED_ATTRIBUTE_NAME)) != null) { - isPushSupported = (Boolean) val; - } else { - // If the request has an If-Modified-Since header, do not push, since it's - // possible the resources are already in the cache. - isPushSupported = StringUtil - .isEmpty(StringUtil.toString(extContext.getRequestHeaderMap().get("If-Modified-Since"))); //$NON-NLS-1$ - } - - if (isPushSupported) { - isPushSupported = (result = hreq.newPushBuilder()) != null; - } - if (!Collections.list(hreq.getAttributeNames()).contains(PUSH_SUPPORTED_ATTRIBUTE_NAME)) { - hreq.setAttribute(PUSH_SUPPORTED_ATTRIBUTE_NAME, isPushSupported); - } - } - - return result; - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaFacesContext.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaFacesContext.java deleted file mode 100644 index 5dbd7fb..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaFacesContext.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.context; - -import javax.faces.context.ExternalContext; -import javax.faces.context.FacesContext; - -import com.ibm.xsp.context.FacesContextExImpl; - -public class JakartaFacesContext extends FacesContextExImpl { - - private ExternalContext externalContext; - - public JakartaFacesContext(FacesContext delegate) { - super(delegate); - } - - @Override - public synchronized ExternalContext getExternalContext() { - if(this.externalContext == null) { - this.externalContext = new JakartaExternalContext(super.getExternalContext()); - } - return this.externalContext; - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaFacesContextFactory.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaFacesContextFactory.java deleted file mode 100644 index 1106ff5..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/context/JakartaFacesContextFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.context; - -import javax.faces.FacesException; -import javax.faces.context.FacesContext; -import javax.faces.context.FacesContextFactory; -import javax.faces.lifecycle.Lifecycle; - -import com.ibm.xsp.context.FacesContextFactoryImpl; - -public class JakartaFacesContextFactory extends FacesContextFactoryImpl { - public JakartaFacesContextFactory() { - super(); - } - - public JakartaFacesContextFactory(FacesContextFactory delegate) { - super(delegate); - } - - @Override - public FacesContext getFacesContext(Object var1, Object var2, Object var3, Lifecycle var4) throws FacesException { - FacesContext context = super.getFacesContext(var1, var2, var3, var4); - return new JakartaFacesContext(context); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/interpreter/DynamicPageDriver.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/interpreter/DynamicPageDriver.java deleted file mode 100644 index 4463296..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/interpreter/DynamicPageDriver.java +++ /dev/null @@ -1,276 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.interpreter; - -import static java.text.MessageFormat.format; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLConnection; -import java.nio.file.FileVisitOption; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import javax.faces.context.FacesContext; - -import org.openntf.xpages.runtime.xsp.JakartaXspSourceClassLoader; -import org.openntf.xpages.runtime.xsp.LibraryWeightComparator; -import org.w3c.dom.Document; - -import com.ibm.commons.extension.ExtensionManager; -import com.ibm.commons.util.PathUtil; -import com.ibm.commons.util.StringUtil; -import com.ibm.commons.util.io.StreamUtil; -import com.ibm.commons.xml.DOMUtil; -import com.ibm.commons.xml.XMLException; -import com.ibm.designer.runtime.domino.adapter.util.PageNotFoundException; -import com.ibm.xsp.application.ApplicationEx; -import com.ibm.xsp.extlib.interpreter.DynamicXPageBean; -import com.ibm.xsp.library.ClasspathResourceBundleSource; -import com.ibm.xsp.library.FacesClassLoader; -import com.ibm.xsp.library.LibraryServiceLoader; -import com.ibm.xsp.library.LibraryWrapper; -import com.ibm.xsp.library.XspLibrary; -import com.ibm.xsp.page.FacesPageDispatcher; -import com.ibm.xsp.page.FacesPageDriver; -import com.ibm.xsp.page.FacesPageException; -import com.ibm.xsp.page.compiled.AbstractCompiledPageDispatcher; -import com.ibm.xsp.page.compiled.DefaultPageErrorHandler; -import com.ibm.xsp.page.compiled.DispatcherParameter; -import com.ibm.xsp.page.compiled.PageToClassNameUtil; -import com.ibm.xsp.registry.FacesProjectImpl; -import com.ibm.xsp.registry.FacesSharableRegistry; -import com.ibm.xsp.registry.SharableRegistryImpl; -import com.ibm.xsp.registry.config.FacesClassLoaderFactory; -import com.ibm.xsp.registry.config.IconUrlSource; -import com.ibm.xsp.registry.config.ResourceBundleSource; -import com.ibm.xsp.registry.config.SimpleRegistryProvider; -import com.ibm.xsp.registry.config.XspRegistryProvider; -import com.ibm.xsp.registry.parse.ConfigParser; -import com.ibm.xsp.registry.parse.ConfigParserFactory; - -@SuppressWarnings("nls") -public class DynamicPageDriver implements FacesPageDriver { - private static class PageHolder { - private final long modified; - private final Class page; - - public PageHolder(long modified, Class page) { - this.modified = modified; - this.page = page; - } - } - - private static final Logger log = Logger.getLogger(DynamicPageDriver.class.getName()); - private static final DefaultPageErrorHandler s_errorHandler = new DefaultPageErrorHandler(); - - private final DynamicXPageBean dynamicXPageBean = new DynamicXPageBean() { - protected JakartaXspSourceClassLoader createJavaSourceClassLoader() { - return new JakartaXspSourceClassLoader(Thread.currentThread().getContextClassLoader(), Collections.emptyList(), new String[0]); - } - }; - private final Map pages = new HashMap<>(); - private static boolean initialized; - - @SuppressWarnings("unchecked") - @Override - public FacesPageDispatcher loadPage(FacesContext context, String pageName) throws FacesPageException { - if(!initialized) { - this.registerCustomControls(); - this.initLibrary(); - initialized = true; - } - - try { - // Check if it's compiled as a class in the current loader - if(!pages.containsKey(pageName)) { - try { - String className = PageToClassNameUtil.getClassNameForPage(pageName); - Class existing = (Class) Class.forName(className); - URL loc = existing.getProtectionDomain().getCodeSource().getLocation(); - String classPath = className.replace('.', '/') + ".class"; //$NON-NLS-1$ - loc = new URL(loc, classPath); - URLConnection classConn = loc.openConnection(); - long classMod = classConn.getLastModified(); - pages.put(pageName, new PageHolder(classMod, existing)); - } catch(ClassNotFoundException e) { - // That's fine - move along to load from source - } - } - - // See if there's a local resource version as well - URL url = findResource(pageName); - - if(!pages.containsKey(pageName) && url == null) { - // Then we have no fallback - throw new PageNotFoundException(format("Unable to find XPage or Custom Control {0}; check WEB-INF/xpages and WEB-INF/controls", pageName)); - } - - - // See if we need to invalidate an existing compiled version - if (url != null) { - URLConnection conn = url.openConnection(); - long mod = conn.getLastModified(); - if (pages.containsKey(pageName)) { - PageHolder holder = pages.get(pageName); - if (mod > holder.modified) { - // Then invalidate - if (log.isLoggable(Level.INFO)) { - log.info(format("Page {0} has been modified; recompiling", pageName)); - } - pages.remove(pageName); - dynamicXPageBean.purgeCompiledPage(pageName); - } - } - - // Compile from source if needed - pages.computeIfAbsent(pageName, key -> { - if(log.isLoggable(Level.INFO)) { - log.info(format("Looking for page {0}", pageName)); - } - FacesSharableRegistry registry = ApplicationEx.getInstance().getRegistry(); - - String xspSource; - try(InputStream is = conn.getInputStream()) { - xspSource = StreamUtil.readString(is); - } catch (IOException e) { - throw new RuntimeException(e); - } - - try { - // TODO In JDK >= 9, it may be possible to do this with the REPL infrastructure - Class compiled = (Class)dynamicXPageBean.compile(pageName, xspSource, registry); - return new PageHolder(mod, compiled); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new RuntimeException(e); - } - }); - } - - AbstractCompiledPageDispatcher page = pages.get(pageName).page.newInstance(); - page.init(new DispatcherParameter(this, pageName, s_errorHandler)); - return page; - } catch (IOException | InstantiationException | IllegalAccessException e) { - throw new FacesPageException(e); - } - } - - private URL findResource(String pageName) { - // TODO cache the URLs - // TODO consider allowing XPages in the root of the app - String path = PathUtil.concat("/WEB-INF/xpages", pageName, '/'); //$NON-NLS-1$ - URL is = Thread.currentThread().getContextClassLoader().getResource(path); - if(is == null) { - path = PathUtil.concat("/WEB-INF/controls", pageName, '/'); //$NON-NLS-1$ - is = Thread.currentThread().getContextClassLoader().getResource(path); - } - return is; - } - - private final IconUrlSource iconUrlSource = iconName -> Thread.currentThread().getContextClassLoader().getResource(iconName); - private final ResourceBundleSource resourceBundleSource = new ClasspathResourceBundleSource(Thread.currentThread().getContextClassLoader()); - - private void registerCustomControls() { - // TODO investigate reloading when resources change - URL controls = Thread.currentThread().getContextClassLoader().getResource("/WEB-INF/controls"); //$NON-NLS-1$ - if(controls != null) { - if(log.isLoggable(Level.FINE)) { - log.fine(format("searching for controls in {0}", controls)); - } - ConfigParser configParser = ConfigParserFactory.getParserInstance(); - FacesSharableRegistry facesRegistry = ApplicationEx.getInstance().getRegistry(); - FacesProjectImpl facesProject = (FacesProjectImpl)facesRegistry.getLocalProjectList().get(0); - FacesClassLoader facesClassLoader = FacesClassLoaderFactory.createContext(this.getClass()); - - switch(StringUtil.toString(controls.getProtocol())) { - case "file": //$NON-NLS-1$ - try { - Path path = Paths.get(controls.toURI()); - Files.find(path, 1, (file, attrs) -> file.getFileName().toString().endsWith(".xsp-config"), FileVisitOption.FOLLOW_LINKS) //$NON-NLS-1$ - .forEach(configPath -> { - try { - Document xspConfig; - try(InputStream is = Files.newInputStream(configPath)) { - xspConfig = DOMUtil.createDocument(is); - } - String namespace = StringUtil.trim(DOMUtil.evaluateXPath(xspConfig, "/faces-config/faces-config-extension/namespace-uri/text()").getStringValue()); //$NON-NLS-1$ - configParser.createFacesLibraryFragment( - facesProject, - facesClassLoader, - path.resolve(configPath.getFileName().toString()).toString(), - xspConfig.getDocumentElement(), - resourceBundleSource, - iconUrlSource, - namespace - ); - } catch (XMLException | IOException e) { - throw new RuntimeException(e); - } - }); - } catch (IOException | URISyntaxException e) { - throw new RuntimeException(e); - } - break; - case "jar": //$NON-NLS-1$ - case "wsjar": //$NON-NLS-1$ - // TODO figure out - // It may be fair to expect the app to be unpacked at runtime, but maybe there could be - // controls in dependencies - break; - } - } - } - - private void initLibrary() { - SharableRegistryImpl facesRegistry = (SharableRegistryImpl)ApplicationEx.getInstance().getRegistry(); - Set existingLibIds = facesRegistry.getDepends().stream() - .parallel() - .map(lib -> lib.getId()) - .collect(Collectors.toSet()); - Set desired = new HashSet<>(Arrays.asList(StringUtil.splitString(ApplicationEx.getInstance().getProperty("xsp.library.depends", ""), ','))); //$NON-NLS-1$ //$NON-NLS-2$ - List libraries = ExtensionManager.findServices((List)null, LibraryServiceLoader.class, "com.ibm.xsp.Library"); //$NON-NLS-1$ - libraries.stream() - .filter(lib -> lib instanceof XspLibrary) - .map(XspLibrary.class::cast) - .filter(lib -> !existingLibIds.contains(lib.getLibraryId())) - .filter(lib -> lib.isGlobalScope() || desired.contains(lib.getLibraryId())) - .sorted(LibraryWeightComparator.INSTANCE) - .map(lib -> new LibraryWrapper(lib.getLibraryId(), lib)) - .map(wrapper -> { - SimpleRegistryProvider provider = new SimpleRegistryProvider(); - provider.init(wrapper); - return provider; - }) - .map(XspRegistryProvider::getRegistry) - .forEach(facesRegistry::addDepend); - facesRegistry.refreshReferences(); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/listener/JakartaConfigureCoreListener.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/listener/JakartaConfigureCoreListener.java deleted file mode 100644 index ba71b56..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/listener/JakartaConfigureCoreListener.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.listener; - -import com.ibm.xsp.config.BootStrap; -import com.ibm.xsp.config.ConfigureCoreListener; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.annotation.WebListener; - -import org.openntf.xpages.runtime.wrapper.JakartaServletContextWrapper; -import org.openntf.xpages.runtime.xsp.JakartaBootStrap; - -@WebListener -public class JakartaConfigureCoreListener extends ConfigureCoreListener { - BootStrap bootstrap; - - @Override - public void contextInitialized(ServletContextEvent servletContextEvent) { - ServletContext context = new JakartaServletContextWrapper(servletContextEvent.getServletContext()); - bootstrap = new JakartaBootStrap(context); - bootstrap.init(context); - } - - @Override - public void contextDestroyed(ServletContextEvent servletContextEvent) { - bootstrap.destroy(new JakartaServletContextWrapper(servletContextEvent.getServletContext())); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/listener/JakartaContextListener.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/listener/JakartaContextListener.java deleted file mode 100644 index d5c7c9f..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/listener/JakartaContextListener.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.listener; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; - -import org.openntf.xpages.runtime.platform.JakartaPlatform; -import org.openntf.xpages.runtime.wrapper.JakartaServletContextWrapper; - -@WebListener -public class JakartaContextListener implements ServletContextListener { - @Override - public void contextInitialized(ServletContextEvent sce) { - JakartaPlatform.initContext(new JakartaServletContextWrapper(sce.getServletContext())); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/ActivatorNameProvider.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/ActivatorNameProvider.java deleted file mode 100644 index 4a74978..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/ActivatorNameProvider.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.osgi; - -import java.util.List; - -import org.osgi.framework.BundleActivator; - -public interface ActivatorNameProvider { - List> getClasses(); -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/DefaultActivatorNameProvider.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/DefaultActivatorNameProvider.java deleted file mode 100644 index 7ce100d..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/DefaultActivatorNameProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.osgi; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.List; - -import org.osgi.framework.BundleActivator; - -import com.ibm.commons.util.StringUtil; - -public class DefaultActivatorNameProvider implements ActivatorNameProvider { - - @SuppressWarnings("unchecked") - @Override - public List> getClasses() { - List> result = new ArrayList>(); - try { - InputStream is = OSGiPatcher.class.getResourceAsStream("/META-INF/platformPlugins.txt"); //$NON-NLS-1$ - try { - BufferedReader r = new BufferedReader(new InputStreamReader(is)); - try { - String line; - while((line = r.readLine()) != null) { - if(StringUtil.isNotEmpty(line) && !line.startsWith("#")) { //$NON-NLS-1$ - Class clazz = (Class) Class.forName(line); - result.add(clazz); - } - } - } finally { - r.close(); - } - } finally { - is.close(); - } - } catch(Exception e) { - throw new RuntimeException(e); - } - return result; - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/MockBundle.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/MockBundle.java deleted file mode 100644 index 0c6dcc7..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/MockBundle.java +++ /dev/null @@ -1,275 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.osgi; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.security.cert.X509Certificate; -import java.util.*; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - -import org.openntf.xpages.runtime.util.XSPUtil; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.ServiceReference; - -import com.ibm.commons.util.PathUtil; -import com.ibm.commons.util.StringUtil; - -public class MockBundle implements Bundle { - - private final Object context; - private BundleContext bundleContext; - - public MockBundle(Object context) { - this.context = context; - } - - @Override - public URL getResource(String s) { - return XSPUtil.getResource(s, context.getClass().getClassLoader()); - } - - @Override - public URL getEntry(String s) { - return getResource(s); - } - - @Override - public Class loadClass(String s) throws ClassNotFoundException { - return Thread.currentThread().getContextClassLoader().loadClass(s); - } - - @Override - public Enumeration getResources(String s) throws IOException { - return XSPUtil.getResources(context.getClass().getClassLoader(), s); - } - - @Override - public Enumeration getEntryPaths(String s) { - return null; - } - - @Override - public Enumeration findEntries(String s, String s1, boolean b) { - try { - // Not a perfect version, but it'll do - String path = PathUtil.concat(s, s1, '/'); - return getResources(path); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - @Override - public BundleContext getBundleContext() { - return bundleContext; - } - - public void setBundleContext(BundleContext bundleContext) { - this.bundleContext = bundleContext; - } - - @Override - public Dictionary getHeaders() { - Manifest mf = getManifest(); - Dictionary result = new Hashtable(); - for(Map.Entry entry : mf.getMainAttributes().entrySet()) { - result.put(StringUtil.toString(entry.getKey()), StringUtil.toString(entry.getValue())); - } - return result; - } - - @Override - public Dictionary getHeaders(String s) { - Manifest mf = getManifest(); - Dictionary result = new Hashtable(); - for(Map.Entry entry : mf.getAttributes(s).entrySet()) { - result.put(StringUtil.toString(entry.getKey()), StringUtil.toString(entry.getValue())); - } - return result; - } - - private Manifest manifest; - private synchronized Manifest getManifest() { - if(this.manifest == null) { - // TODO have this look for the specific context class's manifest, which may require parsing URLs - String path = context.getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); - if(StringUtil.isNotEmpty(path) && path.endsWith(".jar")) { //$NON-NLS-1$ - try { - JarFile f = new JarFile(new File(path)); - try { - this.manifest = f.getManifest(); - } finally { - f.close(); - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } else { - this.manifest = new Manifest(); - - // Check if it's available as a directory - Path dir = Paths.get(path); - if(Files.isDirectory(dir)) { - Path manifest = dir.resolve("META-INF").resolve("MANIFEST.MF"); //$NON-NLS-1$ //$NON-NLS-2$ - if(Files.isRegularFile(manifest) && Files.isReadable(manifest)) { - try(InputStream is = Files.newInputStream(manifest)) { - this.manifest.read(is); - } catch(IOException e) { - throw new RuntimeException(e); - } - } else { - // It's also possible it's up one level, e.g. in an Eclipse workspace project - manifest = dir.getParent().resolve("MANIFEST.MF"); //$NON-NLS-1$ - if(Files.isRegularFile(manifest) && Files.isReadable(manifest)) { - try(InputStream is = Files.newInputStream(manifest)) { - this.manifest.read(is); - } catch(IOException e) { - throw new RuntimeException(e); - } - } - } - } - } - } - return this.manifest; - } - - @Override - public String getSymbolicName() { - String name = getHeaders().get("Bundle-SymbolicName"); //$NON-NLS-1$ - if(StringUtil.isNotEmpty(name)) { - int semiIndex = name.indexOf(";"); //$NON-NLS-1$ - if(semiIndex > -1) { - name = name.substring(0, semiIndex); - } - } - return name; - } - - @Override - public org.osgi.framework.Version getVersion() { - String v = getHeaders().get("Bundle-Version"); //$NON-NLS-1$ - if(StringUtil.isEmpty(v)) { - return null; - } else { - return new org.osgi.framework.Version(v); - } - } - - // ******************************************************************************* - // * Stubbed methods - // ******************************************************************************* - - @Override - public long getLastModified() { - return 0; - } - - @Override - public int getState() { - return 0; - } - - @Override - public void start(int i) throws BundleException { - - } - - @Override - public void start() throws BundleException { - - } - - @Override - public void stop(int i) throws BundleException { - - } - - @Override - public void stop() throws BundleException { - - } - - @Override - public void update(InputStream inputStream) throws BundleException { - - } - - @Override - public void update() throws BundleException { - - } - - @Override - public void uninstall() throws BundleException { - - } - - @Override - public long getBundleId() { - return 0; - } - - @Override - public String getLocation() { - return null; - } - - @Override - public ServiceReference[] getRegisteredServices() { - return new ServiceReference[0]; - } - - @Override - public ServiceReference[] getServicesInUse() { - return new ServiceReference[0]; - } - - @Override - public boolean hasPermission(Object o) { - return false; - } - - @Override - public Map> getSignerCertificates(int i) { - return null; - } - - @Override - public A adapt(Class aClass) { - return null; - } - - @Override - public File getDataFile(String s) { - return null; - } - - @Override - public int compareTo(Bundle o) { - return 0; - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/MockBundleContext.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/MockBundleContext.java deleted file mode 100644 index 4a284e1..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/MockBundleContext.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.osgi; - -import java.io.File; -import java.io.InputStream; -import java.util.Collection; -import java.util.Dictionary; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.BundleListener; -import org.osgi.framework.Filter; -import org.osgi.framework.FrameworkListener; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceFactory; -import org.osgi.framework.ServiceListener; -import org.osgi.framework.ServiceObjects; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; - -public class MockBundleContext implements BundleContext { - - private final MockBundle bundle; - - public MockBundleContext(MockBundle bundle) { - this.bundle = bundle; - } - - @Override - public Bundle getBundle() { - return this.bundle; - } - - @Override - public void addBundleListener(BundleListener listener) { - - } - - @Override - public void addFrameworkListener(FrameworkListener listener) { - - } - - @Override - public void addServiceListener(ServiceListener listener) { - - } - - @Override - public void addServiceListener(ServiceListener arg0, String arg1) throws InvalidSyntaxException { - - } - - @Override - public Filter createFilter(String arg0) throws InvalidSyntaxException { - return null; - } - - @Override - public ServiceReference[] getAllServiceReferences(String arg0, String arg1) throws InvalidSyntaxException { - return null; - } - - @Override - public Bundle getBundle(long arg0) { - return null; - } - - @Override - public Bundle getBundle(String arg0) { - return null; - } - - @Override - public Bundle[] getBundles() { - return null; - } - - @Override - public File getDataFile(String arg0) { - return null; - } - - @Override - public String getProperty(String arg0) { - return null; - } - - @Override - public S getService(ServiceReference arg0) { - return null; - } - - @Override - public ServiceObjects getServiceObjects(ServiceReference arg0) { - return null; - } - - @Override - public ServiceReference getServiceReference(String arg0) { - return null; - } - - @Override - public ServiceReference getServiceReference(Class arg0) { - return null; - } - - @Override - public ServiceReference[] getServiceReferences(String arg0, String arg1) throws InvalidSyntaxException { - return null; - } - - @Override - public Collection> getServiceReferences(Class arg0, String arg1) - throws InvalidSyntaxException { - return null; - } - - @Override - public Bundle installBundle(String arg0) throws BundleException { - return null; - } - - @Override - public Bundle installBundle(String arg0, InputStream arg1) throws BundleException { - return null; - } - - @Override - public ServiceRegistration registerService(String[] arg0, Object arg1, Dictionary arg2) { - return null; - } - - @Override - public ServiceRegistration registerService(String arg0, Object arg1, Dictionary arg2) { - return null; - } - - @Override - public ServiceRegistration registerService(Class arg0, S arg1, Dictionary arg2) { - return null; - } - - @Override - public ServiceRegistration registerService(Class arg0, ServiceFactory arg1, - Dictionary arg2) { - return null; - } - - @Override - public void removeBundleListener(BundleListener arg0) { - - } - - @Override - public void removeFrameworkListener(FrameworkListener arg0) { - - } - - @Override - public void removeServiceListener(ServiceListener arg0) { - - } - - @Override - public boolean ungetService(ServiceReference arg0) { - return false; - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/OSGiEnvironmentListener.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/OSGiEnvironmentListener.java deleted file mode 100644 index 01d4105..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/OSGiEnvironmentListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.osgi; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; - -@WebListener -public class OSGiEnvironmentListener implements ServletContextListener { - @Override - public void contextInitialized(ServletContextEvent sce) { - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Void run() { - OSGiPatcher.initKnownBundles(); - return null; - } - }); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/OSGiPatcher.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/OSGiPatcher.java deleted file mode 100644 index aad0080..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/osgi/OSGiPatcher.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.osgi; - -import java.util.List; - -import org.osgi.framework.BundleActivator; - -import com.ibm.commons.extension.ExtensionManager; - -/** - * This class looks for known OSGi-reliant plugins and initializes them with a mock - * context to allow them to serve resources without a true OSGi context. - * - * @author Jesse Gallagher - * @since 1.0.0 - */ -public class OSGiPatcher { - public static void initKnownBundles() { - try { - List providers = ExtensionManager.findServices(null, Thread.currentThread().getContextClassLoader(), ActivatorNameProvider.class.getName(), ActivatorNameProvider.class); - for(ActivatorNameProvider provider : providers) { - for(Class clazz : provider.getClasses()) { - BundleActivator inst = clazz.newInstance(); - MockBundle mockBundle = new MockBundle(inst); - MockBundleContext bundleContext = new MockBundleContext(mockBundle); - mockBundle.setBundleContext(bundleContext); - inst.start(bundleContext); - } - } - } catch(Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/platform/JakartaPlatform.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/platform/JakartaPlatform.java deleted file mode 100644 index a54ae82..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/platform/JakartaPlatform.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.platform; - -import com.ibm.commons.platform.WebAppServerPlatform; -import com.ibm.commons.util.StringUtil; -import com.ibm.designer.runtime.Application; -import com.ibm.designer.runtime.ApplicationException; -import com.ibm.xsp.context.DojoLibraryFactory; - -import javax.servlet.ServletContext; - -import org.openntf.xpages.runtime.JakartaAppExecutionContext; -import org.openntf.xpages.runtime.JakartaApplication; - -import java.io.File; -import java.util.Properties; - -public class JakartaPlatform extends WebAppServerPlatform { - private static ServletContext servletContext; - - public static void initContext(ServletContext servletContext) { - JakartaPlatform.servletContext = servletContext; - } - public static ServletContext getServletContext() { - return servletContext; - } - - private File installationDirectory; - private File userDataDirectory; - private File propertiesDirectory; - private File xspDirectory; - private File nsfDirectory; - private File styleKitsDirectory; - private File serverDirectory; - private Properties xspProperties; - - public JakartaPlatform() { - super(); - - installationDirectory = new File(System.getProperty("user.dir")); //$NON-NLS-1$ - userDataDirectory = new File(installationDirectory, "xpages"); //$NON-NLS-1$ - propertiesDirectory = new File(userDataDirectory, "properties"); //$NON-NLS-1$ - xspDirectory = new File(userDataDirectory, "xsp"); //$NON-NLS-1$ - nsfDirectory = new File(xspDirectory, "nsf"); //$NON-NLS-1$ - styleKitsDirectory = new File(nsfDirectory, "themes"); //$NON-NLS-1$ - serverDirectory = new File(userDataDirectory, StringUtil.replace("java/xsp", '/', File.separatorChar)); //$NON-NLS-1$ - this.xspProperties = this.loadStaticProperties(); - - DojoLibraryFactory.initializeLibraries(); - } - - @Override - public Object getObject(String s) { - if("com.ibm.xsp.designer.ApplicationFinder".equals(s)) { //$NON-NLS-1$ - return new Application.IApplicationFinder() { - @Override - public Application get() { - try { - JakartaAppExecutionContext ctx = new JakartaAppExecutionContext(servletContext); - return new JakartaApplication(ctx); - } catch (ApplicationException e) { - throw new RuntimeException(e); - } - } - }; - } else { - return super.getObject(s); - } - } - - @Override - public File getGlobalResourceFile(String path) { - if(path.startsWith("/stylekits/")) { //$NON-NLS-1$ - return new File(styleKitsDirectory, path.substring("/stylekits/".length())); //$NON-NLS-1$ - } - if(path.startsWith("/server/")) { //$NON-NLS-1$ - return new File(serverDirectory, path.substring("/server/".length())); //$NON-NLS-1$ - } - if(path.startsWith("/global/")) { //$NON-NLS-1$ - return new File(serverDirectory, path.substring("/global/".length())); //$NON-NLS-1$ - } - if(path.startsWith("/properties/")) { //$NON-NLS-1$ - - if (userDataDirectory != null) { - File localFile = new File(userDataDirectory, "properties/" + path.substring("/properties/".length())); //$NON-NLS-1$ //$NON-NLS-2$ - if (localFile.exists()) { - return localFile; - } - } - - return new File(propertiesDirectory, path.substring("/properties/".length())); //$NON-NLS-1$ - } - return super.getGlobalResourceFile(path); - } - - @Override - public String getProperty(String prop) { - String var2; - if (this.xspProperties != null) { - var2 = this.xspProperties.getProperty(prop); - if (StringUtil.isNotEmpty(var2)) { - return var2; - } - } - return super.getProperty(prop); - } - - @Override - public boolean isPlatform(String name) { - if("Jakarta Web Application Server".equals(name)) { //$NON-NLS-1$ - return true; - } else { - return super.isPlatform(name); - } - } - - @Override - public File getInstallationDirectory() { - return installationDirectory; - } - - @Override - public File getResourcesDirectory() { - return userDataDirectory; - } - - protected Properties loadStaticProperties() { - return new Properties(); - } - - @Override - public String getName() { - return "Jakarta Web Application Server"; //$NON-NLS-1$ - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/platform/JakartaPlatformFactory.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/platform/JakartaPlatformFactory.java deleted file mode 100644 index e1eb7a3..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/platform/JakartaPlatformFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.platform; - -import com.ibm.commons.Platform; -import com.ibm.commons.platform.IPlatformFactory; - -public class JakartaPlatformFactory implements IPlatformFactory { - @Override - public Platform createPlatform() { - return new JakartaPlatform(); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/runtime/JakartaFacesController.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/runtime/JakartaFacesController.java deleted file mode 100644 index 5d4de15..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/runtime/JakartaFacesController.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.runtime; - -import org.openntf.xpages.runtime.interpreter.DynamicPageDriver; - -import com.ibm.xsp.controller.DesignerFacesController; -import com.ibm.xsp.page.FacesPageDriver; - -public class JakartaFacesController extends DesignerFacesController { - - public JakartaFacesController() { - super(); - } - - @Override - protected FacesPageDriver createPageDriver() { - return new DynamicPageDriver(); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/runtime/JakartaFacesControllerFactory.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/runtime/JakartaFacesControllerFactory.java deleted file mode 100644 index 250379a..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/runtime/JakartaFacesControllerFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.runtime; - -import javax.servlet.ServletContext; - -import com.ibm.xsp.FacesExceptionEx; -import com.ibm.xsp.controller.FacesController; -import com.ibm.xsp.controller.FacesControllerFactory; - -public class JakartaFacesControllerFactory implements FacesControllerFactory { - - @Override - public FacesController createFacesController(ServletContext servletContext) throws FacesExceptionEx { - return new JakartaFacesController(); - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/JakartaFacesServlet.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/JakartaFacesServlet.java deleted file mode 100644 index 5d4a451..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/JakartaFacesServlet.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.servlet; - -import org.openntf.xpages.runtime.runtime.JakartaFacesControllerFactory; - -import com.ibm.xsp.controller.FacesControllerFactory; -import com.ibm.xsp.webapp.DesignerFacesServlet; - -public class JakartaFacesServlet extends DesignerFacesServlet { - private final FacesControllerFactory factory = new JakartaFacesControllerFactory(); - - @Override - protected FacesControllerFactory getFacesControllerFactory() { - return factory; - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/JakartaServlet.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/JakartaServlet.java deleted file mode 100644 index 8da63ca..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/JakartaServlet.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.servlet; - -import java.io.IOException; -import java.io.InputStream; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.openntf.xpages.runtime.platform.JakartaPlatform; -import org.openntf.xpages.runtime.wrapper.JakartaServletConfigWrapper; -import org.openntf.xpages.runtime.wrapper.JakartaServletRequestWrapper; -import org.openntf.xpages.runtime.wrapper.JakartaServletResponseWrapper; -import org.w3c.dom.Document; -import org.w3c.dom.Node; - -import com.ibm.commons.util.PathUtil; -import com.ibm.commons.util.StringUtil; -import com.ibm.commons.xml.DOMUtil; -import com.ibm.commons.xml.XMLException; -import com.ibm.commons.xml.XResult; -import com.ibm.xsp.extlib.util.ExtLibUtil; -import com.ibm.xsp.webapp.FacesResourceServlet; -import com.ibm.xsp.webapp.resources.JavaResourceProvider; - -@WebServlet(value="/") -public class JakartaServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - public static ServletConfig servletConfig; - - private JakartaFacesServlet delegate; - private FacesResourceServlet resources = new FacesResourceServlet() { - private static final long serialVersionUID = 1L; - - }; - - public JakartaServlet() { - } - - @Override - public void init(ServletConfig config) throws ServletException { - servletConfig = config; - - this.delegate = new JakartaFacesServlet(); - - ServletConfig conf = new JakartaServletConfigWrapper(config); - JakartaPlatform.initContext(conf.getServletContext()); - delegate.init(conf); - - resources.addResourceProvider(new JavaResourceProvider("") { //$NON-NLS-1$ - @Override - protected String getResourcePath(HttpServletRequest req, String path) { - if(!"/".equals(path) && Thread.currentThread().getContextClassLoader().getResourceAsStream(path) != null) { //$NON-NLS-1$ - return path; - } else { - return null; - } - } - - @Override - protected boolean shouldCacheResources() { - return !ExtLibUtil.isDevelopmentMode(); - } - }); - resources.init(conf); - } - - @Override - protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { - String path = StringUtil.toString(req.getServletPath()); - if("/".equals(path)) { //$NON-NLS-1$ - // Check the welcome-file-list - path = PathUtil.concat("/", getIndex(), '/'); //$NON-NLS-1$ - } - HttpServletResponse resWrap = new JakartaServletResponseWrapper(resp); - int xspIndex = path.indexOf(".xsp"); //$NON-NLS-1$ - if(xspIndex > -1) { - String pathInfo = path.substring(xspIndex+4); - HttpServletRequest wrap = new JakartaServletRequestWrapper(req, path.substring(0, xspIndex+4), pathInfo.isEmpty() ? null : pathInfo); - delegate.service(wrap, resWrap); - } else { - HttpServletRequest wrap = new JakartaServletRequestWrapper(req, "/", path); //$NON-NLS-1$ - resources.service(wrap, resWrap); - } - } - - @Override - public void destroy() { - delegate.destroy(); - } - - private String index; - private String getIndex() { - if(this.index == null) { - try { - Document webXml; - try(InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("/WEB-INF/web.xml")) { //$NON-NLS-1$ - webXml = DOMUtil.createDocument(is); - } - XResult result = DOMUtil.evaluateXPath(webXml, "/*[name()='web-app']/*[name()='welcome-file-list']/*[name()='welcome-file']/text()"); //$NON-NLS-1$ - if(!result.isEmpty()) { - Node node = (Node)result.getNodes()[0]; - return node.getTextContent(); - } - } catch(IOException | XMLException e) { - throw new RuntimeException(e); - } - } - return this.index; - } -} \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/ModuleResourceServlet.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/ModuleResourceServlet.java deleted file mode 100644 index 0b741b8..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/servlet/ModuleResourceServlet.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.servlet; - -import javax.servlet.annotation.WebServlet; - -import com.ibm.xsp.webapp.DesignerModuleResourceServlet; - -@WebServlet(urlPatterns="/xsp/.ibmmodres/*") -public class ModuleResourceServlet extends DesignerModuleResourceServlet { - private static final long serialVersionUID = 1L; -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/util/XSPUtil.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/util/XSPUtil.java deleted file mode 100644 index 02e49ed..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/util/XSPUtil.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.util; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Arrays; -import java.util.Enumeration; - -import com.ibm.commons.util.StringUtil; - -public enum XSPUtil { - ; - - public static URL getResource(String path, ClassLoader... cls) { - for(ClassLoader cl : cls) { - URL result = cl.getResource(path); - if(result == null && path != null && path.startsWith("/")) { //$NON-NLS-1$ - // Try without the leading slash - result = cl.getResource(path.substring(1)); - } - if(result == null && path != null && !path.startsWith("/")) { //$NON-NLS-1$ - result = cl.getResource("/" + path); //$NON-NLS-1$ - } - if(result != null) { - return result; - } - } - - // Try with the thread classloader if it hasn't been included - if(!Arrays.asList(cls).contains(Thread.currentThread().getContextClassLoader())) { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - URL result = cl.getResource(path); - if(result == null && path != null && path.startsWith("/")) { //$NON-NLS-1$ - result = cl.getResource(path.substring(1)); - } - if(result == null && path != null && !path.startsWith("/")) { //$NON-NLS-1$ - result = cl.getResource("/" + path); //$NON-NLS-1$ - } - if(result != null) { - return result; - } - } - - return null; - } - - public static InputStream getResourceAsStream(String path, ClassLoader... cls) { - for(ClassLoader cl : cls) { - InputStream result = cl.getResourceAsStream(path); - if(result == null && path != null && path.startsWith("/")) { //$NON-NLS-1$ - result = cl.getResourceAsStream(path.substring(1)); - } - if(result == null && path != null && !path.startsWith("/")) { //$NON-NLS-1$ - result = cl.getResourceAsStream("/" + path); //$NON-NLS-1$ - } - if(result != null) { - return result; - } - } - - // Try with the thread classloader if it hasn't been included - if(!Arrays.asList(cls).contains(Thread.currentThread().getContextClassLoader())) { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - InputStream result = cl.getResourceAsStream(path); - if(result == null && path != null && path.startsWith("/")) { //$NON-NLS-1$ - result = cl.getResourceAsStream(path.substring(1)); - } - if(result == null && path != null && !path.startsWith("/")) { //$NON-NLS-1$ - result = cl.getResourceAsStream("/" + path); //$NON-NLS-1$ - } - if(result != null) { - return result; - } - } - - return null; - } - - public static Enumeration getResources(ClassLoader cl, String p) throws IOException { - String path = StringUtil.toString(p); - - Enumeration result = cl.getResources(path); - if((result == null || !result.hasMoreElements()) && path != null && path.startsWith("/")) { //$NON-NLS-1$ - result = cl.getResources(path.substring(1)); - } - - if((result == null || !result.hasMoreElements()) && path != null && path.startsWith("/")) { //$NON-NLS-1$ - result = Thread.currentThread().getContextClassLoader().getResources(path.substring(1)); - } - - return result; - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/ClasspathVFS.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/ClasspathVFS.java deleted file mode 100644 index 5dfb6d9..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/ClasspathVFS.java +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.vfs; - -import java.net.URL; -import java.util.List; -import java.util.regex.Pattern; - -import org.openntf.xpages.runtime.util.XSPUtil; - -import com.ibm.commons.util.StringUtil; -import com.ibm.commons.vfs.VFS; -import com.ibm.commons.vfs.VFSException; -import com.ibm.commons.vfs.VFSFile; -import com.ibm.commons.vfs.VFSFilter.IFilter; -import com.ibm.commons.vfs.VFSFolder; -import com.ibm.designer.runtime.server.ServletExecutionContext; -import com.ibm.designer.runtime.server.util.WarVFS; - -/** - * Implementation of IBM Commons VFS using the current classloader's resource mechanism. - * - * @author Jesse Gallagher - * @since 1.0.0 - */ -public class ClasspathVFS extends VFS { - private static final boolean DEBUG = false; - - private final WarVFS delegate; - private final ServletExecutionContext context; - - /** - * Pattern matcher for local XSP classes, assumed to be in the "xsp" package. - */ - private static final Pattern XSP_CLASS = Pattern.compile("^xsp/[^/\\.]+\\.class$"); //$NON-NLS-1$ - - public ClasspathVFS(ServletExecutionContext context) throws VFSException { - this.delegate = new WarVFS(context); - this.context = context; - } - - @Override - protected FileEntry doCreateFileEntry(VFSFile file) { - return null; - } - - @Override - protected FolderEntry doCreateFolderEntry(VFSFolder folder) { - return null; - } - - @Override - protected VFSFile doCreateVFSFile(String fileName) { - String localPath = localResolve(fileName); - if(isBadClassResource(localPath)) { - return new NopVFSFile(this, fileName); - } - URL uri = XSPUtil.getResource(localPath, context.getContextClassLoader()); - return new UrlVFSFile(this, fileName, uri); - } - - @Override - protected VFSFolder doCreateVFSFolder(String folderName) { - return delegate.getFolder(folderName); - } - - @Override - protected boolean doIsReadonly() throws VFSException { - return true; - } - - @Override - protected void doReadEntries(VFS vfs, String path, @SuppressWarnings("rawtypes") List result) { - // Can't assume - } - - @Override - protected void doReadResources(String path, @SuppressWarnings("rawtypes") List result, IFilter filter) { - // Can't assume - // TODO investigate if we're in a .war file or directory context - // Running from Eclipse is tough, as context.getRealPath("/") is just the src/main/webapp dir, while - // resource bundles shouldn't go there - } - - @Override - public boolean hasEntryCache() { - return true; - } - @Override - protected Entry findEntry(String path) { - if(DEBUG) { - System.out.println("findEntry " + path); //$NON-NLS-1$ - } - String localPath = localResolve(path); - if(isBadClassResource(path)) { - return null; - } - return super.findEntry(localPath); - } - @Override - protected FileEntry findFileEntry(String path) { - if(DEBUG) { - System.out.println("findFileEntry " + path); //$NON-NLS-1$ - } - String localPath = localResolve(path); - URL uri = null; - if(!isBadClassResource(path)) { - uri = XSPUtil.getResource(localPath, context.getContextClassLoader()); - } - if(uri != null) { - return super.findFileEntry(path); - } else { - try { - return new DelegateFileEntry(this, delegate.getFile(path)); - } catch (VFSException e) { - throw new RuntimeException(e); - } - } - } - @Override - protected FolderEntry findFolderEntry(String path) { - if(DEBUG) { - System.out.println("findFolderEntry " + path); //$NON-NLS-1$ - } - VFSFolder folder = delegate.getFolder(path); - try { - return new DelegateFolderEntry(this, folder); - } catch (VFSException e) { - throw new RuntimeException(e); - } - } - - @Override - public synchronized void refresh() { - // NOP - } - - @Override - protected void doClose() { - // NOP - } - - // ******************************************************************************* - // * Internal utility methods - // ******************************************************************************* - - // TODO determine if this is needed. It's here to try to get around Badly formed URI "res://WebContent/WEB-INF/classes/xsp/Layout.class", but that is - // not successful - private String localResolve(String path) { - String p = StringUtil.toString(path); - if("WebContent/WEB-INF/classes".equals(p)) { //$NON-NLS-1$ - return "."; //$NON-NLS-1$ - } else if(p.startsWith("WebContent/WEB-INF/classes/")) { //$NON-NLS-1$ - return p.substring("WebContent/WEB-INF/classes/".length()); //$NON-NLS-1$ - } else { - return p; - } - } - - private boolean isBadClassResource(String path) { - return path.endsWith(".class") && !XSP_CLASS.matcher(path).matches(); //$NON-NLS-1$ - } - - // ******************************************************************************* - // * Implementation support classes - // ******************************************************************************* - - private static class DelegateFileEntry extends FileEntry { - public DelegateFileEntry(VFS vfs, VFSFile file) throws VFSException { - super(vfs, file, file.getLastModificationDate()); - } - } - - private static class DelegateFolderEntry extends FolderEntry { - public DelegateFolderEntry(VFS vfs, VFSFolder folder) throws VFSException { - super(vfs, folder, folder.getLastModificationDate()); - } - - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/NopVFSFile.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/NopVFSFile.java deleted file mode 100644 index e7a561a..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/NopVFSFile.java +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.vfs; - -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; - -import com.ibm.commons.vfs.VFS; -import com.ibm.commons.vfs.VFSException; -import com.ibm.commons.vfs.VFSFile; - -/** - * No-op VFSFile implementation for invalid requests. - * - * @author Jesse Gallagher - * @since 1.0.0 - */ -public class NopVFSFile extends VFSFile { - - protected NopVFSFile(VFS vfs, String path) { - super(vfs, path); - } - - @Override - protected InputStream doGetInputStream() throws VFSException { - return null; - } - - @Override - protected OutputStream doGetOutputStream(boolean var1) throws VFSException { - return null; - } - - @Override - protected long doGetSize() throws VFSException { - return 0; - } - - @Override - protected File doGetSystemFile() { - return null; - } - - @Override - protected boolean doExists() throws VFSException { - return false; - } - - @Override - protected boolean doIsReadOnly() throws VFSException { - return true; - } - - @Override - protected long doGetLastModificationDate() throws VFSException { - return 0; - } - - @Override - protected void doSetLastModificationDate(long var1) throws VFSException { - - } - - @SuppressWarnings("rawtypes") - @Override - protected List doDelete() throws VFSException { - return null; - } - - @Override - protected String doRename(String var1) throws VFSException { - return null; - } - - @Override - public Object getPeer() { - return null; - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/UrlVFSFile.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/UrlVFSFile.java deleted file mode 100644 index b7c3259..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/vfs/UrlVFSFile.java +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.vfs; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.List; - -import com.ibm.commons.vfs.VFS; -import com.ibm.commons.vfs.VFSException; -import com.ibm.commons.vfs.VFSFile; - -/** - * VFSFile implementation for a {@link URL} object. - * - * @author Jesse Gallagher - * @since 1.0.0 - */ -public class UrlVFSFile extends VFSFile { - private final URL url; - - protected UrlVFSFile(VFS vfs, String path, URL url) { - super(vfs, path); - this.url = url; - } - - @Override - @SuppressWarnings("nls") - protected InputStream doGetInputStream() throws VFSException { - try { - return url.openStream(); - } catch (IOException e) { - throw new VFSException(e, "Encountered IOException"); - } - } - - @Override - protected OutputStream doGetOutputStream(boolean var1) throws VFSException { - throw new UnsupportedOperationException(); - } - - @Override - @SuppressWarnings("nls") - protected long doGetSize() throws VFSException { - try { - return url.openConnection().getContentLength(); - } catch (IOException e) { - throw new VFSException(e, "Encountered IOException"); - } - } - - @Override - protected File doGetSystemFile() { - try { - return new File(url.toURI()); - } catch (URISyntaxException e) { - throw new RuntimeException(e); - } - } - - @Override - protected boolean doExists() throws VFSException { - return url != null; - } - - @Override - protected boolean doIsReadOnly() throws VFSException { - return true; - } - - @Override - @SuppressWarnings("nls") - protected long doGetLastModificationDate() throws VFSException { - try { - return url.openConnection().getLastModified(); - } catch (IOException e) { - throw new VFSException(e, "Encountered IOException"); - } - } - - @Override - protected void doSetLastModificationDate(long mod) throws VFSException { - - } - - @Override - protected List doDelete() throws VFSException { - throw new UnsupportedOperationException(); - } - - @Override - protected String doRename(String name) throws VFSException { - throw new UnsupportedOperationException(); - } - - @Override - public Object getPeer() { - return null; - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaPrintWriterWrapper.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaPrintWriterWrapper.java deleted file mode 100644 index 7992f76..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaPrintWriterWrapper.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.wrapper; - -import java.io.PrintWriter; - -public class JakartaPrintWriterWrapper extends PrintWriter { - @SuppressWarnings("unused") - private final PrintWriter delegate; - - public JakartaPrintWriterWrapper(PrintWriter delegate) { - super(delegate); - this.delegate = delegate; - } - - @Override - public void close() { - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletConfigWrapper.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletConfigWrapper.java deleted file mode 100644 index ffa81ea..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletConfigWrapper.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.wrapper; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import java.util.Enumeration; - -public class JakartaServletConfigWrapper implements ServletConfig { - private final ServletConfig delegate; - - public JakartaServletConfigWrapper(ServletConfig delegate) { - this.delegate = delegate; - } - - @Override - public String getServletName() { - return delegate.getServletName(); - } - - @Override - public ServletContext getServletContext() { - return new JakartaServletContextWrapper(delegate.getServletContext()); - } - - @Override - public String getInitParameter(String name) { - return delegate.getInitParameter(name); - } - - @Override - public Enumeration getInitParameterNames() { - return delegate.getInitParameterNames(); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletContextWrapper.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletContextWrapper.java deleted file mode 100644 index e28fd52..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletContextWrapper.java +++ /dev/null @@ -1,369 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.wrapper; - -import com.ibm.commons.util.StringUtil; - -import javax.servlet.*; -import javax.servlet.descriptor.JspConfigDescriptor; - -import org.openntf.xpages.runtime.util.XSPUtil; - -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Collections; -import java.util.Enumeration; -import java.util.EventListener; -import java.util.Map; -import java.util.Set; - -public class JakartaServletContextWrapper implements ServletContext { - private final ServletContext delegate; - - public JakartaServletContextWrapper(ServletContext delegate) { - this.delegate = delegate; - } - - @Override - public URL getResource(String path) throws MalformedURLException { - if(StringUtil.isEmpty(path)) { - return getResource("."); //$NON-NLS-1$ - } - - URL url = delegate.getResource(path); - if(url == null) { - url = XSPUtil.getResource(path, Thread.currentThread().getContextClassLoader()); - } - if(url == null && !path.startsWith("/")) { //$NON-NLS-1$ - url = getClass().getResource("/" + path); //$NON-NLS-1$ - } -// System.out.println("getResource path " + path + " -> " + url); - return url; - } - - @Override - public InputStream getResourceAsStream(String path) { - if(StringUtil.isEmpty(path)) { - return null; - } - - InputStream is = delegate.getResourceAsStream(path); - if(is == null) { - is = XSPUtil.getResourceAsStream(path, Thread.currentThread().getContextClassLoader()); - } - if(is == null && !StringUtil.isEmpty(path) && !path.startsWith("/")) { //$NON-NLS-1$ - is = getClass().getResourceAsStream("/" + path); //$NON-NLS-1$ - } -// System.out.println("getResourceAsStream path " + path + " -> " + is); - return is; - } - - @Override - public Set getResourcePaths(String path) { - Set result; - if (StringUtil.isEmpty(path)) { - result = delegate.getResourcePaths("/"); //$NON-NLS-1$ - } else { - result = delegate.getResourcePaths(path); - } - return result == null ? Collections.emptySet() : result; - } - - @Override - public String getContextPath() { - return delegate.getContextPath(); - } - - @Override - public ServletContext getContext(String uripath) { - return delegate.getContext(uripath); - } - - @Override - public int getMajorVersion() { - return delegate.getMajorVersion(); - } - - @Override - public int getMinorVersion() { - return delegate.getMinorVersion(); - } - - @Override - public int getEffectiveMajorVersion() { - return delegate.getEffectiveMajorVersion(); - } - - @Override - public int getEffectiveMinorVersion() { - return delegate.getEffectiveMinorVersion(); - } - - @Override - public String getMimeType(String file) { - return delegate.getMimeType(file); - } - - @Override - public RequestDispatcher getRequestDispatcher(String path) { - return delegate.getRequestDispatcher(path); - } - - @Override - public RequestDispatcher getNamedDispatcher(String name) { - return delegate.getNamedDispatcher(name); - } - - @SuppressWarnings("deprecation") - @Override - public Servlet getServlet(String name) throws ServletException { - return delegate.getServlet(name); - } - - @SuppressWarnings("deprecation") - @Override - public Enumeration getServlets() { - return delegate.getServlets(); - } - - @SuppressWarnings("deprecation") - @Override - public Enumeration getServletNames() { - return delegate.getServletNames(); - } - - @Override - public void log(String msg) { - delegate.log(msg); - } - - @SuppressWarnings("deprecation") - @Override - public void log(Exception exception, String msg) { - delegate.log(exception, msg); - } - - @Override - public void log(String message, Throwable throwable) { - delegate.log(message, throwable); - } - - @Override - public String getRealPath(String path) { - return delegate.getRealPath(path); - } - - @Override - public String getServerInfo() { - return delegate.getServerInfo(); - } - - @Override - public String getInitParameter(String name) { - return delegate.getInitParameter(name); - } - - @Override - public Enumeration getInitParameterNames() { - return delegate.getInitParameterNames(); - } - - @Override - public boolean setInitParameter(String name, String value) { - return delegate.setInitParameter(name, value); - } - - @Override - public Object getAttribute(String name) { - return delegate.getAttribute(name); - } - - @Override - public Enumeration getAttributeNames() { - return delegate.getAttributeNames(); - } - - @Override - public void setAttribute(String name, Object object) { - delegate.setAttribute(name, object); - } - - @Override - public void removeAttribute(String name) { - delegate.removeAttribute(name); - } - - @Override - public String getServletContextName() { - return delegate.getServletContextName(); - } - - @Override - public ServletRegistration.Dynamic addServlet(String servletName, String className) { - return delegate.addServlet(servletName, className); - } - - @Override - public ServletRegistration.Dynamic addServlet(String servletName, Servlet servlet) { - return delegate.addServlet(servletName, servlet); - } - - @Override - public ServletRegistration.Dynamic addServlet(String servletName, Class servletClass) { - return delegate.addServlet(servletName, servletClass); - } - - @Override - public ServletRegistration.Dynamic addJspFile(String servletName, String jspFile) { - return delegate.addJspFile(servletName, jspFile); - } - - @Override - public T createServlet(Class clazz) throws ServletException { - return delegate.createServlet(clazz); - } - - @Override - public ServletRegistration getServletRegistration(String servletName) { - return delegate.getServletRegistration(servletName); - } - - @Override - public Map getServletRegistrations() { - return delegate.getServletRegistrations(); - } - - @Override - public FilterRegistration.Dynamic addFilter(String filterName, String className) { - return delegate.addFilter(filterName, className); - } - - @Override - public FilterRegistration.Dynamic addFilter(String filterName, Filter filter) { - return delegate.addFilter(filterName, filter); - } - - @Override - public FilterRegistration.Dynamic addFilter(String filterName, Class filterClass) { - return delegate.addFilter(filterName, filterClass); - } - - @Override - public T createFilter(Class clazz) throws ServletException { - return delegate.createFilter(clazz); - } - - @Override - public FilterRegistration getFilterRegistration(String filterName) { - return delegate.getFilterRegistration(filterName); - } - - @Override - public Map getFilterRegistrations() { - return delegate.getFilterRegistrations(); - } - - @Override - public SessionCookieConfig getSessionCookieConfig() { - return delegate.getSessionCookieConfig(); - } - - @Override - public void setSessionTrackingModes(Set sessionTrackingModes) { - delegate.setSessionTrackingModes(sessionTrackingModes); - } - - @Override - public Set getDefaultSessionTrackingModes() { - return delegate.getDefaultSessionTrackingModes(); - } - - @Override - public Set getEffectiveSessionTrackingModes() { - return delegate.getEffectiveSessionTrackingModes(); - } - - @Override - public void addListener(String className) { - delegate.addListener(className); - } - - @Override - public void addListener(T t) { - delegate.addListener(t); - } - - @Override - public void addListener(Class listenerClass) { - delegate.addListener(listenerClass); - } - - @Override - public T createListener(Class clazz) throws ServletException { - return delegate.createListener(clazz); - } - - @Override - public JspConfigDescriptor getJspConfigDescriptor() { - return delegate.getJspConfigDescriptor(); - } - - @Override - public ClassLoader getClassLoader() { - return delegate.getClassLoader(); - } - - @Override - public void declareRoles(String... roleNames) { - delegate.declareRoles(roleNames); - } - - @Override - public String getVirtualServerName() { - return delegate.getVirtualServerName(); - } - - @Override - public int getSessionTimeout() { - return delegate.getSessionTimeout(); - } - - @Override - public void setSessionTimeout(int sessionTimeout) { - delegate.setSessionTimeout(sessionTimeout); - } - - @Override - public String getRequestCharacterEncoding() { - return delegate.getRequestCharacterEncoding(); - } - - @Override - public void setRequestCharacterEncoding(String encoding) { - delegate.setRequestCharacterEncoding(encoding); - } - - @Override - public String getResponseCharacterEncoding() { - return delegate.getResponseCharacterEncoding(); - } - - @Override - public void setResponseCharacterEncoding(String encoding) { - delegate.setResponseCharacterEncoding(encoding); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletContextWrapperWrapper.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletContextWrapperWrapper.java deleted file mode 100644 index 959a881..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletContextWrapperWrapper.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.wrapper; - -import com.ibm.xsp.config.ServletContextWrapper; - -import javax.servlet.ServletContext; - -import org.openntf.xpages.runtime.util.XSPUtil; - -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -public class JakartaServletContextWrapperWrapper extends ServletContextWrapper { - public JakartaServletContextWrapperWrapper(ServletContext delegate, List configFiles, List extraFiles) { - super(delegate, configFiles, extraFiles); - } - - @Override - public URL getResource(String path) throws MalformedURLException { - URL result = XSPUtil.getResource(path, Thread.currentThread().getContextClassLoader()); - if(result == null) { - result = super.getResource(path); - } - return result; - } - - @Override - public InputStream getResourceAsStream(String path) { - InputStream result = XSPUtil.getResourceAsStream(path, Thread.currentThread().getContextClassLoader()); - if(result == null) { - result = super.getResourceAsStream(path); - } - return result; - } - - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletOutputStreamWrapper.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletOutputStreamWrapper.java deleted file mode 100644 index 0510dad..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletOutputStreamWrapper.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.wrapper; - -import java.io.IOException; - -import javax.servlet.ServletOutputStream; -import javax.servlet.WriteListener; - -public class JakartaServletOutputStreamWrapper extends ServletOutputStream { - - private final ServletOutputStream delegate; - - public JakartaServletOutputStreamWrapper(ServletOutputStream delegate) { - this.delegate = delegate; - } - - public void close() throws IOException { -// System.out.println("asked to close!"); -// delegate.close(); - } - - public boolean isReady() { -// return delegate.isReady(); - return true; - } - - public void write(int b) throws IOException { - delegate.write(b); - } - - public int hashCode() { - return delegate.hashCode(); - } - - public void write(byte[] b) throws IOException { - delegate.write(b); - } - - public void write(byte[] b, int off, int len) throws IOException { - delegate.write(b, off, len); - } - - public boolean equals(Object obj) { - return delegate.equals(obj); - } - - public void print(String s) throws IOException { - delegate.print(s); - } - - public void flush() throws IOException { - delegate.flush(); - } - - public void print(boolean b) throws IOException { - delegate.print(b); - } - - public void print(char c) throws IOException { - delegate.print(c); - } - - public void print(int i) throws IOException { - delegate.print(i); - } - - public void print(long l) throws IOException { - delegate.print(l); - } - - public void print(float f) throws IOException { - delegate.print(f); - } - - public void print(double d) throws IOException { - delegate.print(d); - } - - public void println() throws IOException { - delegate.println(); - } - - public void println(String s) throws IOException { - delegate.println(s); - } - - public void println(boolean b) throws IOException { - delegate.println(b); - } - - public void println(char c) throws IOException { - delegate.println(c); - } - - public String toString() { - return delegate.toString(); - } - - public void println(int i) throws IOException { - delegate.println(i); - } - - public void println(long l) throws IOException { - delegate.println(l); - } - - public void println(float f) throws IOException { - delegate.println(f); - } - - public void println(double d) throws IOException { - delegate.println(d); - } - - public void setWriteListener(WriteListener writeListener) { - delegate.setWriteListener(writeListener); - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletRequestWrapper.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletRequestWrapper.java deleted file mode 100644 index 6f19a89..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletRequestWrapper.java +++ /dev/null @@ -1,431 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.wrapper; - -import javax.servlet.*; -import javax.servlet.http.*; - -import org.openntf.xpages.runtime.platform.JakartaPlatform; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.nio.file.attribute.UserPrincipal; -import java.security.Principal; -import java.util.Collection; -import java.util.Enumeration; -import java.util.Locale; -import java.util.Map; - -public class JakartaServletRequestWrapper implements HttpServletRequest { - private final HttpServletRequest delegate; - private final String servletPath; - private final String pathInfo; - - private Principal overridePrincipal; - private static final Principal ANONYMOUS = new UserPrincipal() { - @Override - public String getName() { - return "anonymous"; //$NON-NLS-1$ - } - }; - - public JakartaServletRequestWrapper(HttpServletRequest delegate) { - this.delegate = delegate; - this.servletPath = null; - this.pathInfo = null; - } - - public JakartaServletRequestWrapper(HttpServletRequest delegate, String servletPath, String pathInfo) { - this.delegate = delegate; - this.servletPath = servletPath; - this.pathInfo = pathInfo; - } - - @Override - public Principal getUserPrincipal() { - if(this.overridePrincipal != null) { - return this.overridePrincipal; - } - Principal principal = delegate.getUserPrincipal(); - if(principal == null) { - principal = ANONYMOUS; - } - return principal; - } - - @Override - public ServletContext getServletContext() { - return new JakartaServletContextWrapper(delegate.getServletContext()); - } - - @Override - public String getAuthType() { - return delegate.getAuthType(); - } - - @Override - public Cookie[] getCookies() { - return delegate.getCookies(); - } - - @Override - public long getDateHeader(String name) { - return delegate.getDateHeader(name); - } - - @Override - public String getHeader(String name) { - return delegate.getHeader(name); - } - - @Override - public Enumeration getHeaders(String name) { - return delegate.getHeaders(name); - } - - @Override - public Enumeration getHeaderNames() { - return delegate.getHeaderNames(); - } - - @Override - public int getIntHeader(String name) { - return delegate.getIntHeader(name); - } - - @Override - public String getMethod() { - return delegate.getMethod(); - } - - @Override - public String getPathInfo() { - return pathInfo == null ? delegate.getPathInfo() : pathInfo; - } - - @Override - public String getPathTranslated() { - return delegate.getPathTranslated(); - } - - @Override - public String getContextPath() { - return JakartaPlatform.getServletContext().getContextPath(); - } - - @Override - public String getQueryString() { - return delegate.getQueryString(); - } - - @Override - public String getRemoteUser() { - return delegate.getRemoteUser(); - } - - @Override - public boolean isUserInRole(String role) { - return delegate.isUserInRole(role); - } - - @Override - public String getRequestedSessionId() { - return delegate.getRequestedSessionId(); - } - - @Override - public String getRequestURI() { - return delegate.getRequestURI(); - } - - @Override - public StringBuffer getRequestURL() { - return delegate.getRequestURL(); - } - - @Override - public String getServletPath() { - return servletPath == null ? delegate.getServletPath() : servletPath; - } - - @Override - public HttpSession getSession(boolean create) { - return delegate.getSession(create); - } - - @Override - public HttpSession getSession() { - return delegate.getSession(); - } - - @Override - public String changeSessionId() { - return delegate.changeSessionId(); - } - - @Override - public boolean isRequestedSessionIdValid() { - return delegate.isRequestedSessionIdValid(); - } - - @Override - public boolean isRequestedSessionIdFromCookie() { - return delegate.isRequestedSessionIdFromCookie(); - } - - @Override - public boolean isRequestedSessionIdFromURL() { - return delegate.isRequestedSessionIdFromURL(); - } - - @SuppressWarnings("deprecation") - @Override - public boolean isRequestedSessionIdFromUrl() { - return delegate.isRequestedSessionIdFromUrl(); - } - - @Override - public boolean authenticate(HttpServletResponse response) throws IOException, ServletException { - return delegate.authenticate(response); - } - - @Override - public void login(String username, String password) throws ServletException { - delegate.login(username, password); - } - - @Override - public void logout() throws ServletException { - delegate.logout(); - } - - @Override - public Collection getParts() throws IOException, ServletException { - return delegate.getParts(); - } - - @Override - public Part getPart(String name) throws IOException, ServletException { - return delegate.getPart(name); - } - - @Override - public T upgrade(Class handlerClass) throws IOException, ServletException { - return delegate.upgrade(handlerClass); - } - - @Override - public Object getAttribute(String name) { - return delegate.getAttribute(name); - } - - @Override - public Enumeration getAttributeNames() { - return delegate.getAttributeNames(); - } - - @Override - public String getCharacterEncoding() { - return delegate.getCharacterEncoding(); - } - - @Override - public void setCharacterEncoding(String env) throws UnsupportedEncodingException { - delegate.setCharacterEncoding(env); - } - - @Override - public int getContentLength() { - return delegate.getContentLength(); - } - - @Override - public long getContentLengthLong() { - return delegate.getContentLengthLong(); - } - - @Override - public String getContentType() { - return delegate.getContentType(); - } - - @Override - public ServletInputStream getInputStream() throws IOException { - return delegate.getInputStream(); - } - - @Override - public String getParameter(String name) { - return delegate.getParameter(name); - } - - @Override - public Enumeration getParameterNames() { - return delegate.getParameterNames(); - } - - @Override - public String[] getParameterValues(String name) { - return delegate.getParameterValues(name); - } - - @Override - public Map getParameterMap() { - return delegate.getParameterMap(); - } - - @Override - public String getProtocol() { - return delegate.getProtocol(); - } - - @Override - public String getScheme() { - return delegate.getScheme(); - } - - @Override - public String getServerName() { - return delegate.getServerName(); - } - - @Override - public int getServerPort() { - return delegate.getServerPort(); - } - - @Override - public BufferedReader getReader() throws IOException { - return delegate.getReader(); - } - - @Override - public String getRemoteAddr() { - return delegate.getRemoteAddr(); - } - - @Override - public String getRemoteHost() { - return delegate.getRemoteHost(); - } - - @Override - public void setAttribute(String name, Object o) { - delegate.setAttribute(name, o); - } - - @Override - public void removeAttribute(String name) { - delegate.removeAttribute(name); - } - - @Override - public Locale getLocale() { - return delegate.getLocale(); - } - - @Override - public Enumeration getLocales() { - return delegate.getLocales(); - } - - @Override - public boolean isSecure() { - return delegate.isSecure(); - } - - @Override - public RequestDispatcher getRequestDispatcher(String path) { - return delegate.getRequestDispatcher(path); - } - - @SuppressWarnings("deprecation") - @Override - public String getRealPath(String path) { - return delegate.getRealPath(path); - } - - @Override - public int getRemotePort() { - return delegate.getRemotePort(); - } - - @Override - public String getLocalName() { - return delegate.getLocalName(); - } - - @Override - public String getLocalAddr() { - return delegate.getLocalAddr(); - } - - @Override - public int getLocalPort() { - return delegate.getLocalPort(); - } - - @Override - public AsyncContext startAsync() throws IllegalStateException { - return delegate.startAsync(); - } - - @Override - public AsyncContext startAsync(ServletRequest servletRequest, ServletResponse servletResponse) throws IllegalStateException { - return delegate.startAsync(servletRequest, servletResponse); - } - - @Override - public boolean isAsyncStarted() { - return delegate.isAsyncStarted(); - } - - @Override - public boolean isAsyncSupported() { - return delegate.isAsyncSupported(); - } - - @Override - public AsyncContext getAsyncContext() { - return delegate.getAsyncContext(); - } - - @Override - public DispatcherType getDispatcherType() { - return delegate.getDispatcherType(); - } - - @Override - public PushBuilder newPushBuilder() { - return delegate.newPushBuilder(); - } - - @Override - public HttpServletMapping getHttpServletMapping() { - return delegate.getHttpServletMapping(); - } - - @Override - public Map getTrailerFields() { - return delegate.getTrailerFields(); - } - - @Override - public boolean isTrailerFieldsReady() { - return delegate.isTrailerFieldsReady(); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletResponseWrapper.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletResponseWrapper.java deleted file mode 100644 index dcca84b..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/wrapper/JakartaServletResponseWrapper.java +++ /dev/null @@ -1,203 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.wrapper; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Collection; -import java.util.Locale; -import java.util.Map; -import java.util.function.Supplier; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.Cookie; -import javax.servlet.http.HttpServletResponse; - -public class JakartaServletResponseWrapper implements HttpServletResponse { - private final HttpServletResponse delegate; - private ServletOutputStream os; - private PrintWriter writer; - - public JakartaServletResponseWrapper(HttpServletResponse delegate) { - this.delegate = delegate; - } - - public ServletOutputStream getOutputStream() throws IOException { - if(this.os == null) { - this.os = new JakartaServletOutputStreamWrapper(delegate.getOutputStream()); - } - return this.os; - } - - public PrintWriter getWriter() throws IOException { - if(this.writer == null) { - this.writer = new JakartaPrintWriterWrapper(delegate.getWriter()); - } - return this.writer; - } - - public void addCookie(Cookie cookie) { - delegate.addCookie(cookie); - } - - public boolean containsHeader(String name) { - return delegate.containsHeader(name); - } - - public String encodeURL(String url) { - return delegate.encodeURL(url); - } - - public String getCharacterEncoding() { - return delegate.getCharacterEncoding(); - } - - public String encodeRedirectURL(String url) { - return delegate.encodeRedirectURL(url); - } - - public String getContentType() { - return delegate.getContentType(); - } - - @SuppressWarnings("deprecation") - public String encodeUrl(String url) { - return delegate.encodeUrl(url); - } - - @SuppressWarnings("deprecation") - public String encodeRedirectUrl(String url) { - return delegate.encodeRedirectUrl(url); - } - - public void sendError(int sc, String msg) throws IOException { - delegate.sendError(sc, msg); - } - - public void sendError(int sc) throws IOException { - delegate.sendError(sc); - } - - public void setCharacterEncoding(String charset) { - delegate.setCharacterEncoding(charset); - } - - public void sendRedirect(String location) throws IOException { - delegate.sendRedirect(location); - } - - public void setDateHeader(String name, long date) { - delegate.setDateHeader(name, date); - } - - public void setContentLength(int len) { - delegate.setContentLength(len); - } - - public void setContentLengthLong(long len) { - delegate.setContentLengthLong(len); - } - - public void addDateHeader(String name, long date) { - delegate.addDateHeader(name, date); - } - - public void setContentType(String type) { - delegate.setContentType(type); - } - - public void setHeader(String name, String value) { - delegate.setHeader(name, value); - } - - public void addHeader(String name, String value) { - delegate.addHeader(name, value); - } - - public void setBufferSize(int size) { - delegate.setBufferSize(size); - } - - public void setIntHeader(String name, int value) { - delegate.setIntHeader(name, value); - } - - public void addIntHeader(String name, int value) { - delegate.addIntHeader(name, value); - } - - public void setStatus(int sc) { - delegate.setStatus(sc); - } - - public int getBufferSize() { - return delegate.getBufferSize(); - } - - public void flushBuffer() throws IOException { - delegate.flushBuffer(); - } - - @SuppressWarnings("deprecation") - public void setStatus(int sc, String sm) { - delegate.setStatus(sc, sm); - } - - public void resetBuffer() { - delegate.resetBuffer(); - } - - public int getStatus() { - return delegate.getStatus(); - } - - public boolean isCommitted() { - return delegate.isCommitted(); - } - - public String getHeader(String name) { - return delegate.getHeader(name); - } - - public void reset() { - delegate.reset(); - } - - public Collection getHeaders(String name) { - return delegate.getHeaders(name); - } - - public void setLocale(Locale loc) { - delegate.setLocale(loc); - } - - public Collection getHeaderNames() { - return delegate.getHeaderNames(); - } - - public void setTrailerFields(Supplier> supplier) { - delegate.setTrailerFields(supplier); - } - - public Locale getLocale() { - return delegate.getLocale(); - } - - public Supplier> getTrailerFields() { - return delegate.getTrailerFields(); - } - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaBootStrap.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaBootStrap.java deleted file mode 100644 index 8b3c73b..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaBootStrap.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.xsp; - -import java.util.ArrayList; -import java.util.List; - -import javax.faces.FacesException; -import javax.faces.FactoryFinder; -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -import org.openntf.xpages.runtime.wrapper.JakartaServletContextWrapperWrapper; - -import com.ibm.xsp.FacesExceptionEx; -import com.ibm.xsp.application.ApplicationFactoryEx; -import com.ibm.xsp.config.BootStrap; -import com.ibm.xsp.config.ServletContextWrapper; -import com.ibm.xsp.extlib.library.ExtlibLibrary; -import com.ibm.xsp.util.Delegation; - -public class JakartaBootStrap extends BootStrap { - private ServletContextListener contextListener; - private final ServletContext servletContext; - - public JakartaBootStrap(ServletContext servletContext) { - this.servletContext = servletContext; - } - - public void preloadFiles() { - try { - List configFiles = this.getConfigFiles(); - List extraFiles = this.getExtraFiles(); - ServletContextWrapper contextWrapper = new JakartaServletContextWrapperWrapper(servletContext, configFiles, extraFiles); - ServletContextEvent sce = new ServletContextEvent(contextWrapper); - this.getListener().contextInitialized(sce); - } catch (Throwable t) { - throw new FacesExceptionEx(t); - } - } - - @Override - protected void initContext(ServletContext servletContext) throws FacesException { - try { - List configFiles = this.getConfigFiles(); - List extraFiles = this.getExtraFiles(); - ServletContextWrapper contextWrapper = new JakartaServletContextWrapperWrapper(servletContext, configFiles, extraFiles); - ServletContextEvent sce = new ServletContextEvent(contextWrapper); - this.getListener().contextInitialized(sce); - Object fac = FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY); - if(fac instanceof ApplicationFactoryEx) { - ApplicationFactoryEx factory = (ApplicationFactoryEx)fac; - factory.initCompleted(); - } - } catch (Throwable t) { - throw new FacesExceptionEx(t); - } - } - - @Override - protected void destroyContext(ServletContext servletContext) throws FacesException { - try { - ServletContextEvent sce = new ServletContextEvent(servletContext); - getListener().contextDestroyed(sce); - FactoryFinder.releaseFactories(); - destroyListener(); - } catch (Throwable t) { - throw new FacesExceptionEx(t); - } - } - - private ServletContextListener getListener() throws ClassNotFoundException, IllegalAccessException, InstantiationException { - if (this.contextListener == null) { - this.contextListener = (ServletContextListener)Delegation.getImplementation("context-listener"); //$NON-NLS-1$ - } - - return this.contextListener; - } - - private void destroyListener() { - this.contextListener = null; - } - - @Override - protected List readConfigFiles() { - List result = new ArrayList(); - for(String f : super.readConfigFiles()) { -// if(!f.startsWith("/")) { -// result.add("/" + f); -// } else { - result.add(f); -// } - } - result.add("/META-INF/jakarta-faces-config.xml"); //$NON-NLS-1$ - - return result; - } - - @Override - protected List readExtraFiles(ServletContext servletContext) { - List result = new ArrayList(); - for(String f : super.readExtraFiles(servletContext)) { -// if(!f.startsWith("/")) { -// result.add("/" + f); -// } else { - result.add(f); -// } - } - - // Preload files from the ExtLib library as a workaround to https://github.com/darwino/xpages-runtime/issues/19 - ExtlibLibrary lib = new ExtlibLibrary(); - String[] files = lib.getFacesConfigFiles(); - if(files != null) { - for(String f : files) { -// if(!f.startsWith("/")) { -// result.add("/" + f); -// } else { - result.add(f); -// } - } - } - return result; - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFacesClassLoader.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFacesClassLoader.java deleted file mode 100644 index 5597494..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFacesClassLoader.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.xsp; - -import com.ibm.designer.runtime.Application; -import com.ibm.xsp.library.ApplicationFacesClassLoader; - -public class JakartaFacesClassLoader extends ApplicationFacesClassLoader { - public JakartaFacesClassLoader(Application application) { - super(application); - } - - -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFacesPageDriver.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFacesPageDriver.java deleted file mode 100644 index 4459b4e..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFacesPageDriver.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.xsp; - -import com.ibm.xsp.library.FacesClassLoader; -import com.ibm.xsp.page.compiled.CompiledPageDriver; - -public class JakartaFacesPageDriver extends CompiledPageDriver { - public JakartaFacesPageDriver(FacesClassLoader facesClassLoader) { - super(facesClassLoader); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFactoryLookup.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFactoryLookup.java deleted file mode 100644 index e263edc..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaFactoryLookup.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.xsp; - -import com.ibm.xsp.binding.id.ClientIdBindingFactory; -import com.ibm.xsp.binding.javascript.JavaScriptBindingFactoryImpl; -import com.ibm.xsp.binding.xpath.XPathBindingFactoryImpl; -import com.ibm.xsp.designer.context.ServletXSPContextFactory; -import com.ibm.xsp.factory.FactoryLookup; -import com.ibm.xsp.javascript.JavaScriptFactoryImpl; -import com.ibm.xsp.model.ExtsnDataModelFactory; - -import java.util.Iterator; - -public class JakartaFactoryLookup extends FactoryLookup { - private final FactoryLookup delegate; - - public JakartaFactoryLookup(FactoryLookup delegate) { - this.delegate = delegate; - - delegate.setFactory("com.ibm.xsp.XSP_CONTEXT_FACTORY", new ServletXSPContextFactory()); //$NON-NLS-1$ - delegate.setFactory("com.ibm.xsp.EXTSN_DATAMODEL_FACTORY", new ExtsnDataModelFactory()); //$NON-NLS-1$ - delegate.setFactory("com.ibm.xsp.JAVASCRIPT_FACTORY", new JavaScriptFactoryImpl()); //$NON-NLS-1$ - delegate.setFactory("javascript", new JavaScriptBindingFactoryImpl()); //$NON-NLS-1$ - delegate.setFactory("xpath", new XPathBindingFactoryImpl()); //$NON-NLS-1$ - delegate.setFactory("id", new ClientIdBindingFactory()); //$NON-NLS-1$ - } - - @Override - public Iterator getFactories() { - return delegate.getFactories(); - } - - @SuppressWarnings("rawtypes") - @Override - public Iterator getFactories(Class aClass) { - return delegate.getFactories(aClass); - } - - @Override - public Object getFactory(String s) { - return delegate.getFactory(s); - } - - @SuppressWarnings("rawtypes") - @Override - public void setFactory(String s, Class aClass) throws InstantiationException, IllegalAccessException { - delegate.setFactory(s, aClass); - } - - @Override - public void setFactory(String s, Object factory) { - delegate.setFactory(s, factory); - } - - @Override - public void releaseFactories() { - delegate.releaseFactories(); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaSourceFileManager.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaSourceFileManager.java deleted file mode 100644 index 9cbc20e..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaSourceFileManager.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.xsp; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.FileVisitOption; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import javax.tools.JavaFileManager; -import javax.tools.JavaFileObject; -import javax.tools.JavaFileObject.Kind; - -import com.ibm.commons.util.StringUtil; -import com.ibm.xsp.extlib.javacompiler.JavaSourceClassLoader; -import com.ibm.xsp.extlib.javacompiler.impl.JavaFileObjectClass; -import com.ibm.xsp.extlib.javacompiler.impl.SourceFileManager; - -public class JakartaSourceFileManager extends SourceFileManager { - private final JavaFileManager fileManager; - - public JakartaSourceFileManager(JavaFileManager fileManager, JavaSourceClassLoader classLoader, String[] classPath, boolean resolve) { - super(fileManager, classLoader, classPath, resolve); - this.fileManager = fileManager; - } - - @Override - public Iterable list(Location location, String packageName, Set kinds, boolean recurse) - throws IOException { - Iterable sup = fileManager.list(location, packageName, kinds, recurse); - if(sup.iterator().hasNext()) { - return sup; - } else { - return getClasses().stream() - .filter(c -> c.binaryName().startsWith(packageName + ".")) //$NON-NLS-1$ - .collect(Collectors.toList()); - } - } - - private List classes; - - private List getClasses() { - if(classes == null) { - try { - List list = new LinkedList<>(); - for(URL url : Collections.list(Thread.currentThread().getContextClassLoader().getResources("/"))) { //$NON-NLS-1$ - String protocol = StringUtil.toString(url.getProtocol()); - if("file".equals(protocol)) { //$NON-NLS-1$ - Path dir = Paths.get(url.toURI()); - if(Files.isDirectory(dir)) { - Files.walk(dir, FileVisitOption.FOLLOW_LINKS) - .filter(p -> Files.isRegularFile(p)) - .filter(p -> p.getFileName().toString().endsWith(JavaSourceClassLoader.CLASS_EXTENSION)) - .forEach(p -> { - String rel = dir.relativize(p).toString(); - String binaryName = removeClassExtension(StringUtil.replace(rel, File.separatorChar, '.')); - list.add(new JavaFileObjectClass(p.toUri(), binaryName)); - }); - } - } else if(protocol.contains("jar")) { //$NON-NLS-1$ - String jarUrl = url.toString(); - jarUrl = jarUrl.substring(0, jarUrl.indexOf("!/")); //$NON-NLS-1$ - try(InputStream is = new URL(jarUrl).openStream()) { - try(ZipInputStream jis = new ZipInputStream(is)) { - ZipEntry entry = jis.getNextEntry(); - while(entry != null) { - String name = entry.getName(); - if(name.endsWith(JavaSourceClassLoader.CLASS_EXTENSION)) { - URI uri = new URI(jarUrl + "!/" + name); //$NON-NLS-1$ - String binaryName = removeClassExtension(StringUtil.replace(name, '/' , '.')); - list.add(new JavaFileObjectClass(uri, binaryName)); - } - - entry = jis.getNextEntry(); - } - } - } - } - } - this.classes = list; - } catch(IOException | URISyntaxException e) { - throw new RuntimeException(e); - } - } - return classes; - } - - private static String removeClassExtension(String s) { - return s.substring(0, s.length()-JavaSourceClassLoader.CLASS_EXTENSION.length()); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaViewHandler.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaViewHandler.java deleted file mode 100644 index 870d610..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaViewHandler.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.xsp; - -import javax.faces.application.ViewHandler; - -import com.ibm.xsp.application.ViewHandlerExImpl; - -public class JakartaViewHandler extends ViewHandlerExImpl { - - public JakartaViewHandler(ViewHandler delegate) { - super(delegate); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaXspSourceClassLoader.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaXspSourceClassLoader.java deleted file mode 100644 index a238be3..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/JakartaXspSourceClassLoader.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.xsp; - -import java.util.List; - -import javax.tools.DiagnosticCollector; -import javax.tools.JavaCompiler; -import javax.tools.JavaFileObject; -import javax.tools.StandardJavaFileManager; - -import com.ibm.xsp.extlib.javacompiler.JavaSourceClassLoader; -import com.ibm.xsp.extlib.javacompiler.impl.SourceFileManager; - -public class JakartaXspSourceClassLoader extends JavaSourceClassLoader { - - public JakartaXspSourceClassLoader(ClassLoader parentClassLoader, List compilerOptions, String[] classPath, boolean resolve) { - super(parentClassLoader, compilerOptions, classPath, resolve); - setUseSingletonClassLoaders(true); - } - - public JakartaXspSourceClassLoader(ClassLoader parentClassLoader, List compilerOptions, String[] classPath) { - super(parentClassLoader, compilerOptions, classPath); - setUseSingletonClassLoaders(true); - } - - @Override - protected SourceFileManager createSourceFileManager(JavaCompiler javaCompiler, DiagnosticCollector diagnostics, String[] classPath, boolean resolve) { - StandardJavaFileManager standardJavaFileManager = javaCompiler.getStandardFileManager(diagnostics, null, null); - return new JakartaSourceFileManager(standardJavaFileManager, this, classPath, resolve); - } -} diff --git a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/LibraryWeightComparator.java b/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/LibraryWeightComparator.java deleted file mode 100644 index badf00e..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/java/org/openntf/xpages/runtime/xsp/LibraryWeightComparator.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright © 2019-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xpages.runtime.xsp; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; - -import com.ibm.xsp.library.XspLibrary; - -/** - * This library provides a hard-coded sorting order for the stock IBM libraries. This is - * important to ensure that overriding libraries (like extsn over core) are loaded in - * proper order. - * - * @author Jesse Gallagher - * @since 1.2.0 - */ -public class LibraryWeightComparator implements Comparator { - public static final LibraryWeightComparator INSTANCE = new LibraryWeightComparator(); - - private static final List weightedNames = Arrays.asList( - "com.ibm.xsp.core.library", //$NON-NLS-1$ - "com.ibm.xsp.extsn.library", //$NON-NLS-1$ - "com.ibm.xsp.domino.library", //$NON-NLS-1$ - "com.ibm.xsp.designer.library", //$NON-NLS-1$ - "com.ibm.xsp.extlib.library" //$NON-NLS-1$ - ); - - @Override - public int compare(XspLibrary lib1, XspLibrary lib2) { - String libName1 = lib1.getLibraryId(); - String libName2 = lib2.getLibraryId(); - - int loc1 = weightedNames.indexOf(libName1); - int loc2 = weightedNames.indexOf(libName2); - if(loc1 > -1 && loc2 == -1) { - return -1; - } else if(loc1 == -1 && loc2 > -1) { - return 1; - } else if(loc1 > -1 && loc2 > -1) { - return Integer.compare(loc1, loc2); - } - - return libName1.compareTo(libName2); - } - -} \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/jakarta-faces-config.xml b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/jakarta-faces-config.xml deleted file mode 100644 index 78a48c0..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/jakarta-faces-config.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - org.openntf.xpages.runtime.JakartaFacesApplicationFactory - org.openntf.xpages.runtime.context.JakartaFacesContextFactory - - - org.openntf.xpages.runtime.xsp.JakartaViewHandler - - diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/platformPlugins.txt b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/platformPlugins.txt deleted file mode 100644 index 7c8766c..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/platformPlugins.txt +++ /dev/null @@ -1,9 +0,0 @@ -com.ibm.xsp.theme.oneuiv302.ThemeActivator -com.ibm.xsp.theme.oneui_idx.ThemeActivator -com.ibm.xsp.dojo.factory.DojoLibraryActivator - -com.ibm.xsp.extlib.library.ExtlibActivator -com.ibm.xsp.extlib.plugin.ControlsPluginActivator -com.ibm.xsp.theme.bootstrap.plugin.Activator -com.ibm.xsp.extlib.plugin.MobilePluginActivator -com.ibm.xsp.extlib.plugin.OneUIPluginActivator \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory deleted file mode 100644 index 59c131e..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory +++ /dev/null @@ -1 +0,0 @@ -org.openntf.xpages.runtime.domino.platform.JakartaDominoPlatformFactory \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.designer.runtime.extensions.JavaScriptProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.designer.runtime.extensions.JavaScriptProvider deleted file mode 100644 index eec188e..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.designer.runtime.extensions.JavaScriptProvider +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.extlib.relational.javascript.JdbcJSFunctions \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.GlobalResourceProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.GlobalResourceProvider deleted file mode 100644 index ebc96d7..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.GlobalResourceProvider +++ /dev/null @@ -1,2 +0,0 @@ -com.ibm.xsp.minifier.MinifierResourceProvider -com.ibm.xsp.extlib.resources.ExtlibResourceProvider \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.RequestParameters b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.RequestParameters deleted file mode 100644 index 3c143aa..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.RequestParameters +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.extlib.library.ExtlibRequestCustomizerFactory \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.adapter.servletFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.adapter.servletFactory deleted file mode 100644 index 17e5602..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.adapter.servletFactory +++ /dev/null @@ -1,2 +0,0 @@ -com.ibm.xsp.extlib.proxy.servlet.ProxyServletFactory -com.ibm.xsp.extlib.relational.jdbc.services.servlet.JdbcServletFactory \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.context.DojoLibraryFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.context.DojoLibraryFactory deleted file mode 100644 index 7d2ed9a..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.context.DojoLibraryFactory +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.dojo.factory.JakartaDojoLibraryFactory \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.core.events.ApplicationListener b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.core.events.ApplicationListener deleted file mode 100644 index c35b092..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.core.events.ApplicationListener +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.extlib.relational.resources.ApplicationInitializer \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.DumpAccessorFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.DumpAccessorFactory deleted file mode 100644 index 4e1d2e2..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.DumpAccessorFactory +++ /dev/null @@ -1,6 +0,0 @@ -com.ibm.xsp.extlib.util.debug.JavaScriptDumpFactory -com.ibm.xsp.extlib.util.debug.BasicDumpFactory -com.ibm.xsp.extlib.util.debug.XPagesDumpFactory -com.ibm.xsp.extlib.util.debug.ExtLibDumpFactory -com.ibm.xsp.extlib.social.impl.SocialDumpFactory -com.ibm.xsp.extlib.relational.debug.JdbcDumpFactory \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.controls.DynamicColumnBuilderFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.controls.DynamicColumnBuilderFactory deleted file mode 100644 index 7739fc9..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.controls.DynamicColumnBuilderFactory +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.extlib.relational.component.dynamicview.JdbcDynamicColumnBuilderFactory \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.device.DeviceDataProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.device.DeviceDataProvider deleted file mode 100644 index f8f3f2d..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.device.DeviceDataProvider +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.extlib.device.extensions.XspUserAgentDataProvider \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.relational.jdbc.datasource.IFileJdbcPoolProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.relational.jdbc.datasource.IFileJdbcPoolProvider deleted file mode 100644 index d8597ab..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.relational.jdbc.datasource.IFileJdbcPoolProvider +++ /dev/null @@ -1,2 +0,0 @@ -com.ibm.xsp.extlib.relational.jdbc.datasource.dbcp.NSFFileJdbcDBCPProvider -com.ibm.xsp.extlib.relational.jdbc.datasource.xpages.NSFFileJdbcXPCPProvider \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.minifier.loader b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.minifier.loader deleted file mode 100644 index 0197e85..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.minifier.loader +++ /dev/null @@ -1,2 +0,0 @@ -com.ibm.xsp.minifier.DojoLoader -com.ibm.xsp.extlib.minifier.ExtLibLoader \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.renderkit.ContentTypeRenderer b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.renderkit.ContentTypeRenderer deleted file mode 100644 index be8626a..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.renderkit.ContentTypeRenderer +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.extlib.renderkit.contenttype.GoogleSearch \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.resource.DojoModulePathResource b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.resource.DojoModulePathResource deleted file mode 100644 index 626987b..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.resource.DojoModulePathResource +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.extlib.resources.ExtlibModulePath \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.runtime.resources b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.runtime.resources deleted file mode 100644 index a1dfcfc..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.runtime.resources +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.extlib.relational.resources.JdbcDataSourceProvider \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.StyleKitFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.StyleKitFactory deleted file mode 100644 index f1149cd..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.StyleKitFactory +++ /dev/null @@ -1,2 +0,0 @@ -com.ibm.xsp.theme.oneuiv302.ThemeStyleKitFactory -com.ibm.xsp.theme.bootstrap.themes.StyleKitFactory \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.ThemeExtension b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.ThemeExtension deleted file mode 100644 index 90220af..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.ThemeExtension +++ /dev/null @@ -1 +0,0 @@ -com.ibm.xsp.stylekit.CoreThemeExtension \ No newline at end of file diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/org.openntf.xpages.runtime.osgi.ActivatorNameProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/org.openntf.xpages.runtime.osgi.ActivatorNameProvider deleted file mode 100644 index 1e164bf..0000000 --- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/org.openntf.xpages.runtime.osgi.ActivatorNameProvider +++ /dev/null @@ -1 +0,0 @@ -org.openntf.xpages.runtime.osgi.DefaultActivatorNameProvider \ No newline at end of file diff --git a/xpages-webapp-support/xsp-maven-plugin/pom.xml b/xpages-webapp-support/xsp-maven-plugin/pom.xml deleted file mode 100644 index 2a76f80..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/pom.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - 4.0.0 - - org.openntf.xpages - xpages-webapp-support - 1.3.0-SNAPSHOT - - xsp-maven-plugin - maven-plugin - - XSP Transpiler Plugin - - Provides a Maven goal to transpile XSP source to Java during a project build. - - - - 3.3.9 - - - 2020 - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - Jesse Gallagher - jesse@frostillic.us - - - - - - org.apache.maven - maven-plugin-api - ${maven.api.version} - - - org.apache.maven - maven-core - ${maven.api.version} - - - org.apache.maven - maven-project - 2.2.1 - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.2 - provided - - - org.codehaus.plexus - plexus-utils - 3.2.1 - - - org.sonatype.plexus - plexus-build-api - 0.0.7 - - - - org.codehaus.groovy - groovy - 3.0.7 - - - com.ibm.sbt - com.ibm.commons - 9.0.0 - - - com.ibm.sbt - com.ibm.commons.xml - 9.0.0 - - - - ${project.groupId} - xpages-runtime - ${project.version} - provided - - - - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.5.1 - - xsp - true - - - - mojo-descriptor - - descriptor - - - - help-goal - - helpmojo - - - - - - - diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/Messages.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/Messages.java deleted file mode 100644 index 6146c82..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/Messages.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.openntf.xsp.maven.transpiler; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.openntf.xsp.maven.transpiler.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/NonVerifyingPathClassLoader.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/NonVerifyingPathClassLoader.java deleted file mode 100644 index de8ba7f..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/NonVerifyingPathClassLoader.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * Copyright © 2020-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xsp.maven.transpiler; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import com.ibm.commons.util.io.StreamUtil; - -/** - * {@link ClassLoader} implementation that loads classes from a collection of file paths, - * but does not verify signatures. - * - *

This is useful to avoid trouble with OSGi-style split packages in different JARs that - * may or may not have the same signer.

- * - * @author Jesse Gallagher - */ -public class NonVerifyingPathClassLoader extends ClassLoader implements AutoCloseable { - private final Collection paths; - private final ClassLoader delegate; - private final URLClassLoader resourceLoader; - private final Map jarFiles = new HashMap<>(); - - public NonVerifyingPathClassLoader(Collection paths, ClassLoader delegate) { - super(); - this.paths = Objects.requireNonNull(paths); - this.resourceLoader = URLClassLoader.newInstance( - paths.stream() - .map(Path::toUri) - .map(t -> { - try { - return t.toURL(); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - }) - .toArray(size -> new URL[size]) - ); - this.delegate = delegate; - } - - @Override - protected Class findClass(String name) throws ClassNotFoundException { - String binaryName = String.valueOf(name) - .replace('.', '/') - + ".class"; //$NON-NLS-1$ - for(Path path : paths) { - if(Files.isRegularFile(path)) { - try { - JarFile f = jarFiles.computeIfAbsent(path, p -> { - try { - return new JarFile(p.toFile()); - } catch (IOException e) { - throw new RuntimeException(e); - } - }); - JarEntry entry = f.getJarEntry(binaryName); - if(entry != null) { - // Read in the class data - try(InputStream is = f.getInputStream(entry)) { - return defineClass(name, is); - } - } - } catch (IOException e) { - throw new RuntimeException(e); - } - } else if(Files.isDirectory(path)) { - Path classFile = path.resolve(binaryName.replace('/', File.separatorChar)); - if(Files.isRegularFile(classFile)) { - // Read in the class data - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try { - Files.copy(classFile, baos); - } catch (IOException e) { - throw new RuntimeException(e); - } - byte[] classData = baos.toByteArray(); - return defineClass(name, classData, 0, classData.length); - } - } - } - - return delegate.loadClass(name); - } - - public Class defineClass(String name, InputStream is) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - StreamUtil.copyStream(is, baos); - byte[] classData = baos.toByteArray(); - return defineClass(name, classData, 0, classData.length); - } - - @Override - protected URL findResource(String name) { - return resourceLoader.findResource(name); - } - - @Override - protected Enumeration findResources(String name) throws IOException { - return resourceLoader.findResources(name); - } - - @Override - public void close() throws Exception { - resourceLoader.close(); - for(JarFile f : jarFiles.values()) { - f.close(); - } - } -} diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspileXspMojo.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspileXspMojo.java deleted file mode 100644 index 74b9ea2..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspileXspMojo.java +++ /dev/null @@ -1,270 +0,0 @@ -/** - * Copyright © 2020-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xsp.maven.transpiler; -import java.io.File; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.lang.reflect.Method; -import java.nio.file.Files; -import java.nio.file.Path; -import java.text.MessageFormat; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.manager.WagonManager; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.util.Scanner; -import org.sonatype.plexus.build.incremental.BuildContext; - -/** - * Transpiles XSP source to Java. - * - * @author Jesse Gallagher - * @since 1.0.0 - */ -@Mojo( - name="transpile", - defaultPhase=LifecyclePhase.GENERATE_SOURCES, - requiresDependencyResolution=ResolutionScope.COMPILE_PLUS_RUNTIME, - requiresDependencyCollection=ResolutionScope.COMPILE_PLUS_RUNTIME -) -public class TranspileXspMojo extends AbstractMojo { - @Parameter(defaultValue="${project}", readonly=true, required=false) - protected MavenProject project; - - @Component - protected WagonManager wagonManager; - - @Parameter(defaultValue="${plugin}", readonly=true) - protected PluginDescriptor pluginDescriptor; - - @Parameter(defaultValue="${session}", readonly=true) - protected MavenSession mavenSession; - - /** - * The root directory to search for XSP files. - */ - @Parameter(required=false, defaultValue="${project.basedir}/src/main/webapp/WEB-INF/xpages") - private File xspSourceRoot; - - /** - * The root directory to search for XSP files. - */ - @Parameter(required=false, defaultValue="${project.basedir}/src/main/webapp/WEB-INF/controls") - private File ccSourceRoot; - - @Parameter(required=true, defaultValue="${project.build.directory}/generated-sources/java") - private File outputDirectory; - - @Component - private BuildContext buildContext; - - private Log log; - - public TranspileXspMojo() { - } - - @SuppressWarnings("unchecked") - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - log = getLog(); - - Path xspSourceRoot = this.xspSourceRoot == null ? null : this.xspSourceRoot.toPath(); - if(xspSourceRoot != null) { - if(!Files.exists(xspSourceRoot)) { - xspSourceRoot = null; - } - } - if(log.isInfoEnabled()) { - log.info(MessageFormat.format(Messages.getString("TranspileXspMojo.usingXspSourceRoot"), xspSourceRoot)); //$NON-NLS-1$ - } - - Path ccSourceRoot = this.ccSourceRoot == null ? null : this.ccSourceRoot.toPath(); - if(ccSourceRoot != null) { - if(!Files.exists(ccSourceRoot)) { - ccSourceRoot = null; - } - } - if(log.isInfoEnabled()) { - log.info(MessageFormat.format(Messages.getString("TranspileXspMojo.usingCcSourceRoot"), ccSourceRoot)); //$NON-NLS-1$ - } - - // Check if a build is needed - List changedXPages = Collections.emptyList(); - List deletedXPages = Collections.emptyList(); - if(xspSourceRoot != null) { - Scanner scanner = buildContext.newScanner(xspSourceRoot.toFile()); - changedXPages = scanXspChanges(scanner, xspSourceRoot); - - scanner = buildContext.newDeleteScanner(xspSourceRoot.toFile()); - deletedXPages = scanXspChanges(scanner, xspSourceRoot); - } - - List changedControls = Collections.emptyList(); - List deletedControls = Collections.emptyList(); - if(ccSourceRoot != null) { - Scanner scanner = buildContext.newScanner(ccSourceRoot.toFile()); - changedControls = scanXspChanges(scanner, ccSourceRoot); - - scanner = buildContext.newDeleteScanner(ccSourceRoot.toFile()); - deletedControls = scanXspChanges(scanner, ccSourceRoot); - } - - if(!changedXPages.isEmpty() || !changedControls.isEmpty() || !deletedXPages.isEmpty() || deletedControls.isEmpty()) { - Path output = outputDirectory.toPath(); - - Map toWrite = new HashMap<>(); - try(NonVerifyingPathClassLoader projectClassLoader = buildProjectClassLoader()) { - // Shim TranspilerUtil into this classloader, as it's used in multiple places - try(InputStream is = getClass().getResourceAsStream("/" + TranspilerUtil.class.getName().replace('.', '/') + ".class")) { //$NON-NLS-1$ //$NON-NLS-2$ - projectClassLoader.defineClass(TranspilerUtil.class.getName(), is); - } - - // Handle deletions first, which may skip having to establish the full environment - deleteChanges(projectClassLoader, deletedXPages, xspSourceRoot, output); - deleteChanges(projectClassLoader, deletedControls, ccSourceRoot, output); - - // If needed, translate changes - if(!changedXPages.isEmpty() || !changedControls.isEmpty()) { - // Load our XspTranspiler class into the contained class loader - Class transpilerClass; - try(InputStream is = getClass().getResourceAsStream("/" + XspTranspiler.class.getName().replace('.', '/') + ".class")) { //$NON-NLS-1$ //$NON-NLS-2$ - transpilerClass = projectClassLoader.defineClass(XspTranspiler.class.getName(), is); - } - - ClassLoader tlcc = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(projectClassLoader); - - Object transpiler = transpilerClass.getConstructor(boolean.class).newInstance(log.isDebugEnabled()); - - if(ccSourceRoot != null && Files.isDirectory(ccSourceRoot)) { - TranspilerUtil.call(transpiler, "defineCustomControls", new Class[] { Path.class }, ccSourceRoot); //$NON-NLS-1$ - } - - Method transpile = transpilerClass.getMethod("transpile", Path.class, Path.class); //$NON-NLS-1$ - - for(Path xpage : changedXPages) { - Map.Entry results = ((Map)transpile.invoke(transpiler, xspSourceRoot, xpage)).entrySet().iterator().next(); - Path dest = output.resolve(results.getKey()); - toWrite.put(dest, results.getValue()); - } - for(Path control : changedControls) { - Map.Entry results = ((Map)transpile.invoke(transpiler, ccSourceRoot, control)).entrySet().iterator().next(); - Path dest = output.resolve(results.getKey()); - toWrite.put(dest, results.getValue()); - } - } finally { - Thread.currentThread().setContextClassLoader(tlcc); - } - - // Write out the files - for(Map.Entry entry : toWrite.entrySet()) { - Files.createDirectories(entry.getKey().getParent()); - try(OutputStream os = buildContext.newFileOutputStream(entry.getKey().toFile())) { - try(Writer w = new OutputStreamWriter(os)) { - w.write(entry.getValue()); - } - } - } - } - } catch (Exception e) { - throw new MojoExecutionException(Messages.getString("TranspileXspMojo.exceptionTranspilingSource"), e); //$NON-NLS-1$ - } - } else { - if(log.isInfoEnabled()) { - log.info(Messages.getString("TranspileXspMojo.noChangesDetected")); //$NON-NLS-1$ - } - } - } - - private NonVerifyingPathClassLoader buildProjectClassLoader() throws MojoExecutionException { - // Build a class loader based on all project dependencies - List dependencies; - try { - dependencies = project.getArtifacts().stream() - .map(Artifact::getFile) - .map(File::toPath) - .peek(p -> { - if(log.isDebugEnabled()) { - log.debug(MessageFormat.format(Messages.getString("TranspileXspMojo.addingClasspathEntry"), p)); //$NON-NLS-1$ - } - }) - .collect(Collectors.toCollection(LinkedList::new)); - - } catch (Exception e) { - throw new MojoExecutionException(Messages.getString("TranspileXspMojo.exceptionBuildingClasspath"), e); //$NON-NLS-1$ - } - - return new NonVerifyingPathClassLoader(dependencies, ClassLoader.getSystemClassLoader()); - } - - private List scanXspChanges(Scanner scanner, Path sourceRoot) { - scanner.setIncludes(new String[] { "*.xsp" }); //$NON-NLS-1$ - scanner.scan(); - String[] changes = scanner.getIncludedFiles(); - if(changes != null) { - return Arrays.stream(changes) - .map(sourceRoot::resolve) - .peek(p -> { - if(log.isDebugEnabled()) { - log.debug(MessageFormat.format(Messages.getString("TranspileXspMojo.foundChangedFile"), p)); //$NON-NLS-1$ - } - }) - .collect(Collectors.toList()); - } else { - return Collections.emptyList(); - } - } - - private void deleteChanges(ClassLoader projectClassLoader, List deletedFiles, Path sourceRoot, Path output) { - Class innerUtil = TranspilerUtil.loadClass(projectClassLoader, TranspilerUtil.class.getName()); - deletedFiles.stream() - .map(p -> TranspilerUtil.call(innerUtil, "xspPathToJavaPath", new Class[] { Path.class }, sourceRoot.relativize(p))) //$NON-NLS-1$ - .map(Path.class::cast) - .map(output::resolve) - .filter(Files::isRegularFile) - .peek(p -> { - if(log.isDebugEnabled()) { - log.debug(MessageFormat.format(Messages.getString("TranspileXspMojo.clearingDeletedTranslation"), p)); //$NON-NLS-1$ - } - }) - .forEach(p -> { - File file = p.toFile(); - file.delete(); - buildContext.refresh(file); - }); - } -} diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspilerUtil.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspilerUtil.java deleted file mode 100644 index 9fed1f3..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspilerUtil.java +++ /dev/null @@ -1,136 +0,0 @@ -/** - * Copyright © 2020-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xsp.maven.transpiler; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collection; - -import org.w3c.dom.Document; - -import com.ibm.commons.util.io.StreamUtil; -import com.ibm.commons.xml.DOMUtil; -import com.ibm.commons.xml.XMLException; -import com.ibm.xsp.page.compiled.PageToClassNameUtil; - -public enum TranspilerUtil { - ; - - public static Class loadClass(ClassLoader classLoader, String className) { - try { - return classLoader.loadClass(className); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - } - - public static Object newInstance(ClassLoader classLoader, String className, Class[] parameterTypes, Object... parameters) { - try { - Class clazz = classLoader.loadClass(className); - Constructor ctor = clazz.getConstructor(parameterTypes); - return ctor.newInstance(parameters); - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) { - throw new RuntimeException(e); - } - } - - public static T call(Object obj, String methodName) { - return call(obj, methodName, new Class[0]); - } - - @SuppressWarnings("unchecked") - public static T call(Object obj, String methodName, Class[] parameterTypes, Object... parameters) { - try { - Method method = obj.getClass().getMethod(methodName, parameterTypes); - return (T)method.invoke(obj, parameters); - } catch(Exception e) { - throw new RuntimeException(e); - } - } - - public static T call(Class clazz, String staticMethodName) { - return call(clazz, staticMethodName, new Class[0]); - } - - @SuppressWarnings("unchecked") - public static T call(Class clazz, String staticMethodName, Class[] parameterTypes, Object... parameters) { - try { - Method method = clazz.getMethod(staticMethodName, parameterTypes); - return (T)method.invoke(null, parameters); - } catch(Exception e) { - throw new RuntimeException(e); - } - } - - public static String readFile(Path path) { - try(InputStream is = Files.newInputStream(path)) { - return StreamUtil.readString(is); - } catch(IOException e) { - throw new RuntimeException(e); - } - } - - public static Document readXml(Path file) { - try(InputStream is = Files.newInputStream(file)) { - return DOMUtil.createDocument(is); - } catch(IOException | XMLException e) { - throw new RuntimeException(e); - } - } - - public static void deltree(Collection paths) throws IOException { - for(Path path : paths) { - deltree(path); - } - } - - public static void deltree(Path path) throws IOException { - if(Files.isDirectory(path)) { - Files.list(path) - .forEach(t -> { - try { - deltree(t); - } catch (IOException e) { - throw new RuntimeException(e); - } - }); - } - try { - Files.deleteIfExists(path); - } catch(IOException e) { - // This is likely a Windows file-locking thing. In this case, - // punt and hand it off to File#deleteOnExit - path.toFile().deleteOnExit(); - } - } - - @SuppressWarnings("nls") - public static Path xspPathToJavaPath(Path xspFile) { - if(xspFile.isAbsolute()) { - throw new IllegalArgumentException("xspFile must be relative"); - } - String className = PageToClassNameUtil.getClassNameForPage(xspFile.toString()); - String outputFileName = className.replace('.', File.separatorChar) + ".java"; //$NON-NLS-1$ - return Paths.get(outputFileName); - } -} diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/XspTranspiler.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/XspTranspiler.java deleted file mode 100644 index 9f84c30..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/XspTranspiler.java +++ /dev/null @@ -1,227 +0,0 @@ -/** - * Copyright © 2020-2020 Jesse Gallagher - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.openntf.xsp.maven.transpiler; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.Field; -import java.nio.file.FileVisitOption; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.text.MessageFormat; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Stream; - -import org.openntf.xpages.runtime.xsp.LibraryWeightComparator; -import org.w3c.dom.Document; - -import com.ibm.commons.Platform; -import com.ibm.commons.extension.ExtensionManager; -import com.ibm.commons.platform.GenericPlatform; -import com.ibm.commons.util.StringUtil; -import com.ibm.commons.util.io.StreamUtil; -import com.ibm.commons.xml.DOMUtil; -import com.ibm.commons.xml.XMLException; -import com.ibm.xsp.extlib.interpreter.DynamicFacesClassLoader; -import com.ibm.xsp.extlib.interpreter.DynamicXPageBean; -import com.ibm.xsp.extlib.javacompiler.JavaSourceClassLoader; -import com.ibm.xsp.library.ClasspathResourceBundleSource; -import com.ibm.xsp.library.FacesClassLoader; -import com.ibm.xsp.library.LibraryServiceLoader; -import com.ibm.xsp.library.LibraryWrapper; -import com.ibm.xsp.library.XspLibrary; -import com.ibm.xsp.page.compiled.PageToClassNameUtil; -import com.ibm.xsp.registry.CompositeComponentDefinitionImpl; -import com.ibm.xsp.registry.FacesLibraryImpl; -import com.ibm.xsp.registry.FacesProject; -import com.ibm.xsp.registry.FacesProjectImpl; -import com.ibm.xsp.registry.LibraryFragmentImpl; -import com.ibm.xsp.registry.SharableRegistryImpl; -import com.ibm.xsp.registry.UpdatableLibrary; -import com.ibm.xsp.registry.config.IconUrlSource; -import com.ibm.xsp.registry.config.ResourceBundleSource; -import com.ibm.xsp.registry.config.SimpleRegistryProvider; -import com.ibm.xsp.registry.parse.ConfigParser; -import com.ibm.xsp.registry.parse.ConfigParserFactory; -import com.ibm.xsp.registry.parse.ConfigParserImpl; - -public class XspTranspiler { - - private final boolean debug; - protected final SharableRegistryImpl facesRegistry = new SharableRegistryImpl(getClass().getName()); - protected final FacesProject facesProject; - protected final DynamicXPageBean dynamicXPageBean = new DynamicXPageBean(); - protected ResourceBundleSource resourceBundleSource; - protected final IconUrlSource iconUrlSource = icon -> getClass().getResource(icon); - - public XspTranspiler(boolean debug) { - this.debug = debug; - this.facesProject = new FacesProjectImpl(getClass().getName(), facesRegistry); - - // Ensure that IBM Commons's platform detection doesn't try to load an implementation that depends on a Notes runtime - System.setProperty(Platform.PLATFORM_PROPERTY_KEY, GenericPlatform.class.getName()); - - resourceBundleSource = new ClasspathResourceBundleSource(Thread.currentThread().getContextClassLoader()); - - initializeRegistry(); - } - - public void defineCustomControls(Path ccSourceRoot) throws IOException { - if(ccSourceRoot != null) { - if(debug) { - System.out.println("Initializing Custom Control definitions"); //$NON-NLS-1$ - } - - // Generate a classpath, which the CC library needs to find classes for property types - Set cleanup = new HashSet<>(); - try { - ConfigParser configParser = getConfigParser(); - - try(JavaSourceClassLoader cl = new JavaSourceClassLoader(Thread.currentThread().getContextClassLoader(), Collections.emptyList(), null)) { - FacesClassLoader facesClassLoader = new DynamicFacesClassLoader(dynamicXPageBean, cl); - - try(Stream ccConfigs = Files.find(ccSourceRoot, Integer.MAX_VALUE, (path, attr) -> attr.isRegularFile() && path.toString().toLowerCase().endsWith(".xsp-config"), FileVisitOption.FOLLOW_LINKS)) { //$NON-NLS-1$ - ccConfigs.forEach(ccConfig -> { - try { - Document xspConfig = TranspilerUtil.readXml(ccConfig); - - String namespace = StringUtil.trim(DOMUtil.evaluateXPath(xspConfig, "/faces-config/faces-config-extension/namespace-uri/text()").getStringValue()); //$NON-NLS-1$ - Path fileName = ccSourceRoot.relativize(ccConfig); - LibraryFragmentImpl fragment = (LibraryFragmentImpl)configParser.createFacesLibraryFragment( - facesProject, - facesClassLoader, - fileName.toString(), - xspConfig.getDocumentElement(), - resourceBundleSource, - iconUrlSource, - namespace - ); - UpdatableLibrary library = getLibrary(namespace); - library.addLibraryFragment(fragment); - - // Load the definition to refresh its parent ref - String controlName = StringUtil.trim(DOMUtil.evaluateXPath(xspConfig, "/faces-config/composite-component/composite-name/text()").getStringValue()); //$NON-NLS-1$ - CompositeComponentDefinitionImpl def = (CompositeComponentDefinitionImpl)library.getDefinition(controlName); - def.refreshReferences(); - } catch (XMLException e) { - throw new RuntimeException(e); - } - }); - } - } - } finally { - TranspilerUtil.deltree(cleanup); - } - } - } - - private ConfigParser getConfigParser() { - ConfigParser parser = new ConfigParserImpl(); - // Stash this in ConfigParserFactory for reuse. Using the static getter falls down into invalid Eclipse land - try { - Field s_parserInstance = ConfigParserFactory.class.getDeclaredField("s_parserInstance"); //$NON-NLS-1$ - s_parserInstance.setAccessible(true); - s_parserInstance.set(null, parser); - } catch(Exception e) { - throw new RuntimeException(e); - } - - return parser; - } - - private void initializeRegistry() { - List libraries = ExtensionManager.findServices((List)null, LibraryServiceLoader.class, "com.ibm.xsp.Library"); //$NON-NLS-1$ - libraries.stream() - .filter(lib -> lib instanceof XspLibrary) - .map(lib -> (XspLibrary)lib) - .peek(lib -> { - if(debug) { - System.out.println(MessageFormat.format("Adding XSP library: {0}", lib)); //$NON-NLS-1$ - } - }) - .sorted(LibraryWeightComparator.INSTANCE) - .map(lib -> new LibraryWrapper(lib.getLibraryId(), lib)) - .map(wrapper -> { - SimpleRegistryProvider provider = new SimpleRegistryProvider(); - provider.init(wrapper); - return provider; - }) - .map(provider -> provider.getRegistry()) - .forEach(reg -> facesRegistry.addDepend(reg)); - facesRegistry.refreshReferences(); - } - - protected UpdatableLibrary getLibrary(String namespace) { - UpdatableLibrary library = (UpdatableLibrary)facesRegistry.getLocalLibrary(namespace); - if(library == null) { - try { - library = new FacesLibraryImpl(facesRegistry, namespace); - // TODO this is probably properly done by creating a FacesProjectImpl - // - it can then register the library fragments itself - Field localLibsField = facesRegistry.getClass().getDeclaredField("_localLibs"); //$NON-NLS-1$ - localLibsField.setAccessible(true); - @SuppressWarnings("unchecked") - Map localLibs = (Map)localLibsField.get(facesRegistry); - localLibs.put(namespace, library); - } catch(NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { - throw new RuntimeException(e); - } - } - return library; - } - - /** - * @since 1.2.0 - */ - private static final String[] OVERRIDE_METHOD_SIGNATURES = { - "public int getComponentForId(String id)", //$NON-NLS-1$ - "public UIComponent createComponent(int id, FacesContext context,", //$NON-NLS-1$ - "protected void initIncluderAsRoot(FacesContext context,", //$NON-NLS-1$ - "protected AbstractCompiledPage createPage(int pageIndex)", //$NON-NLS-1$ - "protected String[][] getLibraryTagVersions()" //$NON-NLS-1$ - }; - - public Map transpile(Path rootDir, Path xspFile) { - try { - String xspSource; - try(InputStream is = Files.newInputStream(xspFile)) { - xspSource = StreamUtil.readString(is); - } - - Path relativeFile = rootDir.relativize(xspFile); - String className = PageToClassNameUtil.getClassNameForPage(relativeFile.toString()); - - String javaSource = dynamicXPageBean.translate(className, relativeFile.toString(), xspSource, facesRegistry); - - // Apply some fixes for pre-1.5-style source generation - for(String methodSignature : OVERRIDE_METHOD_SIGNATURES) { - javaSource = javaSource.replace(methodSignature, "@Override " + methodSignature); //$NON-NLS-1$ - } - - String outputFileName = className.replace('.', File.separatorChar) + ".java"; //$NON-NLS-1$ - Path outputFile = Paths.get(outputFileName); - return Collections.singletonMap(outputFile, javaSource); - } catch(Exception e) { - throw new RuntimeException(MessageFormat.format("Exception processing page {0}", rootDir.relativize(xspFile)), e); //$NON-NLS-1$ - } - } -} diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml b/xpages-webapp-support/xsp-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml deleted file mode 100644 index 7cabd2a..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/src/main/resources/META-INF/m2e/lifecycle-mapping-metadata.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - transpile - - - - - true - - - - - \ No newline at end of file diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/xpages-webapp-support/xsp-maven-plugin/src/main/resources/META-INF/plexus/components.xml deleted file mode 100644 index 4557207..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/src/main/resources/META-INF/plexus/components.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/resources/org/openntf/xsp/maven/transpiler/messages.properties b/xpages-webapp-support/xsp-maven-plugin/src/main/resources/org/openntf/xsp/maven/transpiler/messages.properties deleted file mode 100644 index 40c6c35..0000000 --- a/xpages-webapp-support/xsp-maven-plugin/src/main/resources/org/openntf/xsp/maven/transpiler/messages.properties +++ /dev/null @@ -1,8 +0,0 @@ -TranspileXspMojo.addingClasspathEntry=Adding project classpath entry: {0} -TranspileXspMojo.clearingDeletedTranslation=Clearing deleted XSP translation: {0} -TranspileXspMojo.exceptionBuildingClasspath=Exception when building project classpath -TranspileXspMojo.exceptionTranspilingSource=Exception transpiling XSP source -TranspileXspMojo.foundChangedFile=Found changed file: {0} -TranspileXspMojo.noChangesDetected=No changes detected -TranspileXspMojo.usingCcSourceRoot=Using Custom Control source root: {0} -TranspileXspMojo.usingXspSourceRoot=Using XSP source root: {0} From a39a3f64bcc5fae482f01e9d3402bec09c523b5c Mon Sep 17 00:00:00 2001 From: dahome-211 Date: Tue, 2 Mar 2021 05:46:58 +0300 Subject: [PATCH 09/11] Delete .gitignore --- .gitignore | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 2571adc..0000000 --- a/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -.DS_Store* -ehthumbs.db -Icon? -Thumbs.db - -.vscode/ - -.idea/ -*.iml - -target/ -.settings/ -.project -.classpath -.factorypath -*.swp -.metadata/ From 667f516dc822fe01b613d7dd980340bddea2c932 Mon Sep 17 00:00:00 2001 From: dahome-211 Date: Tue, 2 Mar 2021 05:47:25 +0300 Subject: [PATCH 10/11] Delete LICENSE --- LICENSE | 202 -------------------------------------------------------- 1 file changed, 202 deletions(-) delete mode 100644 LICENSE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 54f8bda..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2019 Jesse Gallagher - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - From 38479fc4b6f7b268c8aa6c2cb1b5fb10c8b62cf6 Mon Sep 17 00:00:00 2001 From: dahome-211 Date: Tue, 2 Mar 2021 07:07:04 +0300 Subject: [PATCH 11/11] Delete Dahome211 --- Dahome211 | 129 ------------------------------------------------------ 1 file changed, 129 deletions(-) delete mode 100644 Dahome211 diff --git a/Dahome211 b/Dahome211 deleted file mode 100644 index 2867ad4..0000000 --- a/Dahome211 +++ /dev/null @@ -1,129 +0,0 @@ -# XPages Runtime - -This project allows for running XPages applications outside of Domino. It has been specifically used in Open Liberty, but there's nothing in here tied to that container. - -Since XPages does not inherently require OSGi, this project doesn't bother initializing an OSGi runtime (though some Eclipse dependencies are brought along for the ride). - -## Building and Using - -To build this project or use it as a dependency, you must have a property in your Maven ~/.m2/settings.xml named `notes-platform` and containing a URL to a Domino Update Site for Domino 10+. For example: - -```xml - - - notes - - file:///Users/jesse/Java/Domino10.0.1 - - - - - notes - -``` - -Such an update site can be built from a Notes or Domino installation using the [`generate-domino-update-site` Maven plugin](https://github.com/OpenNTF/generate-domino-update-site). This project expects an update site built with at least version 3.3.0 of `generate-domino-update-site`. - -When using this runtime in your downstream project, that project should also include a repository reference for the Update Site accessed via the [`p2-layout-resolver` Maven plugin](https://github.com/OpenNTF/p2-layout-provider), configured with the ID `com.hcl.xsp.repo`. - -## Running - -The servlet container running the app must have access to a local Notes or Domino environment. On Windows, this is taken care of by the registry when installing the apps. On Linux or macOS, this can be accomplished by setting appropriate environment variables, such as by adding this to a `server.env` file in Open Liberty: - -``` -Notes_ExecDirectory=/Applications/IBM Notes.app/Contents/MacOS -LD_LIBRARY_PATH=/Applications/IBM Notes.app/Contents/MacOS -DYLD_LIBRARY_PATH=/Applications/IBM Notes.app/Contents/MacOS -``` - -Additionally, for all platforms, add a `jvm.options` file for the Open Libery server: - -``` --Djava.library.path=/Applications/IBM Notes.app/Contents/MacOS --Dcom.ibm.commons.platform=org.openntf.xpages.runtime.domino.platform.JakartaDominoPlatform -``` - -Notes or Domino do not need to be running - indeed, it's probably best if they're not. To run on an active Domino server, use [the Domino Open Liberty Runtime project](https://github.com/OpenNTF/openliberty-domino). - -## Web App Layout - -Apps built using this runtime should be structured generally like a [normal web app](https://www.mkyong.com/maven/how-to-create-a-web-application-project-with-maven/), with some important notes about the translation from an NSF-based XPages application to a web app: - -* Themes should go in `WEB-INF/themes` -* XPages should go in `WEB-INF/xpages` and can have a folder hierarchy -* Custom controls should go in `WEB-INF/controls`. `.xsp-config` files must be manually managed -* The faces-config file should be `WEB-INF/faces-config.xml` -* The XSP properties file should be `WEB-INF/xsp.properties` -* Unlike in an NSF, images, JavaScript, CSS, and other resources should all go in the content root (`src/main/webapp` in Maven layout) and have no inherent folder structure - -## Development Mode - -During app development, it is useful to set the `xsp.extlib.dvlp` property to `true` to get the same sort of "pick up on resource changes" behavior that you get with e.g. CSS files in an NSF. This property is reflected in `ExtLibUtil.isDevelopmentMode()` and is determined in [several potential ways](https://github.com/OpenNTF/XPagesExtensionLibrary/blob/25b3b1df7fafb7ceb131e07ade93de5c9ff733d5/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/src/com/ibm/xsp/extlib/util/ExtLibUtil.java#L65): - -- From your app's "xsp.properties" (which will be reflected during deployment as well) -- From the "properties/xsp.properties" file within your Notes/Domino data directory (esoteric and not recommended) -- From the "xsp/bootstrap.properties" file within your Notes/Domino installation (similar to above) -- As a Java system property -- As the `XPagesDev` notes.ini property - -For development purposes, the system property is likely the most convenient. For example, in a Liberty server managed from Eclipse's "Servers" view, this can be set in the "bootstrap.properties" file. - -## Limitations and Expectations - -* On Open Liberty, the `jsp` and `jsf` features cannot be enabled. Enabiling either one of them will cause load-order problems and, in the latter case, `ClassCastException`s. -* There is no context database by default. If you wish to have a default `database` and `session*` variables, they'll have to be created and managed using a variable resolver or other mechanism. -* Similarly, it's best to avoid Domino-specific components in general, such as `xp:dominoDocument` and `xp:dominoView`. Though they can be made to work, it's asking for trouble. -* All extensions (such as `XspLibrary` implementations) must be declared using the `META-INF/services` method and not `plugin.xml`. An extension of type `com.ibm.commons.Extension` can be directly translated by taking the `type` and making a file of that name in the services directory, containing a list of newline-separated class names. -* Similarly, this runtime will not recognize servlets declared via the [Equinox servlet extension point](https://www.eclipse.org/equinox/server/http_in_equinox.php) and must be registered either using the `@WebServlet` annotation or in the app's web.xml. -* Any OSGi Activator classes will not be activated by default, and must instead be explicitly registered. This can be done by registering a service class to `org.openntf.xpages.runtime.osgi.ActivatorNameProvider` implementing the interface of the same name and returning a list of Activator classes to instantiate. These Activator classes are expected to have a public static property named `instance` that will be set to the created instance. -* Unlike an NSF-hosted XPages application, these apps are not running inside a `com.ibm.designer.runtime.domino.adapter.ComponentModule` and so not all normal capabilities are available. -* The XPages servlet is mapped to "*" to allow for URLs like `/foo.xsp/bar/baz`. - -## XSP Transpiler - -The runtime will automatically translate XSP source files to executable pages at runtime, but initial load performance can be improved with the use of the XSP Transpiler Maven Mojo. This can be configured by adding an execution to your project to transpile and one to add the generated source to the build path: - -```xml - - org.openntf.xpages - xsp-maven-plugin - 1.0.0-SNAPSHOT - - - transpile-xsp - - transpile - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.7 - - - add-source - generate-sources - - add-source - - - - ${project.build.directory}/generated-sources/java - - - - - -``` - -This will search for XPages in the `src/main/webapp/WEB-INF/xpages` directory and Custom Controls in the `src/main/webapp/WEB-INF/controls` directory and output translated Java files to `${project.build.directory}/generated-sources/java`. - -Note: since this takes place in the `generate-sources` phase by default, it will likely throw an exception if you have a Custom Control that has a property whose type is a class defined inside the current project. - -To use this goal, your project must depend on the core `xpages-runtime` project, as this expects classes from the XPages stack to be present in your project's classpath. - -## License - -The code in the project is licensed under the Apache License 2.0. The dependencies in the binary distribution are licensed under IBM or HCL's Domino license to which you must have agreed when building or using this application.