Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
View export functionality. Layout still needs work though.
- Loading branch information
Showing
5 changed files
with
156 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
ExapusRAP/src/exapus/gui/views/store/ViewDownloadServiceHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,49 @@ | |||
package exapus.gui.views.store; | |||
|
|||
import java.io.File; | |||
import java.io.IOException; | |||
|
|||
import javax.servlet.ServletException; | |||
import javax.servlet.ServletOutputStream; | |||
import javax.servlet.http.HttpServletResponse; | |||
|
|||
import org.eclipse.rwt.RWT; | |||
import org.eclipse.rwt.service.IServiceHandler; | |||
|
|||
import com.google.common.io.Files; | |||
|
|||
import exapus.gui.editors.forest.graph.GraphViz; | |||
import exapus.model.store.Store; | |||
|
|||
public class ViewDownloadServiceHandler implements IServiceHandler { | |||
|
|||
public static String ID = "viewDownloadServiceHandler"; | |||
|
|||
public static String viewDownloadUrl(String viewName) { | |||
StringBuilder url = new StringBuilder(); | |||
url.append(RWT.getRequest().getContextPath()); | |||
url.append(RWT.getRequest().getServletPath()); | |||
url.append("?"); | |||
url.append(IServiceHandler.REQUEST_PARAM ); | |||
url.append("="+ID); | |||
url.append("&viewName=" ); | |||
url.append(viewName); | |||
return RWT.getResponse().encodeURL(url.toString()); | |||
} | |||
|
|||
|
|||
public void service() throws IOException, ServletException { | |||
String viewName = RWT.getRequest().getParameter("viewName"); | |||
File xmlFile = Store.getCurrent().xmlForRegisteredView(viewName); | |||
if(xmlFile != null) { | |||
HttpServletResponse response = RWT.getResponse(); | |||
response.setContentType( "application/octet-stream" ); | |||
String contentDisposition = "attachment; filename=\"" + xmlFile.getName() + "\""; | |||
response.setHeader("Content-Disposition", contentDisposition); | |||
ServletOutputStream out = response.getOutputStream(); | |||
Files.copy(xmlFile, out); | |||
out.close(); | |||
} | |||
} | |||
} | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters