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

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


The following commit(s) were added to refs/heads/trunk by this push:
     new 8dcbbfaff0 Improved: Remove the unused FoPrintServerEvents 
(OFBIZ-13631)
8dcbbfaff0 is described below

commit 8dcbbfaff028760eb09c1d9c6680585c9ea710e9
Author: Mridul Pathak <[email protected]>
AuthorDate: Wed Sep 30 20:36:04 2026 +0530

    Improved: Remove the unused FoPrintServerEvents (OFBIZ-13631)
    
    FoPrintServerEvents was not referenced by any request-map since they were 
removed in 2016 (OFBIZ-7021), and nothing else in the framework or the plugins 
calls it. It is removed.
---
 .../ofbiz/webtools/print/FoPrintServerEvents.java  | 118 ---------------------
 1 file changed, 118 deletions(-)

diff --git 
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/print/FoPrintServerEvents.java
 
b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/print/FoPrintServerEvents.java
deleted file mode 100644
index ab57b9ac8f..0000000000
--- 
a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/print/FoPrintServerEvents.java
+++ /dev/null
@@ -1,118 +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.webtools.print;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.Locale;
-import java.util.Map;
-
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.GeneralException;
-import org.apache.ofbiz.base.util.UtilHttp;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.entity.GenericEntityException;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.service.DispatchContext;
-import org.apache.ofbiz.service.LocalDispatcher;
-import org.apache.ofbiz.widget.model.ThemeFactory;
-import org.apache.ofbiz.widget.renderer.ScreenRenderer;
-import org.apache.ofbiz.widget.renderer.ScreenStringRenderer;
-import org.apache.ofbiz.widget.renderer.VisualTheme;
-import org.apache.ofbiz.widget.renderer.macro.MacroScreenRenderer;
-
-/**
- * FoPrintServerEvents
- */
-
-public class FoPrintServerEvents {
-
-    private static final String MODULE = FoPrintServerEvents.class.getName();
-
-    public static String getXslFo(HttpServletRequest req, HttpServletResponse 
resp) {
-        LocalDispatcher dispatcher = (LocalDispatcher) 
req.getAttribute("dispatcher");
-        Map<String, Object> reqParams = UtilHttp.getParameterMap(req);
-        reqParams.put("locale", UtilHttp.getLocale(req));
-
-        String screenUri = (String) reqParams.remove("screenUri");
-        if (UtilValidate.isNotEmpty(screenUri)) {
-            String base64String = null;
-            try {
-                byte[] bytes = 
FoPrintServerEvents.getXslFo(dispatcher.getDispatchContext(), screenUri, 
reqParams);
-                base64String = new String(Base64.encodeBase64(bytes));
-            } catch (GeneralException e) {
-                Debug.logError(e, MODULE);
-                try {
-                    resp.sendError(500);
-                } catch (IOException e1) {
-                    Debug.logError(e1, MODULE);
-                }
-            }
-            if (base64String != null) {
-                try {
-                    Writer out = resp.getWriter();
-                    out.write(base64String);
-                } catch (IOException e) {
-                    try {
-                        resp.sendError(500);
-                    } catch (IOException e1) {
-                        Debug.logError(e1, MODULE);
-                    }
-                }
-            }
-        }
-
-        return null;
-    }
-
-    public static byte[] getXslFo(DispatchContext dctx, String screen, 
Map<String, Object> parameters) throws GeneralException {
-        // run as the system user
-        VisualTheme visualTheme = (VisualTheme) parameters.get("visualTheme");
-        if (visualTheme == null) {
-            visualTheme = ThemeFactory.resolveVisualTheme(null);
-        }
-        GenericValue system = null;
-        try {
-            system = dctx.getDelegator().findOne("UserLogin", false, 
"userLoginId", "system");
-        } catch (GenericEntityException e) {
-            throw new GeneralException(e.getMessage(), e);
-        }
-        parameters.put("userLogin", system);
-        if (!parameters.containsKey("locale")) {
-            parameters.put("locale", Locale.getDefault());
-        }
-        // render and obtain the XSL-FO
-        Writer writer = new StringWriter();
-        try {
-            ScreenStringRenderer screenStringRenderer = new 
MacroScreenRenderer(visualTheme.getModelTheme().getType("screen"),
-                    
visualTheme.getModelTheme().getScreenRendererLocation("screen"));
-            ScreenRenderer screens = new ScreenRenderer(writer, null, 
screenStringRenderer);
-            screens.populateContextForService(dctx, parameters);
-            screens.render(screen);
-        } catch (Throwable t) {
-            throw new GeneralException("Problems rendering FOP XSL-FO", t);
-        }
-        return writer.toString().getBytes();
-    }
-}

Reply via email to