mirror of https://github.com/apache/nifi.git
NIFI-547:
- Setting the default charset in the content viewer page. - Using the content stream when formatting json.
This commit is contained in:
parent
0af9c75d78
commit
66365b0e1d
|
@ -64,6 +64,9 @@ public class ContentViewerController extends HttpServlet {
|
|||
*/
|
||||
@Override
|
||||
protected void doGet(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException {
|
||||
// specify the charset in a response header
|
||||
response.addHeader("Content-Type", "text/html; charset=UTF-8");
|
||||
|
||||
// get the content
|
||||
final ServletContext servletContext = request.getServletContext();
|
||||
final ContentAccess contentAccess = (ContentAccess) servletContext.getAttribute("nifi-content-access");
|
||||
|
|
|
@ -44,9 +44,8 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.jackson</groupId>
|
||||
<artifactId>jackson-mapper-asl</artifactId>
|
||||
<version>1.9.13</version>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.nifi</groupId>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.nifi.web;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
@ -33,7 +34,6 @@ import javax.xml.transform.TransformerFactoryConfigurationError;
|
|||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
import org.apache.nifi.web.ViewableContent.DisplayMode;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
|
||||
@WebServlet(name = "StandardContentViewer", urlPatterns = {"/view-content"})
|
||||
public class StandardContentViewerController extends HttpServlet {
|
||||
|
@ -60,7 +60,7 @@ public class StandardContentViewerController extends HttpServlet {
|
|||
if ("application/json".equals(content.getContentType())) {
|
||||
// format json
|
||||
final ObjectMapper mapper = new ObjectMapper();
|
||||
final Object objectJson = mapper.readValue(content.getContent(), Object.class);
|
||||
final Object objectJson = mapper.readValue(content.getContentStream(), Object.class);
|
||||
formatted = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(objectJson);
|
||||
} else if ("application/xml".equals(content.getContentType())) {
|
||||
// format xml
|
||||
|
|
|
@ -172,7 +172,6 @@
|
|||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.avro</groupId>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<module>nifi-standard-reporting-tasks</module>
|
||||
<module>nifi-standard-content-viewer</module>
|
||||
<module>nifi-standard-nar</module>
|
||||
</modules>
|
||||
</modules>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -53,6 +53,11 @@
|
|||
<type>war</type>
|
||||
<version>0.2.0-incubating-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.4.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
Loading…
Reference in New Issue