List of usage examples for org.apache.http.client.utils URIBuilder addParameter
public URIBuilder addParameter(final String param, final String value)
From source file:com.ecofactor.qa.automation.newapp.page.impl.TstatControlOpsPageImpl.java
/** * Temporary method. Which we rechanged again. * @param url the url//from w ww . ja v a2 s .c om * @param params the params * @param expectedStatus the expected status * @return the e eapi * @see com.ecofactor.qa.automation.newapp.page.TstatControlOpsPage#getEEapi(java.lang.String, * java.util.Map, int) */ public String getEEapi(String url, Map<String, String> params, int expectedStatus) { String content = null; HttpGet request = new HttpGet(url); URIBuilder builder = new URIBuilder(request.getURI()); if (params != null) { final Set<String> keys = params.keySet(); for (String key : keys) { builder.addParameter(key, params.get(key)); } } try { request.setURI(builder.build()); DriverConfig.setLogString("URL " + request.getURI().toString(), true); getDriver().navigate().to(request.getURI().toString()); largeWait(); content = getDriver().findElement(By.tagName("Body")).getText(); DriverConfig.setLogString("Content: " + content, true); } catch (Exception e) { e.printStackTrace(); } finally { request.releaseConnection(); } return content; }
From source file:org.outermedia.solrfusion.adapter.solr.DefaultSolrAdapter.java
protected void buildFacetHttpClientParams(Multimap<String> params, URIBuilder ub) { String facet = params.getFirst(FACET); if ("true".equals(facet)) { ub.setParameter(FACET_PARAMETER, "true"); addIfNotNull(ub, FACET_SORT_PARAMETER, params.getFirst(FACET_SORT)); addIfNotNull(ub, FACET_PREFIX_PARAMETER, params.getFirst(FACET_PREFIX)); addIfNotNull(ub, FACET_MINCOUNT_PARAMETER, params.getFirst(FACET_MINCOUNT)); addIfNotNull(ub, FACET_LIMIT_PARAMETER, params.getFirst(FACET_LIMIT)); Collection<String> facetFields = params.get(FACET_FIELD); if (facetFields != null) { for (String ff : facetFields) { ub.addParameter(FACET_FIELD_PARAMETER, ff); }// w w w . j av a 2 s . c o m } List<Map.Entry<String, String>> sortFields = params.filterBy(FACET_SORT_FIELD); for (Map.Entry<String, String> sfEntry : sortFields) { ub.addParameter(sfEntry.getKey(), sfEntry.getValue()); } } }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testPopulateResourcesForMultipleHostMetrics() throws Exception { setUpCommonMocks();/*from w w w . j av a 2 s .c o m*/ TestStreamProvider streamProvider = new TestStreamProvider(MULTIPLE_HOST_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.Host); AMSPropertyProvider propertyProvider = new AMSHostPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, HOST_NAME_PROPERTY_ID); Resource resource = new ResourceImpl(Resource.Type.Host); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(PROPERTY_ID1, new TemporalInfoImpl(1416445244701L, 1416448936564L, 15L)); temporalInfoMap.put(PROPERTY_ID2, new TemporalInfoImpl(1416445244701L, 1416448936564L, 15L)); Request request = PropertyHelper.getReadRequest(new HashSet<String>() { { add(PROPERTY_ID1); add(PROPERTY_ID2); add("params/padding/NONE"); // Ignore padding to match result size } }, temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder1 = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder1.addParameter("metricNames", "cpu_user,mem_free"); uriBuilder1.addParameter("hostname", "h1"); uriBuilder1.addParameter("appId", "HOST"); uriBuilder1.addParameter("startTime", "1416445244701"); uriBuilder1.addParameter("endTime", "1416448936564"); URIBuilder uriBuilder2 = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder2.addParameter("metricNames", "mem_free,cpu_user"); uriBuilder2.addParameter("hostname", "h1"); uriBuilder2.addParameter("appId", "HOST"); uriBuilder2.addParameter("startTime", "1416445244701"); uriBuilder2.addParameter("endTime", "1416448936564"); List<String> allSpecs = new ArrayList<String>(streamProvider.getAllSpecs()); Assert.assertEquals(1, allSpecs.size()); Assert.assertTrue( uriBuilder1.toString().equals(allSpecs.get(0)) || uriBuilder2.toString().equals(allSpecs.get(0))); Number[][] val = (Number[][]) res.getPropertyValue(PROPERTY_ID1); Assert.assertEquals(111, val.length); val = (Number[][]) res.getPropertyValue(PROPERTY_ID2); Assert.assertEquals(86, val.length); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testPopulateMetricsForEmbeddedHBase() throws Exception { AmbariManagementController ams = createNiceMock(AmbariManagementController.class); PowerMock.mockStatic(AmbariServer.class); expect(AmbariServer.getController()).andReturn(ams); AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class); Clusters clusters = createNiceMock(Clusters.class); Cluster cluster = createNiceMock(Cluster.class); ComponentInfo componentInfo = createNiceMock(ComponentInfo.class); StackId stackId = new StackId("HDP", "2.2"); expect(ams.getClusters()).andReturn(clusters).anyTimes(); try {/*from w w w .ja va 2s . c om*/ expect(clusters.getCluster(anyObject(String.class))).andReturn(cluster).anyTimes(); } catch (AmbariException e) { e.printStackTrace(); } expect(cluster.getCurrentStackVersion()).andReturn(stackId).anyTimes(); expect(ams.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes(); expect(ambariMetaInfo.getComponentToService("HDP", "2.2", "METRICS_COLLECTOR")).andReturn("AMS").anyTimes(); expect(ambariMetaInfo.getComponent("HDP", "2.2", "AMS", "METRICS_COLLECTOR")).andReturn(componentInfo) .anyTimes(); expect(componentInfo.getTimelineAppid()).andReturn("AMS-HBASE"); replay(ams, clusters, cluster, ambariMetaInfo, componentInfo); PowerMock.replayAll(); TestStreamProvider streamProvider = new TestStreamProvider(EMBEDDED_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.Component); AMSPropertyProvider propertyProvider = new AMSComponentPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID); String propertyId = PropertyHelper.getPropertyId("metrics/hbase/regionserver", "requests"); Resource resource = new ResourceImpl(Resource.Type.Component); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1"); resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "METRICS_COLLECTOR"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(propertyId, new TemporalInfoImpl(1421694000L, 1421697600L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(propertyId), temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder.addParameter("metricNames", "regionserver.Server.totalRequestCount"); uriBuilder.addParameter("appId", "AMS-HBASE"); uriBuilder.addParameter("startTime", "1421694000"); uriBuilder.addParameter("endTime", "1421697600"); Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec()); Number[][] val = (Number[][]) res.getPropertyValue(propertyId); Assert.assertEquals(189, val.length); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testAggregateFunctionForComponentMetrics() throws Exception { AmbariManagementController ams = createNiceMock(AmbariManagementController.class); PowerMock.mockStatic(AmbariServer.class); expect(AmbariServer.getController()).andReturn(ams); AmbariMetaInfo ambariMetaInfo = createNiceMock(AmbariMetaInfo.class); Clusters clusters = createNiceMock(Clusters.class); Cluster cluster = createNiceMock(Cluster.class); ComponentInfo componentInfo = createNiceMock(ComponentInfo.class); StackId stackId = new StackId("HDP", "2.2"); expect(ams.getClusters()).andReturn(clusters).anyTimes(); try {//from w w w . j av a 2 s . c om expect(clusters.getCluster(anyObject(String.class))).andReturn(cluster).anyTimes(); } catch (AmbariException e) { e.printStackTrace(); } expect(cluster.getCurrentStackVersion()).andReturn(stackId).anyTimes(); expect(ams.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes(); expect(ambariMetaInfo.getComponentToService("HDP", "2.2", "HBASE_REGIONSERVER")).andReturn("HBASE") .anyTimes(); expect(ambariMetaInfo.getComponent("HDP", "2.2", "HBASE", "HBASE_REGIONSERVER")).andReturn(componentInfo) .anyTimes(); expect(componentInfo.getTimelineAppid()).andReturn("HBASE"); replay(ams, clusters, cluster, ambariMetaInfo, componentInfo); PowerMock.replayAll(); TestStreamProvider streamProvider = new TestStreamProvider(AGGREGATE_METRICS_FILE_PATH); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.Component); PropertyHelper.updateMetricsWithAggregateFunctionSupport(propertyIds); AMSComponentPropertyProvider propertyProvider = new AMSComponentPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID); String propertyId = PropertyHelper.getPropertyId("metrics/rpc", "NumOpenConnections._sum"); Resource resource = new ResourceImpl(Resource.Type.Component); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "HBASE_REGIONSERVER"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); temporalInfoMap.put(propertyId, new TemporalInfoImpl(1429824611300L, 1429825241400L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(propertyId), temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); URIBuilder uriBuilder = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder.addParameter("metricNames", "rpc.rpc.NumOpenConnections._sum"); uriBuilder.addParameter("appId", "HBASE"); uriBuilder.addParameter("startTime", "1429824611300"); uriBuilder.addParameter("endTime", "1429825241400"); Assert.assertEquals(uriBuilder.toString(), streamProvider.getLastSpec()); Number[][] val = (Number[][]) res.getPropertyValue(propertyId); Assert.assertEquals(32, val.length); }
From source file:org.openrdf.http.client.SesameSession.java
public long size(Resource... contexts) throws IOException, RepositoryException, UnauthorizedException { checkRepositoryURL();/*from www .j a va 2s. c o m*/ try { final boolean useTransaction = transactionURL != null; String baseLocation = useTransaction ? appendAction(transactionURL, Action.SIZE) : Protocol.getSizeLocation(getQueryURL()); URIBuilder url = new URIBuilder(baseLocation); String[] encodedContexts = Protocol.encodeContexts(contexts); for (int i = 0; i < encodedContexts.length; i++) { url.addParameter(Protocol.CONTEXT_PARAM_NAME, encodedContexts[i]); } final HttpUriRequest method = useTransaction ? new HttpPost(url.build()) : new HttpGet(url.build()); String response = EntityUtils.toString(executeOK(method).getEntity()); try { return Long.parseLong(response); } catch (NumberFormatException e) { throw new RepositoryException("Server responded with invalid size value: " + response); } } catch (URISyntaxException e) { throw new AssertionError(e); } catch (RepositoryException e) { throw e; } catch (OpenRDFException e) { throw new RepositoryException(e); } }
From source file:org.eclipse.ebr.maven.EclipseIpLogUtil.java
private String createCq(final CloseableHttpClient httpclient, final Artifact artifact, final Model artifactPom, final Map<String, Xpp3Dom> existingLicenses) throws URISyntaxException, MojoExecutionException, IOException { final URIBuilder postUri = new URIBuilder(DISPATCH_PHP); postUri.addParameter("id", "portal/contribution_questionnaire.contribution_questionnaire_reuse." + projectId + "!reuse"); postUri.addParameter("action", "submit"); final HttpPost httpPost = new HttpPost(postUri.build()); httpPost.addHeader("Referer", PORTAL_PHP); final List<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("name", getCqName(artifact, artifactPom))); nvps.add(new BasicNameValuePair("version", artifact.getVersion())); nvps.add(new BasicNameValuePair("description", getCqDescription(artifact, artifactPom))); nvps.add(new BasicNameValuePair("cryptography", Strings.nullToEmpty(getCqCryptography(artifact, artifactPom)))); nvps.add(new BasicNameValuePair("projecturl", Strings.nullToEmpty(getCqProjectUrl(artifact, artifactPom)))); nvps.add(new BasicNameValuePair("sourceurl", Strings.nullToEmpty(getCqSourceUrl(artifact, artifactPom)))); nvps.add(new BasicNameValuePair("license", getCqLicense(artifact, artifactPom, existingLicenses))); nvps.add(new BasicNameValuePair("otherlicense", "")); nvps.add(new BasicNameValuePair("sourcebinary", "sourceandbinary")); nvps.add(new BasicNameValuePair("modifiedcode", "unmodified")); nvps.add(new BasicNameValuePair("apachehosted", getCqApacheHosted(artifact, artifactPom))); nvps.add(new BasicNameValuePair("codeagreement", getCqCodeAgreement(artifact, artifactPom))); nvps.add(new BasicNameValuePair("stateid", "not_existing")); httpPost.setEntity(new UrlEncodedFormEntity(nvps)); if (getLog().isDebugEnabled()) { for (final NameValuePair pair : nvps) { getLog().debug(" " + pair.getName() + "=" + pair.getValue()); }//from w w w . jav a 2 s . co m } final String responseHtml = executeRequest(httpclient, httpPost, StringUtils.removeEnd(artifact.getFile().getName(), ".jar") + "-ipzilla-response.html"); final String cqUrl = "https://dev.eclipse.org/ipzilla/show_bug.cgi?id="; final int cqUrlIndex = responseHtml.indexOf(cqUrl); final StrBuilder cqId = new StrBuilder(); for (int i = cqUrlIndex + cqUrl.length(); i < responseHtml.length(); i++) { final char c = responseHtml.charAt(i); if (Character.isDigit(c)) { cqId.append(c); } else { break; } } try { final int cqNumber = Integer.parseInt(cqId.toString()); if (cqNumber > 0) return String.valueOf(cqNumber); } catch (final NumberFormatException e) { getLog().error(format("Error parsing extracted CQ number '%s'. %s", cqId, e.getMessage()), e); } // we can only fail at this point throw new MojoExecutionException( "Unable to extract CQ number from response. Please check response and IPzilla!"); }
From source file:org.apache.ambari.server.controller.metrics.timeline.AMSPropertyProviderTest.java
@Test public void testPopulateResourcesForHostComponentHostMetrics() throws Exception { setUpCommonMocks();//from w w w . j a va 2 s . c om TestStreamProviderForHostComponentHostMetricsTest streamProvider = new TestStreamProviderForHostComponentHostMetricsTest( null); injectCacheEntryFactoryWithStreamProvider(streamProvider); TestMetricHostProvider metricHostProvider = new TestMetricHostProvider(); ComponentSSLConfiguration sslConfiguration = mock(ComponentSSLConfiguration.class); Map<String, Map<String, PropertyInfo>> propertyIds = PropertyHelper .getMetricPropertyIds(Resource.Type.HostComponent); AMSPropertyProvider propertyProvider = new AMSHostComponentPropertyProvider(propertyIds, streamProvider, sslConfiguration, cacheProvider, metricHostProvider, CLUSTER_NAME_PROPERTY_ID, HOST_NAME_PROPERTY_ID, COMPONENT_NAME_PROPERTY_ID); Resource resource = new ResourceImpl(Resource.Type.Host); resource.setProperty(CLUSTER_NAME_PROPERTY_ID, "c1"); resource.setProperty(HOST_NAME_PROPERTY_ID, "h1"); resource.setProperty(COMPONENT_NAME_PROPERTY_ID, "DATANODE"); Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); // Set same time ranges to make sure the query comes in as grouped and // then turns into a separate query to the backend temporalInfoMap.put(PROPERTY_ID1, new TemporalInfoImpl(1416445244801L, 1416448936464L, 1L)); temporalInfoMap.put(PROPERTY_ID3, new TemporalInfoImpl(1416445244801L, 1416448936464L, 1L)); Request request = PropertyHelper.getReadRequest(new HashSet<String>() { { add(PROPERTY_ID1); add(PROPERTY_ID3); add("params/padding/NONE"); // Ignore padding to match result size } }, temporalInfoMap); Set<Resource> resources = propertyProvider.populateResources(Collections.singleton(resource), request, null); Assert.assertEquals(1, resources.size()); Resource res = resources.iterator().next(); Map<String, Object> properties = PropertyHelper.getProperties(resources.iterator().next()); Assert.assertNotNull(properties); Set<String> specs = streamProvider.getAllSpecs(); Assert.assertEquals(2, specs.size()); String hostMetricSpec = null; String hostComponentMetricsSpec = null; for (String spec : specs) { if (spec.contains("HOST")) { hostMetricSpec = spec; } else { hostComponentMetricsSpec = spec; } } Assert.assertNotNull(hostMetricSpec); Assert.assertNotNull(hostComponentMetricsSpec); // Verify calls URIBuilder uriBuilder1 = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder1.addParameter("metricNames", "dfs.datanode.BlocksReplicated"); uriBuilder1.addParameter("hostname", "h1"); uriBuilder1.addParameter("appId", "DATANODE"); uriBuilder1.addParameter("startTime", "1416445244801"); uriBuilder1.addParameter("endTime", "1416448936464"); Assert.assertEquals(uriBuilder1.toString(), hostComponentMetricsSpec); URIBuilder uriBuilder2 = AMSPropertyProvider.getAMSUriBuilder("localhost", 6188, false); uriBuilder2.addParameter("metricNames", "cpu_user"); uriBuilder2.addParameter("hostname", "h1"); uriBuilder2.addParameter("appId", "HOST"); uriBuilder2.addParameter("startTime", "1416445244801"); uriBuilder2.addParameter("endTime", "1416448936464"); Assert.assertEquals(uriBuilder2.toString(), hostMetricSpec); Number[][] val = (Number[][]) res.getPropertyValue(PROPERTY_ID1); Assert.assertEquals(111, val.length); val = (Number[][]) res.getPropertyValue(PROPERTY_ID3); Assert.assertNotNull("No value for property " + PROPERTY_ID3, val); Assert.assertEquals(8, val.length); }
From source file:com.activiti.service.activiti.ProcessInstanceService.java
public void executeAction(ServerConfig serverConfig, String processInstanceId, JsonNode actionBody) throws ActivitiServiceException { boolean validAction = false; if (actionBody.has("action")) { String action = actionBody.get("action").asText(); if ("delete".equals(action)) { validAction = true;//from w w w. ja v a 2s . c o m // Delete historic instance URIBuilder builder = clientUtil .createUriBuilder(MessageFormat.format(HISTORIC_PROCESS_INSTANCE_URL, processInstanceId)); HttpDelete delete = new HttpDelete(clientUtil.getServerUrl(serverConfig, builder)); clientUtil.executeRequestNoResponseBody(delete, serverConfig, HttpStatus.SC_OK); } else if ("terminate".equals(action)) { validAction = true; // Delete runtime instance URIBuilder builder = clientUtil .createUriBuilder(MessageFormat.format(RUNTIME_PROCESS_INSTANCE_URL, processInstanceId)); if (actionBody.has("deleteReason")) { builder.addParameter("deleteReason", actionBody.get("deleteReason").asText()); } HttpDelete delete = new HttpDelete(clientUtil.getServerUrl(serverConfig, builder)); clientUtil.executeRequestNoResponseBody(delete, serverConfig, HttpStatus.SC_NO_CONTENT); } } if (!validAction) { throw new BadRequestException( "Action is missing in the request body or the given action is not supported."); } }
From source file:org.openrdf.http.client.SesameSession.java
protected void upload(HttpEntity reqEntity, String baseURI, boolean overwrite, boolean preserveNodeIds, Action action, Resource... contexts) throws IOException, RDFParseException, RepositoryException, UnauthorizedException { OpenRDFUtil.verifyContextNotNull(contexts); checkRepositoryURL();//from w w w . j a v a 2 s.c o m boolean useTransaction = transactionURL != null; try { String baseLocation = useTransaction ? transactionURL : Protocol.getStatementsLocation(getQueryURL()); URIBuilder url = new URIBuilder(baseLocation); // Set relevant query parameters for (String encodedContext : Protocol.encodeContexts(contexts)) { url.addParameter(Protocol.CONTEXT_PARAM_NAME, encodedContext); } if (baseURI != null && baseURI.trim().length() != 0) { String encodedBaseURI = Protocol.encodeValue(new SimpleIRI(baseURI)); url.setParameter(Protocol.BASEURI_PARAM_NAME, encodedBaseURI); } if (preserveNodeIds) { url.setParameter(Protocol.PRESERVE_BNODE_ID_PARAM_NAME, "true"); } if (useTransaction) { if (action == null) { throw new IllegalArgumentException("action can not be null on transaction operation"); } url.setParameter(Protocol.ACTION_PARAM_NAME, action.toString()); } // Select appropriate HTTP method HttpEntityEnclosingRequest method; if (overwrite) { method = new HttpPut(url.build()); } else { method = new HttpPost(url.build()); } // Set payload method.setEntity(reqEntity); // Send request try { executeNoContent((HttpUriRequest) method); } catch (RepositoryException e) { throw e; } catch (RDFParseException e) { throw e; } catch (OpenRDFException e) { throw new RepositoryException(e); } } catch (URISyntaxException e) { throw new AssertionError(e); } }