Skip to content

Commit

Permalink
WIP tomcat 10 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
cgaetan committed Jun 7, 2024
1 parent 7b8f149 commit 77e54e7
Show file tree
Hide file tree
Showing 249 changed files with 763 additions and 756 deletions.
4 changes: 2 additions & 2 deletions applications/accounting/servicedef/services_paypal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ under the License.
</service>
<service name="payPalCheckoutUpdate" engine="java" auth="false"
location="org.apache.ofbiz.accounting.thirdparty.paypal.PayPalServices" invoke="payPalCheckoutUpdate">
<attribute name="request" mode="IN" type="javax.servlet.http.HttpServletRequest"/>
<attribute name="response" mode="IN" type="javax.servlet.http.HttpServletResponse"/>
<attribute name="request" mode="IN" type="jakarta.servlet.http.HttpServletRequest"/>
<attribute name="response" mode="IN" type="jakarta.servlet.http.HttpServletResponse"/>
</service>

<service name="payPalProcessor" engine="java"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/
package org.apache.ofbiz.accounting.accounting

import javax.servlet.http.HttpSession

import org.apache.ofbiz.entity.GenericValue
import org.apache.ofbiz.order.shoppingcart.CheckOutEvents
import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents
Expand All @@ -32,6 +30,8 @@ import org.apache.ofbiz.shipment.packing.PackingSession
import org.springframework.mock.web.MockHttpServletRequest
import org.springframework.mock.web.MockHttpServletResponse

import jakarta.servlet.http.HttpSession

class InvoicePerShipmentTests extends OFBizTestCase {

InvoicePerShipmentTests(String name) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.math.BigDecimal;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import java.util.List;
import java.util.Map;

import javax.servlet.ServletRequest;
import jakarta.servlet.ServletRequest;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilFormatOut;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
import java.util.Map;
import java.util.WeakHashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import javax.transaction.Transaction;

import org.apache.commons.lang.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilDateTime;
Expand Down
10 changes: 5 additions & 5 deletions applications/content/minilang/layout/LayoutEvents.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ under the License.
<log level="info" message="contentId: ${contentId}"/>
<log level="info" message="dataResourceId: ${dataResourceId}"/>
<call-class-method class-name="org.apache.ofbiz.content.ContentManagementWorker" method-name="mruAdd">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
<field field="subContent" type="org.apache.ofbiz.entity.GenericEntity"/>
</call-class-method>
-->
Expand Down Expand Up @@ -169,7 +169,7 @@ under the License.
<log level="info" message="in createLayoutImage."/>

<call-class-method class-name="org.apache.ofbiz.content.layout.LayoutWorker" method-name="uploadImageAndParameters" ret-field="formInput">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
<string value="imageData"/>
</call-class-method>

Expand Down Expand Up @@ -229,7 +229,7 @@ under the License.
<log level="info" message="contentId: ${contentId}"/>
<log level="info" message="dataResourceId: ${dataResourceId}"/>
<call-class-method class-name="org.apache.ofbiz.content.ContentManagementWorker" method-name="mruAdd">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
<field field="subContent" type="org.apache.ofbiz.entity.GenericEntity"/>
</call-class-method>
-->
Expand Down Expand Up @@ -285,7 +285,7 @@ under the License.
<log level="info" message="contentId: ${contentId}"/>
<log level="info" message="dataResourceId: ${dataResourceId}"/>
<call-class-method class-name="org.apache.ofbiz.content.ContentManagementWorker" method-name="mruAdd">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
<field field="subContent" type="org.apache.ofbiz.entity.GenericEntity"/>
</call-class-method>
-->
Expand Down Expand Up @@ -316,7 +316,7 @@ under the License.
<simple-method method-name="createGenericContent" short-description="Create Generic Content">
<call-class-method class-name="org.apache.ofbiz.content.layout.LayoutWorker"
method-name="uploadImageAndParameters" ret-field="formInput">
<field field="request" type="javax.servlet.http.HttpServletRequest"/>
<field field="request" type="jakarta.servlet.http.HttpServletRequest"/>
<string value="dataResourceName"/>
</call-class-method>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import java.util.Map;
import java.util.Map.Entry;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import java.util.Map;
import java.util.Map.Entry;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ Licensed to the Apache Software Foundation (ASF) under one
import java.util.List;
import java.util.Locale;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilHttp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ k Licensed to the Apache Software Foundation (ASF) under one
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.GeneralException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;

import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.content.content.ContentSearch.ContentSearchConstraint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilGenerics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.RequestDispatcher;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilHttp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload2.core.FileUploadException;
import org.apache.commons.fileupload2.jakarta.JakartaServletFileUpload;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.StringUtil;
import org.apache.ofbiz.base.util.UtilDateTime;
Expand Down Expand Up @@ -76,12 +76,7 @@ public static String uploadContentAndImage(HttpServletRequest request, HttpServl
HttpSession session = request.getSession();
GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");

long maxUploadSize = UtilHttp.getMaxUploadSize(delegator);
int sizeThreshold = UtilHttp.getSizeThreshold(delegator);
File tmpUploadRepository = UtilHttp.getTmpUploadRepository(delegator);

ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, tmpUploadRepository));
upload.setSizeMax(maxUploadSize);
JakartaServletFileUpload upload = UtilHttp.getDefaultServlerFileUpload(delegator);
List<FileItem> lst = null;
try {
lst = UtilGenerics.cast(upload.parseRequest(request));
Expand Down Expand Up @@ -345,13 +340,7 @@ public static String uploadContentStuff(HttpServletRequest request, HttpServletR
HttpSession session = request.getSession();
GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
Delegator delegator = (Delegator) request.getAttribute("delegator");

long maxUploadSize = UtilHttp.getMaxUploadSize(delegator);
int sizeThreshold = UtilHttp.getSizeThreshold(delegator);
File tmpUploadRepository = UtilHttp.getTmpUploadRepository(delegator);
ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, tmpUploadRepository));
upload.setSizeMax(maxUploadSize);

JakartaServletFileUpload upload = UtilHttp.getDefaultServlerFileUpload(delegator);
List<FileItem> lst = null;
try {
lst = UtilGenerics.cast(upload.parseRequest(request));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import java.util.Locale;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.ServletContext;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import org.apache.commons.io.IOUtils;
import org.apache.ofbiz.base.util.Debug;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@
import java.util.Map;
import java.util.TreeMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload2.core.DiskFileItemFactory;
import org.apache.commons.fileupload2.core.FileUploadException;
import org.apache.commons.fileupload2.jakarta.JakartaServletFileUpload;
import org.apache.commons.io.IOUtils;
import org.apache.ofbiz.base.location.FlexibleLocation;
import org.apache.ofbiz.base.util.Debug;
Expand Down Expand Up @@ -209,12 +210,13 @@ public static void buildList(Map<String, Object> nd, List<Map<String, Object>> l
* "idField" value and the binary data to be in a field id's by uploadField.
*/
public static String uploadAndStoreImage(HttpServletRequest request, String idField, String uploadField) {
ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, FileUtil.getFile("runtime/tmp")));
Delegator delegator = (Delegator) request.getAttribute("delegator");
JakartaServletFileUpload upload = UtilHttp.getDefaultServlerFileUpload(delegator);
List<FileItem> lst = null;
Locale locale = UtilHttp.getLocale(request);

try {
lst = UtilGenerics.cast(fu.parseRequest(request));
lst = UtilGenerics.cast(upload.parseRequest(request));
} catch (FileUploadException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@
import java.util.Locale;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload2.core.DiskFileItemFactory;
import org.apache.commons.fileupload2.core.FileUploadException;
import org.apache.commons.fileupload2.jakarta.JakartaServletFileUpload;
import org.apache.ofbiz.base.util.FileUtil;
import org.apache.ofbiz.base.util.UtilGenerics;
import org.apache.ofbiz.base.util.UtilHttp;
import org.apache.ofbiz.base.util.UtilMisc;
Expand Down Expand Up @@ -62,14 +63,7 @@ public static Map<String, Object> uploadImageAndParameters(HttpServletRequest re
results.put("formInput", formInput);

Delegator delegator = (Delegator) request.getAttribute("delegator");

long maxUploadSize = UtilHttp.getMaxUploadSize(delegator);
int sizeThreshold = UtilHttp.getSizeThreshold(delegator);
File tmpUploadRepository = UtilHttp.getTmpUploadRepository(delegator);

ServletFileUpload upload = new ServletFileUpload(new DiskFileItemFactory(sizeThreshold, tmpUploadRepository));
upload.setSizeMax(maxUploadSize);

JakartaServletFileUpload upload = UtilHttp.getDefaultServlerFileUpload(delegator);
List<FileItem> lst = null;
try {
lst = UtilGenerics.cast(upload.parseRequest(request));
Expand Down
Loading

0 comments on commit 77e54e7

Please sign in to comment.