diff --git a/wise-webapp/src/main/java/com/wisemapping/config/Application.java b/wise-webapp/src/main/java/com/wisemapping/config/Application.java index c694c89a..e22ae7ed 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/Application.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/Application.java @@ -2,20 +2,10 @@ package com.wisemapping.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.transaction.annotation.EnableTransactionManagement; -import org.springframework.web.servlet.HandlerExceptionResolver; -import org.springframework.web.servlet.ViewResolver; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; -import org.springframework.web.servlet.view.InternalResourceViewResolver; -import org.springframework.web.servlet.view.JstlView; -@EnableWebMvc @EnableTransactionManagement @SpringBootApplication @EnableJpaRepositories("com.wisemapping.model") @@ -25,26 +15,4 @@ public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } - - @Bean - HandlerExceptionResolver errorHandler() { - final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver(); - - //mapping status code with view response. - result.addStatusCode("reactInclude", 403); - - //setting default error view - result.setDefaultErrorView("reactInclude"); - result.setDefaultStatusCode(500); - return result; - } - - @Bean - public ViewResolver viewResolver() { - InternalResourceViewResolver resolver = new InternalResourceViewResolver(); - resolver.setPrefix("/WEB-INF/views/"); - resolver.setSuffix(".jsp"); - resolver.setViewClass(JstlView.class); - return resolver; - } } diff --git a/wise-webapp/src/main/java/com/wisemapping/config/HibernateConfig.java b/wise-webapp/src/main/java/com/wisemapping/config/HibernateConfig.java index a4e19549..8e25e9ce 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/HibernateConfig.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/HibernateConfig.java @@ -1,19 +1,8 @@ package com.wisemapping.config; -import jakarta.persistence.EntityManagerFactory; -import org.apache.commons.dbcp2.BasicDataSource; -import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.orm.hibernate5.HibernateTransactionManager; -import org.springframework.orm.hibernate5.LocalSessionFactoryBean; import org.springframework.transaction.annotation.EnableTransactionManagement; -import javax.sql.DataSource; -import java.util.Properties; - @Configuration @EnableTransactionManagement public class HibernateConfig { diff --git a/wise-webapp/src/main/java/com/wisemapping/config/MvcConfig.java b/wise-webapp/src/main/java/com/wisemapping/config/MvcConfig.java new file mode 100644 index 00000000..7c86002c --- /dev/null +++ b/wise-webapp/src/main/java/com/wisemapping/config/MvcConfig.java @@ -0,0 +1,45 @@ +package com.wisemapping.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.HandlerExceptionResolver; +import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver; +import org.springframework.web.servlet.view.InternalResourceViewResolver; +import org.springframework.web.servlet.view.JstlView; + +@Configuration +@EnableWebMvc +public class MvcConfig implements WebMvcConfigurer { + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + registry + .addResourceHandler("/**") + .addResourceLocations("classpath:/public/"); + } + + @Bean + public ViewResolver viewResolver() { + InternalResourceViewResolver resolver = new InternalResourceViewResolver(); + resolver.setPrefix("/views/"); + resolver.setSuffix(".jsp"); + resolver.setViewClass(JstlView.class); + return resolver; + } + + @Bean + HandlerExceptionResolver errorHandler() { + final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver(); + + //mapping status code with view response. + result.addStatusCode("reactInclude", 403); + + //setting default error view + result.setDefaultErrorView("reactInclude"); + result.setDefaultStatusCode(500); + return result; + } +} \ No newline at end of file diff --git a/wise-webapp/src/main/resources/application.properties b/wise-webapp/src/main/resources/application.properties index 04a919e7..fbd8c1f9 100755 --- a/wise-webapp/src/main/resources/application.properties +++ b/wise-webapp/src/main/resources/application.properties @@ -179,7 +179,3 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HSQLDialect spring.jpa.open-in-view=true spring.h2.console.enabled=true spring.h2.console.path=/h2-ui - -spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext - - diff --git a/wise-webapp/src/main/webapp/ads.txt b/wise-webapp/src/main/resources/public/ads.txt similarity index 100% rename from wise-webapp/src/main/webapp/ads.txt rename to wise-webapp/src/main/resources/public/ads.txt diff --git a/wise-webapp/src/main/webapp/css/viewonly.css b/wise-webapp/src/main/resources/public/css/viewonly.css similarity index 100% rename from wise-webapp/src/main/webapp/css/viewonly.css rename to wise-webapp/src/main/resources/public/css/viewonly.css diff --git a/wise-webapp/src/main/webapp/favicon.ico b/wise-webapp/src/main/resources/public/favicon.ico similarity index 100% rename from wise-webapp/src/main/webapp/favicon.ico rename to wise-webapp/src/main/resources/public/favicon.ico diff --git a/wise-webapp/src/main/webapp/favicon.png b/wise-webapp/src/main/resources/public/favicon.png similarity index 100% rename from wise-webapp/src/main/webapp/favicon.png rename to wise-webapp/src/main/resources/public/favicon.png diff --git a/wise-webapp/src/main/webapp/images/add.svg b/wise-webapp/src/main/resources/public/images/add.svg similarity index 100% rename from wise-webapp/src/main/webapp/images/add.svg rename to wise-webapp/src/main/resources/public/images/add.svg diff --git a/wise-webapp/src/main/webapp/images/center_focus.svg b/wise-webapp/src/main/resources/public/images/center_focus.svg similarity index 100% rename from wise-webapp/src/main/webapp/images/center_focus.svg rename to wise-webapp/src/main/resources/public/images/center_focus.svg diff --git a/wise-webapp/src/main/webapp/images/logo-icon.png b/wise-webapp/src/main/resources/public/images/logo-icon.png similarity index 100% rename from wise-webapp/src/main/webapp/images/logo-icon.png rename to wise-webapp/src/main/resources/public/images/logo-icon.png diff --git a/wise-webapp/src/main/webapp/images/logo-icon.svg b/wise-webapp/src/main/resources/public/images/logo-icon.svg similarity index 100% rename from wise-webapp/src/main/webapp/images/logo-icon.svg rename to wise-webapp/src/main/resources/public/images/logo-icon.svg diff --git a/wise-webapp/src/main/webapp/images/logo-small.png b/wise-webapp/src/main/resources/public/images/logo-small.png similarity index 100% rename from wise-webapp/src/main/webapp/images/logo-small.png rename to wise-webapp/src/main/resources/public/images/logo-small.png diff --git a/wise-webapp/src/main/webapp/images/logo-text-black.svg b/wise-webapp/src/main/resources/public/images/logo-text-black.svg similarity index 100% rename from wise-webapp/src/main/webapp/images/logo-text-black.svg rename to wise-webapp/src/main/resources/public/images/logo-text-black.svg diff --git a/wise-webapp/src/main/webapp/images/minus.svg b/wise-webapp/src/main/resources/public/images/minus.svg similarity index 100% rename from wise-webapp/src/main/webapp/images/minus.svg rename to wise-webapp/src/main/resources/public/images/minus.svg diff --git a/wise-webapp/src/main/webapp/index.html b/wise-webapp/src/main/resources/public/index.html similarity index 100% rename from wise-webapp/src/main/webapp/index.html rename to wise-webapp/src/main/resources/public/index.html diff --git a/wise-webapp/src/main/webapp/robots.txt b/wise-webapp/src/main/resources/public/robots.txt similarity index 100% rename from wise-webapp/src/main/webapp/robots.txt rename to wise-webapp/src/main/resources/public/robots.txt diff --git a/wise-webapp/src/main/webapp/WEB-INF/views/init.jsp b/wise-webapp/src/main/resources/views/init.jsp similarity index 100% rename from wise-webapp/src/main/webapp/WEB-INF/views/init.jsp rename to wise-webapp/src/main/resources/views/init.jsp diff --git a/wise-webapp/src/main/webapp/WEB-INF/views/mindmapEditor.jsp b/wise-webapp/src/main/resources/views/mindmapEditor.jsp similarity index 100% rename from wise-webapp/src/main/webapp/WEB-INF/views/mindmapEditor.jsp rename to wise-webapp/src/main/resources/views/mindmapEditor.jsp diff --git a/wise-webapp/src/main/webapp/WEB-INF/views/mindmapViewonly.jsp b/wise-webapp/src/main/resources/views/mindmapViewonly.jsp similarity index 100% rename from wise-webapp/src/main/webapp/WEB-INF/views/mindmapViewonly.jsp rename to wise-webapp/src/main/resources/views/mindmapViewonly.jsp diff --git a/wise-webapp/src/main/webapp/WEB-INF/views/pageHeaders.jsf b/wise-webapp/src/main/resources/views/pageHeaders.jsf similarity index 100% rename from wise-webapp/src/main/webapp/WEB-INF/views/pageHeaders.jsf rename to wise-webapp/src/main/resources/views/pageHeaders.jsf diff --git a/wise-webapp/src/main/webapp/WEB-INF/views/reactInclude.jsp b/wise-webapp/src/main/resources/views/reactInclude.jsp similarity index 100% rename from wise-webapp/src/main/webapp/WEB-INF/views/reactInclude.jsp rename to wise-webapp/src/main/resources/views/reactInclude.jsp diff --git a/wise-webapp/src/main/webapp/META-INF/Context.xml b/wise-webapp/src/main/webapp/META-INF/Context.xml deleted file mode 100755 index 0af54be5..00000000 --- a/wise-webapp/src/main/webapp/META-INF/Context.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/wise-webapp/src/main/webapp/index.jsp b/wise-webapp/src/main/webapp/index.jsp deleted file mode 100644 index a444398c..00000000 --- a/wise-webapp/src/main/webapp/index.jsp +++ /dev/null @@ -1,3 +0,0 @@ -<% - response.sendRedirect("c/maps/"); -%> \ No newline at end of file