You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ch...@apache.org on 2014/06/30 22:37:38 UTC

[1/4] git commit: Fixed typo in class name jira STRATOS-682

Repository: stratos
Updated Branches:
  refs/heads/4.0.0 d63e01c61 -> 56da2fd6e


Fixed typo in class name jira STRATOS-682


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/762e4ba3
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/762e4ba3
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/762e4ba3

Branch: refs/heads/4.0.0
Commit: 762e4ba3036f906fa393e2ba5f265b0c4368f457
Parents: d63e01c
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Sun Jun 22 09:55:32 2014 +0000
Committer: Chris Snow <ch...@apache.org>
Committed: Mon Jun 30 20:34:58 2014 +0000

----------------------------------------------------------------------
 .../mgt/ui/servlets/ThemeResourceServlets.java  | 125 +++++++++++++++++++
 1 file changed, 125 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/762e4ba3/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlets.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlets.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlets.java
new file mode 100644
index 0000000..3190590
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlets.java
@@ -0,0 +1,125 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+
+ *  http://www.apache.org/licenses/LICENSE-2.0
+
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.stratos.theme.mgt.ui.servlets;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentDownloadBean;
+import org.apache.stratos.theme.mgt.ui.clients.ThemeMgtServiceClient;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ThemeResourceServlets extends HttpServlet {
+
+    private static final Log log = LogFactory.getLog(ThemeResourceServlets.class);
+
+    private ServletConfig servletConfig;
+
+    public void init(ServletConfig servletConfig) throws ServletException {
+        super.init(servletConfig);
+        this.servletConfig = servletConfig;
+    }
+
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+
+        try {
+            ThemeMgtServiceClient client = new ThemeMgtServiceClient(servletConfig, request.getSession());
+            String path = request.getParameter("path");
+            String viewImage = request.getParameter("viewImage");
+            if (path == null) {
+                String msg = "Could not get the resource content. Path is not specified.";
+                log.error(msg);
+                response.setStatus(400);
+                return;
+            }
+
+            ContentDownloadBean bean = client.getContentDownloadBean(path);
+
+            InputStream contentStream = null;
+            if (bean.getContent() != null) {
+                contentStream = bean.getContent().getInputStream();
+            } else {
+                String msg = "The resource content was empty.";
+                log.error(msg);
+                response.setStatus(204);
+                return;
+            }
+
+            response.setDateHeader("Last-Modified", bean.getLastUpdatedTime().getTime().getTime());
+            String ext = "jpg";
+            if (path.lastIndexOf(".") < path.length() -1 && path.lastIndexOf(".") > 0) {
+                ext = path.substring(path.lastIndexOf(".") + 1);
+            }
+
+            if (viewImage != null && viewImage.equals("1")) {
+                response.setContentType("img/" + ext);
+            }
+            else {
+                if (bean.getMediatype() != null && bean.getMediatype().length() > 0) {
+                    response.setContentType(bean.getMediatype());
+                } else {
+                    response.setContentType("application/download");
+                }
+
+                if (bean.getResourceName() != null) {
+                    response.setHeader(
+                            "Content-Disposition", "attachment; filename=\"" + bean.getResourceName() + "\"");
+                }
+            }
+
+            if (contentStream != null) {
+
+                ServletOutputStream servletOutputStream = null;
+                try {
+                    servletOutputStream = response.getOutputStream();
+
+                    byte[] contentChunk = new byte[1024];
+                    int byteCount;
+                    while ((byteCount = contentStream.read(contentChunk)) != -1) {
+                        servletOutputStream.write(contentChunk, 0, byteCount);
+                    }
+
+                    response.flushBuffer();
+                    servletOutputStream.flush();
+
+                } finally {
+                    contentStream.close();
+
+                    if (servletOutputStream != null) {
+                        servletOutputStream.close();
+                    }
+                }
+            }
+        } catch (Exception e) {
+
+            String msg = "Failed to get resource content. " + e.getMessage();
+            log.error(msg, e);
+            response.setStatus(500);
+        }
+    }
+}


[2/4] git commit: Fixed typo in class name jira STRATOS-682

Posted by ch...@apache.org.
Fixed typo in class name jira STRATOS-682


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/df9c46b0
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/df9c46b0
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/df9c46b0

Branch: refs/heads/4.0.0
Commit: df9c46b00c3ecbccbac76e5972b94a160a068424
Parents: 762e4ba
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Sun Jun 22 09:55:56 2014 +0000
Committer: Chris Snow <ch...@apache.org>
Committed: Mon Jun 30 20:34:59 2014 +0000

----------------------------------------------------------------------
 .../src/main/resources/META-INF/component.xml                      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/df9c46b0/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml
index 9faf205..326eae9 100644
--- a/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml
@@ -63,7 +63,7 @@
             <url-pattern>/registry/themeResourceContent</url-pattern>
             <display-name>Theme Resource Content Servlet</display-name>
 
-            <servlet-class>org.apache.stratos.theme.mgt.ui.servlets.ThemeResourceSevelet</servlet-class>
+            <servlet-class>org.apache.stratos.theme.mgt.ui.servlets.ThemeResourceServlets</servlet-class>
         </servlet>
     </servlets>
 </component>


[3/4] git commit: Fixed typo in class name in singular form jira STRATOS-682

Posted by ch...@apache.org.
Fixed typo in class name in singular form jira STRATOS-682


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/56da2fd6
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/56da2fd6
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/56da2fd6

Branch: refs/heads/4.0.0
Commit: 56da2fd6e7ae80f6537d49b22752ae9b6ed3f74c
Parents: 88fc484
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Sun Jun 22 22:55:38 2014 +0000
Committer: Chris Snow <ch...@apache.org>
Committed: Mon Jun 30 20:34:59 2014 +0000

----------------------------------------------------------------------
 .../src/main/resources/META-INF/component.xml                      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/56da2fd6/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml
index 326eae9..f28ba4b 100644
--- a/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/resources/META-INF/component.xml
@@ -63,7 +63,7 @@
             <url-pattern>/registry/themeResourceContent</url-pattern>
             <display-name>Theme Resource Content Servlet</display-name>
 
-            <servlet-class>org.apache.stratos.theme.mgt.ui.servlets.ThemeResourceServlets</servlet-class>
+            <servlet-class>org.apache.stratos.theme.mgt.ui.servlets.ThemeResourceServlet</servlet-class>
         </servlet>
     </servlets>
 </component>


[4/4] git commit: Fixed typo in class name in singular form jira STRATOS-682

Posted by ch...@apache.org.
Fixed typo in class name in singular form jira STRATOS-682


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/88fc4842
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/88fc4842
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/88fc4842

Branch: refs/heads/4.0.0
Commit: 88fc484233fb7f0a0c0564da3442c3d520d42dd3
Parents: df9c46b
Author: Dakshika Jayathilaka <si...@gmail.com>
Authored: Sun Jun 22 17:20:51 2014 +0000
Committer: Chris Snow <ch...@apache.org>
Committed: Mon Jun 30 20:34:59 2014 +0000

----------------------------------------------------------------------
 .../mgt/ui/servlets/ThemeResourceServlet.java   | 125 +++++++++++++++++++
 .../mgt/ui/servlets/ThemeResourceServlets.java  | 125 -------------------
 .../mgt/ui/servlets/ThemeResourceSevelet.java   | 125 -------------------
 3 files changed, 125 insertions(+), 250 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/88fc4842/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlet.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlet.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlet.java
new file mode 100644
index 0000000..c9e674a
--- /dev/null
+++ b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlet.java
@@ -0,0 +1,125 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+
+ *  http://www.apache.org/licenses/LICENSE-2.0
+
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.stratos.theme.mgt.ui.servlets;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentDownloadBean;
+import org.apache.stratos.theme.mgt.ui.clients.ThemeMgtServiceClient;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.InputStream;
+
+public class ThemeResourceServlet extends HttpServlet {
+
+    private static final Log log = LogFactory.getLog(ThemeResourceServlet.class);
+
+    private ServletConfig servletConfig;
+
+    public void init(ServletConfig servletConfig) throws ServletException {
+        super.init(servletConfig);
+        this.servletConfig = servletConfig;
+    }
+
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+
+        try {
+            ThemeMgtServiceClient client = new ThemeMgtServiceClient(servletConfig, request.getSession());
+            String path = request.getParameter("path");
+            String viewImage = request.getParameter("viewImage");
+            if (path == null) {
+                String msg = "Could not get the resource content. Path is not specified.";
+                log.error(msg);
+                response.setStatus(400);
+                return;
+            }
+
+            ContentDownloadBean bean = client.getContentDownloadBean(path);
+
+            InputStream contentStream = null;
+            if (bean.getContent() != null) {
+                contentStream = bean.getContent().getInputStream();
+            } else {
+                String msg = "The resource content was empty.";
+                log.error(msg);
+                response.setStatus(204);
+                return;
+            }
+
+            response.setDateHeader("Last-Modified", bean.getLastUpdatedTime().getTime().getTime());
+            String ext = "jpg";
+            if (path.lastIndexOf(".") < path.length() -1 && path.lastIndexOf(".") > 0) {
+                ext = path.substring(path.lastIndexOf(".") + 1);
+            }
+
+            if (viewImage != null && viewImage.equals("1")) {
+                response.setContentType("img/" + ext);
+            }
+            else {
+                if (bean.getMediatype() != null && bean.getMediatype().length() > 0) {
+                    response.setContentType(bean.getMediatype());
+                } else {
+                    response.setContentType("application/download");
+                }
+
+                if (bean.getResourceName() != null) {
+                    response.setHeader(
+                            "Content-Disposition", "attachment; filename=\"" + bean.getResourceName() + "\"");
+                }
+            }
+
+            if (contentStream != null) {
+
+                ServletOutputStream servletOutputStream = null;
+                try {
+                    servletOutputStream = response.getOutputStream();
+
+                    byte[] contentChunk = new byte[1024];
+                    int byteCount;
+                    while ((byteCount = contentStream.read(contentChunk)) != -1) {
+                        servletOutputStream.write(contentChunk, 0, byteCount);
+                    }
+
+                    response.flushBuffer();
+                    servletOutputStream.flush();
+
+                } finally {
+                    contentStream.close();
+
+                    if (servletOutputStream != null) {
+                        servletOutputStream.close();
+                    }
+                }
+            }
+        } catch (Exception e) {
+
+            String msg = "Failed to get resource content. " + e.getMessage();
+            log.error(msg, e);
+            response.setStatus(500);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/88fc4842/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlets.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlets.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlets.java
deleted file mode 100644
index 3190590..0000000
--- a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceServlets.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
-
- *  http://www.apache.org/licenses/LICENSE-2.0
-
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.stratos.theme.mgt.ui.servlets;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentDownloadBean;
-import org.apache.stratos.theme.mgt.ui.clients.ThemeMgtServiceClient;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class ThemeResourceServlets extends HttpServlet {
-
-    private static final Log log = LogFactory.getLog(ThemeResourceServlets.class);
-
-    private ServletConfig servletConfig;
-
-    public void init(ServletConfig servletConfig) throws ServletException {
-        super.init(servletConfig);
-        this.servletConfig = servletConfig;
-    }
-
-    protected void doGet(HttpServletRequest request, HttpServletResponse response)
-            throws ServletException, IOException {
-
-        try {
-            ThemeMgtServiceClient client = new ThemeMgtServiceClient(servletConfig, request.getSession());
-            String path = request.getParameter("path");
-            String viewImage = request.getParameter("viewImage");
-            if (path == null) {
-                String msg = "Could not get the resource content. Path is not specified.";
-                log.error(msg);
-                response.setStatus(400);
-                return;
-            }
-
-            ContentDownloadBean bean = client.getContentDownloadBean(path);
-
-            InputStream contentStream = null;
-            if (bean.getContent() != null) {
-                contentStream = bean.getContent().getInputStream();
-            } else {
-                String msg = "The resource content was empty.";
-                log.error(msg);
-                response.setStatus(204);
-                return;
-            }
-
-            response.setDateHeader("Last-Modified", bean.getLastUpdatedTime().getTime().getTime());
-            String ext = "jpg";
-            if (path.lastIndexOf(".") < path.length() -1 && path.lastIndexOf(".") > 0) {
-                ext = path.substring(path.lastIndexOf(".") + 1);
-            }
-
-            if (viewImage != null && viewImage.equals("1")) {
-                response.setContentType("img/" + ext);
-            }
-            else {
-                if (bean.getMediatype() != null && bean.getMediatype().length() > 0) {
-                    response.setContentType(bean.getMediatype());
-                } else {
-                    response.setContentType("application/download");
-                }
-
-                if (bean.getResourceName() != null) {
-                    response.setHeader(
-                            "Content-Disposition", "attachment; filename=\"" + bean.getResourceName() + "\"");
-                }
-            }
-
-            if (contentStream != null) {
-
-                ServletOutputStream servletOutputStream = null;
-                try {
-                    servletOutputStream = response.getOutputStream();
-
-                    byte[] contentChunk = new byte[1024];
-                    int byteCount;
-                    while ((byteCount = contentStream.read(contentChunk)) != -1) {
-                        servletOutputStream.write(contentChunk, 0, byteCount);
-                    }
-
-                    response.flushBuffer();
-                    servletOutputStream.flush();
-
-                } finally {
-                    contentStream.close();
-
-                    if (servletOutputStream != null) {
-                        servletOutputStream.close();
-                    }
-                }
-            }
-        } catch (Exception e) {
-
-            String msg = "Failed to get resource content. " + e.getMessage();
-            log.error(msg, e);
-            response.setStatus(500);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/88fc4842/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceSevelet.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceSevelet.java b/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceSevelet.java
deleted file mode 100644
index 0650ca3..0000000
--- a/components/org.apache.stratos.theme.mgt.ui/src/main/java/org/apache/stratos/theme/mgt/ui/servlets/ThemeResourceSevelet.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
-
- *  http://www.apache.org/licenses/LICENSE-2.0
-
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.stratos.theme.mgt.ui.servlets;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.theme.mgt.stub.registry.resource.stub.beans.xsd.ContentDownloadBean;
-import org.apache.stratos.theme.mgt.ui.clients.ThemeMgtServiceClient;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class ThemeResourceSevelet extends HttpServlet {
-
-    private static final Log log = LogFactory.getLog(ThemeResourceSevelet.class);
-
-    private ServletConfig servletConfig;
-
-    public void init(ServletConfig servletConfig) throws ServletException {
-        super.init(servletConfig);
-        this.servletConfig = servletConfig;
-    }
-
-    protected void doGet(HttpServletRequest request, HttpServletResponse response)
-            throws ServletException, IOException {
-
-        try {
-            ThemeMgtServiceClient client = new ThemeMgtServiceClient(servletConfig, request.getSession());
-            String path = request.getParameter("path");
-            String viewImage = request.getParameter("viewImage");
-            if (path == null) {
-                String msg = "Could not get the resource content. Path is not specified.";
-                log.error(msg);
-                response.setStatus(400);
-                return;
-            }
-
-            ContentDownloadBean bean = client.getContentDownloadBean(path);
-
-            InputStream contentStream = null;
-            if (bean.getContent() != null) {
-                contentStream = bean.getContent().getInputStream();
-            } else {
-                String msg = "The resource content was empty.";
-                log.error(msg);
-                response.setStatus(204);
-                return;
-            }
-
-            response.setDateHeader("Last-Modified", bean.getLastUpdatedTime().getTime().getTime());
-            String ext = "jpg";
-            if (path.lastIndexOf(".") < path.length() -1 && path.lastIndexOf(".") > 0) {
-                ext = path.substring(path.lastIndexOf(".") + 1);
-            }
-
-            if (viewImage != null && viewImage.equals("1")) {
-                response.setContentType("img/" + ext);
-            }
-            else {
-                if (bean.getMediatype() != null && bean.getMediatype().length() > 0) {
-                    response.setContentType(bean.getMediatype());
-                } else {
-                    response.setContentType("application/download");
-                }
-
-                if (bean.getResourceName() != null) {
-                    response.setHeader(
-                            "Content-Disposition", "attachment; filename=\"" + bean.getResourceName() + "\"");
-                }
-            }
-
-            if (contentStream != null) {
-
-                ServletOutputStream servletOutputStream = null;
-                try {
-                    servletOutputStream = response.getOutputStream();
-
-                    byte[] contentChunk = new byte[1024];
-                    int byteCount;
-                    while ((byteCount = contentStream.read(contentChunk)) != -1) {
-                        servletOutputStream.write(contentChunk, 0, byteCount);
-                    }
-
-                    response.flushBuffer();
-                    servletOutputStream.flush();
-
-                } finally {
-                    contentStream.close();
-
-                    if (servletOutputStream != null) {
-                        servletOutputStream.close();
-                    }
-                }
-            }
-        } catch (Exception e) {
-
-            String msg = "Failed to get resource content. " + e.getMessage();
-            log.error(msg, e);
-            response.setStatus(500);
-        }
-    }
-}