Index: components/core/src/main/java/org/hippoecm/hst/core/container/ActionValve.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- components/core/src/main/java/org/hippoecm/hst/core/container/ActionValve.java	(revision 32905)
+++ components/core/src/main/java/org/hippoecm/hst/core/container/ActionValve.java	(revision )
@@ -36,28 +36,27 @@
 
 /**
  * ActionValve
- * 
+ *
  * @version $Id: ActionValve.java 30870 2011-10-30 13:12:33Z aschrijvers $
  */
 public class ActionValve extends AbstractValve {
 
     @Override
-    public void invoke(ValveContext context) throws ContainerException
-    {
+    public void invoke(ValveContext context) throws ContainerException {
         HttpServletRequest servletRequest = context.getServletRequest();
         HttpServletResponse servletResponse = context.getServletResponse();
         HstRequestContext requestContext = context.getRequestContext();
         String actionWindowReferenceNamespace = requestContext.getBaseURL().getActionWindowReferenceNamespace();
-        
+
         if (actionWindowReferenceNamespace != null) {
-            
+
             HstContainerURL baseURL = requestContext.getBaseURL();
             HstComponentWindow window = null;
             window = findComponentWindow(context.getRootComponentWindow(), actionWindowReferenceNamespace);
-            
+
             HstResponseState responseState = null;
             HstContainerURLProvider urlProvider = requestContext.getURLFactory().getContainerURLProvider();
-            
+
             if (window == null) {
                 if (log.isWarnEnabled()) {
                     log.warn("Cannot find the action window: {}", actionWindowReferenceNamespace);
@@ -65,19 +64,19 @@
             } else {
                 // Check if it is invoked from portlet.
                 responseState = (HstResponseState) servletRequest.getAttribute(HstResponseState.class.getName());
-                
+
                 if (responseState == null) {
                     responseState = new HstServletResponseState(servletRequest, servletResponse);
                 }
-                
+
                 HstRequest request = new HstRequestImpl(servletRequest, requestContext, window, HstRequest.ACTION_PHASE);
                 HstResponseImpl response = new HstResponseImpl(servletRequest, servletResponse, requestContext, window, responseState, null);
                 ((HstComponentWindowImpl) window).setResponseState(responseState);
 
                 getComponentInvoker().invokeAction(context.getRequestContainerConfig(), request, response);
-                
+
                 // page error handling...
-                PageErrors pageErrors = getPageErrors(new HstComponentWindow [] { window }, true);
+                PageErrors pageErrors = getPageErrors(new HstComponentWindow[]{window}, true);
                 if (pageErrors != null) {
                     PageErrorHandler.Status handled = handleComponentExceptions(pageErrors, context.getRequestContainerConfig(), window, request, response);
                     String location = responseState.getRedirectLocation();
@@ -86,22 +85,22 @@
                         return;
                     }
                 }
-                
+
-                Map<String, String []> renderParameters = response.getRenderParameters();
+                Map<String, String[]> renderParameters = response.getRenderParameters();
                 response.setRenderParameters(null);
-                
+
                 if (renderParameters == null) {
                     renderParameters = Collections.emptyMap();
                 }
-                
+
                 String referenceNamespace = window.getReferenceNamespace();
-                
+
                 if (getUrlFactory().isReferenceNamespaceIgnored()) {
                     referenceNamespace = "";
                 }
-                
+
                 urlProvider.mergeParameters(baseURL, referenceNamespace, renderParameters);
-                
+
                 if (responseState.getErrorCode() > 0) {
                     try {
                         int errorCode = responseState.getErrorCode();
@@ -111,7 +110,7 @@
                         if (log.isDebugEnabled()) {
                             log.debug("The action window has error status code: {} - {}", errorCode, componentClassName);
                         }
-                        
+
                         if (errorMessage != null) {
                             servletResponse.sendError(errorCode, errorMessage);
                         } else {
@@ -132,7 +131,7 @@
                                 baseURL.getActionParameterMap().clear();
                             }
                             baseURL.setActionWindowReferenceNamespace(null);
-                            
+
                             if (requestContext.isPortletContext()) {
                                 responseState.sendRedirect(urlProvider.toContextRelativeURLString(baseURL, requestContext));
                             } else {
@@ -144,25 +143,29 @@
                             throw new ContainerException(e);
                         }
                     }
-                    
+
                     try {
                         if (!requestContext.isPortletContext()) {
                             responseState.flush();
-                            
+
                             String location = responseState.getRedirectLocation();
-                            
+
-                            if(StringUtils.isEmpty(location)) {
+                            if (StringUtils.isEmpty(location)) {
                                 // location is the homepage (/) and there is no context path in the URL/ replace location with "/"
                                 location = "/";
                             }
-                            
+
+                            if (location.startsWith("?")) {
+                                location = "/" + location;
+                            }
+
                             if (location.startsWith("http:") || location.startsWith("https:")) {
                                 servletResponse.sendRedirect(location);
                             } else {
                                 if (!location.startsWith("/")) {
                                     throw new ContainerException("Can only redirect to a context relative path starting with a '/'.");
                                 }
-                                
+
                                 /* 
                                  * We will redirect to a URL containing the scheme + hostname + portnumber to avoid problems
                                  * when redirecting behind a proxy by default.
@@ -174,20 +177,19 @@
                                     servletResponse.sendRedirect(location);
                                 }
                             }
-                        }
-                        else {
+                        } else {
                             String location = responseState.getRedirectLocation();
                             if (!(location.startsWith("http:") || location.startsWith("https:"))) {
                                 if (!location.startsWith("/")) {
                                     throw new ContainerException("Can only redirect to a context relative path starting with a '/'.");
                                 }
                                 if (!getHstManager().getVirtualHosts().isExcluded(location)) {
-                                	ResolvedVirtualHost rvh = requestContext.getResolvedSiteMapItem().getResolvedMount().getResolvedVirtualHost();
-                                	String targetContextPath = requestContext.isEmbeddedRequest() ? requestContext.getEmbeddingContextPath() : baseURL.getContextPath();
-                                	ResolvedMount mount = rvh.matchMount(targetContextPath, location);
+                                    ResolvedVirtualHost rvh = requestContext.getResolvedSiteMapItem().getResolvedMount().getResolvedVirtualHost();
+                                    String targetContextPath = requestContext.isEmbeddedRequest() ? requestContext.getEmbeddingContextPath() : baseURL.getContextPath();
+                                    ResolvedMount mount = rvh.matchMount(targetContextPath, location);
                                     if (mount != null && mount.getMount().isMapped()) {
-                                    	// redirectLocation is (at least) matched on a Mount: the portlet should try to render it 
+                                        // redirectLocation is (at least) matched on a Mount: the portlet should try to render it
-                                    	((HstPortletResponseState)responseState).setRenderRedirect(true);
+                                        ((HstPortletResponseState) responseState).setRenderRedirect(true);
                                     }
                                 }
                             }
@@ -197,7 +199,7 @@
                     }
                 }
             }
-            
+
         } else {
             // continue
             context.invokeNext();
