Skip to content

Commit

Permalink
changed filenames of velocity templates since colon character is rese…
Browse files Browse the repository at this point in the history
…rved in windows
  • Loading branch information
fasseg committed Jun 7, 2013
1 parent 35707b8 commit 3cc4da1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
Expand Up @@ -5,12 +5,13 @@
import static com.google.common.collect.ImmutableMap.builder;
import static javax.ws.rs.core.MediaType.TEXT_HTML;
import static javax.ws.rs.core.MediaType.TEXT_HTML_TYPE;
import static org.fcrepo.responses.RdfSerializationUtils.getFirstValueForPredicate;
import static org.fcrepo.responses.RdfSerializationUtils.getDatasetSubject;
import static org.fcrepo.responses.RdfSerializationUtils.getFirstValueForPredicate;
import static org.fcrepo.responses.RdfSerializationUtils.primaryTypePredicate;
import static org.fcrepo.responses.RdfSerializationUtils.setCachingHeaders;
import static org.slf4j.LoggerFactory.getLogger;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
Expand All @@ -32,7 +33,6 @@
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;

import com.hp.hpl.jena.graph.Node;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
Expand All @@ -44,14 +44,15 @@
import org.springframework.stereotype.Component;

import com.google.common.collect.ImmutableMap.Builder;
import com.hp.hpl.jena.graph.Node;
import com.hp.hpl.jena.query.Dataset;

/**
* A simple JAX-RS Entity Provider that can accept RDF datasets
* that represent Fedora resources and merge them into templates
* that represent Fedora resources and merge them into templates
* chosen based on the primary node type of the backing JCR node
* for that Fedora resource.
*
*
* @author ajs6f
* @date May 19, 2013
*/
Expand All @@ -67,10 +68,10 @@ public class HtmlProvider implements MessageBodyWriter<Dataset> {
/**
* Location in the classpath where Velocity templates are to be found.
*/
public static final String templatesLocation = "/views";
public static final String templatesLocation = File.separator + "views";

/**
* A map from String names for primary node types to the
* A map from String names for primary node types to the
* Velocity templates that should be used for those node types.
*/
protected Map<String, Template> templatesMap;
Expand Down Expand Up @@ -108,7 +109,7 @@ void init() throws IOException, RepositoryException {
primaryNodeTypes.nextNodeType().getName();
// for each node primary type, we try to find a template
final String templateLocation =
templatesLocation + "/" + primaryNodeTypeName +
templatesLocation + "/" + primaryNodeTypeName.replace(':', '-') +
templateFilenameExtension;
try {
final Template template =
Expand Down

0 comments on commit 3cc4da1

Please sign in to comment.