1 40 package org.dspace.app.webui.servlet; 41 42 import java.io.IOException ; 43 import java.sql.SQLException ; 44 45 import javax.servlet.ServletException ; 46 import javax.servlet.http.HttpServletRequest ; 47 import javax.servlet.http.HttpServletResponse ; 48 49 import org.apache.log4j.Logger; 50 import org.dspace.authorize.AuthorizeException; 51 import org.dspace.core.Context; 52 import org.dspace.core.LogManager; 53 54 61 public class OpenURLServlet extends DSpaceServlet 62 { 63 64 private static Logger log = Logger.getLogger(OpenURLServlet.class); 65 66 protected void doDSGet(Context context, HttpServletRequest request, 67 HttpServletResponse response) throws ServletException , IOException , 68 SQLException , AuthorizeException 69 { 70 String query = ""; 71 72 String title = request.getParameter("title"); 74 String authorFirst = request.getParameter("aufirst"); 75 String authorLast = request.getParameter("aulast"); 76 77 String logInfo = ""; 78 79 if (title != null) 80 { 81 query = query + " " + title; 82 logInfo = logInfo + "title=\"" + title + "\","; 83 } 84 85 if (authorFirst != null) 86 { 87 query = query + " " + authorFirst; 88 logInfo = logInfo + "aufirst=\"" + authorFirst + "\","; 89 } 90 91 if (authorLast != null) 92 { 93 query = query + " " + authorLast; 94 logInfo = logInfo + "aulast=\"" + authorLast + "\","; 95 } 96 97 log.info(LogManager.getHeader(context, "openURL", logInfo 98 + "dspacequery=" + query)); 99 100 response.sendRedirect(response.encodeRedirectURL(request 101 .getContextPath() 102 + "/simple-search?query=" + query)); 103 } 104 105 protected void doDSPost(Context context, HttpServletRequest request, 106 HttpServletResponse response) throws ServletException , IOException , 107 SQLException , AuthorizeException 108 { 109 doDSGet(context, request, response); 111 } 112 } 113 | Popular Tags |