This works for me public class ServletRedirectResultExt extends ServletRedirectResult {
private static final Log log = LogFactory.getLog(ServletRedirectResult.class); protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception { ActionContext ctx = invocation.getInvocationContext(); HttpServletRequest request = (HttpServletRequest) ctx.get(ServletActionContext.HTTP_REQUEST); HttpServletResponse response = (HttpServletResponse) ctx.get(ServletActionContext.HTTP_RESPONSE); if (isPathUrl(finalLocation)) { if (!finalLocation.startsWith("/")) { ActionMapping mapping = actionMapper.getMapping( request, Dispatcher.getInstance().getConfigurationManager()); String namespace = null; if (mapping != null) { namespace = mapping.getNamespace(); } if ((namespace != null) && (namespace.length() > 0) && (!"/".equals(namespace))) { finalLocation = namespace + "/" + finalLocation; } else { finalLocation = "/" + finalLocation; } } // if the URL's are relative to the servlet context, append the servlet context path if (prependServletContext && (request.getContextPath() != null) && (request.getContextPath().length() > 0)) { finalLocation = request.getContextPath() + finalLocation; } finalLocation = response.encodeRedirectURL(finalLocation); } if (log.isDebugEnabled()) { log.debug("Redirecting to finalLocation " + finalLocation); } response.sendRedirect(finalLocation); } private boolean isPathUrl(String finalLocation) { try { new URL(finalLocation); return false; } catch (MalformedURLException ex) { return true; } } } On Fri, Dec 12, 2008 at 7:35 AM, Luis Gervaso <luis.gerv...@gmail.com>wrote: > Hello > > *private* *static* *boolean* isPathUrl(String url) { > *// filter out "http:", "https:", "mailto:", "file:", "ftp:" > * *// since the only valid places for : in URL's is before the path > specification > * *// either before the port, or after the protocol > * *return* (url.indexOf(*':'*) == -1); > } > > I'm currently using jcr (jackrabbit) as backend, and the path *parameter* of > the nodes can be ns:name > > so my urls are http://.../resourcesManager.action?path=/jcr:system/other/stuff > > The redirect removes the context path, > > maybe a workaround solution use de URL class > > When you construct a URL object, Java looks for a > > protocol handler that understands the protocol part of the URL such > as "http" or "mailto". If no such handler is found, the constructor > throws a MalformedURLException. > > Hope this helps > > > -- > ------------------------------------------- > Luis Alberto Gervaso Martin > Java EE Architect & Instructor > C/ Cuenca 4A, 2ºB > Getafe (Madrid) > SPAIN > mobile: (+34) 627983344 > luis.gerv...@gmail.com > -- ------------------------------------------- Luis Alberto Gervaso Martin Java EE Architect & Instructor C/ Cuenca 4A, 2ºB Getafe (Madrid) SPAIN mobile: (+34) 627983344 luis.gerv...@gmail.com