Skip to content

Commit 27c97f4

Browse files
committed
spring-mvc-json-pdf-xls
spring-mvc-json-pdf-xls
1 parent 278285f commit 27c97f4

File tree

21 files changed

+10246
-0
lines changed

21 files changed

+10246
-0
lines changed

spring-mvc-json-pdf-xls/.classpath

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
4+
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
5+
<classpathentry kind="output" path="target/classes"/>
6+
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
7+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
8+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-core/3.1.0.RELEASE/spring-core-3.1.0.RELEASE.jar"/>
9+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-asm/3.1.0.RELEASE/spring-asm-3.1.0.RELEASE.jar"/>
10+
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/>
11+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-web/3.1.0.RELEASE/spring-web-3.1.0.RELEASE.jar"/>
12+
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
13+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/3.1.0.RELEASE/spring-beans-3.1.0.RELEASE.jar"/>
14+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/3.1.0.RELEASE/spring-context-3.1.0.RELEASE.jar"/>
15+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/3.1.0.RELEASE/spring-aop-3.1.0.RELEASE.jar"/>
16+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-expression/3.1.0.RELEASE/spring-expression-3.1.0.RELEASE.jar"/>
17+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-webmvc/3.1.0.RELEASE/spring-webmvc-3.1.0.RELEASE.jar"/>
18+
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context-support/3.1.0.RELEASE/spring-context-support-3.1.0.RELEASE.jar"/>
19+
<classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.9.12/jackson-mapper-asl-1.9.12.jar"/>
20+
<classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-core-asl/1.9.12/jackson-core-asl-1.9.12.jar"/>
21+
<classpathentry kind="var" path="M2_REPO/junit/junit/4.11/junit-4.11.jar"/>
22+
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar"/>
23+
</classpath>

spring-mvc-json-pdf-xls/pom.xml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.hmkcode</groupId>
5+
<artifactId>spring-mvc-json-pdf-xls</artifactId>
6+
<packaging>war</packaging>
7+
<version>1.0-SNAPSHOT</version>
8+
<name>spring-mvc-json-pdf-xls Maven Webapp</name>
9+
<url>http://maven.apache.org</url>
10+
11+
<properties>
12+
<spring.version>3.1.0.RELEASE</spring.version>
13+
<junit.version>4.11</junit.version>
14+
</properties>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.springframework</groupId>
19+
<artifactId>spring-core</artifactId>
20+
<version>${spring.version}</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>org.springframework</groupId>
24+
<artifactId>spring-web</artifactId>
25+
<version>${spring.version}</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.springframework</groupId>
29+
<artifactId>spring-webmvc</artifactId>
30+
<version>${spring.version}</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>javax.servlet</groupId>
34+
<artifactId>servlet-api</artifactId>
35+
<version>2.5</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.codehaus.jackson</groupId>
39+
<artifactId>jackson-mapper-asl</artifactId>
40+
<version>1.9.12</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.codehaus.jackson</groupId>
44+
<artifactId>jackson-core-asl</artifactId>
45+
<version>1.9.12</version>
46+
</dependency>
47+
48+
<dependency>
49+
<groupId>junit</groupId>
50+
<artifactId>junit</artifactId>
51+
<version>${junit.version}</version>
52+
<scope>test</scope>
53+
</dependency>
54+
</dependencies>
55+
56+
<build>
57+
<finalName>spring-mvc-json-pdf-xls</finalName>
58+
<plugins>
59+
<plugin>
60+
<groupId>org.mortbay.jetty</groupId>
61+
<artifactId>maven-jetty-plugin</artifactId>
62+
<version>6.1.10</version>
63+
<configuration>
64+
<scanIntervalSeconds>10</scanIntervalSeconds>
65+
</configuration>
66+
</plugin>
67+
<plugin>
68+
<artifactId>maven-compiler-plugin</artifactId>
69+
<configuration>
70+
<source>1.6</source>
71+
<target>1.6</target>
72+
</configuration>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
</project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.hmkcode.controllers;
2+
3+
4+
5+
import java.util.LinkedList;
6+
import java.util.List;
7+
8+
import javax.servlet.http.HttpServletRequest;
9+
import javax.servlet.http.HttpServletResponse;
10+
11+
import org.springframework.stereotype.Controller;
12+
import org.springframework.web.bind.annotation.RequestMapping;
13+
import org.springframework.web.bind.annotation.RequestMethod;
14+
import org.springframework.web.bind.annotation.ResponseBody;
15+
16+
import com.hmkcode.data.Data;
17+
import com.hmkcode.vo.Article;
18+
19+
20+
21+
22+
@Controller
23+
@RequestMapping("/controller")
24+
public class MyController {
25+
26+
public MyController(){
27+
System.out.println("init RestController");
28+
}
29+
30+
@RequestMapping(value = "/get", method = RequestMethod.GET)
31+
public @ResponseBody List<Article> get(HttpServletRequest request, HttpServletResponse response) {
32+
33+
34+
return Data.getData();
35+
36+
37+
}
38+
39+
}
40+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.hmkcode.data;
2+
3+
import java.util.LinkedList;
4+
import java.util.List;
5+
6+
import com.hmkcode.vo.Article;
7+
8+
public class Data {
9+
10+
public static List<Article> getData(){
11+
12+
List data = new LinkedList<Article>();
13+
14+
Article article = new Article();
15+
16+
article.setTitle("Spring MVC + jQuery File Upload (multiple, drag&drop, progress…)");
17+
article.setUlr("http://hmkcode.com/spring-mvc-jquery-file-upload-multiple-dragdrop-progress/");
18+
article.addCategory("Spring MVC");
19+
article.addTag("Spring MVC");
20+
article.addTag("jQuery");
21+
22+
data.add(article);
23+
return data;
24+
25+
}
26+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.hmkcode.vo;
2+
3+
import java.util.LinkedList;
4+
import java.util.List;
5+
6+
public class Article {
7+
8+
private String title;
9+
private String ulr;
10+
private List<String> categories;
11+
private List<String> tags;
12+
13+
public void addCategory(String category){
14+
if(categories == null)
15+
categories = new LinkedList<String>();
16+
17+
categories.add(category);
18+
}
19+
public void addTag(String tag){
20+
if(tags == null)
21+
tags = new LinkedList<String>();
22+
23+
tags.add(tag);
24+
}
25+
public String getTitle() {
26+
return title;
27+
}
28+
public void setTitle(String title) {
29+
this.title = title;
30+
}
31+
public String getUlr() {
32+
return ulr;
33+
}
34+
public void setUlr(String ulr) {
35+
this.ulr = ulr;
36+
}
37+
public List<String> getCategories() {
38+
return categories;
39+
}
40+
public void setCategories(List<String> categories) {
41+
this.categories = categories;
42+
}
43+
public List<String> getTags() {
44+
return tags;
45+
}
46+
public void setTags(List<String> tags) {
47+
this.tags = tags;
48+
}
49+
50+
51+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<beans xmlns="http://www.springframework.org/schema/beans"
2+
xmlns:context="http://www.springframework.org/schema/context"
3+
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="
5+
http://www.springframework.org/schema/beans
6+
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
7+
http://www.springframework.org/schema/context
8+
http://www.springframework.org/schema/context/spring-context-3.0.xsd
9+
http://www.springframework.org/schema/mvc
10+
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
11+
12+
<context:component-scan base-package="com.hmkcode.controllers" />
13+
<mvc:annotation-driven />
14+
</beans>
15+
16+
17+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
3+
<display-name>SpringMVC</display-name>
4+
<welcome-file-list>
5+
<welcome-file>index.html</welcome-file>
6+
</welcome-file-list>
7+
8+
<servlet>
9+
<servlet-name>rest</servlet-name>
10+
11+
12+
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
13+
</servlet>
14+
15+
<servlet-mapping>
16+
<servlet-name>rest</servlet-name>
17+
<url-pattern>/rest/*</url-pattern>
18+
</servlet-mapping>
19+
</web-app>

0 commit comments

Comments
 (0)