Changeset 19 for trunk/grails-app


Ignore:
Timestamp:
Mar 8, 2011, 1:17:45 PM (9 years ago)
Author:
robert@…
Message:

Resolved session timeouts as mentioned in #20

Location:
trunk/grails-app
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/nl/tno/metagenomics/RunController.groovy

    r18 r19  
    542542
    543543                // Export the metadata
    544                 response.setHeader "Content-disposition", "attachment; filename=${name}.xls"
    545544                try {
    546545                        // The export functionality needs a assaysSample-tag list, but it
     
    550549                                tags << [assaySampleId: assaySample.id, sampleName: assaySample.sample.name, assayName: assaySample.assay.name, studyName: assaySample.assay.study.name, tag: "-"]
    551550                        }
    552                         sampleExcelService.exportExcelSampleData( assaySamples.unique(), tags, response.getOutputStream() );
     551                        response.setHeader "Content-disposition", "attachment; filename=${name}.xls"
     552                        if( !sampleExcelService.exportExcelSampleData( assaySamples.unique(), tags, response.getOutputStream() ) ) {
     553                                flash.error = "An error occurred while fetching sample data. Maybe the session has timed out.";
     554                                response.setHeader( "Content-disposition", "" );
     555                                redirect( action: "index" );
     556                        }
    553557                        response.outputStream.flush();
    554558                } catch( Exception e ) {
    555559                        log.error( "Exception occurred during export of sequences. Probably the user has cancelled the download." );
    556                         throw e
    557560                }
    558561        }
  • trunk/grails-app/services/nl/tno/metagenomics/SampleExcelService.groovy

    r18 r19  
    238238                } catch( Exception e ) {
    239239                        log.error "Exception occurred while fetching sample data from gscf: " + e.getMessage();
    240                         return;
     240                        return false;
    241241                }
    242242               
     
    327327                // Write the data to the output stream
    328328                wb.write( stream );
     329               
     330                return true;
    329331        }
    330332       
  • trunk/grails-app/services/nl/tno/metagenomics/integration/GscfService.groovy

    r18 r19  
    33import grails.converters.JSON
    44import org.codehaus.groovy.grails.commons.ConfigurationHolder
     5import org.springframework.web.context.request.RequestContextHolder;
    56
    67/**
     
    340341                        case 403:       // Incorrect authentication
    341342                                println "Not authenticated (" + addr + "): " + connection.responseCode
     343                               
     344                                // The user is logged in to the metagenomics module, but not to GSCF. We log the user out of the module
     345                                RequestContextHolder.currentRequestAttributes().getSession().user = null
     346                               
    342347                                throw new NotAuthenticatedException( "User is not authenticated with GSCF." );
    343348                                break;
Note: See TracChangeset for help on using the changeset viewer.