Revision ad875511
adding xom dependency again since it is required by jsonview in xml mode
cdmlib-remote/pom.xml | ||
---|---|---|
126 | 126 |
<dependency> |
127 | 127 |
<groupId>org.easymock</groupId> |
128 | 128 |
<artifactId>easymock</artifactId> |
129 |
</dependency>
|
|
130 |
|
|
129 |
</dependency> |
|
130 |
|
|
131 | 131 |
<dependency> |
132 | 132 |
<groupId>com.ibm.lsid</groupId> |
133 | 133 |
<artifactId>lsid-server</artifactId> |
... | ... | |
182 | 182 |
<artifactId>stax</artifactId> |
183 | 183 |
</dependency> |
184 | 184 |
|
185 |
<!-- JsonView --> |
|
186 |
<dependency> |
|
187 |
<!-- for xml serialization (net.sf.json.xml.XMLSerializer) --> |
|
188 |
<groupId>xom</groupId> |
|
189 |
<artifactId>xom</artifactId> |
|
190 |
</dependency> |
|
191 |
|
|
192 |
|
|
185 | 193 |
|
186 | 194 |
<!-- Connection Pooling --> |
187 | 195 |
<dependency> |
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/view/JsonView.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.cdm.remote.view; |
11 | 11 |
|
12 | 12 |
import java.io.PrintWriter; |
13 |
import java.net.MalformedURLException; |
|
14 |
import java.net.URI; |
|
15 |
import java.net.URISyntaxException; |
|
16 |
import java.net.URL; |
|
17 | 13 |
import java.util.Collection; |
18 | 14 |
import java.util.Map; |
19 |
import java.util.Properties; |
|
20 |
import java.util.regex.Matcher; |
|
21 |
import java.util.regex.Pattern; |
|
22 | 15 |
|
23 | 16 |
import javax.servlet.http.HttpServletRequest; |
24 | 17 |
import javax.servlet.http.HttpServletResponse; |
... | ... | |
30 | 23 |
import net.sf.json.xml.XMLSerializer; |
31 | 24 |
|
32 | 25 |
import org.apache.log4j.Logger; |
33 |
import org.springframework.beans.factory.annotation.Autowired; |
|
34 |
import org.springframework.beans.factory.annotation.Qualifier; |
|
35 |
import org.springframework.context.annotation.Bean; |
|
36 | 26 |
import org.springframework.web.servlet.View; |
37 | 27 |
|
38 | 28 |
import eu.etaxonomy.cdm.remote.config.DataSourceProperties; |
... | ... | |
58 | 48 |
JSON("application/json"), |
59 | 49 |
XML("application/xml"); |
60 | 50 |
|
61 |
private String contentType; |
|
51 |
private final String contentType;
|
|
62 | 52 |
|
63 | 53 |
Type(String contentType){ |
64 | 54 |
this.contentType = contentType; |
... | ... | |
101 | 91 |
* (non-Javadoc) |
102 | 92 |
* @see org.springframework.web.servlet.View#getContentType() |
103 | 93 |
*/ |
94 |
@Override |
|
104 | 95 |
public String getContentType() { |
105 | 96 |
return type.getContentType(); |
106 | 97 |
} |
... | ... | |
108 | 99 |
/* (non-Javadoc) |
109 | 100 |
* @see eu.etaxonomy.cdm.remote.view.BaseView#render(java.lang.Object, java.io.PrintWriter, java.lang.String, java.lang.String) |
110 | 101 |
*/ |
102 |
@Override |
|
111 | 103 |
public void render(Object entity, PrintWriter writer, String jsonpCallback, HttpServletRequest request, HttpServletResponse response) throws Exception { |
112 | 104 |
|
113 | 105 |
String contextPath = null; |
114 |
|
|
106 |
|
|
115 | 107 |
if (request != null) |
116 | 108 |
{ |
117 | 109 |
contextPath = request.getContextPath(); |
... | ... | |
179 | 171 |
* (non-Javadoc) |
180 | 172 |
* @see org.springframework.web.servlet.View#render(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) |
181 | 173 |
*/ |
174 |
@Override |
|
182 | 175 |
public void render(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception { |
183 | 176 |
|
184 | 177 |
// Retrieve data from model |
Also available in: Unified diff