List of usage examples for org.apache.commons.httpclient HttpMethod getResponseBodyAsString
public abstract String getResponseBodyAsString() throws IOException;
From source file:net.sf.ehcache.constructs.web.filter.CachingFilterTest.java
/** * Servlets and JSPs can send content even when the response is set to no content. * In this case there should not be a body but there is. Orion seems to kill the body * after is has left the Servlet filter chain. To avoid wget going into an inifinite * retry loop, and presumably some other web clients, the content length should be 0 * and the body 0.//from w w w.j a v a 2 s. com * <p/> * Manual Test: wget -d --server-response --timestamping --header='If-modified-Since: Fri, 13 May 3006 23:54:18 GMT' --header='Accept-Encoding: gzip' http://localhost:9080/empty_caching_filter/SC_NO_CONTENT.jsp */ public void testNoContentJSPGzipFilter() throws Exception { String url = "http://localhost:9080/empty_caching_filter/SC_NO_CONTENT.jsp"; HttpClient httpClient = new HttpClient(); HttpMethod httpMethod = new GetMethod(url); httpMethod.addRequestHeader("If-modified-Since", "Fri, 13 May 3006 23:54:18 GMT"); httpMethod.addRequestHeader("Accept-Encoding", "gzip"); int responseCode = httpClient.executeMethod(httpMethod); assertEquals(HttpURLConnection.HTTP_NO_CONTENT, responseCode); String responseBody = httpMethod.getResponseBodyAsString(); assertEquals(null, responseBody); assertNull(httpMethod.getResponseHeader("Content-Encoding")); assertNotNull(httpMethod.getResponseHeader("Last-Modified").getValue()); checkNullOrZeroContentLength(httpMethod); }
From source file:net.sf.ehcache.constructs.web.filter.CachingFilterTest.java
/** * Servlets and JSPs can send content even when the response is set to no content. * In this case there should not be a body but there is. Orion seems to kill the body * after is has left the Servlet filter chain. To avoid wget going into an inifinite * retry loop, and presumably some other web clients, the content length should be 0 * and the body 0./* w w w . ja v a 2s . co m*/ * <p/> * wget -d --server-response --timestamping --header='If-modified-Since: Fri, 13 May 3006 23:54:18 GMT' --header='Accept-Encoding: gzip' http://localhost:9080/empty_caching_filter/SC_NOT_MODIFIED.jsp */ public void testNotModifiedJSPGzipFilter() throws Exception { String url = "http://localhost:9080/empty_caching_filter/SC_NOT_MODIFIED.jsp"; HttpClient httpClient = new HttpClient(); HttpMethod httpMethod = new GetMethod(url); httpMethod.addRequestHeader("If-modified-Since", "Fri, 13 May 3006 23:54:18 GMT"); httpMethod.addRequestHeader("Accept-Encoding", "gzip"); int responseCode = httpClient.executeMethod(httpMethod); assertEquals(HttpURLConnection.HTTP_NOT_MODIFIED, responseCode); String responseBody = httpMethod.getResponseBodyAsString(); assertEquals(null, responseBody); assertNull(httpMethod.getResponseHeader("Content-Encoding")); assertNotNull(httpMethod.getResponseHeader("Last-Modified").getValue()); checkNullOrZeroContentLength(httpMethod); }
From source file:com.delmar.station.service.impl.WFDetailServiceImpl.java
public String updateDcmsFcrDate(EDIResponseInfo edirInfo, String trustFileCode) { String resultMessage = "success"; Date date = new Date(); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd"); String currentDate = sf.format(date); try {/* w w w . ja v a2 s . c om*/ date = sf.parse(edirInfo.getInDate()); currentDate = sf.format(date); } catch (ParseException e1) { e1.printStackTrace(); } try { EDIResponseInfo resultEDIResponseInfo = ediResponseInfoService.getEDIRByTrustFileCode(trustFileCode); // Booking IDCargoProDcms????bookingID if (StringUtil.isNotEmpty(resultEDIResponseInfo.getCsReferenceNo())) { Map<String, String> params = new HashMap<String, String>(); params.put("id", resultEDIResponseInfo.getCsReferenceNo()); params.put("fcrDate", currentDate); params.put("remark", edirInfo.getResponseDesc()); HttpClient httpClient = null; httpClient.getParams().setAuthenticationPreemptive(true); // ? Credentials credentials = new UsernamePasswordCredentials("wsuserchina", "ws1sGreat"); httpClient.getState().setCredentials(AuthScope.ANY, credentials); HttpMethod method = buildPostMethod( "https://www.delmarcargo.com/cms/api/bookingservice/updateBookingFcrDate", params); int statusCode = httpClient.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { throw new HttpException(method.getStatusText()); } String xmlResult = method.getResponseBodyAsString(); method.releaseConnection(); // StringReader xmlReader = new StringReader(xmlResult); // ?SAX ? InputSource ?? XML InputSource xmlSource = new InputSource(xmlReader); // SAXBuilder SAXReader builder = new SAXReader(); // ?SAXDocument Document doc = builder.read(xmlSource); // Element root = doc.getRootElement(); // BODY Element resultStatusCode = root.element("ServiceResponse").element("statusCode"); // ???? if ("200".equals(resultStatusCode.getText())) { // add edirInfo.setEdiType("DCMS_FCRDATE"); edirInfo.setEdiStatus("1"); edirInfo.setCsReferenceNo(resultEDIResponseInfo.getCsReferenceNo());// set Booking Id edirInfo.setEdiAction("NEW"); edirInfo.setEdiStatus("1"); edirInfo.setBatchNo("0"); edirInfo.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); edirInfo.setUpdateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); edirInfo.setBeUse(0); ediResponseInfoService.saveOrUpdate(edirInfo); ediResponseInfoService.updateTrustFileInfoFCRDate(currentDate, edirInfo.getTrustFileCode()); } else if ("405".equals(resultStatusCode.getText())) { Element resultText = root.element("ServiceResponse").element("description"); resultMessage = resultText.getText(); // add edirInfo.setEdiType("DCMS_FCRDATE"); edirInfo.setEdiStatus("11"); edirInfo.setCsReferenceNo(resultEDIResponseInfo.getCsReferenceNo());// set Booking Id edirInfo.setEdiAction("NEW"); edirInfo.setEdiStatus("1"); edirInfo.setBatchNo("0"); edirInfo.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); edirInfo.setUpdateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); edirInfo.setBeUse(0); ediResponseInfoService.saveOrUpdate(edirInfo); } else { Element resultText = root.element("ServiceResponse").element("description"); resultMessage = resultText.getText(); } } else { resultMessage = "Booking IDCargoProDcms?"; } } catch (Exception e) { e.printStackTrace(); resultMessage = "Modify Dcms Fcr Date have Exception"; return resultMessage; } return resultMessage; }
From source file:com.zimbra.qa.unittest.TestWsdlServlet.java
String doWsdlServletRequest(String wsdlUrl, boolean admin, int expectedCode) throws Exception { Server localServer = Provisioning.getInstance().getLocalServer(); String protoHostPort;/*from ww w .ja va 2s.co m*/ if (admin) protoHostPort = "https://localhost:" + localServer.getIntAttr(Provisioning.A_zimbraAdminPort, 0); else protoHostPort = "http://localhost:" + localServer.getIntAttr(Provisioning.A_zimbraMailPort, 0); String url = protoHostPort + wsdlUrl; HttpClient client = new HttpClient(); HttpMethod method = new GetMethod(url); try { int respCode = HttpClientUtil.executeMethod(client, method); int statusCode = method.getStatusCode(); String statusLine = method.getStatusLine().toString(); ZimbraLog.test.debug("respCode=" + respCode); ZimbraLog.test.debug("statusCode=" + statusCode); ZimbraLog.test.debug("statusLine=" + statusLine); assertTrue("Response code", respCode == expectedCode); assertTrue("Status code", statusCode == expectedCode); Header[] respHeaders = method.getResponseHeaders(); for (int i = 0; i < respHeaders.length; i++) { String header = respHeaders[i].toString(); ZimbraLog.test.debug("ResponseHeader:" + header); } String respBody = method.getResponseBodyAsString(); // ZimbraLog.test.debug("Response Body:" + respBody); return respBody; } catch (HttpException e) { fail("Unexpected HttpException" + e); throw e; } catch (IOException e) { fail("Unexpected IOException" + e); throw e; } finally { method.releaseConnection(); } }
From source file:edu.indiana.d2i.htrc.portal.HTRCPersistenceAPIClient.java
/** * Get Volum details from solr meta data instance. Here it adds '\' character before the ':'. * @param volId//from w w w. j a va 2 s .co m * @return VolumeDetailsBean * @throws IOException */ public VolumeDetailsBean getVolumeDetails(String volId) throws IOException { String volumeId; if (volId.contains(":")) { volumeId = volId.substring(0, volId.indexOf(":")) + "\\" + volId.substring(volId.indexOf(":")); } else { volumeId = volId; } String volumeDetailsQueryUrl = PlayConfWrapper.solrMetaQueryUrl() + "id:" + URLEncoder.encode(volumeId, "UTF-8") + "&fl=title,author,htrc_genderMale,htrc_genderFemale,htrc_genderUnknown,htrc_pageCount,htrc_wordCount"; VolumeDetailsBean volDetails = new VolumeDetailsBean(); if (log.isDebugEnabled()) { log.debug(volumeDetailsQueryUrl); } HttpClient httpClient = new HttpClient(); HttpMethod method = new GetMethod(volumeDetailsQueryUrl); method.setFollowRedirects(true); try { httpClient.executeMethod(method); volDetails.setVolumeId(volId); if (method.getStatusCode() == 200 && !method.getResponseBodyAsString().contains("<warn>RESPONSE CODE: 400</warn>")) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = dbf.newDocumentBuilder(); Document dom = documentBuilder.parse(method.getResponseBodyAsStream()); NodeList result = dom.getElementsByTagName("result"); NodeList arrays = ((org.w3c.dom.Element) result.item(0)).getElementsByTagName("arr"); NodeList integers = ((org.w3c.dom.Element) result.item(0)).getElementsByTagName("int"); NodeList longIntegers = ((org.w3c.dom.Element) result.item(0)).getElementsByTagName("long"); for (int i = 0; i < arrays.getLength(); i++) { org.w3c.dom.Element arr = (org.w3c.dom.Element) arrays.item(i); if (arr.hasAttribute("name") && arr.getAttribute("name").equals("title")) { NodeList strElements = arr.getElementsByTagName("str"); volDetails.setTitle((strElements.item(0)).getTextContent()); } else if (arr.hasAttribute("name") && arr.getAttribute("name").equals("htrc_genderMale")) { NodeList strElements = arr.getElementsByTagName("str"); String maleAuthor = ""; for (int j = 0; j < strElements.getLength(); j++) { org.w3c.dom.Element str = (org.w3c.dom.Element) strElements.item(j); if (j != strElements.getLength() - 1) { maleAuthor += str.getTextContent(); } else { maleAuthor += str.getTextContent(); } } volDetails.setMaleAuthor(maleAuthor); } else if (arr.hasAttribute("name") && arr.getAttribute("name").equals("htrc_genderFemale")) { NodeList strElements = arr.getElementsByTagName("str"); String femaleAuthor = ""; for (int j = 0; j < strElements.getLength(); j++) { org.w3c.dom.Element str = (org.w3c.dom.Element) strElements.item(j); if (j != strElements.getLength() - 1) { femaleAuthor += str.getTextContent(); } else { femaleAuthor += str.getTextContent(); } } volDetails.setFemaleAuthor(femaleAuthor); } else if (arr.hasAttribute("name") && arr.getAttribute("name").equals("htrc_genderUnknown")) { NodeList strElements = arr.getElementsByTagName("str"); String genderUnknownAuthor = ""; for (int j = 0; j < strElements.getLength(); j++) { org.w3c.dom.Element str = (org.w3c.dom.Element) strElements.item(j); if (j != strElements.getLength() - 1) { genderUnknownAuthor += str.getTextContent(); } else { genderUnknownAuthor += str.getTextContent(); } } volDetails.setGenderUnkownAuthor(genderUnknownAuthor); } } for (int i = 0; i < integers.getLength(); i++) { org.w3c.dom.Element integer = (org.w3c.dom.Element) integers.item(i); if (integer.hasAttribute("name") && integer.getAttribute("name").equals("htrc_pageCount")) { String pageCount = integer.getTextContent(); volDetails.setPageCount(pageCount); } } for (int i = 0; i < longIntegers.getLength(); i++) { org.w3c.dom.Element longInteger = (org.w3c.dom.Element) longIntegers.item(0); if (longInteger.hasAttribute("name") && longInteger.getAttribute("name").equals("htrc_wordCount")) { String wordCount = longInteger.getTextContent(); volDetails.setWordCount(wordCount); } } } else { volDetails.setTitle("Cannot retrieve volume details."); log.warn("Cannot retrieve details for volume id: " + volId + " Response body: \n" + method.getResponseBodyAsString()); } } catch (SAXParseException e) { log.error("Error while parsing volume details for volume: " + volId + " query url: " + volumeDetailsQueryUrl + " status code: " + method.getStatusCode(), e); volDetails.setTitle("Cannot parse volume details."); } catch (ParserConfigurationException e) { log.error("Unrecoverable error while parsing volume details.", e); log.error("Error while parsing volume details for volume: " + volId + " query url: " + volumeDetailsQueryUrl + " status code: " + method.getStatusCode(), e); throw new RuntimeException("Unrecoverable error while parsing volume details.", e); } catch (SAXException e) { log.error("Error while parsing volume details for volume: " + volId + " query url: " + volumeDetailsQueryUrl + " status code: " + method.getStatusCode(), e); volDetails.setTitle("Cannot parse volume details."); } return volDetails; }
From source file:com.ms.commons.test.classloader.util.SimpleAntxLoader.java
protected int readHttpResource(String svnUrl, String file, StringBuilder outContent) { if ((svnUrl != null) && svnUrl.startsWith("/") && (new File(svnUrl + "/" + file)).exists()) { try {//from w w w . j ava 2 s . c om outContent.append(FileUtils.readFileToString(new File(svnUrl + "/" + file))); } catch (IOException e) { throw new RuntimeException(e); } return 200; } SvnUrl url = SvnUrl.parse(svnUrl + file); if (url == null) { return -1; } int cacheStatus = readCacheFile(svnUrl, file, outContent); if (cacheStatus == 200) { return cacheStatus; } this.preparePassword(url); Credentials credentials = new UsernamePasswordCredentials(url.getUserName(), this.password); AuthScope authScope = new AuthScope(url.getHost(), 80, AuthScope.ANY_REALM); HttpClient client = new HttpClient(); client.getState().setCredentials(authScope, credentials); System.out.println("Read HTTP resource:" + url.getFullUrl()); client.getParams().setConnectionManagerTimeout(30 * 1000); client.getParams().setSoTimeout(30 * 1000); HttpMethod httpMethod = new GetMethod(url.getFullUrl()); int statusCode = 0; try { statusCode = client.executeMethod(httpMethod); } catch (HttpException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if (statusCode == 200) { String content = null; try { content = httpMethod.getResponseBodyAsString(); outContent.append(content); } catch (IOException e) { e.printStackTrace(); } writeCacheFile(svnUrl, file, outContent.toString()); } return statusCode; }
From source file:net.sf.ehcache.constructs.web.filter.CachingFilterTest.java
/** * A 0 length body should give a 0 length nongzipped body and content length * Manual Test: wget -d --server-response --timestamping --header='If-modified-Since: Fri, 13 May 3006 23:54:18 GMT' --header='Accept-Encoding: gzip' http://localhost:9080/empty_caching_filter/empty.html *//*ww w. j av a 2 s . com*/ public void testIfModifiedZeroLengthHTML() throws Exception { String url = "http://localhost:9080/empty_caching_filter/empty.html"; HttpClient httpClient = new HttpClient(); HttpMethod httpMethod = new GetMethod(url); httpMethod.addRequestHeader("If-modified-Since", "Fri, 13 May 3006 23:54:18 GMT"); httpMethod.addRequestHeader("Accept-Encoding", "gzip"); int responseCode = httpClient.executeMethod(httpMethod); assertTrue( HttpURLConnection.HTTP_OK == responseCode || HttpURLConnection.HTTP_NOT_MODIFIED == responseCode); String responseBody = httpMethod.getResponseBodyAsString(); assertTrue("".equals(responseBody) || null == responseBody); checkNullOrZeroContentLength(httpMethod); }
From source file:com.worldline.easycukes.rest.client.RestService.java
/** * Allows to send a GET request to the path passed using the http client * * @param path the path on which the request should be sent *///from w w w . j av a 2 s .c o m public void sendGetRequest(final String path) throws Exception { String fullpath = path; if (path.startsWith("/")) fullpath = baseUrl + path; log.info("Sending GET request to " + fullpath); final HttpMethod method = new GetMethod(fullpath); try { for (final Map.Entry<String, String> header : requestHeaders.entrySet()) method.setRequestHeader(header.getKey(), header.getValue()); final int statusCode = httpClient.executeMethod(method); response = new ResponseWrapper(method.getResponseBodyAsString(), method.getResponseHeaders(), statusCode); } catch (final IOException e) { log.error(e.getMessage(), e); throw e; } finally { method.releaseConnection(); } }
From source file:net.sf.ehcache.constructs.web.filter.SimpleCachingHeadersPageCachingFilterTest.java
/** * HEAD methods return an empty response body. If a HEAD request populates * a cache and then a GET follorws, a blank page will result. * This test ensures that the SimplePageCachingFilter implements calculateKey * properly to avoid this problem.//from w w w . j ava 2 s.c o m */ @Test public void testHeadThenGetOnCachedPage() throws Exception { HttpClient httpClient = new HttpClient(); HttpMethod httpMethod = new HeadMethod(buildUrl(cachedPageUrl)); int responseCode = httpClient.executeMethod(httpMethod); //httpclient follows redirects, so gets the home page. assertEquals(HttpURLConnection.HTTP_OK, responseCode); String responseBody = httpMethod.getResponseBodyAsString(); assertNull(responseBody); assertNull(httpMethod.getResponseHeader("Content-Encoding")); httpMethod = new GetMethod(buildUrl(cachedPageUrl)); responseCode = httpClient.executeMethod(httpMethod); responseBody = httpMethod.getResponseBodyAsString(); assertNotNull(responseBody); }
From source file:edu.du.penrose.systems.fedoraProxy.web.bus.OaiAggregator.java
/** * Retrieve all sets for a particular aggregate set from an AggregateList object. * <br>/*from w w w . j a v a 2 s . co m*/ * NOTE: I am using HttpMethod.getResponseBodyAsString() instead of HttpMethod.getResponseBodyAsStream(), to make it easy to parse, * unfortunately it reads the entire response at once. Is this a potential memory overflow? Since we are reading text not large * binary files, such as a pdf or an image, hopefully we be OK. TBD * <br><br> * All resumption token values are removed, since fedoraProxy does not know how to handle a request that uses them (in the instance * of a restart due to a network error) * * The response if of type... * * <?xml version="1.0" encoding="UTF-8"?> * <OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> * <responseDate>2011-06-06T10:54:51Z</responseDate> * * <request verb="ListRecords" metadataPrefix="oai_dc" resumptionToken="">http://adr.coalliance.org/codu/fez/oai.php</request> * <ListRecords> * <record> * <header> * <identifier>oai:adr.coalliance.org:codu:55689</identifier> * <datestamp>2010-09-20T14:09:34Z</datestamp> * <setSpec>oai:adr.coalliance.org:codu:55690</setSpec> * </header> * <metadata> * <oai_dc:dc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/"> * <dc:title>University of Denver Alumna A. Helen Anderson</dc:title> * <dc:identifier>http://adr.coalliance.org/codu/fez/view/codu:55689</dc:identifier> * <dc:description>B.A., 1914; M.A., 1931</dc:description> * <dc:type>DU Image</dc:type> * <dc:date>Array</dc:date> * <dc:subject>Education</dc:subject> * <dc:subject>School integration</dc:subject> * <dc:subject>Busing for school integration</dc:subject> * <dc:publisher>University of Denver</dc:publisher> * <dc:relation>A. Helen Anderson Papers</dc:relation> * <dc:format>http://adr.coalliance.org/codu/fez/eserv/codu:55689/U201.02.0002.0023.00002.tif</dc:format> * <dc:rights>Copyright restrictions may apply. User is responsible for all copyright compliance.</dc:rights> * </oai_dc:dc> * </metadata> * </record> * <record> * .......More aggregate records. * <record> * <resumptionToken></resumptionToken> * </ListRecords> * </OAI-PMH> * * @param verb the oai verb * @param response * @param authenicate * @param aggregateSetName * @param metadataPrefix * @param forceNewDate if true the oai <datestamp> is set with todays date, to force retrieval. * @throws IOException */ private void executeOaiListAggregateSetRecords(String verb, HttpServletResponse response, boolean authenicate, String aggregateSetName, String metadataPrefix, boolean forceNewDate) throws IOException { AggregateList aggregateSets = new AggregateList(); AggregateSet setToRetrieve = aggregateSets.getAggregateSet(aggregateSetName); if (setToRetrieve == null) { return; // TBD this will create an error. return empty set? } Iterator<SingleSet> setIterator = setToRetrieve.getIterator(); HttpClient theClient = new HttpClient(); boolean firstRecordOfFirstSet = true; String header = null; String footer = null; HttpMethod method = null; try { while (setIterator.hasNext()) { SingleSet singleSet = setIterator.next(); method = new GetMethod( ADR_OAI_GET_URL + "?verb=" + verb + "&set=" + FedoraProxyConstants.ADR_OAI_SET_SPEC + singleSet.getUniqueID() + "&metadataPrefix=" + metadataPrefix); theClient.executeMethod(method); String recordList = method.getResponseBodyAsString(); int listRecordTagLoc = recordList.toLowerCase().indexOf("<listrecords>"); int listRecordEndTagLoc = recordList.toLowerCase().indexOf("</listrecords>"); // int resumptionTagLoc = recordList.toLowerCase().indexOf( "<resumptiontoken>" ); // int resumptionEndTagLoc = recordList.toLowerCase().indexOf( "<resumptiontoken>" ); if (listRecordTagLoc < 0 || listRecordEndTagLoc < 0) { // TBD need to log error String errorMsg = "Error retieving: " + singleSet.getName(); System.out.println(errorMsg); continue; // abort and move attempt next set. } String justTheRecords = recordList.substring(listRecordTagLoc + 14, listRecordEndTagLoc); justTheRecords = justTheRecords.substring(0, justTheRecords.indexOf("<resumptionToken>")); if (firstRecordOfFirstSet) { header = recordList.substring(0, listRecordTagLoc + 14); // int verbLoc = header.indexOf( "<verb=" ); // int verbEndLod = header.indexOf( '>', verbLoc ); // int requestEndLod = header.indexOf( "</request>", verbEndLod ); // String textToReplace = header.substring( verbEndLod+1, requestEndLod); // // header.replace( textToReplace, fedoraProxyConstants.FedoraProxyOAI_URL ); // TBD this will this change! // see above notes about <resumptionToken> footer = "<resumptionToken></resumptionToken>\n" + recordList.substring(listRecordEndTagLoc); firstRecordOfFirstSet = false; response.getWriter().print(header); System.out.println(header); } if (forceNewDate) { justTheRecords = justTheRecords.replaceAll( "<datestamp>\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\dZ</datestamp>", "<datestamp>2011-08-04T00:00:00Z</datestamp>"); } response.getWriter().print(justTheRecords); System.out.println(justTheRecords); } System.out.println(footer); response.getWriter().print(footer); } catch (Exception e) { response.sendError(404); } finally { method.releaseConnection(); } }