/** * Give a URI break off any URI options and store them in a Key / Value Mapping. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseQuery(String uri) throws URISyntaxException { try { uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query Map<String, String> rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { parseParameters(rc, uri.split("[&;]")); } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
throw (URISyntaxException)new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
throw (URISyntaxException)new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
public static Map<String, String> parseQuery(String uri, Map<String, String> propertyOverrides) throws URISyntaxException { try { Map<String, String> rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { String[] parameters = uri.split("&"); for (String parameter : parameters) { int p = parameter.indexOf("="); if (p >= 0) { String name = BeanSupport.decodeURI(parameter.substring(0, p)); String value = BeanSupport.decodeURI(parameter.substring(p + 1)); rc.put(name, value); } else { if (!parameter.trim().isEmpty()) { rc.put(parameter, null); } } } } if (propertyOverrides != null) { for (Map.Entry<String, String> entry : propertyOverrides.entrySet()) { rc.put(entry.getKey(), entry.getValue()); } } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
uriException.initCause(ex); throw uriException; } catch (IOException e) {
/** * Like URI.toURL, but translates exceptions to URISyntaxException * with a descriptive error message. */ public static URL toURL(URI uri) throws URISyntaxException { try { return uri.toURL(); } catch (IllegalArgumentException | MalformedURLException e) { URISyntaxException exception = new URISyntaxException(uri.toString(), e.getMessage()); exception.initCause(e); throw exception; } }
public static Map<String, String> parseQuery(final String uri) throws URISyntaxException { try { final Map<String, String> rc = new LinkedHashMap<String, String>(); if (uri != null) { final String[] parameters = uri.split("&"); for (int i = 0; i < parameters.length; i++) { final int p = parameters[i].indexOf("="); if (p >= 0) { final String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); final String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); rc.put(name, value); } else { rc.put(parameters[i], null); } } } return rc; } catch (final UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
public static Map parseQuery(String uri) throws URISyntaxException { try { Map rc = new HashMap(); if (uri != null) { String[] parameters = uri.split("&"); for (int i = 0; i < parameters.length; i++) { int p = parameters[i].indexOf("="); if (p >= 0) { String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); rc.put(name, value); } else { rc.put(parameters[i], null); } } } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
public static Map<String, String> parseQuery(final String uri) throws URISyntaxException { try { final Map<String, String> rc = new LinkedHashMap<String, String>(); if (uri != null) { final String[] parameters = uri.split("&"); for (int i = 0; i < parameters.length; i++) { final int p = parameters[i].indexOf("="); if (p >= 0) { final String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); final String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); rc.put(name, value); } else { rc.put(parameters[i], null); } } } return rc; } catch (final UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
public static Map parseQuery(String uri) throws URISyntaxException { try { Map rc = new HashMap(); if (uri != null) { String[] parameters = uri.split("&"); for (int i = 0; i < parameters.length; i++) { int p = parameters[i].indexOf("="); if (p >= 0) { String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); rc.put(name, value); } else { rc.put(parameters[i], null); } } } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
public static Map<String, String> parseQuery(String uri) throws URISyntaxException{ try{ Map<String, String> rc = new LinkedHashMap<String,String>(); if(uri!=null){ String[] parameters=uri.split("&"); for(int i=0;i<parameters.length;i++){ int p=parameters[i].indexOf("="); if(p>=0){ String name= URLDecoder.decode(parameters[i].substring(0,p),"UTF-8"); String value=URLDecoder.decode(parameters[i].substring(p+1),"UTF-8"); rc.put(name,value); }else{ rc.put(parameters[i],null); } } } return rc; }catch(UnsupportedEncodingException e){ throw (URISyntaxException) new URISyntaxException(e.toString(),"Invalid encoding").initCause(e); } }
/** * Give a URI break off any URI options and store them in a Key / Value Mapping. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseQuery(String uri) throws URISyntaxException { try { uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query Map<String, String> rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { parseParameters(rc, uri.split("[&;]")); } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
public static Map<String, String> parseQuery(final String uri) throws URISyntaxException { try { final Map<String, String> rc = new LinkedHashMap<String, String>(); if (uri != null) { final String[] parameters = uri.split("&"); for (final String parameter : parameters) { final int p = parameter.indexOf("="); if (p >= 0) { final String name = URLDecoder.decode(parameter.substring(0, p), "UTF-8"); final String value = URLDecoder.decode(parameter.substring(p + 1), "UTF-8"); rc.put(name, value); } else { rc.put(parameter, null); } } } return rc; } catch (final UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
public static Map<String, String> parseQuery(String uri) throws URISyntaxException { try { Map<String, String> rc = new HashMap<String, String>(); if (uri != null) { String[] parameters = uri.split("&"); for (int i = 0; i < parameters.length; i++) { int p = parameters[i].indexOf("="); if (p >= 0) { String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8"); String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8"); rc.put(name, value); } else { rc.put(parameters[i], null); } } } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException)new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
/** * Give a URI break off any URI options and store them in a Key / Value Mapping. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseQuery(String uri) throws URISyntaxException { try { uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query Map<String, String> rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { parseParameters(rc, uri.split("[&;]")); } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
/** * Give a URI break off any URI options and store them in a Key / Value Mapping. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseQuery(String uri) throws URISyntaxException { try { uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query Map<String, String> rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { parseParameters(rc, uri.split("[&;]")); } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
/** * Give a URI break off any URI options and store them in a Key / Value Mapping. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseQuery(String uri) throws URISyntaxException { try { uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query Map<String, String> rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { parseParameters(rc, uri.split("[&;]")); } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
/** * Give a URI break off any URI options and store them in a Key / Value Mapping. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseQuery(String uri) throws URISyntaxException { try { uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query Map<String, String> rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { parseParameters(rc, uri.split("[&;]")); } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }
/** * Give a URI break off any URI options and store them in a Key / Value Mapping. * * @param uri The URI whose query should be extracted and processed. * @return A Mapping of the URI options. * @throws java.net.URISyntaxException */ public static Map<String, String> parseQuery(String uri) throws URISyntaxException { try { uri = uri.substring(uri.lastIndexOf("?") + 1); // get only the relevant part of the query Map<String, String> rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { parseParameters(rc, uri.split("[&;]")); } return rc; } catch (UnsupportedEncodingException e) { throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e); } }