1 /** 2 * Copyright (C) 2005-2009 Alfresco Software Limited. 3 * 4 * This file is part of the Spring Surf Extension project. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.springframework.extensions.surf.util; 20 21 import javax.servlet.http.HttpServletRequest; 22 import javax.servlet.http.HttpServletRequestWrapper; 23 24 /** 25 * A wrapper class for buffering around HttpServletRequest objects 26 * 27 * @author muzquiano 28 */ 29 public class WrappedHttpServletRequest extends HttpServletRequestWrapper 30 { 31 /** 32 * Instantiates a new wrapped http servlet request. 33 * 34 * @param request the request 35 */ 36 public WrappedHttpServletRequest(HttpServletRequest request) 37 { 38 super(request); 39 } 40 41 private String requestUri; 42 43 /** 44 * Allows for the request URI to be manually overridden 45 * 46 * @param requestUri the new request uri 47 */ 48 public void setRequestURI(String requestUri) 49 { 50 this.requestUri = requestUri; 51 } 52 53 /* (non-Javadoc) 54 * @see javax.servlet.http.HttpServletRequestWrapper#getRequestURI() 55 */ 56 public String getRequestURI() 57 { 58 String value = null; 59 60 if (requestUri != null) 61 { 62 value = requestUri; 63 } 64 else 65 { 66 value = super.getRequestURI(); 67 } 68 69 return value; 70 } 71 72 }