List of usage examples for java.net URISyntaxException getMessage
public String getMessage()
From source file:jails.server.servlet.ServletServerHttpRequest.java
public URI getURI() { try {/*from w ww .j a va 2 s .c o m*/ return new URI(servletRequest.getScheme(), null, servletRequest.getServerName(), servletRequest.getServerPort(), servletRequest.getRequestURI(), servletRequest.getQueryString(), null); } catch (URISyntaxException ex) { throw new IllegalStateException("Could not get HttpServletRequest URI: " + ex.getMessage(), ex); } }
From source file:grails.plugin.cloudfoundry.GrailsHttpRequest.java
public URI getURI() { try {// ww w. j a v a 2 s . co m return connection.getURL().toURI(); } catch (URISyntaxException ex) { throw new IllegalStateException("Could not get HttpURLConnection URI: " + ex.getMessage(), ex); } }
From source file:it.txt.ens.core.impl.test.BasicENSResourceTest.java
private void testURI(ENSResource resource) { URIBuilder uriBuilder = new URIBuilder(); uriBuilder.addParameter(ENSResource.NAMESPACE_PARAMETER_NAME, resource.getNamespace()); uriBuilder.addParameter(ENSResource.PATTERN_PARAMETER_NAME, resource.getPattern()); uriBuilder.setHost(resource.getHost()); uriBuilder.setPath(resource.getPath()); uriBuilder.setScheme(ENSResource.URI_SCHEME); try {/*ww w .j a v a 2 s.c o m*/ assertEquals("Unexpected resourceURI", uriBuilder.build(), resource.getURI()); } catch (URISyntaxException e) { fail(e.getMessage()); e.printStackTrace(); } }
From source file:com.pidoco.juri.JURI.java
/** * @throws IllegalArgumentException if the given URI cannot be parsed. *//*from w ww . ja v a2s . c o m*/ public static JURI parse(String rawURI) { JURI result = new JURI(); try { result.prototype = result.currentUri = new URI(rawURI); } catch (URISyntaxException e) { throw new IllegalArgumentException( String.format("Cannot parse as URI: '%s'. Reason: %s", rawURI, e.getMessage()), e); } return result; }
From source file:com.seuf.arseuf.arseuf.java
public boolean sendRequestToArduino(String cmd) { HttpClient hc = new DefaultHttpClient(); HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(); try {/*from w w w . ja va 2s .c o m*/ request.setURI(new URI("http://" + pref.getString("arduino_ip", null) + "/" + cmd)); } catch (URISyntaxException e) { Toast.makeText(context, "URISyntaxException : " + e.getMessage(), Toast.LENGTH_SHORT).show(); } try { HttpResponse response = client.execute(request); } catch (IOException e) { Toast.makeText(context, "IOException : " + e.getMessage(), Toast.LENGTH_SHORT).show(); } return true; }
From source file:com.android.idtt.http.client.HttpRequest.java
@Override public URI getURI() { try {// ww w .j a v a 2 s . c om return uriBuilder.build(); } catch (URISyntaxException e) { LogUtils.e(e.getMessage(), e); return null; } }
From source file:lh.api.showcase.server.api.lh.operations.OperationsServiceImpl.java
@Override public String getFlightStatus(String flightNumber, String departureDate) throws HttpErrorResponseException { // e.g., https://api.lufthansa.com/v1/operations/flightstatus/LH741/2015-06-25 OperationsRequestFactoryImpl reqFact = new OperationsRequestFactoryImpl(); try {// w w w. java2 s.c o m URI uri = reqFact.getRequestUri((NameValuePair) new BasicNameValuePair("flightstatus", ""), (List<NameValuePair>) Arrays.asList((NameValuePair) new BasicNameValuePair(flightNumber, ""), (NameValuePair) new BasicNameValuePair(departureDate, "")), null); return HttpQueryUtils.executeQuery(uri); } catch (URISyntaxException e) { logger.log(Level.SEVERE, e.getMessage()); } return null; }
From source file:edu.jhu.pha.vospace.node.VospaceId.java
public URI getId() { try {// w w w. j a v a 2 s. c o m return toUri(nodePath.getNodeStoragePath(), uri); } catch (URISyntaxException ex) { // Should be already checked in the constructor logger.error(ex.getMessage()); return null; } }
From source file:ca.islandora.fcrepo.client.FcrepoClient.java
@Override public IFcrepoResponse createTransaction() throws FcrepoOperationFailedException { try {/*from w ww . j a v a2 s . c o m*/ URIBuilder uriBuilder = new URIBuilder(baseUri); uriBuilder.setPath(uriBuilder.getPath() + "/fcr:tx"); final String uri = uriBuilder.build().toString(); final IFcrepoRequest request = new CreateResourceRequest(httpClient, uri); 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 extendTransaction(final String uri) throws FcrepoOperationFailedException { try {//w ww . j a v a 2s.c om URIBuilder uriBuilder = new URIBuilder(uri); uriBuilder.setPath(uriBuilder.getPath() + "/fcr:tx"); 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()); } }