Monthly Archives: October 2015


Learning Note for Functional Programming

Coursera Note Sentence in red is my own perspective, inspired by the instructor. 1.1 Programming Paradigms Imperative Programs and Computers There is strong correspondence between Mutable variables ~ Memory cells Variable dereference ~ load instructions Variable assignments ~ store instructions Control structures ~ jumps Problem: how can we avoid conceptualizing […]


Jetty Hello World教程 2

关于如何在命令行下run一个Hello world的jetty程序。 首先下载两个依赖包 http://mvnrepository.com/artifact/javax.servlet/servlet-api/2.5 http://mvnrepository.com/artifact/org.eclipse.jetty.aggregate/jetty-all/7.0.2.v20100331 将它们放在一个文件夹下,然后新建一个HelloWorld.java的文件,填入如下代码: import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletException; import java.io.IOException; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.Request; import org.eclipse.jetty.server.handler.AbstractHandler; public class HelloWorld extends AbstractHandler { public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType(“text/html;charset=utf-8”); response.setStatus(HttpServletResponse.SC_OK); baseRequest.setHandled(true); response.getWriter().println(“<h1>Hello World</h1>”); } public static void main(String[] args) […]