You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by ni...@apache.org on 2024/07/08 02:56:37 UTC

(paimon-webui) branch main updated: [Improvement] Remove ForwardController.java (#460)

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

nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-webui.git


The following commit(s) were added to refs/heads/main by this push:
     new 1fd762de [Improvement] Remove ForwardController.java (#460)
1fd762de is described below

commit 1fd762de0b6721ca2c339caee0afd779569301e0
Author: yangyang zhong <35...@users.noreply.github.com>
AuthorDate: Mon Jul 8 10:56:34 2024 +0800

    [Improvement] Remove ForwardController.java (#460)
---
 .../web/server/controller/ForwardController.java   | 40 ----------------
 .../server/controller/ForwardControllerTest.java   | 53 ----------------------
 2 files changed, 93 deletions(-)

diff --git a/paimon-web-server/src/main/java/org/apache/paimon/web/server/controller/ForwardController.java b/paimon-web-server/src/main/java/org/apache/paimon/web/server/controller/ForwardController.java
deleted file mode 100644
index 2d67d2b8..00000000
--- a/paimon-web-server/src/main/java/org/apache/paimon/web/server/controller/ForwardController.java
+++ /dev/null
@@ -1,40 +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.paimon.web.server.controller;
-
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.servlet.ModelAndView;
-
-/**
- * When accessing front-end pages through the back-end server, requests to /ui/{routePath} ought to
- * be forwarded to ui/index.html to guarantee correct page rendering.
- */
-@Controller
-public class ForwardController {
-
-    @GetMapping(value = "/ui/{[path:[^\\.]*}")
-    public ModelAndView forwardToIndex() {
-        ModelAndView modelAndView = new ModelAndView();
-        modelAndView.setStatus(HttpStatus.OK);
-        modelAndView.setViewName("forward:/ui/index.html");
-        return modelAndView;
-    }
-}
diff --git a/paimon-web-server/src/test/java/org/apache/paimon/web/server/controller/ForwardControllerTest.java b/paimon-web-server/src/test/java/org/apache/paimon/web/server/controller/ForwardControllerTest.java
deleted file mode 100644
index 9b004088..00000000
--- a/paimon-web-server/src/test/java/org/apache/paimon/web/server/controller/ForwardControllerTest.java
+++ /dev/null
@@ -1,53 +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.paimon.web.server.controller;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
-import org.springframework.http.HttpStatus;
-import org.springframework.test.web.servlet.MvcResult;
-import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
-import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.http.HttpServletRequest;
-
-/** Test for {@link ForwardController}. */
-@SpringBootTest
-@AutoConfigureMockMvc
-public class ForwardControllerTest extends ControllerTestBase {
-
-    @MockBean private HttpServletRequest request;
-
-    @Test
-    public void testForwardIndex() throws Exception {
-        MvcResult result =
-                mockMvc.perform(
-                                MockMvcRequestBuilders.get("/ui/login")
-                                        .requestAttr(
-                                                RequestDispatcher.ERROR_STATUS_CODE,
-                                                HttpStatus.NOT_FOUND.value()))
-                        .andExpect(MockMvcResultMatchers.status().isOk())
-                        .andReturn();
-        Assertions.assertEquals("forward:/ui/index.html", result.getModelAndView().getViewName());
-    }
-}