Ver código fonte

No stacktrace when encountering problems while building a base URL. It's not necessary and draws too much attention. Instead added the URL to the log message that causes the problem.

Don't validate Base URLs anymore in FOUserAgent because that produces errors (because an URL cannot be built) if a symbolic URI is used which is later resolved through a URIResolver.
Improved support for relative URLs for accessing font resources.
ServletContextURIResolver can now use a base URI that starts with "servlet-context:".

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@388766 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_92-beta
Jeremias Maerki 18 anos atrás
pai
commit
86ef02db9d

+ 1
- 1
src/java/org/apache/fop/apps/FOURIResolver.java Ver arquivo

@@ -204,7 +204,7 @@ public class FOURIResolver
? new java.io.File("").toURL().toExternalForm()
: baseURL);
} catch (MalformedURLException mfue) {
log.error("Error with base URL: " + mfue.getMessage(), mfue);
log.error("Error with base URL \"" + baseURL + "\"): " + mfue.getMessage());
}
return null;
}

+ 0
- 3
src/java/org/apache/fop/apps/FOUserAgent.java Ver arquivo

@@ -462,9 +462,6 @@ public class FOUserAgent {
File dir = new File(cfgBaseDir);
if (dir.isDirectory()) {
cfgBaseDir = dir.toURL().toExternalForm();
} else {
//The next statement is for validation only
new URL(cfgBaseDir);
}
}
log.info(name + " set to: " + cfgBaseDir);

+ 3
- 1
src/java/org/apache/fop/fonts/LazyFont.java Ver arquivo

@@ -95,7 +95,9 @@ public class LazyFont extends Typeface implements FontDescriptor {
}
return;
}
reader = new FontReader(new InputSource(in));
InputSource src = new InputSource(in);
src.setSystemId(source.getSystemId());
reader = new FontReader(src);
} else {
reader
= new FontReader(new InputSource(new URL(metricsFileName).openStream()));

+ 10
- 1
src/java/org/apache/fop/servlet/ServletContextURIResolver.java Ver arquivo

@@ -52,7 +52,13 @@ public class ServletContextURIResolver implements URIResolver {
if (href.startsWith(SERVLET_CONTEXT_PROTOCOL)) {
return resolveServletContextURI(href.substring(SERVLET_CONTEXT_PROTOCOL.length()));
} else {
return null;
if (base.startsWith(SERVLET_CONTEXT_PROTOCOL) && (href.indexOf(':') < 0)) {
String abs = base + href;
return resolveServletContextURI(
abs.substring(SERVLET_CONTEXT_PROTOCOL.length()));
} else {
return null;
}
}
}

@@ -63,6 +69,9 @@ public class ServletContextURIResolver implements URIResolver {
* @throws TransformerException if no URL can be constructed from the path
*/
protected Source resolveServletContextURI(String path) throws TransformerException {
while (path.startsWith("//")) {
path = path.substring(1);
}
try {
URL url = this.servletContext.getResource(path);
InputStream in = this.servletContext.getResourceAsStream(path);

Carregando…
Cancelar
Salvar