All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mobicents.servlet.sip.catalina.rules.Mapping Maven / Gradle / Ivy

/*
 * JBoss, Home of Professional Open Source
 * Copyright 2011, Red Hat, Inc. and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

package org.mobicents.servlet.sip.catalina.rules;

import org.apache.log4j.Logger;

public class Mapping {
	private static final Logger logger = Logger.getLogger(Mapping.class);
	/**
	 * From JSR: amounts to 
	 * method == "RULETEST1" &&
     * (r-uri.scheme == "sips" || r-uri.scheme = "sip") &&
     * r-uri.user == "rule-1" &&
     * r-uri.host subdomain-of "example.com" &&
     * r-uri.host == "host17.example.com" &&
     * !(r-uri.tel != null) &&
     * r-uri.param.foo != null &&
     * r-uri.port == 5000
	 */
	public static final String TEST = 
		""
		+ ""
	    + ""
	    + "rule-1"
	    + ""
	    + ""
	    + ""
	    + "request.method"
        + "RULETEST1"
        + ""
        + ""
        + ""
        + "request.uri.scheme"
        + "sips"
        + ""
        + ""
        + "request.uri.scheme"
        + "sip"
        + ""
        + ""
        + ""
        + "request.uri.user"
        + "rule-1"
        + ""
        + ""
        + "request.uri.host"
        + "example.com"
        + ""
        + ""
        + "request.uri.host"
        + "host17.example.com"
        + ""
        + ""
        + ""
        + "request.uri.tel"
        + ""
        + ""
        + ""
        + "request.uri.param.foo"
        + ""
        + ""
        + "request.uri.port"
        + "5072"
        + ""
        + ""
        + "" 
        + ""
        + "";
        

//	public static void main(String[] args) throws Exception {
//		
//		BasicConfigurator.configure();
//		
//		Digester digester = new Digester();
//        digester.setValidating(false);
//        digester.addRule("sip-app/servlet-mapping/pattern",
//                new TestRule());
//        
//       digester.parse(new StringReader(TEST));
//	}
	
//	static class TestRule extends NodeCreateRule {
//		
//		public TestRule() throws Exception {	
//		}
//
//		@Override
//		public void begin(String arg0, String arg1, Attributes arg2)
//				throws Exception {
//			// TODO Auto-generated method stub
//			super.begin(arg0, arg1, arg2);
//		}
//		
//		@Override
//		public void end(String namespace, String name) throws Exception {
//			 Element e = (Element) super.digester.pop();
//			   Node pattern = (Node) e;
//
//			   NodeList list = pattern.getChildNodes();
//			   
//			   try {
//				   MatchingRule rule = MatchingRuleParser.buildRule((Element) list.item(0));
//				   if (rule != null) {
//					   logger.debug(rule.getExpression());
//				   }
//			   } catch (Throwable t) {
//				   t.printStackTrace();
//			   }
//		}
//	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy