Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: A Class that implements administrative methods 
4
 *  Copyright: 2008 Regents of the University of California and the
5
 *             National Center for Ecological Analysis and Synthesis
6
 *    Authors: Michael Daigle
7
 * 
8
 *   '$Author: daigle $'
9
 *     '$Date: 2008-07-06 21:25:34 -0700 (Sun, 06 Jul 2008) $'
10
 * '$Revision: 4080 $'
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
 */
26

    
27
package edu.ucsb.nceas.metacat.util;
28

    
29
import java.io.IOException;
30

    
31
import javax.servlet.http.HttpServletRequest;
32
import javax.servlet.http.HttpServletResponse;
33

    
34
import org.apache.log4j.Logger;
35

    
36
public class ResponseUtil {
37
	
38
	private static Logger logMetacat = Logger.getLogger(ResponseUtil.class);
39
	
40
	/**
41
	 * private constructor - all methods are static so there is no
42
     * no need to instantiate.
43
	 */
44
	private ResponseUtil() {}
45
	
46
	/**
47
	 * Redirect a response.
48
	 * 
49
	 * @param response
50
	 *            that is to be redirected
51
	 * @param destination
52
	 *            the context-relative URL to which the request is forwarded
53
	 */
54
	public static void redirectResponse(HttpServletRequest request,
55
			HttpServletResponse response, String destination)
56
			throws IOException {
57
		logMetacat.debug("Redirecting response to " + request.getContextPath() + destination);
58
		response.sendRedirect(request.getContextPath() + destination);
59
	}
60
}
(7-7/11)