Java Code Examples for javax.xml.soap.MimeHeaders#getHeader()

The following examples show how to use javax.xml.soap.MimeHeaders#getHeader() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserAgentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   if (context.getMessage() != null) {
      MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders();
      if (mimeHeaders != null) {
         String[] agents = mimeHeaders.getHeader("User-Agent");
         if (ArrayUtils.isNotEmpty(agents)) {
            LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]");
            mimeHeaders.removeHeader("User-Agent");
         }

         String value = this.config.getProperty("be.ehealth.technicalconnector.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")";
         LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]");
         mimeHeaders.addHeader("User-Agent", value);
      }
   }

   return true;
}
 
Example 2
Source File: UserAgentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   if (context.getMessage() != null) {
      MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders();
      if (mimeHeaders != null) {
         String[] agents = mimeHeaders.getHeader("User-Agent");
         if (ArrayUtils.isNotEmpty(agents)) {
            LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]");
            mimeHeaders.removeHeader("User-Agent");
         }

         String value = this.config.getProperty("be.ehealth.technicalconnector.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")";
         LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]");
         mimeHeaders.addHeader("User-Agent", value);
      }
   }

   return true;
}
 
Example 3
Source File: UserAgentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   if (context.getMessage() != null) {
      MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders();
      if (mimeHeaders != null) {
         String[] agents = mimeHeaders.getHeader("User-Agent");
         if (ArrayUtils.isNotEmpty(agents)) {
            LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]");
            mimeHeaders.removeHeader("User-Agent");
         }

         String value = this.config.getProperty("be.ehealth.technicalconnector.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")";
         LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]");
         mimeHeaders.addHeader("User-Agent", value);
      }
   }

   return true;
}
 
Example 4
Source File: UserAgentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   if (context.getMessage() != null) {
      MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders();
      if (mimeHeaders != null) {
         String[] agents = mimeHeaders.getHeader("User-Agent");
         if (ArrayUtils.isNotEmpty(agents)) {
            LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]");
            mimeHeaders.removeHeader("User-Agent");
         }

         String value = this.config.getProperty("be.ehealth.technicalconnector.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")";
         LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]");
         mimeHeaders.addHeader("User-Agent", value);
      }
   }

   return true;
}
 
Example 5
Source File: UserAgentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean handleOutbound(SOAPMessageContext context) {
   if (context.getMessage() != null) {
      MimeHeaders mimeHeaders = context.getMessage().getMimeHeaders();
      if (mimeHeaders != null) {
         String[] agents = mimeHeaders.getHeader("User-Agent");
         if (ArrayUtils.isNotEmpty(agents)) {
            LOG.info("Removing MIME header [User-Agent] with value [" + StringUtils.join(agents, ",") + "]");
            mimeHeaders.removeHeader("User-Agent");
         }

         String value = this.config.getProperty("org.taktik.connector.technical.handler.user-agent.value", "Ehealth Technical") + " (" + applicationProps.getProperty("application.version", "unknown") + ")";
         LOG.debug("Adding MIME header [User-Agent] with value [" + value + "]");
         mimeHeaders.addHeader("User-Agent", value);
      }
   }

   return true;
}
 
Example 6
Source File: SOAPConnectionImpl.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Checks whether the request has an associated SOAPAction MIME header
 * and returns its value.
 * @param request the message to check
 * @return the value of any associated SOAPAction MIME header or null
 * if there is no such header.
 */
private String checkForSOAPActionHeader(SOAPMessage request) {
    MimeHeaders hdrs = request.getMimeHeaders();
    if (hdrs != null) {
        String[] saHdrs = hdrs.getHeader("SOAPAction");
        if (saHdrs != null && saHdrs.length > 0)
            return saHdrs[0];
    }
    return null;
}
 
Example 7
Source File: MessageContextFactory.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
static String getHeader(MimeHeaders headers, String name) {
    String[] values = headers.getHeader(name);
    return (values != null && values.length > 0) ? values[0] : null;
}
 
Example 8
Source File: MessageContextFactory.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
static String getHeader(MimeHeaders headers, String name) {
    String[] values = headers.getHeader(name);
    return (values != null && values.length > 0) ? values[0] : null;
}
 
Example 9
Source File: MessageContextFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
static String getHeader(MimeHeaders headers, String name) {
    String[] values = headers.getHeader(name);
    return (values != null && values.length > 0) ? values[0] : null;
}
 
Example 10
Source File: MessageContextFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
static String getHeader(MimeHeaders headers, String name) {
    String[] values = headers.getHeader(name);
    return (values != null && values.length > 0) ? values[0] : null;
}
 
Example 11
Source File: MessageContextFactory.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static String getHeader(MimeHeaders headers, String name) {
    String[] values = headers.getHeader(name);
    return (values != null && values.length > 0) ? values[0] : null;
}
 
Example 12
Source File: MessageContextFactory.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
static String getHeader(MimeHeaders headers, String name) {
    String[] values = headers.getHeader(name);
    return (values != null && values.length > 0) ? values[0] : null;
}
 
Example 13
Source File: MessageContextFactory.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
static String getHeader(MimeHeaders headers, String name) {
    String[] values = headers.getHeader(name);
    return (values != null && values.length > 0) ? values[0] : null;
}
 
Example 14
Source File: MessageContextFactory.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
static String getHeader(MimeHeaders headers, String name) {
    String[] values = headers.getHeader(name);
    return (values != null && values.length > 0) ? values[0] : null;
}