Skip to content

Commit

Permalink
Merge branch 'release/2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jesse-gallagher committed Jan 3, 2022
2 parents e64f0de + 56a270c commit acfdb5b
Show file tree
Hide file tree
Showing 66 changed files with 263 additions and 134 deletions.
7 changes: 6 additions & 1 deletion xpages-runtime-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.openntf.xpages</groupId>
<artifactId>xpages-runtime-example</artifactId>
<version>1.5.0</version>
<version>2.0.0</version>
<packaging>war</packaging>

<properties>
Expand All @@ -17,6 +17,11 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>

Expand Down
24 changes: 21 additions & 3 deletions xpages-webapp-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.openntf.xpages</groupId>
<artifactId>xpages-webapp-support</artifactId>
<version>1.5.0</version>
<version>2.0.0</version>
<packaging>pom</packaging>

<inceptionYear>2019</inceptionYear>
Expand Down Expand Up @@ -51,6 +51,14 @@
</repository>
</distributionManagement>

<repositories>
<repository>
<id>artifactory.openntf.org</id>
<name>artifactory.openntf.org</name>
<url>https://artifactory.openntf.org/openntf</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>artifactory.openntf.org</id>
Expand All @@ -61,10 +69,20 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>4.0.4</version>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.openntf.xsp</groupId>
<artifactId>org.openntf.xsp.jakartaee.commons</artifactId>
<version>2.1.0</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -303,7 +321,7 @@
</excludes>
<properties>
<owner>Jesse Gallagher</owner>
<copyrightYear>2021</copyrightYear>
<copyrightYear>2022</copyrightYear>
</properties>
<mapping>
<java>SLASHSTAR_STYLE</java>
Expand Down
10 changes: 9 additions & 1 deletion xpages-webapp-support/xpages-runtime-domino/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.openntf.xpages</groupId>
<artifactId>xpages-webapp-support</artifactId>
<version>1.5.0</version>
<version>2.0.0</version>
</parent>
<artifactId>xpages-runtime-domino</artifactId>

Expand All @@ -18,11 +18,19 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openntf.xsp</groupId>
<artifactId>org.openntf.xsp.jakartaee.commons</artifactId>
</dependency>

<!-- Domino-specific -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,12 +23,13 @@
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 jakarta.servlet.ServletContextEvent;
import jakarta.servlet.ServletContextListener;
import jakarta.servlet.annotation.WebListener;

import org.openntf.xpages.runtime.domino.platform.JakartaDominoPlatform;
import org.openntf.xpages.runtime.wrapper.JakartaServletContextWrapper;
import org.openntf.xsp.jakartaee.servlet.ServletUtil;

import com.ibm.commons.util.StringUtil;
import com.ibm.domino.napi.c.C;
Expand All @@ -43,7 +44,7 @@ public void contextInitialized(ServletContextEvent sce) {
NotesThread t = new NotesThread(() -> {
C.initLibrary(null);

JakartaDominoPlatform.initContext(new JakartaServletContextWrapper(sce.getServletContext()));
JakartaDominoPlatform.initContext(new JakartaServletContextWrapper(ServletUtil.newToOld(sce.getServletContext())));

final URLStreamHandlerFactory delegate = AccessController.doPrivileged((PrivilegedAction<URLStreamHandlerFactory>) () -> {
URLStreamHandlerFactory d;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,17 +25,18 @@
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 jakarta.servlet.ServletConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.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 org.openntf.xsp.jakartaee.servlet.ServletUtil;

import java.io.IOException;

Expand Down Expand Up @@ -69,7 +70,11 @@ public void init(ServletConfig config) throws ServletException {
this.lcdEnvironment = LCDEnvironment.getInstance();

this.delegate = new DesignerFacesServlet();
delegate.init(config);
try {
delegate.init(ServletUtil.newToOld(config));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e);
}
}

@Override
Expand All @@ -83,19 +88,25 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
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);
HttpSessionAdapter sessionAdapter = new ServletHttpSessionAdapter(ServletUtil.newToOld(req.getSession()));
HttpServletRequestAdapter requestAdapter = new JakartaDominoServletRequestWrapper(ServletUtil.newToOld(req));
HttpServletResponseAdapter responseAdapter = new ServletHttpServletResponseAdapter(ServletUtil.newToOld(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$
} catch (javax.servlet.ServletException e) {
throw new ServletException(e);
}
} else {
// In-app XPage
delegate.service(new JakartaServletRequestWrapper(req), resp);
try {
delegate.service(new JakartaServletRequestWrapper(ServletUtil.newToOld(req)), ServletUtil.newToOld(resp));
} catch (javax.servlet.ServletException e) {
throw new ServletException(e);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 9 additions & 1 deletion xpages-webapp-support/xpages-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@
<parent>
<groupId>org.openntf.xpages</groupId>
<artifactId>xpages-webapp-support</artifactId>
<version>1.5.0</version>
<version>2.0.0</version>
</parent>
<artifactId>xpages-runtime</artifactId>

<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openntf.xsp</groupId>
<artifactId>org.openntf.xsp.jakartaee.commons</artifactId>
</dependency>

<!-- Expected OSGi -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright © 2019-2021 Jesse Gallagher
* Copyright © 2019-2022 Jesse Gallagher
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,21 +17,28 @@

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import org.openntf.xsp.jakartaee.servlet.ServletUtil;

import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import com.ibm.xsp.webapp.DesignerGlobalResourceServlet;

@WebServlet(urlPatterns="/xsp/.ibmxspres/*")
public class JakartaGlobalFacesResourceServlet extends DesignerGlobalResourceServlet {
public class JakartaGlobalFacesResourceServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

private final DesignerGlobalResourceServlet delegate = new DesignerGlobalResourceServlet();

@Override
public void service(ServletRequest var1, ServletResponse var2) throws ServletException, IOException {
try {
super.service(var1, var2);
delegate.service(ServletUtil.newToOld((HttpServletRequest)var1), ServletUtil.newToOld((HttpServletResponse)var2));
} catch(IOException e) {
if("Broken pipe".equals(e.getMessage())) { //$NON-NLS-1$
// Ignore
Expand All @@ -44,10 +51,10 @@ public void service(ServletRequest var1, ServletResponse var2) throws ServletExc
if("Broken pipe".equals(t.getCause().getMessage())) { //$NON-NLS-1$
// Ignore
} else {
throw t;
throw new ServletException(t);
}
} else {
throw t;
throw new ServletException(t);
}
}
}
Expand Down
Loading

0 comments on commit acfdb5b

Please sign in to comment.