public static String loadResource(String path, String resource, String encoding, boolean checkParentPaths) throws IOException {
		
		if (logger.isDebugEnabled()) logger.debug("Loading resource " + resource + " from path " + path + " with encoding " + encoding + " (parents = " + checkParentPaths + ")");
		
		//normalizes path
		InputStream input;
		String tmpPath = path.replaceAll("\\\\","/");
		if (tmpPath.endsWith("/")) {
			tmpPath = tmpPath.substring(0, path.length() - 1);
		}
		
		//checks the path for the resource and then the parent paths
		do {
			input = Thread.currentThread().getContextClassLoader().getResourceAsStream(tmpPath + "/" + resource);
			if (input == null) {
				int pos = tmpPath.lastIndexOf('/');
				if (pos > 0) {
					tmpPath = tmpPath.substring(0, pos);
				} else {
					break;
				}
			}
		} while (checkParentPaths && input == null && tmpPath != null);
		
		//exception if not found
		if (input == null) {
			throw new IOException("Resource not found in path '" + path + "'" +
					(checkParentPaths ? " nor in its parent paths" : "") + "!");
		}
		
		//return String
		return readInputStream(input, encoding);
		
	}