/** * Decodes using URLDecoder - use when queries or form post values are decoded * @param value value to decode * @param enc encoding */ public static String urlDecode(String value, String enc) { return urlDecode(value, enc, false); }
public static String urlEncode(String value, String enc) { return UrlUtils.urlEncode(value, enc); }
private String resolveRelativePath(String parentUri, String relativePath) { // can not use `new URI(uri).resolve(path)`, because that doesn't work with "jar:file:x!y" kind of URIs String base = UrlUtils.getStem(parentUri); return base + '/' + relativePath; }
public static List<Element> getSchemas(Server server, String id) { Message message = PhaseInterceptorChain.getCurrentMessage(); String base = (String)message.get(Message.REQUEST_URL); String ctxUri = (String)message.get(Message.PATH_INFO); WSDLGetUtils utils = new WSDLGetUtils(); EndpointInfo info = server.getEndpoint().getEndpointInfo(); Map<String, String> locs = utils.getSchemaLocations(message, base, ctxUri, info); List<Element> ret = new LinkedList<>(); for (Map.Entry<String, String> xsd : locs.entrySet()) { if (StringUtils.isEmpty(id) || id.equals(xsd.getKey())) { String query = xsd.getValue().substring(xsd.getValue().indexOf('?') + 1); Map<String, String> params = UrlUtils.parseQueryString(query); ret.add(utils.getDocument(message, base, params, ctxUri, info).getDocumentElement()); } } return ret; }
@Override public boolean isRecognizedQuery(String baseUri, String ctx, EndpointInfo endpointInfo, boolean contextMatchExact) { if (baseUri != null && (baseUri.contains("?") && (baseUri.toLowerCase().contains("wsdl") || baseUri.toLowerCase().contains("xsd=")))) { int idx = baseUri.indexOf("?"); Map<String, String> map = UrlUtils.parseQueryString(baseUri.substring(idx + 1)); if (map.containsKey("wsdl") || map.containsKey("xsd")) { if (contextMatchExact) { return endpointInfo.getAddress().contains(ctx); } else { // contextMatchStrategy will be "stem" return endpointInfo.getAddress(). contains(UrlUtils.getStem(baseUri.substring(0, idx))); } } } return false; }
public static String pathDecode(String value) { return UrlUtils.pathDecode(value); }
public static List<Element> getSchemas(Server server, String id) { Message message = PhaseInterceptorChain.getCurrentMessage(); String base = (String)message.get(Message.REQUEST_URL); String ctxUri = (String)message.get(Message.PATH_INFO); WSDLGetUtils utils = new WSDLGetUtils(); EndpointInfo info = server.getEndpoint().getEndpointInfo(); Map<String, String> locs = utils.getSchemaLocations(message, base, ctxUri, info); List<Element> ret = new LinkedList<>(); for (Map.Entry<String, String> xsd : locs.entrySet()) { if (StringUtils.isEmpty(id) || id.equals(xsd.getKey())) { String query = xsd.getValue().substring(xsd.getValue().indexOf('?') + 1); Map<String, String> params = UrlUtils.parseQueryString(query); ret.add(utils.getDocument(message, base, params, ctxUri, info).getDocumentElement()); } } return ret; }
public static String pathDecode(String value) { return UrlUtils.pathDecode(value); }
/** * Decodes using URLDecoder - use when queries or form post values are decoded * @param value value to decode * @param enc encoding */ public static String urlDecode(String value, String enc) { return urlDecode(value, enc, false); }
try { int idx = baseUri.toLowerCase().indexOf("?"); Map<String, String> params = UrlUtils.parseQueryString(baseUri.substring(idx + 1));
public static String urlEncode(String value) { return urlEncode(value, "UTF-8"); }
private String resolveRelativePath(String parentUri, String relativePath) { // can not use `new URI(uri).resolve(path)`, because that doesn't work with "jar:file:x!y" kind of URIs String base = UrlUtils.getStem(parentUri); return base + '/' + relativePath; }
public static String urlDecode(String value) { return UrlUtils.urlDecode(value); }
String ctx = (String)message.get(Message.PATH_INFO); Map<String, String> map = UrlUtils.parseQueryString(query); if (isRecognizedQuery(map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) { Document doc = getDocument(message, baseUri, map, ctx);
public static String urlEncode(String value, String enc) { return UrlUtils.urlEncode(value, enc); }
public static String urlDecode(String value, String enc) { return UrlUtils.urlDecode(value, enc); }
public void handleMessage(Message message) throws Fault { String method = (String)message.get(Message.HTTP_REQUEST_METHOD); String query = (String)message.get(Message.QUERY_STRING); if (!"GET".equals(method) || StringUtils.isEmpty(query)) { return; } String baseUri = (String)message.get(Message.REQUEST_URL); URI uri = null; try { uri = URI.create(baseUri); } catch (IllegalArgumentException iae) { //invalid URI, ignore and continue return; } Map<String, String> map = UrlUtils.parseQueryString(query); if (isRecognizedQuery(map, uri, message.getExchange().getEndpoint().getEndpointInfo())) { try { Conduit c = message.getExchange().getDestination().getBackChannel(message); Message mout = new MessageImpl(); mout.setExchange(message.getExchange()); message.getExchange().setOutMessage(mout); mout.put(Message.CONTENT_TYPE, "application/javascript;charset=UTF-8"); c.prepare(mout); OutputStream os = mout.getContent(OutputStream.class); writeResponse(uri, map, os, message.getExchange().getEndpoint()); } catch (IOException ioe) { throw new Fault(ioe); } } }
public static String urlEncode(String value) { return urlEncode(value, "UTF-8"); }
public static String urlDecode(String value) { return urlDecode(value, "UTF-8"); }
message.put(WSDLGetUtils.class, utils); Map<String, String> map = UrlUtils.parseQueryString(query); if (isRecognizedQuery(map)) { Document doc = getDocument(utils, message, baseUri, map, ctx);