/*
- * Copyright (C) 2007-2012 Mathieu Baudier
+ * Copyright (C) 2007-2012 Argeo GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletRequest;
import org.argeo.ArgeoException;
-import org.eclipse.rwt.RWT;
-import org.eclipse.rwt.service.IServiceHandler;
+import org.eclipse.rap.rwt.RWT;
+import org.eclipse.rap.rwt.service.IServiceHandler;
public class DownloadServiceHandler implements IServiceHandler {
this.provider = provider;
}
- public void service() throws IOException, ServletException {
+ public void service( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException {
// Which file to download?
- String fileName = RWT.getRequest().getParameter("filename");
- String fileId = RWT.getRequest().getParameter("fileid");
+ String fileName = request.getParameter("filename");
+ String fileId = request.getParameter("fileid");
// Get the file content
byte[] download = provider.getByteArrayFileFromId(fileId);
// Send the file in the response
- HttpServletResponse response = RWT.getResponse();
response.setContentType("application/octet-stream");
response.setContentLength(download.length);
String contentDisposition = "attachment; filename=\"" + fileName + "\"";