Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<java.version>11</java.version>
<ftl.version>2.3.29</ftl.version>
<encoding>UTF-8</encoding>

</properties>

<dependencies>
Expand All @@ -30,6 +31,7 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/ru/amm/fileexplorer/server/IndexController.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
package ru.amm.fileexplorer.server;

import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;

@Controller


public class IndexController {
@RequestMapping(path="/", method = RequestMethod.GET)
public ModelAndView index() {
Map<String, String> data = new HashMap<>();
data.put("username", "Вася");

//ResponseEntity<ModelAndView> m=new ResponseEntity<ModelAndView>();
return new ModelAndView("index", data);
}
}
35 changes: 0 additions & 35 deletions src/main/java/ru/amm/fileexplorer/server/MathEvaluator.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.XmlWebApplicationContext;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
Expand All @@ -19,6 +21,7 @@ public class MainConfiguration implements WebMvcConfigurer {
@Bean
public FreeMarkerViewResolver freemarkerViewResolver() {
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
resolver.setContentType("text/html;charset=UTF-8");
resolver.setCache(true);
resolver.setPrefix("");
resolver.setSuffix(".ftl");
Expand All @@ -28,14 +31,20 @@ public FreeMarkerViewResolver freemarkerViewResolver() {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/scripts/**")
.addResourceLocations("classpath:/static/scripts/");
.addResourceLocations("classpath:/static1/scripts/");
registry.addResourceHandler("/css/**")
.addResourceLocations("classpath:/static1/css/");
}

@Bean
public FreeMarkerConfigurer freeMarkerConfigurer(@Value("${my.name}") String myName) {
LOG.info("My name: {}", myName);
FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
freeMarkerConfigurer.setTemplateLoaderPath("classpath:/templates/");

return freeMarkerConfigurer;
}



}
3 changes: 2 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

logging.level.root=WARN
logging.level.ru.amm=DEBUG
logging.level.org.springframework=WARN
logging.level.web=DEBUG
#logging.pattern.console=%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
logging.pattern.console=%d{HH:mm:ss.SSS} [${LOG_LEVEL_PATTERN}] %c{1}:%L - %m%n
pathToPublish = D:\\java
my.name = Kostya
my.name = Kostya
Loading