1 6 package org.jboss.net.axis.server; 7 8 import javax.activation.CommandMap ; 9 import javax.activation.MailcapCommandMap ; 10 11 import org.jboss.logging.Logger; 12 13 17 public class JAFConfigService 18 { 19 private static Logger log = Logger.getLogger(JAFConfigService.class); 20 private String [] mailcaps = { 21 "text/xml;;x-java-content-handler=org.jboss.net.axis.jaf.XMLDataContentHandler", 22 "application/xml;;x-java-content-handler=org.jboss.net.axis.jaf.XMLDataContentHandler" 23 }; 24 25 public String [] getMailcaps() 26 { 27 return mailcaps; 28 } 29 public void setMailcaps(String [] mailcaps) 30 { 31 this.mailcaps = mailcaps; 32 } 33 34 public void start() throws Exception 35 { 36 CommandMap commandMap = CommandMap.getDefaultCommandMap(); 37 if( commandMap instanceof MailcapCommandMap ) 38 { 39 MailcapCommandMap mailMap = (MailcapCommandMap ) commandMap; 40 for(int n = 0; n < mailcaps.length; n ++) 41 { 42 String mailcap = mailcaps[n]; 43 mailMap.addMailcap(mailcap); 44 log.debug("Added mailcap: "+mailcap); 45 } 46 } 47 else 48 { 49 throw new Exception ("Cannot handle non-MailcapCommandMap, map=" 50 +commandMap); 51 } 52 } 53 } 54 | Popular Tags |