Subversion Repositories SmartDukaan

Rev

Rev 6204 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package in.shop2020.serving.mappers;

import in.shop2020.serving.services.SpecialPageConfigurer;
import in.shop2020.serving.utils.Utils;

import org.apache.struts2.dispatcher.mapper.ActionMapping;
import org.apache.struts2.rest.RestActionMapper;

/**
 * 
 * @author rajveer
 * 
 * Saholic mapper will allow us to dynamically map the urls with action. We will be able to create the pages dynamically in cms.
 */
public class SaholicMapper extends RestActionMapper{
            
        @Override
        public org.apache.struts2.dispatcher.mapper.ActionMapping getMapping(javax.servlet.http.HttpServletRequest request, com.opensymphony.xwork2.config.ConfigurationManager configManager){
                ActionMapping mapping = super.getMapping(request, configManager);
                if (mapping == null){
                        mapping = new ActionMapping();
                        mapping.setName("");
                        mapping.setNamespace("/");
                }
                if(SpecialPageConfigurer.isValidSpecialPage(mapping.getName())){
                        mapping.setName("special-page");
                }
                if(Utils.getOperatorByUri(mapping.getName()) != null){
                        mapping.setName("recharge");
                }
                return mapping;
        }
}