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 47be3ab829 Improved: Remove the unused http view type (OFBIZ-13648)
47be3ab829 is described below
commit 47be3ab82904c1c0866b90a22b69eec50ebebb83
Author: Mridul Pathak <[email protected]>
AuthorDate: Mon Oct 5 12:39:20 2026 +0530
Improved: Remove the unused http view type (OFBIZ-13648)
The http view type, implemented by HttpViewHandler, fetched the page of the
view-map from another server for every request and printed it as the view. It
has been in OFBiz since the initial import, nothing in the framework, the
applications or the plugins uses it, and what it does is covered by other
means: a redirection, an iframe, a service that fetches the data for a regular
view, or a reverse proxy.
HttpViewHandler and its declaration in handlers-controller.xml are removed.
A controller that still declares the http handler has to drop the declaration,
as the view handlers are loaded when a web application starts. The declaration
in the ecommerce plugin is removed by a change in the plugins repository, which
has to be merged first.
---
.../webcommon/WEB-INF/handlers-controller.xml | 1 -
.../apache/ofbiz/webapp/view/HttpViewHandler.java | 78 ----------------------
2 files changed, 79 deletions(-)
diff --git a/framework/common/webcommon/WEB-INF/handlers-controller.xml
b/framework/common/webcommon/WEB-INF/handlers-controller.xml
index 5860b21a07..18514ec7fa 100644
--- a/framework/common/webcommon/WEB-INF/handlers-controller.xml
+++ b/framework/common/webcommon/WEB-INF/handlers-controller.xml
@@ -43,6 +43,5 @@ under the License.
<handler name="screenxlsx" type="view"
class="org.apache.ofbiz.widget.renderer.xlsx.ScreenXlsxViewHandler"/>
<handler name="screenfop" type="view"
class="org.apache.ofbiz.widget.renderer.fo.ScreenFopViewHandler"/>
<handler name="jsp" type="view"
class="org.apache.ofbiz.webapp.view.JspViewHandler"/>
- <handler name="http" type="view"
class="org.apache.ofbiz.webapp.view.HttpViewHandler"/>
<handler name="ftl" type="view"
class="org.apache.ofbiz.webapp.ftl.FreeMarkerViewHandler"/>
</site-conf>
diff --git
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/HttpViewHandler.java
b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/HttpViewHandler.java
deleted file mode 100644
index 186c2caefe..0000000000
---
a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/view/HttpViewHandler.java
+++ /dev/null
@@ -1,78 +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.webapp.view;
-
-import java.io.IOException;
-
-import java.util.Map;
-import jakarta.servlet.ServletContext;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-
-import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.HttpClient;
-import org.apache.ofbiz.base.util.HttpClientException;
-import org.apache.ofbiz.base.util.UtilValidate;
-import org.apache.ofbiz.webapp.control.ConfigXMLReader;
-
-/**
- * ViewHandlerException - View Handler Exception
- */
-public class HttpViewHandler extends AbstractViewHandler {
-
- private static final String MODULE = HttpViewHandler.class.getName();
-
- @Override
- public void init(ServletContext context) throws ViewHandlerException {
- }
-
- @Override
- public Map<String, Object> prepareViewContext(HttpServletRequest request,
HttpServletResponse response, ConfigXMLReader.ViewMap viewMap) {
- return Map.of();
- }
-
- @Override
- public void render(String name, String page, String info, String
contentType, String encoding, HttpServletRequest request, HttpServletResponse
- response, Map<String, Object> context) throws ViewHandlerException
{
- // some containers call filters on EVERY request, even forwarded ones,
- // so let it know that it came from the control servlet
-
- if (request == null) {
- throw new ViewHandlerException("Null HttpServletRequest object");
- }
- if (UtilValidate.isEmpty(page)) {
- throw new ViewHandlerException("Null or empty source");
- }
-
- if (Debug.infoOn()) {
- Debug.logInfo("Retreiving HTTP resource at: " + page, MODULE);
- }
- try {
- HttpClient httpClient = new HttpClient(page);
- String pageText = httpClient.get();
-
- // TODO: parse page and remove harmful tags like <HTML>, <HEAD>,
<BASE>, etc - look into the OpenSymphony piece for an example
- response.getWriter().print(pageText);
- } catch (IOException e) {
- throw new ViewHandlerException("IO Error in view", e);
- } catch (HttpClientException e) {
- throw new ViewHandlerException(e.getNonNestedMessage(),
e.getNested());
- }
- }
-}