public static GetMethod connectAndGet(String url, String file, boolean useSSL) throws Exception { url = createAuthUrl(url,baseHmac); String prot = "http"; if (useSSL) { prot = "https"; } String req = prot + "://" + server + ":" + port + "/" + file + "?" + url; // SDFSLogger.getLog().info(req); GetMethod method = new GetMethod(req); int returnCode = client.executeMethod(method); if (returnCode != 200) throw new IOException("Unable to process command " + method.getQueryString() + " return code was" + returnCode + " return msg was " + method.getResponseBodyAsString()); return method; }
if (returnCode != 200) throw new IOException("Unable to process command " + method.getQueryString() + " return code was" + returnCode + " return msg was " + method.getResponseBodyAsString());
public static GetMethod connectAndGetHMAC(String server, int port, String url, String file, boolean useSSL) throws Exception { String req = null; try { String prot = "http"; if (useSSL) { prot = "https"; } req = prot + "://" + server + ":" + port + "/" + file + "?" + url; if(useSSL) { req = req.replaceAll("(?<!https:)//", "/"); }else req = req.replaceAll("(?<!http:)//", "/"); GetMethod method = new GetMethod(req); int returnCode = client.executeMethod(method); if (returnCode != 200) throw new IOException("Unable to process command " + method.getQueryString() + " return code was" + returnCode + " return msg was " + method.getResponseBodyAsString()); return method; } catch (Exception e) { SDFSLogger.getLog().error( "unable to connect " + server + " on port " + port); SDFSLogger.getLog().error("unable to connect url = " + req); throw e; } }
/** * Method to execute a GET request to the given URL with the given parameters. * @param url * @param parameters * @return */ private String doGet(String url, Map<String, String[]> parameters, String mimeType) throws IOException, CatalogException { // build HTTP/GET request GetMethod method = new GetMethod(url); List<NameValuePair> nvps = new ArrayList<NameValuePair>(); for (Map.Entry<String, String[]> key : parameters.entrySet()) { for (String value : key.getValue()) { nvps.add(new NameValuePair(key.getKey(), value)); } } // request results in JSON format if (mimeType.equals(Parameters.MIME_TYPE_JSON)) { nvps.add(new NameValuePair("wt", "json")); } method.setQueryString( nvps.toArray( new NameValuePair[nvps.size()] ) ); LOG.info("GET url: "+url+" query string: "+method.getQueryString()); // send HTTP/GET request, return response return doHttp(method); }
private String executeGetMethod(GetMethod get) { LOGGER.debug("Making HTTP request to fetch OpenMRS Atom Feed: " + httpClient.getHostConfiguration().getHostURL() + get.getPath() + get.getQueryString()); try { int responseCode = httpClient.executeMethod(get); if (responseCode == HttpStatus.SC_OK) { LOGGER.debug("Successfully made HTTP request to OpenMRS"); return get.getResponseBodyAsString(); } else { LOGGER.warn("OpenMRS Atom Feed module returned non 200 status: " + get.getStatusCode()); return ""; } } catch (IOException e) { LOGGER.error("Motech OpenMRS Atom Feed module could not communicate with the OpenMRS"); throw new MotechException(e.getMessage(), e); } }
+ method.getQueryString() + " return code was" + returnCode + " return msg was " + method.getResponseBodyAsString());
if (returnCode != 200) throw new IOException("Unable to process command " + method.getQueryString() + " return code was" + returnCode + " return msg was " + method.getResponseBodyAsString());
/** * @param owsRequest * @return * @throws ServiceException */ private Transferable forwardGet(Transferable owsRequest) throws ServiceException { GetMethod method = new GetMethod(getURL().toString()); Payload payload = owsRequest.getPayload(); String baseQueryString = method.getQueryString(); if (baseQueryString != null && baseQueryString.length() > 0) { baseQueryString = baseQueryString + "&" + payload.toString(); } else { baseQueryString = payload.toString(); } method.setQueryString(baseQueryString); Transferable trans; try { trans = initBasicResponseTransferable(method); } catch (Exception e) { throw new ServiceException(String.format("Could not send basic GET request to <%s>.", getURL()), ServiceException.SERVICE_ERROR, e); } finally { method.releaseConnection(); } return trans; }
String queryString = method.getQueryString(); checkExpiredSession(queryString);
if (logger.isDebugEnabled()) { logger.debug("Initiating a SCIM filter request to retrieve SCIM user id to delete user. Filter" + " query string: " + getMethod.getQueryString());
GetMethod gm = new GetMethod(URL); gm.setQueryString( mergeQueryStringWithParams(gm.getQueryString(), params) );
if (logger.isDebugEnabled()) { logger.debug("Initiating a SCIM filter request to retrieve SCIM user id to patch user. Filter" + " query string: " + getMethod.getQueryString());
if (logger.isDebugEnabled()) { logger.debug("Initiating a SCIM filter request to retrieve SCIM group id to delete group. Filter" + " query string: " + getMethod.getQueryString());
if (logger.isDebugEnabled()) { logger.debug("Initiating a SCIM filter request to retrieve SCIM user id to update user. Filter" + " query string: " + getMethod.getQueryString());
" query string: " + getMethod.getQueryString());
" query string: " + getMethod.getQueryString());