Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * Conditions Of Use
  *
  * This software was developed by employees of the National Institute of
  * Standards and Technology (NIST), an agency of the Federal Government.
  * Pursuant to title 15 Untied States Code Section 105, works of NIST
  * employees are not subject to copyright protection in the United States
  * and are considered to be in the public domain.  As a result, a formal
  * license is not needed to use the software.
 *
 * This software is provided by NIST as a service and is expressly
 * provided "AS IS."  NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
 * OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
 * AND DATA ACCURACY.  NIST does not warrant or make any representations
 * regarding the use of the software or the results thereof, including but
 * not limited to the correctness, accuracy, reliability or usefulness of
 * the software.
 *
 * Permission to use this software is contingent upon your acceptance
 * of the terms of this agreement
 *
 * .
 *
 */
 package gov.nist.javax.sip.header;
 
A mapping class that returns the SIPHeader for a given header name. Add new classes to this map if you are implementing new header types if you want some of the introspection based methods to work.

Version:
1.2 $Revision: 1.11 $ $Date: 2009-07-17 18:57:32 $
Since:
1.1
 
 public class NameMap implements SIPHeaderNamesPackageNames {
     static Hashtable nameMap;
     static {
         initializeNameMap();
     }
 
     protected static void putNameMap(String headerNameString className) {
         .put(
             headerName.toLowerCase(),
             className);
     }
 
     public static Class getClassFromName(String headerName) {
         String className = (String.get(headerName.toLowerCase());
         if (className == null)
             return null;
         else {
             try {
                 return Class.forName(className);
             } catch (ClassNotFoundException ex) {
                 return null;
             }
         }
     }

    
add an extension header to this map.

Parameters:
headerName is the extension header name.
className is the fully qualified class name that implements the header (does not have to belong to the nist-sip package). Use this if you want to use the introspection-based methods.
 
 
     public static void addExtensionHeader(
         String headerName,
         String className) {
         .put(headerName.toLowerCase(), className);
     }
 
     private static void initializeNameMap() {
          = new Hashtable();
         putNameMap(.MinExpires.class.getName()); // 1
 
         putNameMap(.ErrorInfo.class.getName()); // 2
 
         putNameMap(.MimeVersion.class.getName()); // 3
 
         putNameMap(.InReplyTo.class.getName()); // 4
 
         putNameMap(.Allow.class.getName()); // 5
 
         putNameMap(.ContentLanguage.class.getName()); // 6
 
         putNameMap(CallInfo.class.getName()); //7
 
         putNameMap(CSeq.class.getName()); //8
 
         putNameMap(AlertInfo.class.getName()); //9
 
         putNameMap(AcceptEncoding.class.getName()); //10
 
         putNameMap(Accept.class.getName()); //11
        putNameMap(AcceptLanguage.class.getName()); //12
        putNameMap(RecordRoute.class.getName()); //13
        putNameMap(TimeStamp.class.getName()); //14
        putNameMap(To.class.getName()); //15
        putNameMap(Via.class.getName()); //16
        putNameMap(From.class.getName()); //17
        putNameMap(CallID.class.getName()); //18
        putNameMap(Authorization.class.getName()); //19
        putNameMap(ProxyAuthenticate.class.getName()); //20
        putNameMap(Server.class.getName()); //21
        putNameMap(Unsupported.class.getName()); //22
        putNameMap(RetryAfter.class.getName()); //23
        putNameMap(ContentType.class.getName()); //24
        putNameMap(ContentEncoding.class.getName()); //25
        putNameMap(ContentLength.class.getName()); //26
        putNameMap(Route.class.getName()); //27
        putNameMap(Contact.class.getName()); //28
        putNameMap(WWWAuthenticate.class.getName()); //29
        putNameMap(MaxForwards.class.getName()); //30
        putNameMap(Organization.class.getName()); //31
        putNameMap(ProxyRequire.class.getName()); //33
        putNameMap(Require.class.getName()); //34
        putNameMap(Subject.class.getName()); //36
        putNameMap(UserAgent.class.getName()); //37
        putNameMap(Warning.class.getName()); //38
        putNameMap(Priority.class.getName()); //39
        putNameMap(SIPDateHeader.class.getName()); //40
        putNameMap(Expires.class.getName()); //41
        putNameMap(Supported.class.getName()); //42
        putNameMap(ReplyTo.class.getName()); // 43
        putNameMap(SubscriptionState.class.getName()); //44
        putNameMap(Event.class.getName()); //45
        putNameMap(AllowEvents.class.getName()); //46
        // pmusgrave - extensions
        putNameMap("ReferredBy");
        putNameMap("SessionExpires");
        putNameMap("MinSE");
        putNameMap("Replaces");
        // jean deruelle
        putNameMap("Join");
        // IMS Specific headers.
        putNameMap(.Path.class.getName());
        putNameMap(.,Privacy.class.getName());
        putNameMap(.ServiceRoute.class.getName());
    }
New to GrepCode? Check out our FAQ X