Project

General

Profile

« Previous | Next » 

Revision 3768

Added by daigle about 16 years ago

Include the contextURL as a parameter for the transformer. Remove leading / from resultset paths

View differences:

Stylizer.java
32 32
import javax.xml.transform.TransformerException;
33 33
import javax.xml.transform.TransformerFactory;
34 34

  
35
import org.apache.log4j.Logger;
36

  
37
import edu.ucsb.nceas.metacat.MetaCatUtil;
38

  
35 39
/**
36 40
 * @author dcosta
37 41
 * 
......
40 44
 */
41 45
public class Stylizer {
42 46

  
47
  private Logger logMetacat = Logger.getLogger(Stylizer.class);
48
	
43 49
  /**
44 50
   * Applies the resultset.xsl stylesheet to the pathquery result string
45 51
   * returned by Metacat.
......
76 82

  
77 83
    try {
78 84
      transformer = transformerFactory.newTransformer(xsltSource);
85
      
86
      MetaCatUtil metaCatUtil = new MetaCatUtil();
87
      
88
      String httpServer = MetaCatUtil.getOption("httpserver");
89
      String context = MetaCatUtil.getOption("context");
90
      
91
      // Log error if httpserver or context are not set in metacat
92
      // configuration, but allow transform to proceed.  User will
93
      // see data, albeit without pretty formatting.
94
      if (httpServer == null || context == null) {
95
    	logMetacat.error("httpserver and context values must be set in " +
96
    			"metacat configuration for advanced search formatting to " +
97
    			"work properly");
98
      } else {
99
        transformer.setParameter("contextURL", httpServer+"/"+context+"/");
100
      }
79 101

  
80 102
      if (sessionId != null) {
81 103
        transformer.setParameter("sessid", sessionId);

Also available in: Unified diff