From: Jose C. <jos...@us...> - 2009-08-10 08:54:03
|
Update of /cvsroot/gbif/portal-web/src/main/java/org/gbif/portal/web/controller/occurrence In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14331/src/main/java/org/gbif/portal/web/controller/occurrence Modified Files: OccurrenceController.java Log Message: increased "user experience" when downloading original record form data provider Index: OccurrenceController.java =================================================================== RCS file: /cvsroot/gbif/portal-web/src/main/java/org/gbif/portal/web/controller/occurrence/OccurrenceController.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** OccurrenceController.java 3 Jul 2009 08:53:23 -0000 1.46 --- OccurrenceController.java 10 Aug 2009 08:53:52 -0000 1.47 *************** *** 86,92 **** /** the cell width for the bounding box links */ protected int cellWidth; ! /** Raw XML message view */ protected String providerXmlSubview = "providerMessage"; /** Raw XML message view */ protected String requestXmlSubview = "providerRequest"; /** large map view */ --- 86,96 ---- /** the cell width for the bounding box links */ protected int cellWidth; ! /** Preparing provider request message view */ protected String providerXmlSubview = "providerMessage"; /** Raw XML message view */ + protected String providerXmlRawView = "rawProviderMessage"; + /** Raw XML message view */ + protected String providerUrlView = "providerUrl"; + /** Raw XML message view */ protected String requestXmlSubview = "providerRequest"; /** large map view */ *************** *** 94,97 **** --- 98,103 ---- /** Raw XML message view */ protected String rawXmlStylesheet = "rawXml.jsp"; + /** Provider not available view */ + protected String providerOffline = "providerOffline"; /** The results limit for a distinct query */ *************** *** 154,157 **** --- 160,169 ---- return retrieveProviderMessage(occurrenceRecordKey, properties, request, response); } + if(view.equals(providerUrlView)) { + return retrieveProviderUrl(occurrenceRecordKey, properties, request, response); + } + if(view.equals(providerXmlRawView)) { + return retrieveRawProviderMessage(occurrenceRecordKey, properties, request, response); + } if(view.equals(requestXmlSubview)){ return retrieveProviderRequest(occurrenceRecordKey, properties, request, response); *************** *** 196,202 **** return redirectToDefaultView(); } /** ! * Retrieve and render the original provider message. * @param occurrenceRecordKey * @param request --- 208,229 ---- return redirectToDefaultView(); } + + /** + * Retrieves the URL that is going to be used to request the original data from the provider + * @param occurrenceRecordKey + * @param request + * @param response + * @return + */ + public ModelAndView retrieveProviderUrl(String occurrenceRecordKey, Map<String, String>properties, HttpServletRequest request, HttpServletResponse response) { + + ModelAndView mav = resolveAndCreateView(properties, request, false); + mav.addObject("occurrenceRecordKey", occurrenceRecordKey); + return mav; + } + /** ! * Prepare the request for the data resource * @param occurrenceRecordKey * @param request *************** *** 217,223 **** } catch (Exception e) { logger.debug(e.getMessage(), e); } ! return null; ! } /** --- 244,270 ---- } catch (Exception e) { logger.debug(e.getMessage(), e); + ModelAndView mav = new ModelAndView(providerOffline); + mav.addObject("occurrenceRecordKey", occurrenceRecordKey); + return mav; } ! return null; ! ! ! ! } ! ! /** ! * Retrieve and render the original provider message. ! * @param occurrenceRecordKey ! * @param request ! * @param response ! * @return ! */ ! public ModelAndView retrieveRawProviderMessage(String occurrenceRecordKey, Map<String, String>properties, HttpServletRequest request, HttpServletResponse response) { ! ! ModelAndView mav = resolveAndCreateView(properties, request, false); ! mav.addObject("occurrenceRecordKey", occurrenceRecordKey); ! return mav; ! } /** |