Author: scottbw
Date: Tue Aug 28 13:40:14 2012
New Revision: 1378133
URL: http://svn.apache.org/viewvc?rev=1378133&view=rev
Log:
Return correct content-type and filename when requesting a widget package
rather than XML or JSON. See WOOKIE-365.
Modified:
incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetsController.java
Modified:
incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java?rev=1378133&r1=1378132&r2=1378133&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java
(original)
+++ incubator/wookie/trunk/src/org/apache/wookie/controller/Controller.java Tue
Aug 28 13:40:14 2012
@@ -60,6 +60,11 @@ public abstract class Controller extends
*/
protected final String ATOM_CONTENT_TYPE =
"application/atom+xml;charset=\"UTF-8\"";
+ /**
+ * Content type for W3C Widget output
+ */
+ protected final String WIDGET_CONTENT_TYPE = "application/widget";
+
/* (non-Javadoc)
* @see
javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse)
*/
Modified:
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetsController.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetsController.java?rev=1378133&r1=1378132&r2=1378133&view=diff
==============================================================================
---
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetsController.java
(original)
+++
incubator/wookie/trunk/src/org/apache/wookie/controller/WidgetsController.java
Tue Aug 28 13:40:14 2012
@@ -144,6 +144,8 @@ public class WidgetsController extends C
File widgetFile = new File(widget.getPackagePath());
InputStream in = new FileInputStream(widgetFile);
OutputStream out = response.getOutputStream();
+ response.setContentType(WIDGET_CONTENT_TYPE);
+ response.setHeader("Content-Disposition",
"attachment;filename="+widgetFile.getName());
IOUtils.copy(in, out);
}