List of usage examples for java.net URI toString
public String toString()
From source file:org.kitodo.sruimport.SRUImport.java
@Override public Document getFullRecordById(String catalogId, String id) { loadOPACConfiguration(catalogId);/*from www . ja v a 2s . co m*/ LinkedHashMap<String, String> queryParameters = new LinkedHashMap<>(parameters); try { URI queryURL = createQueryURI(queryParameters); return performQueryToDocument( queryURL.toString() + "&maximumRecords=1&query=" + idParameter + equalsOperand + id); } catch (URISyntaxException e) { throw new ConfigException(e.getLocalizedMessage()); } // TODO: transform hit to Kitodo internal format using SchemaConverter! }
From source file:com.amazonaws.eclipse.elasticbeanstalk.git.AWSGitPushCommand.java
private String getRemoteUrl() throws Exception { AWSElasticBeanstalkGitPushRequest request = new AWSElasticBeanstalkGitPushRequest(); request.setHost(getGitPushHost());//from w w w .ja v a 2 s. c o m Region region = RegionUtils.getRegionByEndpoint(environment.getRegionEndpoint()); request.setRegion(region.getId()); request.setApplication(environment.getApplicationName()); if (!skipEnvironmentDeployment) { request.setEnvironment(environment.getEnvironmentName()); } AWSGitPushAuth auth = new AWSGitPushAuth(request); URI uri = auth.deriveRemote(accessKey, secretKey); return uri.toString(); }
From source file:com.google.android.net.GoogleHttpClient.java
public HttpResponse execute(HttpUriRequest request, HttpContext context) throws IOException { // Rewrite the supplied URL... URI uri = request.getURI(); String original = uri.toString(); UrlRules rules = UrlRules.getRules(mResolver); UrlRules.Rule rule = rules.matchRule(original); String rewritten = rule.apply(original); if (rewritten == null) { Log.w(TAG, "Blocked by " + rule.mName + ": " + original); throw new BlockedRequestException(rule); } else if (rewritten == original) { return executeWithoutRewriting(request, context); // Pass through }/*from w w w .j a va 2s . c om*/ try { uri = new URI(rewritten); } catch (URISyntaxException e) { throw new RuntimeException("Bad URL from rule: " + rule.mName, e); } // Wrap request so we can replace the URI. RequestWrapper wrapper = wrapRequest(request); wrapper.setURI(uri); request = wrapper; if (Config.LOGV) { Log.v(TAG, "Rule " + rule.mName + ": " + original + " -> " + rewritten); } return executeWithoutRewriting(request, context); }
From source file:org.londonsburning.proxy.ProxyPrinter.java
/** * @param cardName Name of Card//from w w w. j a v a 2 s. c o m * @return String Url * @throws URISyntaxException Exception * @throws IOException Exception * @throws InterruptedException Exception */ private String getURL(final String cardName) throws URISyntaxException, IOException, InterruptedException { URI uri = new URI("http", "magiccards.info", "/query", "q=!" + cardName, null); String request = uri.toString(); URL url = new URL(request); InputStream inputStream = url.openStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); Thread.sleep(1000); while (bufferedReader.ready()) { String lineHtml = bufferedReader.readLine(); Thread.sleep(1); if (lineHtml.contains("http://magiccards.info/scans/en") && lineHtml.contains("jpg")) { return lineHtml.substring(lineHtml.indexOf("http"), lineHtml.indexOf("jpg") + ".jpg".length() - 1); } } String tokenUrl = parseTokens(cardName); if (tokenUrl.isEmpty()) { return proxyBackUrl; } else { return tokenUrl; } }
From source file:org.opencastproject.inspection.remote.MediaInspectionServiceRemoteImpl.java
/** * {@inheritDoc}//from ww w . ja v a2 s. com * * @see org.opencastproject.inspection.api.MediaInspectionService#inspect(java.net.URI) */ @Override public Job inspect(URI uri) throws MediaInspectionException { List<NameValuePair> queryStringParams = new ArrayList<NameValuePair>(); queryStringParams.add(new BasicNameValuePair("uri", uri.toString())); String url = "/inspect?" + URLEncodedUtils.format(queryStringParams, "UTF-8"); logger.info("Inspecting media file at {} using a remote media inspection service", uri); HttpResponse response = null; try { HttpGet get = new HttpGet(url); response = getResponse(get); if (response != null) { Job job = JobParser.parseJob(response.getEntity().getContent()); logger.info("Completing inspection of media file at {} using a remote media inspection service", uri); return job; } } catch (Exception e) { throw new MediaInspectionException("Unable to inspect " + uri + " using a remote inspection service", e); } finally { closeConnection(response); } throw new MediaInspectionException("Unable to inspect " + uri + " using a remote inspection service"); }
From source file:se.vgregion.pubsub.push.repository.jpa.JpaPushSubscriberRepository.java
@SuppressWarnings("unchecked") @Override/*from w w w .j ava2 s. c om*/ public List<PushSubscriber> findByTopic(URI topic) { try { return (List<PushSubscriber>) entityManager .createQuery("select l from DefaultPushSubscriber l " + "where l.topic = :topic ") .setParameter("topic", topic.toString()).getResultList(); } catch (NoResultException e) { return Collections.emptyList(); } }
From source file:com.microsoft.tfs.client.common.ui.webaccessintegration.editors.WebAccessWorkItemEditor.java
@Override public void createPartControl(final Composite parent) { super.createPartControl(parent); final WorkItemEditorInput input = (WorkItemEditorInput) getEditorInput(); setPartName(input.getName());/*w w w.j av a 2s .co m*/ final URI url = WorkItemEditorHelper.workItemToWebAccessURI(input.getServer(), input.getWorkItem(), input.getDocumentNumber(), true); browser.setUrl(url.toString()); }
From source file:com.proofpoint.event.blackhole.BlackholeEvent.java
public BlackholeEvent(String method, URI uri, byte[] entity) { Preconditions.checkNotNull(method, "method is null"); Preconditions.checkNotNull(uri, "uri is null"); Preconditions.checkNotNull(entity, "entity is null"); this.method = method; this.uri = uri.toString(); this.entity = Base64.encodeBase64String(entity); }
From source file:com.github.brandtg.pantopod.crawler.DbiBasedCrawlingEventHandler.java
@Override protected boolean handleData(URI url, byte[] data) throws IOException { try (Handle handle = dbi.open()) { int numRows = handle.update("INSERT IGNORE INTO `pantopod_crawler` (`url`, `data`) VALUES (?, ?)", url.toString(), data); if (numRows > 0) { LOG.info("Inserted {}", url); }/*ww w. j a v a 2 s. c om*/ return true; } catch (Exception e) { LOG.error("Could not insert {}", url, e); return false; } }
From source file:org.nuxeo.ecm.liveconnect.box.BoxBlobProvider.java
@Override public InputStream getStream(ManagedBlob blob) throws IOException { URI uri = getURI(blob, UsageHint.STREAM, null); return uri == null ? null : doGet(uri.toString()).getContent(); }