Java源码示例:javax.activation.CommandInfo
示例1
private static boolean cmdMapInitialized(MailcapCommandMap mailMap) {
CommandInfo[] commands = mailMap.getAllCommands("text/xml");
if (commands == null || commands.length == 0) {
return false;
}
// SAAJ RI implements it's own DataHandlers which can be used for JAX-WS too;
// see com.sun.xml.internal.messaging.saaj.soap.AttachmentPartImpl#initializeJavaActivationHandlers
// so if found any of SAAJ or our own handler registered, we are ok; anyway using SAAJ directly here
// is not good idea since we don't want standalone JAX-WS to depend on specific SAAJ impl.
// This is also reason for duplication of Handler's code by JAX-WS
String saajClassName = "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler";
String jaxwsClassName = "com.sun.xml.internal.ws.encoding.XmlDataContentHandler";
for (CommandInfo command : commands) {
String commandClass = command.getCommandClass();
if (saajClassName.equals(commandClass) ||
jaxwsClassName.equals(commandClass)) {
return true;
}
}
return false;
}
示例2
private static boolean cmdMapInitialized(MailcapCommandMap mailMap) {
CommandInfo[] commands = mailMap.getAllCommands("text/xml");
if (commands == null || commands.length == 0) {
return false;
}
// SAAJ RI implements it's own DataHandlers which can be used for JAX-WS too;
// see com.sun.xml.internal.messaging.saaj.soap.AttachmentPartImpl#initializeJavaActivationHandlers
// so if found any of SAAJ or our own handler registered, we are ok; anyway using SAAJ directly here
// is not good idea since we don't want standalone JAX-WS to depend on specific SAAJ impl.
// This is also reason for duplication of Handler's code by JAX-WS
String saajClassName = "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler";
String jaxwsClassName = "com.sun.xml.internal.ws.encoding.XmlDataContentHandler";
for (CommandInfo command : commands) {
String commandClass = command.getCommandClass();
if (saajClassName.equals(commandClass) ||
jaxwsClassName.equals(commandClass)) {
return true;
}
}
return false;
}
示例3
private static boolean cmdMapInitialized(MailcapCommandMap mailMap) {
CommandInfo[] commands = mailMap.getAllCommands("text/xml");
if (commands == null || commands.length == 0) {
return false;
}
// SAAJ RI implements it's own DataHandlers which can be used for JAX-WS too;
// see com.sun.xml.internal.messaging.saaj.soap.AttachmentPartImpl#initializeJavaActivationHandlers
// so if found any of SAAJ or our own handler registered, we are ok; anyway using SAAJ directly here
// is not good idea since we don't want standalone JAX-WS to depend on specific SAAJ impl.
// This is also reason for duplication of Handler's code by JAX-WS
String saajClassName = "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler";
String jaxwsClassName = "com.sun.xml.internal.ws.encoding.XmlDataContentHandler";
for (CommandInfo command : commands) {
String commandClass = command.getCommandClass();
if (saajClassName.equals(commandClass) ||
jaxwsClassName.equals(commandClass)) {
return true;
}
}
return false;
}
示例4
private static boolean cmdMapInitialized(MailcapCommandMap mailMap) {
CommandInfo[] commands = mailMap.getAllCommands("text/xml");
if (commands == null || commands.length == 0) {
return false;
}
// SAAJ RI implements it's own DataHandlers which can be used for JAX-WS too;
// see com.sun.xml.internal.messaging.saaj.soap.AttachmentPartImpl#initializeJavaActivationHandlers
// so if found any of SAAJ or our own handler registered, we are ok; anyway using SAAJ directly here
// is not good idea since we don't want standalone JAX-WS to depend on specific SAAJ impl.
// This is also reason for duplication of Handler's code by JAX-WS
String saajClassName = "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler";
String jaxwsClassName = "com.sun.xml.internal.ws.encoding.XmlDataContentHandler";
for (CommandInfo command : commands) {
String commandClass = command.getCommandClass();
if (saajClassName.equals(commandClass) ||
jaxwsClassName.equals(commandClass)) {
return true;
}
}
return false;
}
示例5
private static boolean cmdMapInitialized(MailcapCommandMap mailMap) {
CommandInfo[] commands = mailMap.getAllCommands("text/xml");
if (commands == null || commands.length == 0) {
return false;
}
// SAAJ RI implements it's own DataHandlers which can be used for JAX-WS too;
// see com.sun.xml.internal.messaging.saaj.soap.AttachmentPartImpl#initializeJavaActivationHandlers
// so if found any of SAAJ or our own handler registered, we are ok; anyway using SAAJ directly here
// is not good idea since we don't want standalone JAX-WS to depend on specific SAAJ impl.
// This is also reason for duplication of Handler's code by JAX-WS
String saajClassName = "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler";
String jaxwsClassName = "com.sun.xml.internal.ws.encoding.XmlDataContentHandler";
for (CommandInfo command : commands) {
String commandClass = command.getCommandClass();
if (saajClassName.equals(commandClass) ||
jaxwsClassName.equals(commandClass)) {
return true;
}
}
return false;
}
示例6
private static boolean cmdMapInitialized(MailcapCommandMap mailMap) {
CommandInfo[] commands = mailMap.getAllCommands("text/xml");
if (commands == null || commands.length == 0) {
return false;
}
// SAAJ RI implements it's own DataHandlers which can be used for JAX-WS too;
// see com.sun.xml.internal.messaging.saaj.soap.AttachmentPartImpl#initializeJavaActivationHandlers
// so if found any of SAAJ or our own handler registered, we are ok; anyway using SAAJ directly here
// is not good idea since we don't want standalone JAX-WS to depend on specific SAAJ impl.
// This is also reason for duplication of Handler's code by JAX-WS
String saajClassName = "com.sun.xml.internal.messaging.saaj.soap.XmlDataContentHandler";
String jaxwsClassName = "com.sun.xml.internal.ws.encoding.XmlDataContentHandler";
for (CommandInfo command : commands) {
String commandClass = command.getCommandClass();
if (saajClassName.equals(commandClass) ||
jaxwsClassName.equals(commandClass)) {
return true;
}
}
return false;
}
示例7
@Override
public synchronized CommandInfo[] getAllCommands(String mimeType) {
CommandInfo[] commands = super.getAllCommands(mimeType);
CommandInfo[] defaultCommands = DEFAULT_COMMAND_MAP.getAllCommands(mimeType);
List<CommandInfo> cmdList = new ArrayList<>(Arrays.asList(commands));
// Add CommandInfo which does not exist in current command map.
for (CommandInfo defCmdInfo : defaultCommands) {
String defCmdName = defCmdInfo.getCommandName();
boolean cmdNameExist = false;
for (CommandInfo cmdInfo : commands) {
if (cmdInfo.getCommandName().equals(defCmdName)) {
cmdNameExist = true;
break;
}
}
if (!cmdNameExist) {
cmdList.add(defCmdInfo);
}
}
CommandInfo[] allCommandArray = new CommandInfo[0];
return cmdList.toArray(allCommandArray);
}
示例8
@Override
public synchronized CommandInfo getCommand(String mimeType, String cmdName) {
CommandInfo cmdInfo = super.getCommand(mimeType, cmdName);
if (cmdInfo == null) {
cmdInfo = DEFAULT_COMMAND_MAP.getCommand(mimeType, cmdName);
}
return cmdInfo;
}