+ * {@code
+ * print getLeapSecondCountForUs2000( Units.us2000.parse('1972-01-01T00:00Z').doubleValue(Units.us2000) ) # results in 10
+ * print getLeapSecondCountForUs2000( Units.us2000.parse('2017-01-01T00:00Z').doubleValue(Units.us2000) ) # results in 37
+ * }
+ *
+ * This is intended to replicate the table https://cdf.gsfc.nasa.gov/html/CDFLeapSeconds.txt
+ * @param us2000 the time in us2000, which include the leap seconds.
+ * @return the number of leap seconds for the time.
+ * @throws IOException
+ */
+ public synchronized static int getLeapSecondCountForUs2000( double us2000 ) throws IOException {
+
+ if ( System.currentTimeMillis()-lastUpdateMillis > 86400000 ) {
+ updateLeapSeconds();
+ }
+
+ if ( us2000 < withoutLeapSeconds.get(0) ) {
+ return 0;
+ }
+
+ for ( int i=0; iPOST methods.
*
@@ -138,39 +164,93 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
throws ServletException, IOException {
MapGET and POST methods.
@@ -30,9 +30,24 @@ public class LandingServlet extends HttpServlet {
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
-
- response.sendRedirect( "index.jsp");
-
+ String url= request.getRequestURI();
+ if ( request.getQueryString()!=null ) {
+ response.sendRedirect( url.substring(0,url.length()-1) + "?" + request.getQueryString() );
+ } else {
+ if ( url.endsWith("/hapi/") ) {
+ response.sendRedirect( url.substring(0,url.length()-1) );
+ } else if ( url.endsWith("/hapi/hapi") ) {
+ response.sendRedirect( url.substring(0,url.length()-5) );
+ } else if ( !url.endsWith("/hapi") ) {
+ int lastSlash= url.lastIndexOf("/");
+ if ( lastSlash>-1 ) {
+ url= url.substring(0,lastSlash+1);
+ }
+ response.sendRedirect( url + "hapi" );
+ } else {
+ response.sendRedirect( url.substring(0,url.length()-1) );
+ }
+ }
}
// command is the command which is run on the command line, with start, stop,
+ * timeFormat, parameters, and HAPI_HOME macros.
+ * Where the control timeFormat is used to format the start and stop times. granuleSize
+ * will cause the calls to be broken up into separate calls for each step.
* @author jbf
*/
public class SpawnRecordSource implements HapiRecordSource {
@@ -47,6 +47,7 @@ public class SpawnRecordSource implements HapiRecordSource {
String timeFormat; // "$Y-$m-$d"
URITemplate uriTemplate;
int[] granuleSize;
+ SpawnRecordSourceIterator iter;
/**
* create a new SpawnRecordSource for the command. Examples include:%s
", title ) ); if ( exampleRange!=null ) { - out.println( String.format("[Info] [Data]", - ds.getString("id"), ds.getString("id"), exampleTimeRange ) ); + out.println( String.format("[Info] [Data]", + id, id, exampleTimeRange ) ); } else { - out.println( String.format("[Info] [Data]", - ds.getString("id"), ds.getString("id") ) ); + out.println( String.format("[Info] [Data]", + id, id ) ); } out.println(" "); @@ -140,7 +243,7 @@ if ( j>0 ) out.print(" "); try { String pname= parameters.getJSONObject(j).getString("name"); - out.print( String.format( "%s", ds.getString("id"), pname, exampleTimeRange, labels[j] ) ); + out.print( String.format( "%s", id, pname, exampleTimeRange, labels[j] ) ); if ( j>0 && sparklines ) { //sparklines // vap +hapi :https ://jfaden.net /HapiServerDemo /hapi ?id=?parameters=Temperature //?url=vap%2Bhapi%3Ahttps%3A%2F%2Fjfaden.net%2FHapiServerDemo%2Fhapi%3Fid%3DpoolTemperature%26timerange%3D2020-08-06&format=image%2Fpng&width=70&height=20&column=0%2C100%25&row=0%2C100%25&timeRange=2003-mar&renderType=&color=%23000000&symbolSize=&fillColor=%23aaaaff&foregroundColor=%23000000&backgroundColor=none @@ -152,13 +255,13 @@ ub.append("id="+id); ub.append("¶meters="+pname); ub.append("&timerange="+exampleRange.toString().replaceAll(" ","+") ); - sb.append( URLEncoder.encode(ub.toString()) ); + sb.append( URLEncoder.encode(ub.toString(),"US-ASCII") ); sb.append("&format=image%2Fpng"); sb.append("&width=70"); sb.append("&height=16"); sb.append("&row=0%25-1px%2C100%25"); sb.append("&column=0%25-1px%2C100%25"); - sb.append("&timerange="+URLEncoder.encode(exampleRange.toString()) ); + sb.append("&timerange="+URLEncoder.encode(exampleRange.toString(),"US-ASCII") ); out.print( ""); out.print( "%s
", title ) ); - out.println( "Unable to load info for dataset: "+id+", log files should notify the server host.
Unable to load info for dataset: "+id+", log files should notify the server host.
("+(dss.length()-numDataSets)+" additional dataset" + pps +" can be accessed using a HAPI client.)
" ); } @@ -191,8 +294,23 @@ } out.println("