Project

General

Profile

« Previous | Next » 

Revision 5652

Added by berkley about 14 years ago

changed date format a bit to get the parser to like it

View differences:

src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
222 222
    private static final String FUNCTION_NAME_UPDATE = "update";
223 223
    private static final String FUNCTION_NAME_GENERATE_MISSING_SYSTEM_METADATA = "generatemissingsystemmetadata";
224 224

  
225
    private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
225
    private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
226 226
    
227 227
    private ServletContext servletContext;
228 228
    private Logger logMetacat;
......
500 500
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SZ");
501 501
            response.addHeader("guid", guid);
502 502
            response.addHeader("checksum", dr.getDataONE_Checksum().getValue());
503
            response.addHeader("checksum_algorithm", dr.getDataONE_Checksum().getAlgorithm().name());
503 504
            response.addHeader("content_length", dr.getContent_Length() + "");
504 505
            response.addHeader("last_modified", dateFormat.format(dr.getLast_Modified()));
505 506
            response.addHeader("format", dr.getDataONE_ObjectFormat().toString());
......
970 971
            dateFormat2.setTimeZone(TimeZone.getTimeZone("GMT-0"));
971 972
            return dateFormat2.parse(date);
972 973
        }    
973
        
974
        /*System.out.println("Parsing date " + date);
975
        Date d = dateFormat.parse(date);
976
        
977
        if(date.endsWith("Z"))
978
        {
979
            Calendar lTime = Calendar.getInstance();
980
            lTime.setTime(d);
981
            Calendar zTime = Calendar.getInstance(TimeZone.getTimeZone("GMT-0"));
982
            zTime.set(Calendar.MONTH, lTime.get(Calendar.MONTH));
983
            zTime.set(Calendar.DATE, lTime.get(Calendar.DATE));
984
            zTime.set(Calendar.YEAR, lTime.get(Calendar.YEAR));
985
            zTime.set(Calendar.HOUR, lTime.get(Calendar.HOUR));
986
            zTime.set(Calendar.MINUTE, lTime.get(Calendar.MINUTE));
987
            zTime.set(Calendar.SECOND, lTime.get(Calendar.SECOND));
988
            
989
            System.out.println("date parsed to " + zTime.getTime());
990
            return zTime.getTime();
991
        }
992
        
993
        System.out.println("date parsed, but not converted. returned as " + d);
994
        return d;*/
995 974
    }
996 975

  
997 976
    /**
src/edu/ucsb/nceas/metacat/dataone/CrudService.java
102 102
    
103 103
    private String metacatUrl;
104 104
    
105
    private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SZ");
105
    private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
106 106

  
107 107
    /**
108 108
     * singleton accessor

Also available in: Unified diff