/* (non-Javadoc)
* @see org.apache.struts2.dispatcher.mapper.ActionMapper#getMapping(javax.servlet.http.HttpServletRequest)
*/
String uri = RequestUtils.getServletPath(request);
int nextSlash = uri.indexOf('/", 1);
if (nextSlash == -1) {
return null;
}
String actionName = uri.substring(1, nextSlash);
HashMap<String,String> parameters = new HashMap<String,String>();
try {
StringTokenizer st = new StringTokenizer(uri.substring(nextSlash), "/");
boolean isNameTok = true;
String paramName = null;
String paramValue;
// check if we have the first parameter name
if ((st.countTokens() % 2) != 0) {
isNameTok = false;
paramName = actionName + "Id";
}
while (st.hasMoreTokens()) {
if (isNameTok) {
paramName = URLDecoder.decode(st.nextToken(), "UTF-8");
isNameTok = false;
} else {
paramValue = URLDecoder.decode(st.nextToken(), "UTF-8");
if ((paramName != null) && (paramName.length() > 0)) {
parameters.put(paramName, paramValue);
}
isNameTok = true;
}
}
} catch (Exception e) {
LOG.warn(e);
}
return new ActionMapping(actionName, "", "", parameters);