Project

General

Profile

« Previous | Next » 

Revision 3011

Add qformat parameter in call to executeAdvancedSearch() method.

Refactor code to get the relative paths of the resultset XSL and search results JSP from the MetacatHelper class rather than hard-coded.

View differences:

SearchServlet.java
51 51
   */
52 52
  private static final String CONFIG_DIR = "WEB-INF";
53 53
  private static final String CONFIG_NAME = "metacat.properties";
54
  static final long serialVersionUID = 0;  // Needed for Eclipse warning.
54 55
			   
55 56
  // Instance Variables
56 57
  private String contextString = "";
......
66 67
    RequestDispatcher dispatcher;
67 68
    HttpSession httpSession = request.getSession();
68 69
    Metacat metacat = (Metacat) httpSession.getAttribute("metacat");
70
    MetacatHelper metacatHelper = new MetacatHelper();
69 71
    String metacatURL;
72
    String qformat = (String) httpSession.getAttribute("qformat");
70 73
    String result = "";
71
    final String resultsJSP = "style/skins/default/advancedsearchresults.jsp";
74
    final String resultsJSP = metacatHelper.getResultsJSP();
72 75
    String searchValue;
73 76
    ServletContext servletContext = httpSession.getServletContext();
74
    String stylesheet = (String) httpSession.getAttribute("stylesheet");
75
    String xslPath = servletContext.getRealPath("style/common/resultset.xsl");
77
    String xslPath = metacatHelper.getResultsetXSL(request);
76 78

  
77 79
    // First check whether the metacat URL was set as a context-param.
78 80
    metacatURL = servletContext.getInitParameter("metacatURL");
......
80 82
    // If no metacat URL was configured, then derive the metacat URL from the
81 83
    // server name and server port.
82 84
    if (metacatURL == null || metacatURL.equals("")) {
83
      MetacatHelper metacatHelper = new MetacatHelper();
84 85
      String serverName = request.getServerName();
85 86
      int serverPort = request.getServerPort();
86 87
      metacatURL = 
87
          metacatHelper.constructMetacatURL(serverName, serverPort, contextString);
88
       metacatHelper.constructMetacatURL(serverName, serverPort, contextString);
88 89
    }
89 90

  
90 91
    // Tell the web server that the response is HTML
......
94 95
    advancedSearch = new AdvancedSearch(null);
95 96
    searchValue = request.getParameter("searchValue");
96 97
    System.err.println("Search Servlet: " + searchValue);
97
    result = advancedSearch.executeSearch(metacatURL, metacat, xslPath, searchValue);
98
    result = advancedSearch.executeSearch(metacatURL, metacat, qformat, 
99
                                          xslPath, searchValue);
98 100

  
99 101
    // Store the result HTML string in the request for retrieval by
100 102
    // the metacatpathqueryresults.jsp form.

Also available in: Unified diff