@SuppressWarnings("rawtypes") private boolean retryFailedEntries(InputStream content, TrackingBytesArray data) throws IOException { ObjectReader r = mapper.reader(Map.class); JsonParser parser = mapper.getJsonFactory().createJsonParser(content); if (ParsingUtils.seek("items", new JacksonJsonParser(parser)) == null) { return false; } int entryToDeletePosition = 0; // head of the list for (Iterator<Map> iterator = r.readValues(parser); iterator.hasNext(); ) { Map map = iterator.next(); Map values = (Map) map.values().iterator().next(); String error = (String) values.get("error"); if (error != null) { // status - introduced in 1.0.RC1 Integer status = (Integer) values.get("status"); if (status != null && HttpStatus.canRetry(status) || error.contains("EsRejectedExecutionException")) { entryToDeletePosition++; } else { String message = (status != null ? String.format("%s(%s) - %s", HttpStatus.getText(status), status, error) : error); throw new IllegalStateException( String.format("Found unrecoverable error [%s]; Bailing out..", message)); } } else { data.remove(entryToDeletePosition); } } return entryToDeletePosition > 0; }
private HttpStatus commit(HttpUriRequest method) throws IOException { HttpStatus status; HttpClient httpclient = createHttpClient(); // reduce the TIME_WAIT // method.addHeader("Connection", "close"); if (method.getFirstHeader("Referer") == null) { URI uri = method.getURI(); method.setHeader("Referer", uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort()); } ; try { HttpResponse resp = execute(method, httpclient); status = new HttpStatus(resp.getStatusLine()); if (resp.getEntity() != null) { status.setMessage(EntityUtils.toString(resp.getEntity(), "UTF-8")); } } catch (IOException e) { // cancel the connection when the error happen method.abort(); throw e; } finally { HttpClientUtils.abortConnection(method, httpclient); } return status; }
/** * Gets the Enumerated value from the HTTP Status code * * @param code the HTTP Status code * @return The matching HttpStatus Enumerated value * @thows IllegalArgumentException if the HTTP Status is not a valid HTTP 1.1 status */ public static HttpStatus fromStatus(final int code) { for (final HttpStatus httpStatus : HttpStatus.values()) { if (httpStatus.getStatus() == code) { return httpStatus; } } throw new IllegalArgumentException("HTTP Status code: " + code + " is not recognised."); }
static { int versionLength = HttpVersion.HTTP_1_1.toString().length(); for (int i = 0; i < __preprepared.length; i++) { HttpStatus.Code code = HttpStatus.getCode(i); if (code == null) continue; String reason = code.getMessage(); byte[] line = new byte[versionLength + 5 + reason.length() + 2]; HttpVersion.HTTP_1_1.toBuffer().get(line, 0, versionLength); line[versionLength + 0] = ' '; line[versionLength + 1] = (byte) ('0' + i / 100); line[versionLength + 2] = (byte) ('0' + (i % 100) / 10); line[versionLength + 3] = (byte) ('0' + (i % 10)); line[versionLength + 4] = ' '; for (int j = 0; j < reason.length(); j++) line[versionLength + 5 + j] = (byte) reason.charAt(j); line[versionLength + 5 + reason.length()] = HttpTokens.CARRIAGE_RETURN; line[versionLength + 6 + reason.length()] = HttpTokens.LINE_FEED; __preprepared[i] = new PreparedResponse(); __preprepared[i]._schemeCode = Arrays.copyOfRange(line, 0, versionLength + 5); __preprepared[i]._reason = Arrays.copyOfRange(line, versionLength + 5, line.length - 2); __preprepared[i]._responseLine = line; } }
public void execute() { client = new HttpClient(); // if (requestType.equals("GET")) { // Instantiate a GET HTTP method // HttpMethod method = new GetMethod(apiUrl); // if (!authentication.equals("")) { // method.setRequestHeader("Authorization", "basic " + authentication); // } try { int statusCode = client.executeMethod(method); System.out.println("QueryString>>> " + apiUrl); System.out.println("Status Text>>>" + HttpStatus.getStatusText(statusCode)); // Get data as a String System.out.println(method.getResponseBodyAsString()); // OR as a byte array byte[] res = method.getResponseBody(); // write to file FileOutputStream fos = new FileOutputStream("donepage.html"); fos.write(res); // release connection method.releaseConnection(); } catch (IOException e) { e.printStackTrace(); } // } }
private String getRequest(String path) { logger.log(Level.FINEST, "PR-GET-REQUEST:" + path); HttpClient client = getHttpClient(); client.getState().setCredentials(AuthScope.ANY, credentials); GetMethod httpget = new GetMethod(path); client.getParams().setAuthenticationPreemptive(true); String response = null; int responseCode; try { responseCode = client.executeMethod(httpget); InputStream responseBodyAsStream = httpget.getResponseBodyAsStream(); StringWriter stringWriter = new StringWriter(); IOUtils.copy(responseBodyAsStream, stringWriter, "UTF-8"); response = stringWriter.toString(); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Failed to process PR get request; " + path, e); } logger.log(Level.FINEST, "PR-GET-RESPONSE:" + response); if (!validResponseCode(responseCode)) { logger.log(Level.SEVERE, "Failing to get response from Stash PR GET" + path); throw new RuntimeException( "Didn't get a 200 response from Stash PR GET! Response; '" + HttpStatus.getStatusText(responseCode) + "' with message; " + response); } return response; }
private static Series valueOf(HttpStatus status) { int seriesCode = status.value() / 100; for (Series series : values()) { if (series.value == seriesCode) { return series; } } throw new IllegalArgumentException("No matching constant for [" + status + "]"); }
/** utility */ private static String errorMessage(int code) { return /* (non-Javadoc) * @i18n.test * @org-mes="HTTP Status code: " + p[0] + ":" + p[1] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-592", new Object[] {new Integer(code), HttpStatus.getStatusText(code)}); }
private String postRequest(String path, String comment) throws UnsupportedEncodingException { logger.log(Level.FINEST, "PR-POST-REQUEST:" + path + " with: " + comment); HttpClient client = getHttpClient(); client.getState().setCredentials(AuthScope.ANY, credentials); PostMethod httppost = new PostMethod(path); ObjectNode node = mapper.getNodeFactory().objectNode(); node.put("text", comment); StringRequestEntity requestEntity = null; try { requestEntity = new StringRequestEntity(mapper.writeValueAsString(node), "application/json", "UTF-8"); } catch (IOException e) { e.printStackTrace(); } httppost.setRequestEntity(requestEntity); client.getParams().setAuthenticationPreemptive(true); String response = ""; int responseCode; try { responseCode = client.executeMethod(httppost); InputStream responseBodyAsStream = httppost.getResponseBodyAsStream(); StringWriter stringWriter = new StringWriter(); IOUtils.copy(responseBodyAsStream, stringWriter, "UTF-8"); response = stringWriter.toString(); logger.log(Level.FINEST, "API Request Response: " + response); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Failed to process PR get request; " + path, e); } logger.log(Level.FINEST, "PR-POST-RESPONSE:" + response); if (!validResponseCode(responseCode)) { logger.log(Level.SEVERE, "Failing to get response from Stash PR POST" + path); throw new RuntimeException( "Didn't get a 200 response from Stash PR POST! Response; '" + HttpStatus.getStatusText(responseCode) + "' with message; " + response); } return response; }
@Override public void deployItemsToTarget( String site, List<PublishingSyncItem> filteredItems, PublishingTargetItem target) throws ContentNotFoundForPublishingException, UploadFailedException { LOGGER.debug( "Start deploying items for site \"{0}\", target \"{1}\", number of items \"{2}\"", site, target.getName(), filteredItems.size()); URL requestUrl = null; try { requestUrl = new URL(target.getServerUrl()); } catch (MalformedURLException e) { LOGGER.error("Invalid server URL for target {0}", target.getName()); throw new UploadFailedException(site, target.getName(), target.getServerUrl(), e); } ByteArrayPartSource baps = null; PartSource metadataPart = null; StringPart stringPart = null; FilePart filePart = null; int numberOfBuckets = filteredItems.size() / target.getBucketSize() + 1; Iterator<PublishingSyncItem> iter = filteredItems.iterator(); LOGGER.debug( "Divide all deployment items into {0} bucket(s) for target {1}", numberOfBuckets, target.getName()); List<DeploymentEventItem> eventItems = new ArrayList<DeploymentEventItem>(); for (int bucketIndex = 0; bucketIndex < numberOfBuckets; bucketIndex++) { int cntFiles = 0; StringBuilder sbDeletedFiles = new StringBuilder(); List<Part> formParts = new ArrayList<Part>(); formParts.add(new StringPart(PASSWORD_REQUEST_PARAMETER, target.getPassword())); formParts.add(new StringPart(TARGET_REQUEST_PARAMETER, target.getTarget())); String siteId = target.getSiteId(); if (StringUtils.isEmpty(siteId)) { siteId = site; } formParts.add(new StringPart(SITE_REQUEST_PARAMETER, siteId)); LOGGER.debug( "Preparing deployment items (bucket {0}) for target {1}", bucketIndex + 1, target.getName()); int loopSize = (filteredItems.size() - (bucketIndex * target.getBucketSize()) > target.getBucketSize()) ? target.getBucketSize() : filteredItems.size() - bucketIndex * target.getBucketSize(); for (int j = 0; j < loopSize; j++) { if (iter.hasNext()) { PublishingSyncItem item = iter.next(); LOGGER.debug( "Parsing \"{0}\" , site \"{1}\"; for publishing on target \"{2}\"", item.getPath(), item.getSite(), target.getName()); DeploymentEventItem eventItem = new DeploymentEventItem(); eventItem.setSite(item.getSite()); eventItem.setPath(item.getPath()); eventItem.setUser(item.getUser()); eventItem.setDateTime(new Date()); if (item.getAction() == PublishingSyncItem.Action.DELETE) { eventItem.setState(DeploymentEventItem.STATE_DELETED); if (sbDeletedFiles.length() > 0) { sbDeletedFiles.append(FILES_SEPARATOR).append(item.getPath()); } else { sbDeletedFiles.append(item.getPath()); } if (item.getPath().endsWith("/" + _indexFile)) { sbDeletedFiles .append(FILES_SEPARATOR) .append(item.getPath().replace("/" + _indexFile, "")); } } else { if (item.getAction() == PublishingSyncItem.Action.NEW) { eventItem.setState(DeploymentEventItem.STATE_NEW); } else if (item.getAction() == PublishingSyncItem.Action.MOVE) { eventItem.setState(DeploymentEventItem.STATE_MOVED); } else { eventItem.setState(DeploymentEventItem.STATE_UPDATED); } LOGGER.debug("Get content for \"{0}\" , site \"{1}\"", item.getPath(), item.getSite()); InputStream input = _contentRepository.getContent(site, null, item.getEnvironment(), item.getPath()); try { if (input == null || input.available() < 0) { if (!_contentRepository.isFolder(site, item.getPath()) && _contentRepository.contentExists(site, item.getPath())) { baps = null; stringPart = null; filePart = null; formParts = null; throw new ContentNotFoundForPublishingException( site, target.getName(), item.getPath()); } else { // Content does not exist - skip deploying file continue; } } } catch (IOException err) { LOGGER.error( "Error reading input stream for content at path: " + item.getPath() + " site: " + item.getSite()); if (_contentRepository.contentExists(site, item.getPath())) { baps = null; stringPart = null; filePart = null; formParts = null; throw new ContentNotFoundForPublishingException( site, target.getName(), item.getPath()); } else { // Content does not exist - skip deploying file continue; } } String fileName = _contentRepository.getFilename(site, item.getPath()); byte[] byteArray = null; try { byteArray = IOUtils.toByteArray(input); } catch (IOException e) { LOGGER.error("Error while converting input stream to byte array", e); baps = null; stringPart = null; filePart = null; formParts = null; if (_contentRepository.contentExists(site, item.getPath())) { throw new ContentNotFoundForPublishingException( site, target.getName(), item.getPath()); } else { // Content does not exist - skip deploying file continue; } } finally { IOUtils.closeQuietly(input); input = null; } baps = new ByteArrayPartSource(fileName, byteArray); LOGGER.debug( "Create http request parameters for \"{0}\" , site \"{1}\"; publishing on target \"{2}\"", item.getPath(), item.getSite(), target.getName()); int idx = item.getPath().lastIndexOf("/"); String relativePath = item.getPath().substring(0, idx + 1) + fileName; stringPart = new StringPart(CONTENT_LOCATION_REQUEST_PARAMETER + cntFiles, relativePath); formParts.add(stringPart); filePart = new FilePart(CONTENT_FILE_REQUEST_PARAMETER + cntFiles, baps); formParts.add(filePart); if (item.getAction() == PublishingSyncItem.Action.MOVE) { if (item.getOldPath() != null && !item.getOldPath().equalsIgnoreCase(item.getPath())) { LOGGER.debug( "Add old path to be deleted for MOVE action (\"{0}\")", item.getOldPath()); eventItem.setOldPath(item.getOldPath()); if (sbDeletedFiles.length() > 0) { sbDeletedFiles.append(",").append(item.getOldPath()); } else { sbDeletedFiles.append(item.getOldPath()); } if (item.getOldPath().endsWith("/" + _indexFile)) { sbDeletedFiles .append(FILES_SEPARATOR) .append(item.getOldPath().replace("/" + _indexFile, "")); } } } if (target.isSendMetadata()) { LOGGER.debug( "Adding meta data for content \"{0}\" site \"{0}\"", item.getPath(), item.getSite()); InputStream metadataStream = null; try { metadataStream = _contentRepository.getMetadataStream(site, item.getPath()); metadataPart = new ByteArrayPartSource( fileName + ".meta", IOUtils.toByteArray(metadataStream)); formParts.add( new FilePart(METADATA_FILE_REQUEST_PARAMETER + cntFiles, metadataPart)); } catch (IOException e) { LOGGER.error("Error while creating input stream with content metadata", e); baps = null; stringPart = null; filePart = null; formParts = null; } finally { IOUtils.closeQuietly(metadataStream); metadataPart = null; } } } cntFiles++; eventItems.add(eventItem); } } if (sbDeletedFiles.length() > 0) { formParts.add(new StringPart(DELETED_FILES_REQUEST_PARAMETER, sbDeletedFiles.toString())); } LOGGER.debug( "Create http request to deploy bucket {0} for target {1}", bucketIndex + 1, target.getName()); PostMethod postMethod = null; HttpClient client = null; try { LOGGER.debug("Create HTTP Post Method"); postMethod = new PostMethod(requestUrl.toString()); postMethod.getParams().setBooleanParameter(HttpMethodParams.USE_EXPECT_CONTINUE, true); Part[] parts = new Part[formParts.size()]; for (int i = 0; i < formParts.size(); i++) parts[i] = formParts.get(i); postMethod.setRequestEntity(new MultipartRequestEntity(parts, postMethod.getParams())); client = new HttpClient(); LOGGER.debug("Execute HTTP POST request \"{0}\"", postMethod.getURI()); int status = client.executeMethod(postMethod); if (status == HttpStatus.SC_OK) { LOGGER.info( "Successfully deployed bucket number {0} on target {1}", bucketIndex + 1, target.getName()); } else { LOGGER.error( "Deployment failed for bucket number {0} on target {1}. Deployment agent returned status {2}", bucketIndex + 1, target.getName(), HttpStatus.getStatusText(status)); throw new UploadFailedException(site, target.getName(), target.getServerUrl()); } } catch (HttpException e) { LOGGER.error( "Publish failed for target {0} due to http protocol exception", target.getName()); throw new UploadFailedException(site, target.getName(), target.getServerUrl(), e); } catch (IOException e) { LOGGER.error( "Publish failed for target {0} due to I/O (transport) exception", target.getName()); throw new UploadFailedException(site, target.getName(), target.getServerUrl(), e); } finally { LOGGER.debug("Release http connection and release resources"); if (client != null) { HttpConnectionManager mgr = client.getHttpConnectionManager(); if (mgr instanceof SimpleHttpConnectionManager) { ((SimpleHttpConnectionManager) mgr).shutdown(); } } if (postMethod != null) { postMethod.releaseConnection(); postMethod = null; client = null; } baps = null; stringPart = null; filePart = null; formParts = null; } } LOGGER.debug( "Publishing deployment event for target \"{0}\" with \"{1}\" items.", target.getName(), eventItems.size()); _contentRepository.publishDeployEvent(target.getName(), eventItems); LOGGER.info("Deployment successful on target {0}", target.getName()); LOGGER.debug( "Finished deploying items for site \"{0}\", target \"{1}\", number of items \"{2}\"", site, target.getName(), filteredItems.size()); }
public String getDesc() { return status.getDesc(); }
public int getCode() { return status.getCode(); }
@Test public void testInvalidGetCode() { assertNull("Invalid code: 800", HttpStatus.getCode(800)); assertNull("Invalid code: 190", HttpStatus.getCode(190)); }
/** * @param since last modified time to use * @param req * @param url if null, ignored * @param redirCount number of redirs we've done */ public static HttpData getDataOnce( HttpServletRequest req, HttpServletResponse res, long since, String surl, int redirCount, int timeout) throws IOException, HttpException, DataSourceException, MalformedURLException { HttpMethodBase request = null; HostConfiguration hcfg = new HostConfiguration(); /* [todo hqm 2006-02-01] Anyone know why this code was here? It is setting the mime type to something which just confuses the DHTML parser. if (res != null) { res.setContentType("application/x-www-form-urlencoded;charset=UTF-8"); } */ try { // TODO: [2002-01-09 bloch] cope with cache-control // response headers (no-store, no-cache, must-revalidate, // proxy-revalidate). if (surl == null) { surl = getURL(req); } if (surl == null || surl.equals("")) { throw new MalformedURLException( /* (non-Javadoc) * @i18n.test * @org-mes="url is empty or null" */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-312")); } String reqType = ""; String headers = ""; if (req != null) { reqType = req.getParameter("reqtype"); headers = req.getParameter("headers"); } boolean isPost = false; mLogger.debug("reqtype = " + reqType); if (reqType != null && reqType.equals("POST")) { request = new LZPostMethod(); request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); isPost = true; mLogger.debug("setting POST req method"); } else if (reqType != null && reqType.equals("PUT")) { request = new LZPutMethod(); // todo [hqm 2007] treat PUT like POST? isPost = true; mLogger.debug("setting PUT req method"); } else if (reqType != null && reqType.equals("DELETE")) { request = new LZDeleteMethod(); mLogger.debug("setting DELETE req method"); } else { mLogger.debug("setting GET (default) req method"); request = new LZGetMethod(); } request.setHttp11(mUseHttp11); // Proxy the request headers if (req != null) { LZHttpUtils.proxyRequestHeaders(req, request); } // Set headers from query string if (headers != null && headers.length() > 0) { StringTokenizer st = new StringTokenizer(headers, "\n"); while (st.hasMoreTokens()) { String h = st.nextToken(); int i = h.indexOf(":"); if (i > -1) { String n = h.substring(0, i); String v = h.substring(i + 2, h.length()); request.setRequestHeader(n, v); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="setting header " + p[0] + "=" + p[1] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-359", new Object[] {n, v})); } } } mLogger.debug("Parsing url"); URI uri = LZHttpUtils.newURI(surl); try { hcfg.setHost(uri); } catch (Exception e) { throw new MalformedURLException( /* (non-Javadoc) * @i18n.test * @org-mes="can't form uri from " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-376", new Object[] {surl})); } // This gets us the url-encoded (escaped) path and query string String path = uri.getEscapedPath(); String query = uri.getEscapedQuery(); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="encoded path: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-389", new Object[] {path})); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="encoded query: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-397", new Object[] {query})); // This call takes a decoded (unescaped) path request.setPath(path); boolean hasQuery = (query != null && query.length() > 0); String rawcontent = null; // Newer rawpost protocol puts lzpostbody as a separate // top level query arg in the request. rawcontent = req.getParameter("lzpostbody"); if (isPost) { // Older rawpost protocol put the "lzpostbody" arg // embedded in the "url" args's query args if (rawcontent == null && hasQuery) { rawcontent = findQueryArg("lzpostbody", query); } if (rawcontent != null) { // Get the unescaped query string ((EntityEnclosingMethod) request).setRequestBody(rawcontent); } else if (hasQuery) { StringTokenizer st = new StringTokenizer(query, "&"); while (st.hasMoreTokens()) { String it = st.nextToken(); int i = it.indexOf("="); if (i > 0) { String n = it.substring(0, i); String v = it.substring(i + 1, it.length()); // POST encodes values during request ((PostMethod) request).addParameter(n, URLDecoder.decode(v, "UTF-8")); } else { mLogger.warn( /* (non-Javadoc) * @i18n.test * @org-mes="ignoring bad token (missing '=' char) in query string: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-429", new Object[] {it})); } } } } else { // This call takes an encoded (escaped) query string request.setQueryString(query); } // Put in the If-Modified-Since headers if (since != -1) { String lms = LZHttpUtils.getDateString(since); request.setRequestHeader(LZHttpUtils.IF_MODIFIED_SINCE, lms); mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="proxying lms: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-450", new Object[] {lms})); } mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="setting up http client" */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-460")); HttpClient htc = null; if (mConnectionMgr != null) { htc = new HttpClient(mConnectionMgr); } else { htc = new HttpClient(); } htc.setHostConfiguration(hcfg); // This is the data timeout mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="timeout set to " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-478", new Object[] {new Integer(timeout)})); htc.setTimeout(timeout); // Set connection timeout the same htc.setConnectionTimeout(mConnectionTimeout); // Set timeout for getting a connection htc.setHttpConnectionFactoryTimeout(mConnectionPoolTimeout); // TODO: [2003-03-05 bloch] this should be more configurable (per app?) if (!isPost) { request.setFollowRedirects(mFollowRedirects > 0); } long t1 = System.currentTimeMillis(); mLogger.debug("starting remote request"); int rc = htc.executeMethod(hcfg, request); String status = HttpStatus.getStatusText(rc); if (status == null) { status = "" + rc; } mLogger.debug( /* (non-Javadoc) * @i18n.test * @org-mes="remote response status: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-504", new Object[] {status})); HttpData data = null; if (isRedirect(rc) && mFollowRedirects > redirCount) { String loc = request.getResponseHeader("Location").toString(); String hostURI = loc.substring(loc.indexOf(": ") + 2, loc.length()); mLogger.info( /* (non-Javadoc) * @i18n.test * @org-mes="Following URL from redirect: " + p[0] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-517", new Object[] {hostURI})); long t2 = System.currentTimeMillis(); if (timeout > 0) { timeout -= (t2 - t1); if (timeout < 0) { throw new InterruptedIOException( /* (non-Javadoc) * @i18n.test * @org-mes=p[0] + " timed out after redirecting to " + p[1] */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-529", new Object[] {surl, loc})); } } data = getDataOnce(req, res, since, hostURI, redirCount++, timeout); } else { data = new HttpData(request, rc); } if (req != null && res != null) { // proxy response headers LZHttpUtils.proxyResponseHeaders(request, res, req.isSecure()); } return data; } catch (ConnectTimeoutException ce) { // Transduce to an InterrupedIOException, since lps takes these to be timeouts. if (request != null) { request.releaseConnection(); } throw new InterruptedIOException( /* (non-Javadoc) * @i18n.test * @org-mes="connecting to " + p[0] + ":" + p[1] + " timed out beyond " + p[2] + " msecs." */ org.openlaszlo.i18n.LaszloMessages.getMessage( HTTPDataSource.class.getName(), "051018-557", new Object[] { hcfg.getHost(), new Integer(hcfg.getPort()), new Integer(mConnectionTimeout) })); } catch (HttpRecoverableException hre) { if (request != null) { request.releaseConnection(); } throw hre; } catch (HttpException e) { if (request != null) { request.releaseConnection(); } throw e; } catch (IOException ie) { if (request != null) { request.releaseConnection(); } throw ie; } catch (RuntimeException e) { if (request != null) { request.releaseConnection(); } throw e; } }
public String getStatusText() { return HttpStatus.getStatusText(this.status); }