diff options
Diffstat (limited to 'src/java/org/apache/fop/apps')
-rw-r--r-- | src/java/org/apache/fop/apps/FOUserAgent.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/apps/MimeConstants.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/apps/io/URIResolverWrapper.java | 94 |
3 files changed, 4 insertions, 96 deletions
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java index 987ba7d1e..fc9287401 100644 --- a/src/java/org/apache/fop/apps/FOUserAgent.java +++ b/src/java/org/apache/fop/apps/FOUserAgent.java @@ -60,7 +60,7 @@ import org.apache.fop.render.ImageHandlerRegistry; import org.apache.fop.render.Renderer; import org.apache.fop.render.RendererConfig; import org.apache.fop.render.RendererConfig.RendererConfigParser; -import org.apache.fop.render.RendererConfigOptions; +import org.apache.fop.render.RendererConfigOption; import org.apache.fop.render.RendererFactory; import org.apache.fop.render.XMLHandlerRegistry; import org.apache.fop.render.intermediate.IFDocumentHandler; @@ -390,7 +390,7 @@ public class FOUserAgent { * @param option the renderer option * @return the value */ - public Object getRendererOption(RendererConfigOptions option) { + public Object getRendererOption(RendererConfigOption option) { return rendererOptions.get(option.getName()); } diff --git a/src/java/org/apache/fop/apps/MimeConstants.java b/src/java/org/apache/fop/apps/MimeConstants.java index 851690db1..75b05c8b7 100644 --- a/src/java/org/apache/fop/apps/MimeConstants.java +++ b/src/java/org/apache/fop/apps/MimeConstants.java @@ -32,4 +32,6 @@ public interface MimeConstants extends org.apache.xmlgraphics.util.MimeConstants String MIME_FOP_AREA_TREE = "application/X-fop-areatree"; /** Apache FOP's intermediate format XML */ String MIME_FOP_IF = "application/X-fop-intermediate-format"; + /** Bitmap images */ + String MIME_BITMAP = "image/x-bitmap"; } diff --git a/src/java/org/apache/fop/apps/io/URIResolverWrapper.java b/src/java/org/apache/fop/apps/io/URIResolverWrapper.java deleted file mode 100644 index 2d2420d49..000000000 --- a/src/java/org/apache/fop/apps/io/URIResolverWrapper.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* $Id$ */ - -package org.apache.fop.apps.io; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.xml.transform.Source; -import javax.xml.transform.TransformerException; -import javax.xml.transform.stream.StreamSource; - -import org.apache.xmlgraphics.util.uri.DataURIResolver; - -public class URIResolverWrapper { - private final URI baseUri; - private final ResourceResolver uriResolver; - private final DataURIResolver dataSchemeResolver = new DataURIResolver(); - - public URIResolverWrapper(URI baseUri, ResourceResolver uriResolver) { - this.baseUri = baseUri; - this.uriResolver = uriResolver; - } - - public URI getBaseURI() { - return baseUri; - } - - public InputStream resolveIn(String stringUri) throws IOException, URISyntaxException { - if (stringUri.startsWith("data:")) { - return resolveDataURI(stringUri); - } - return resolveIn(cleanURI(stringUri)); - } - - public InputStream resolveIn(URI uri) throws IOException { - if (uri.getScheme() != null && uri.getScheme().startsWith("data")) { - return resolveDataURI(uri.toASCIIString()); - } - return uriResolver.getResource(resolveFromBase(uri)); - } - - public OutputStream resolveOut(URI uri) throws IOException { - return uriResolver.getOutputStream(resolveFromBase(uri)); - } - - private URI resolveFromBase(URI uri) { - return baseUri.resolve(uri); - } - - public static URI cleanURI(String uriStr) throws URISyntaxException { - // replace back slash with forward slash to ensure windows file:/// URLS are supported - if (uriStr == null) { - return null; - } - String fixedUri = uriStr.replace('\\', '/'); - fixedUri = fixedUri.replace(" ", "%20"); - URI baseURI = new URI(fixedUri); - return baseURI; - } - - public static URI getBaseURI(String base) throws URISyntaxException { - String path = base + (base.endsWith("/") ? "" : "/"); - return cleanURI(path); - } - - private InputStream resolveDataURI(String dataURI) { - try { - Source src = dataSchemeResolver.resolve(dataURI, ""); - return src == null ? null : ((StreamSource) src).getInputStream(); - } catch (TransformerException e) { - throw new RuntimeException(e); - } - } -} |