List of usage examples for java.net URISyntaxException getMessage
public String getMessage()
From source file:ca.islandora.fcrepo.client.FcrepoClient.java
@Override public IFcrepoResponse commitTransaction(final String uri) throws FcrepoOperationFailedException { try {/*w ww. jav a 2s . c o m*/ URIBuilder uriBuilder = new URIBuilder(baseUri); uriBuilder.setPath(uriBuilder.getPath() + "/fcr:tx/fcr:commit"); final String fullUri = uriBuilder.build().toString(); final IFcrepoRequest request = new CreateResourceRequest(httpClient, fullUri); return request.execute(); } catch (URISyntaxException ex) { throw new FcrepoOperationFailedException(null, -1, ex.getMessage()); } }
From source file:ca.islandora.fcrepo.client.FcrepoClient.java
@Override public IFcrepoResponse rollbackTransaction(final String uri) throws FcrepoOperationFailedException { try {//from ww w . j a v a 2s . com URIBuilder uriBuilder = new URIBuilder(baseUri); uriBuilder.setPath(uriBuilder.getPath() + "/fcr:tx/fcr:rollback"); final String fullUri = uriBuilder.build().toString(); final IFcrepoRequest request = new CreateResourceRequest(httpClient, fullUri); return request.execute(); } catch (URISyntaxException ex) { throw new FcrepoOperationFailedException(null, -1, ex.getMessage()); } }
From source file:com.dhenton9000.birt.configs.DatabaseConfig.java
@Bean public DataSource dataSource() { URI dbUrl = null;/*from w w w . j av a 2 s . co m*/ String dbString = env.getProperty("DATABASE_URL"); log.debug("database string " + dbString); try { dbUrl = new URI(dbString); } catch (URISyntaxException ex) { throw new RuntimeException(ex.getMessage()); } DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName("org.postgresql.Driver"); String url = "jdbc:postgresql://" + dbUrl.getHost() + ":" + dbUrl.getPort() + dbUrl.getPath(); // log.debug("url "+url); dataSource.setUrl(url); // log.debug("info user "+dbUrl.getUserInfo()); dataSource.setUsername(dbUrl.getUserInfo().split(":")[0]); dataSource.setPassword(dbUrl.getUserInfo().split(":")[1]); return dataSource; }
From source file:io.wcm.caravan.commons.httpasyncclient.impl.HttpAsyncClientFactoryImpl.java
private URI toUri(String uri) { if (StringUtils.isEmpty(uri)) { return null; } else {/*from ww w . jav a2 s . c om*/ try { return new URI(uri); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid URI: " + ex.getMessage(), ex); } } }
From source file:lh.api.showcase.server.api.lh.operations.OperationsServiceImpl.java
@Override public String getFlightStatusByRoute(AirportCode origin, AirportCode destination, String departureDate) throws HttpErrorResponseException { // e.g., https://api.lufthansa.com/v1/operations/flightstatus/route/FRA/KIX/2015-06-25 OperationsRequestFactoryImpl reqFact = new OperationsRequestFactoryImpl(); try {//from w w w . j a v a2 s . c o m URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("flightstatus", ""), (List<NameValuePair>) Arrays.asList((NameValuePair) new BasicNameValuePair("route", ""), (NameValuePair) new BasicNameValuePair(origin.toString(), ""), (NameValuePair) new BasicNameValuePair(destination.toString(), ""), (NameValuePair) new BasicNameValuePair(departureDate, "")), null); return HttpQueryUtils.executeQuery(uri); } catch (URISyntaxException e) { logger.log(Level.SEVERE, e.getMessage()); } return null; }
From source file:lh.api.showcase.server.api.lh.operations.OperationsServiceImpl.java
@Override public String getArrivalsStatus(AirportCode arrivalAirport, String startDate, String endDate) throws HttpErrorResponseException { // e.g., https://api.lufthansa.com/v1/operations/flightstatus/arrivals/FRA/2015-06-25T14:00/2015-06-25T16:00 OperationsRequestFactoryImpl reqFact = new OperationsRequestFactoryImpl(); try {/*from w w w .j a v a 2s .co m*/ URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("flightstatus", ""), (List<NameValuePair>) Arrays.asList((NameValuePair) new BasicNameValuePair("arrivals", ""), (NameValuePair) new BasicNameValuePair(arrivalAirport.toString(), ""), (NameValuePair) new BasicNameValuePair(startDate, ""), (NameValuePair) new BasicNameValuePair(endDate, "")), null); return HttpQueryUtils.executeQuery(uri); } catch (URISyntaxException e) { logger.log(Level.SEVERE, e.getMessage()); } return null; }
From source file:lh.api.showcase.server.api.lh.operations.OperationsServiceImpl.java
@Override public String getDeparturesStatus(AirportCode departureAirport, String startDate, String endDate) throws HttpErrorResponseException { // e.g., https://api.lufthansa.com/v1/operations/flightstatus/departures/FRA/2015-06-25T14:00/2015-06-25T16:00 OperationsRequestFactoryImpl reqFact = new OperationsRequestFactoryImpl(); try {/*from w ww . j a v a2s. c o m*/ URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("flightstatus", ""), (List<NameValuePair>) Arrays.asList((NameValuePair) new BasicNameValuePair("departures", ""), (NameValuePair) new BasicNameValuePair(departureAirport.toString(), ""), (NameValuePair) new BasicNameValuePair(startDate, ""), (NameValuePair) new BasicNameValuePair(endDate, "")), null); return HttpQueryUtils.executeQuery(uri); } catch (URISyntaxException e) { logger.log(Level.SEVERE, e.getMessage()); } return null; }
From source file:lh.api.showcase.server.api.lh.referencedata.ReferenceDataServiceImpl.java
@Override public String getAirlines(AirlineCode airlineCode) throws HttpErrorResponseException { ReferenceDataRequestFactoryImpl reqFact = new ReferenceDataRequestFactoryImpl(); try {/*from ww w .ja va2s .co m*/ URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("airlines", (airlineCode == null) ? ("") : (airlineCode.toString())), null, null); return HttpQueryUtils.executeQuery(uri); } catch (URISyntaxException e) { logger.log(Level.SEVERE, e.getMessage()); } return null; }
From source file:lh.api.showcase.server.api.lh.referencedata.ReferenceDataServiceImpl.java
@Override public String getAircraft(AircraftCode aircraftCode) throws HttpErrorResponseException { ReferenceDataRequestFactoryImpl reqFact = new ReferenceDataRequestFactoryImpl(); try {//w w w.j a va2 s. c om URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("aircraft", (aircraftCode == null) ? ("") : (aircraftCode.toString())), null, null); return HttpQueryUtils.executeQuery(uri); } catch (URISyntaxException e) { logger.log(Level.SEVERE, e.getMessage()); } return null; }
From source file:com.epam.ngb.cli.manager.command.handler.http.DatasetListHandler.java
private HttpRequestBase createTreeRequest(Long parentId) { try {//from w w w . j ava 2 s . c o m URIBuilder builder = new URIBuilder( serverParameters.getServerUrl() + serverParameters.getProjectTreeUrl()); builder.addParameter("parentId", String.valueOf(parentId)); HttpGet get = new HttpGet(builder.build()); setDefaultHeader(get); if (isSecure()) { addAuthorizationToRequest(get); } return get; } catch (URISyntaxException e) { throw new ApplicationException(e.getMessage(), e); } }