This post originated from an RSS feed registered with Java Buzz
by Marc Logemann.
Original Post: Struts 2.1.x with CXF 2.1.4 issues on URI mappings
Feed Title: Logemann Blog
Feed URL: http://feeds.feedburner.com/LogemannBlog
Feed Description: Marc Logemann's thoughts on java and other stuff
The CXF servlet never gets called on CXF requests like "http://..../services/. Thats because even though Struts2 has no namespace for this nor any action it "handles" this request without passing through the chain.
My quick solutions is to write a custom ActionMapper which modifies the default one a bit. Here the struts.properties for the custom actionMapper.
/* * Copyright (c) 2008 Logentis GmbH. All Rights Reserved. * * This software is the proprietary information of Logentis GmbH * Use is subject to license terms as seen in LICENSE.txt in the * distribution. Logentis GmbH PROPRIETARY/CONFIDENTIAL. * */ package de.logentis.struts2;
/** * ActionMapper that excludes all /services/* URLs. A shame that this cant be * done simpler w/o a custom ActionMapper * */ public class CXFStruts2ActionMapper extends DefaultActionMapper {
@Override public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) { ActionMapping mapping = new ActionMapping(); String uri = getUri(request); int indexOfSemicolon = uri.indexOf(";"); uri = (indexOfSemicolon > -1) ? uri.substring(0, indexOfSemicolon) : uri; uri = dropExtension(uri, mapping);