Changeset 1098


Ignore:
Timestamp:
May 28, 2009, 11:10:01 AM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #220: MeV doesn't download files correctly

Added the file id and last update time to the exported filename. This seems make the cache work as expected and cause a re-download if the file has been updated.

Location:
extensions/net.sf.basedb.mev/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.mev/trunk/resources/mev_jnlp.jsp

    r1083 r1098  
    3030  session="false"
    3131  import="net.sf.basedb.core.SessionControl"
     32  import="net.sf.basedb.core.DbControl"
     33  import="net.sf.basedb.core.BioAssaySet"
     34  import="net.sf.basedb.core.File"
     35  import="net.sf.basedb.core.FileStoreUtil"
     36  import="net.sf.basedb.core.ItemNotFoundException"
    3237  import="net.sf.basedb.clients.web.Base"
    3338  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
     
    4853final String fullHomeUrl = scheme + "://" + serverName + ":" + serverPort + homeUrl;
    4954final int jvmMaxMemory = Values.getInt(sc.getUserClientSetting("net.sf.basedb.mev.launchmev.jvm.maxmemory"), 512);
     55String extraFileName = "";
     56DbControl dc = sc.newDbControl();
     57try
     58{
     59  BioAssaySet bas = BioAssaySet.getById(dc, bioAssaySetId);
     60  File mevFile = FileStoreUtil.getDataFile(dc, bas, fileType);
     61 
     62  if (mevFile == null)
     63  {
     64    throw new ItemNotFoundException("No " + fileType + " file found on bioassay set: " +
     65      bas.getName());
     66  }
     67  extraFileName = "-" + mevFile.getId() + "." + mevFile.getLastUpdate().getTime();
     68}
     69finally
     70{
     71  if (dc != null) dc.close();
     72}
    5073out.clearBuffer();
    5174%><?xml version="1.0" encoding="UTF-8"?>
     
    125148    <argument><%=mevFileType%></argument>
    126149    <argument>-fileUrl</argument>
    127     <argument><%=fullHomeUrl%>/MevExport/<%=ID%>/<%=bioAssaySetId%>/<%=fileType%>.servlet</argument>
     150    <argument><%=fullHomeUrl%>/MevExport/<%=ID%>/<%=bioAssaySetId%>/<%=fileType%><%=extraFileName%>.servlet</argument>
    128151  </application-desc>
    129152</jnlp>
  • extensions/net.sf.basedb.mev/trunk/src/net/sf/basedb/mev/servlet/MevExport.java

    r1083 r1098  
    7878      {
    7979        // Parameters are given as path: /ID/bioassayset_id/filetype
     80        // filetype may optionally end with '-some extra info'
    8081        String[] path = request.getPathInfo().split("/");
    8182        ID = path[path.length-3];
    8283        bioAssaySetId = Values.getInt(path[path.length-2]);
    8384        fileType = path[path.length-1];
     85        int extraInfo = fileType.lastIndexOf('-');
     86        if (extraInfo >= 0) fileType = fileType.substring(0, extraInfo);
    8487      }
    8588      final SessionControl sc = Application.getSessionControl(ID, request.getRemoteAddr());
     
    99102      OutputStream out = response.getOutputStream();
    100103      response.setContentType("text/plain");
     104      if (mevFile.getLastUpdate() != null)
     105      {
     106        response.setDateHeader("Last-Modified", mevFile.getLastUpdate().getTime());
     107      }
    101108      if (mevFile.getSize() < Integer.MAX_VALUE)
    102109      {
Note: See TracChangeset for help on using the changeset viewer.