This is an automated email from the ASF dual-hosted git repository.

jacopoc pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release24.09 by this push:
     new 6e2d9f431e Fixed: Remove the USPS Mock ShippingAPI servlet
6e2d9f431e is described below

commit 6e2d9f431e2207ba5c0b00beae87034226fbf598
Author: Jacopo Cappellato <[email protected]>
AuthorDate: Wed May 27 10:42:57 2026 +0200

    Fixed: Remove the USPS Mock ShippingAPI servlet
    
    The servlet was an old artifact that was no longer used or maintained.
    
    (cherry picked from commit a5f5cc7d6812b7bdc697edfb21f95113f2d33ab9)
---
 .../thirdparty/usps/UspsMockApiServlet.java        | 126 ---------------------
 .../product/webapp/facility/WEB-INF/web.xml        |  13 +--
 2 files changed, 1 insertion(+), 138 deletions(-)

diff --git 
a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java
 
b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java
deleted file mode 100644
index d89667b7a9..0000000000
--- 
a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsMockApiServlet.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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.apache.ofbiz.shipment.thirdparty.usps;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.List;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.transform.TransformerException;
-
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.base.util.UtilXml;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * USPS Webtools API Mock API Servlet
- */
-@SuppressWarnings("serial")
-public class UspsMockApiServlet extends HttpServlet {
-
-    private static final String MODULE = UspsMockApiServlet.class.getName();
-
-
-    public UspsMockApiServlet() {
-        super();
-    }
-
-    @Override
-    public void doPost(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
-        doGet(request, response);
-    }
-
-    @Override
-    public void doGet(HttpServletRequest request, HttpServletResponse 
response) throws ServletException, IOException {
-
-        // we're only testing the Rate API right now
-        if (!"Rate".equals(request.getParameter("API"))) {
-            Debug.logError("Unsupported API [" + request.getParameter("API") + 
"]", MODULE);
-            return;
-        }
-
-        String xmlValue = request.getParameter("XML");
-        Document requestDocument = null;
-        try {
-            requestDocument = UtilXml.readXmlDocument(xmlValue, false);
-        } catch (Exception e) {
-            Debug.logError(e, MODULE);
-            return;
-        }
-
-        if (requestDocument == null) {
-            Debug.logError("In UspsMockApiSerlvet No XML document found in 
request, quiting now; XML parameter is: " + xmlValue, MODULE);
-            return;
-        }
-
-        List<? extends Element> packageElementList = 
UtilXml.childElementList(requestDocument.getDocumentElement(), "Package");
-        if (UtilValidate.isNotEmpty(packageElementList)) {
-
-            Document responseDocument = 
UtilXml.makeEmptyXmlDocument("RateResponse");
-            for (Element packageElement: packageElementList) {
-                Element responsePackageElement =
-                        
UtilXml.addChildElement(responseDocument.getDocumentElement(), "Package", 
responseDocument);
-                responsePackageElement.setAttribute("ID", 
packageElement.getAttribute("ID"));
-
-                UtilXml.addChildElementValue(responsePackageElement, 
"ZipOrigination",
-                        UtilXml.childElementValue(packageElement, 
"ZipOrigination"), responseDocument);
-
-                UtilXml.addChildElementValue(responsePackageElement, 
"ZipDestination",
-                        UtilXml.childElementValue(packageElement, 
"ZipDestination"), responseDocument);
-
-                UtilXml.addChildElementValue(responsePackageElement, "Pounds",
-                        UtilXml.childElementValue(packageElement, "Pounds"), 
responseDocument);
-
-                UtilXml.addChildElementValue(responsePackageElement, "Ounces",
-                        UtilXml.childElementValue(packageElement, "Ounces"), 
responseDocument);
-
-                UtilXml.addChildElementValue(responsePackageElement, 
"Container",
-                        UtilXml.childElementValue(packageElement, 
"Container"), responseDocument);
-
-                UtilXml.addChildElementValue(responsePackageElement, "Size",
-                        UtilXml.childElementValue(packageElement, "Size"), 
responseDocument);
-
-                UtilXml.addChildElementValue(responsePackageElement, "Zone", 
"1", responseDocument);
-                UtilXml.addChildElementValue(responsePackageElement, 
"Postage", "3.00", responseDocument);
-            }
-
-            ByteArrayOutputStream os = new ByteArrayOutputStream();
-
-            try {
-                UtilXml.writeXmlDocument(responseDocument, os, "UTF-8", true, 
false, 0);
-            } catch (TransformerException e) {
-                Debug.logInfo(e, MODULE);
-                return;
-            }
-
-            response.setContentType("text/xml");
-            ServletOutputStream sos = response.getOutputStream();
-            sos.print(os.toString("UTF-8"));
-            sos.flush();
-        }
-    }
-}
diff --git a/applications/product/webapp/facility/WEB-INF/web.xml 
b/applications/product/webapp/facility/WEB-INF/web.xml
index 6883c083e1..703f653f15 100644
--- a/applications/product/webapp/facility/WEB-INF/web.xml
+++ b/applications/product/webapp/facility/WEB-INF/web.xml
@@ -55,7 +55,7 @@ under the License.
         
<filter-class>org.apache.ofbiz.webapp.control.ControlFilter</filter-class>
         <init-param>
             <param-name>allowedPaths</param-name>
-            
<param-value>/error:/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images:/ShippingAPI.dll</param-value>
+            
<param-value>/error:/control:/select:/index.html:/index.jsp:/default.html:/default.jsp:/images</param-value>
         </init-param>
         <init-param>
             <param-name>redirectPath</param-name>
@@ -97,21 +97,10 @@ under the License.
         
<servlet-class>org.apache.ofbiz.webapp.control.ControlServlet</servlet-class>
         <load-on-startup>1</load-on-startup>
     </servlet>
-    <servlet>
-        <description>Mock USPS Webtools API Servlet</description>
-        <display-name>ShippingAPI</display-name>
-        <servlet-name>ShippingAPI</servlet-name>
-        
<servlet-class>org.apache.ofbiz.shipment.thirdparty.usps.UspsMockApiServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
     <servlet-mapping>
         <servlet-name>ControlServlet</servlet-name>
         <url-pattern>/control/*</url-pattern>
     </servlet-mapping>
-    <servlet-mapping>
-        <servlet-name>ShippingAPI</servlet-name>
-        <url-pattern>/ShippingAPI.dll</url-pattern>
-    </servlet-mapping>
 
     <welcome-file-list>
         <welcome-file>index.jsp</welcome-file>

Reply via email to