[base] downloading files
I have a List of File objects. what is the best way to zip them all together and download it? Is there a way to get the Httpresponse object from inside a plugin? If the files are really large, would it better to write the outputstream to the local filesystem and have the user find and download the archive from inside their home dir? is there a nice File.Action.addZip ? thanks, -keith -- Keith Ching, Ph.D. Bioinformatics, Laboratory of Gene Regulation Ludwig Institute for Cancer Research 9500 Gilman Drive, #0653 CMM East, Room 3020 La Jolla, CA 92093-0653 [EMAIL PROTECTED] 858-822-5767 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ The BASE general discussion mailing list basedb-users@lists.sourceforge.net unsubscribe: send a mail with subject unsubscribe to [EMAIL PROTECTED]
Re: [base] downloading files
Keith Ching wrote: I have a List of File objects. what is the best way to zip them all together and download it? I assume that you want to this with a plugin. I think the best way is to create a new File (net.sf.basedb.core.File) object and then use java.util.zip.ZipOutputStream for writing to the new file. Is there a way to get the Httpresponse object from inside a plugin? Not really, since plugins are executed in the background or maybe even on a different server. In the the upcoming 2.2 release we have added the interface net.sf.basedb.core.plugin.ImmediateDownloadExporter that more or less makes it possible for a plugin to send the output to the HTTP response. Look at the source code some of the existing export plugins (for example HelpExporter) to see how to use it. If the files are really large, would it better to write the outputstream to the local filesystem and have the user find and download the archive from inside their home dir? Maybe. I don't think a zip stream needs much memory or uses very much CPU. The main problem is probably slow network connections. If you use the net.sf.basedb.core.plugin.AbstractExportPlugin as a base class it can help you with supporting both immediate download and saving to the file system. is there a nice File.Action.addZip ? No. /Nicklas - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ The BASE general discussion mailing list basedb-users@lists.sourceforge.net unsubscribe: send a mail with subject unsubscribe to [EMAIL PROTECTED]
Re: [base] downloading files
Hi, I am getting a peculiar stack trace upon trying to define the plugin. do you think it could be caused by using Base2.2 classes in a Base2.1.1 codebase? i tried to include the revised classes in the plugin JAR.. but i suppose this probably doesn't work.. i had to include Base2.2 versions of net.sf.basedb.core.Path net.sf.basedb.util.FileExportOutputStream net.sf.basedb.core.plugin.AbstractExporterPlugin net.sf.basedb.core.plugin.ExportOutputStream net.sf.basedb.core.plugin.ImmediateDownloadExporter do you think it would be safe to just replace these files in 2.1.1 and rebuild it? -keith Version BASE 2.1.1 (build #2996; schema #20) Web server Apache Tomcat/5.5.20 Database Dialect org.hibernate.dialect.MySQLInnoDBDialect JDBC Driver com.mysql.jdbc.Driver (version 3.1) Java runtime Java(TM) 2 Runtime Environment, Standard Edition (1.5.0_06-112), Apple Computer, Inc. http://apple.com/ Operating system Mac OS X ppc 10.4.8 Memory Total: 89.1 MB Free: 55.7 MB Max: 494.5 MB Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8 Error message Could not instantiate plugin class: edu.ucsd.basedb.plugins.DownloadPlugin Stack trace ...at PluginDefinition.newInstance(PluginDefinition.java:930) ...at PluginDefinition.loadPluginInformation(PluginDefinition.java:1026) ...at PluginDefinition.getNew(PluginDefinition.java:140) ...at org.apache.jsp.admin.plugindefinitions.index_jsp._jspService(index_jsp.java:160) ...at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) ...at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) ...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334) ...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) ...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) ...at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) ...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) ...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) ...at net.sf.basedb.clients.web.servlet.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:71) ...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) ...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) ...at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) ...at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) ...at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) ...at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) ...at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) ...at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) ...at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) ...at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) ...at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) ...at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) ...at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) ...at java.lang.Thread.run(Thread.java:613) Caused by: java.util.zip.ZipException ...at java.util.zip.ZipFile.open(Native Method) ...at java.util.zip.ZipFile.(ZipFile.java:203) ...at java.util.jar.JarFile.(JarFile.java:132) ...at java.util.jar.JarFile.(JarFile.java:97) ...at net.sf.basedb.util.JarClassLoader.loadJarFile(JarClassLoader.java:206) ...at net.sf.basedb.util.JarClassLoader.(JarClassLoader.java:144) ...at net.sf.basedb.util.JarClassLoader.getInstance(JarClassLoader.java:85) ...at PluginDefinition.newInstance(PluginDefinition.java:919) ...at PluginDefinition.loadPluginInformation(PluginDefinition.java:1026) ...at PluginDefinition.getNew(PluginDefinition.java:140) ...at org.apache.jsp.admin.plugindefinitions.index_jsp._jspService(index_jsp.java:160) ...at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) ...at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) ...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334) ...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314) ...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264) ...at
Re: [base] downloading files
sorry.. i'm careless.. i called my jar file DownloadFilePlugins.jar instead of DownloadFilePlugin.jar and it couldn't find / load it but it threw a pretty impressive stack trace.. -keith Keith Ching wrote: Hi, I am getting a peculiar stack trace upon trying to define the plugin. do you think it could be caused by using Base2.2 classes in a Base2.1.1 codebase? i tried to include the revised classes in the plugin JAR.. but i suppose this probably doesn't work.. i had to include Base2.2 versions of net.sf.basedb.core.Path net.sf.basedb.util.FileExportOutputStream net.sf.basedb.core.plugin.AbstractExporterPlugin net.sf.basedb.core.plugin.ExportOutputStream net.sf.basedb.core.plugin.ImmediateDownloadExporter do you think it would be safe to just replace these files in 2.1.1 and rebuild it? -keith - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ The BASE general discussion mailing list basedb-users@lists.sourceforge.net unsubscribe: send a mail with subject unsubscribe to [EMAIL PROTECTED]