public SimpleAppResource(Resource resource, boolean defaultOverride, float order, String path) { this.resource = resource; this.defaultOverride = defaultOverride; this.order = order; this.path = Paths.prefixWithoutSlash(path); }
public static String prefixWithoutAndSuffixWithSlash(String path){ if(Strings.isEmpty(path)){ return path; } if(path.endsWith("/")){ return prefixWithoutSlash(path); }else{ return prefixWithoutSlash(path) + "/"; } }
public static File createRelative(File parent, final String relativePath){ if(parent.isDirectory()) { return new File(Paths.suffixWithSlash(parent.getAbsolutePath()) + Paths.prefixWithoutSlash(relativePath)); }else{ return new File(Paths.getDirPath(parent.getAbsolutePath()) + Paths.prefixWithoutSlash(relativePath)); } }
public static String prefixAndSuffixWithoutSlash(String path){ if(Strings.isEmpty(path)){ return path; } return suffixWithoutSlash(prefixWithoutSlash(path)); }
sc, Strings.isEmpty(sc.getContextPath()) ? "" : Paths.prefixWithoutSlash(sc.getContextPath()),
@Override public String resolveDoc(String doc) { if (Strings.isEmpty(doc)) { return "!!!err!! : doc file can't be empty!"; } String fragment = null; int fragmentIndex = doc.lastIndexOf('#'); if (fragmentIndex > 0) { fragment = doc.substring(fragmentIndex + 1); doc = doc.substring(0, fragmentIndex); } String cp = EXTERNAL_DOC_CLASSPATH + Paths.prefixWithoutSlash(doc); Resource resource = Resources.getResource(cp); if (!resource.exists()) { return "!!!err!!! : doc file '" + cp + "' not exists!"; } log.debug("Read doc '{}'", cp); String content = resource.getContent(); if (Strings.isEmpty(fragment)) { return content; } else { //todo : optimize performance return readFragment(cp, content, fragment); } }
protected boolean doCheckOperationExists(RestdContext context, RouteBuilder r, Routes routes, boolean container) { final String verb = r.getMethod(); final String path = r.getPathTemplate().getTemplate(); final String fullPath = container ? path : Paths.suffixWithSlash(context.getApi().getBasePath()) + Paths.prefixWithoutSlash(path);
settings.setRemoteType(RemoteType.rest); settings.setEndpoint(Paths.suffixWithSlash(entity.getServiceUrl())); settings.setRelativePath(Paths.prefixWithoutSlash(entity.getServicePath())); em.setRemoteSettings(settings);