Examples of PhoneContextHandler


Examples of org.glassfish.comms.api.telurl.PhoneContextHandler

     * @param localNumber the local number to normalize
     * @param phoneContext the phone-context
     * @return the normalized number
     */
    String normalize(String localNumber, String phoneContext) {
        PhoneContextHandler handler = null;

        Map<String, PatternMapping<PhoneContextHandler>> mappings;

        synchronized (this) {
            mappings = phoneContextHandlerMappings;
        }

        for (PatternMapping<PhoneContextHandler> mapping : mappings.values()) {
            if (mapping.regexpPattern.matcher(phoneContext).find()) {
                handler = mapping.mappedObject;

                break;
            }
        }

        String normalizedNumber = (handler != null)
            ? handler.normalize(localNumber, phoneContext) : null;

        if ((normalizedNumber != null) && (normalizedNumber.charAt(0) != '+')) {
            // Be nice and make it correct :-)
            normalizedNumber = "+" + normalizedNumber;

            if (logger.isLoggable(Level.WARNING)) {
                logger.log(Level.WARNING,
                    "The result of phone number normalization using: \"" +
                    handler.getClass() +
                    "\", was not a number prefixed with '+'. This has been fixed by the container.");
            }
        }

        return UriUtil.cleanupPhonenumber(normalizedNumber);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.