ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker cp <containerId>:/file/path/within/container /host/path/target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Enable component-scanning and auto-configuration with @SpringBootApplication Annotation | |
| // It combines @Configuration + @ComponentScan + @EnableAutoConfiguration | |
| @SpringBootApplication | |
| public class FooApplication { | |
| public static void main(String[] args) { | |
| // Bootstrap the application | |
| SpringApplication.run(FooApplication.class, args); | |
| } | |
| } |
When hosting our web applications, we often have one public IP
address (i.e., an IP address visible to the outside world)
using which we want to host multiple web apps. For example, one
may wants to host three different web apps respectively for
example1.com, example2.com, and example1.com/images on
the same machine using a single IP address.
How can we do that? Well, the good news is Internet browsers
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SpringContext implements ApplicationContextAware { | |
| /** | |
| * Spring应用上下文环境 | |
| */ | |
| private static ApplicationContext applicationContext; | |
| /** | |
| * 实现ApplicationContextAware接口的回调方法,设置上下文环境 | |
| * | |
| * @param applicationContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private static final String CONTENT_TYPE_ZIP = "application/x-zip-compressed"; | |
| @PostMapping(value = "/downloadReport", produces = CONTENT_TYPE_ZIP) | |
| public Resource downloadReport(@RequestBody Map<String, String> map, HttpServletResponse response) { | |
| String fileName = map.get("fileName"); | |
| File file = new File("D:\\" + fileName); | |
| response.setHeader("Content-Disposition", "attachment; filename=info.zip"); | |
| return new FileSystemResource(file); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.fasterxml.jackson.core.JsonProcessingException; | |
| import com.fasterxml.jackson.core.type.TypeReference; | |
| import com.fasterxml.jackson.databind.ObjectMapper; | |
| import java.io.IOException; | |
| import java.util.ArrayList; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; |
NewerOlder