Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
lenve committed Mar 1, 2021
1 parent adeafb5 commit 337a628
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 6 deletions.
41 changes: 41 additions & 0 deletions flash_map/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.javaboy</groupId>
<artifactId>flash_map</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>flash_map</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.javaboy.flash_map;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class FlashMapApplication {

public static void main(String[] args) {
SpringApplication.run(FlashMapApplication.class, args);
}

}
45 changes: 45 additions & 0 deletions flash_map/src/main/java/org/javaboy/flash_map/OrderController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.javaboy.flash_map;

import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.FlashMap;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;

/**
* @author 江南一点雨
* @微信公众号 江南一点雨
* @网站 http://www.itboyhub.com
* @国际站 http://www.javaboy.org
* @微信 a_java_boy
* @GitHub https://github.com/lenve
* @Gitee https://gitee.com/lenve
*/
@Controller
public class OrderController {
@PostMapping("/order")
public String order(HttpServletRequest req) {
FlashMap flashMap = (FlashMap) req.getAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE);
flashMap.put("site", "www.javaboy.org");
flashMap.addTargetRequestParam("aa", "bb");
// attr.addFlashAttribute("site", "www.javaboy.org");
// attr.addAttribute("name", "微信公众号:江南一点雨");
return "redirect:/orderlist?aa=bb";
}

@GetMapping("/orderlist")
@ResponseBody
public String orderList(Model model) {
return (String) model.getAttribute("site");
}
}
1 change: 1 addition & 0 deletions flash_map/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

12 changes: 12 additions & 0 deletions flash_map/src/main/resources/static/01.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form action="/order" method="post">
<input type="submit" value="提交">
</form>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.javaboy.flash_map;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class FlashMapApplicationTests {

@Test
void contextLoads() {
}

}
2 changes: 1 addition & 1 deletion logging-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>logging-spring-boot-starter</artifactId>
<version>0.1</version>
<version>0.0.1</version>

<parent>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.lang.annotation.Target;

/**
* @author 江南一点雨
* @author 江南一点雨 jitpack
* @微信公众号 江南一点雨
* @网站 http://www.itboyhub.com
* @国际站 http://www.javaboy.org
Expand Down
2 changes: 1 addition & 1 deletion logging_test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>logging-spring-boot-starter</artifactId>
<version>0.1</version>
<version>0.0.1</version>
</dependency>

<dependency>
Expand Down
4 changes: 2 additions & 2 deletions logging_test/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
logging.config=classpath:log.xml
#logging.config=classpath:log.xml

time.log.enable=false
#time.log.enable=false
2 changes: 1 addition & 1 deletion swagger2/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@

#server.port=8081

0 comments on commit 337a628

Please sign in to comment.