Fix public resource sharing.
@ -2,20 +2,10 @@ package com.wisemapping.config;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
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.context.annotation.ImportResource;
|
||||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
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
|
@EnableTransactionManagement
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableJpaRepositories("com.wisemapping.model")
|
@EnableJpaRepositories("com.wisemapping.model")
|
||||||
@ -25,26 +15,4 @@ public class Application {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(Application.class, 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
package com.wisemapping.config;
|
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.context.annotation.Configuration;
|
||||||
import org.springframework.orm.hibernate5.HibernateTransactionManager;
|
|
||||||
import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
|
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
public class HibernateConfig {
|
public class HibernateConfig {
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -179,7 +179,3 @@ spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
|||||||
spring.jpa.open-in-view=true
|
spring.jpa.open-in-view=true
|
||||||
spring.h2.console.enabled=true
|
spring.h2.console.enabled=true
|
||||||
spring.h2.console.path=/h2-ui
|
spring.h2.console.path=/h2-ui
|
||||||
|
|
||||||
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
|
|
||||||
|
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 440 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<Context path="/wisemapping" reloadable="true">
|
|
||||||
|
|
||||||
<Resource
|
|
||||||
name="jdbc/wisemapping"
|
|
||||||
auth="Container"
|
|
||||||
type="javax.sql.DataSource"
|
|
||||||
maxActive="100"
|
|
||||||
maxIdle="30" maxWait="10000"
|
|
||||||
username="root"
|
|
||||||
password=""
|
|
||||||
driverClassName="com.mysql.jdbc.Driver"
|
|
||||||
url="jdbc:mysql://localhost/wisemapping?autoReconnect=true"/>
|
|
||||||
|
|
||||||
</Context>
|
|
@ -1,3 +0,0 @@
|
|||||||
<%
|
|
||||||
response.sendRedirect("c/maps/");
|
|
||||||
%>
|
|