01: /**
02: * Copyright 2004, Gareth Cronin
03: * Subject to LGPL
04: * User: garethc
05: * Date: 5/06/2004
06: * Time: 17:47:23
07: */package vqwiki.servlets;
08:
09: import vqwiki.utils.JSPUtils;
10:
11: import javax.servlet.ServletException;
12: import javax.servlet.http.HttpServletRequest;
13: import javax.servlet.http.HttpServletResponse;
14: import java.io.IOException;
15:
16: /**
17: * Servlet for handling quick menu search and jump-to options. Despatches work to other servlets.
18: * <p/>
19: * Copyright 2004, Gareth Cronin
20: *
21: * @author $Author: wrh2 $
22: * Last Modified: $Date: 2006-04-23 08:36:56 +0200 (zo, 23 apr 2006) $
23: * $Id: MenuJumpServlet.java 643 2006-04-23 06:36:56Z wrh2 $
24: */
25: public class MenuJumpServlet extends VQWikiServlet {
26:
27: /**
28: *
29: */
30: protected void doPost(HttpServletRequest httpServletRequest,
31: HttpServletResponse httpServletResponse)
32: throws ServletException, IOException {
33: String jumpto = httpServletRequest.getParameter("jumpto");
34: String text = httpServletRequest.getParameter("text");
35: if (jumpto != null) {
36: // the jump-to submit button was pushed so do a jumpto
37: String redirectURL = JSPUtils.createRedirectURL(
38: httpServletRequest, "Wiki?"
39: + JSPUtils.encodeURL(text));
40: redirect(redirectURL, httpServletResponse);
41: return;
42: } else {
43: // do a search
44: String redirectURL = JSPUtils.createRedirectURL(
45: httpServletRequest, "Wiki?action="
46: + WikiServlet.ACTION_SEARCH + "&text="
47: + JSPUtils.encodeURL(text));
48: redirect(redirectURL, httpServletResponse);
49: return;
50: }
51: }
52: }
|