org.apache.cxf.headers.Header.getDirection()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.apache.cxf.headers.Header.getDirection()方法的一些代码示例,展示了Header.getDirection()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.getDirection()方法的具体详情如下:
包路径:org.apache.cxf.headers.Header
类名称:Header
方法名:getDirection

Header.getDirection介绍

暂无

代码示例

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

protected void updateHeader(Exchange exchange, MessageContext ctx) {
  if (ctx.containsKey(Header.HEADER_LIST)
      && ctx.get(Header.HEADER_LIST) instanceof List<?>) {
    List<?> list = (List<?>) ctx.get(Header.HEADER_LIST);
    if (list != null && !list.isEmpty()) {
      SoapMessage sm = (SoapMessage) createResponseMessage(exchange);
      if (sm != null) {
        Iterator<?> iter = list.iterator();
        while (iter.hasNext()) {
          Header header = (Header) iter.next();
          if (header.getDirection() != Header.Direction.DIRECTION_IN
            && !header.getName().getNamespaceURI().
              equals("http://docs.oasis-open.org/wss/2004/01/"
                  + "oasis-200401-wss-wssecurity-secext-1.0.xsd")
                && !header.getName().getNamespaceURI().
                  equals("http://docs.oasis-open.org/"
                     + "wss/oasis-wss-wssecurity-secext-1.1.xsd")) {
            //don't copy over security header, out interceptor chain will take care of it.
            sm.getHeaders().add(header);
          }
        }
      }
    }
  }
}

代码示例来源:origin: apache/cxf

public void handleMessage(SoapMessage message) throws Fault {
  Iterator<Header> iter = message.getHeaders().iterator();
  while (iter.hasNext()) {
    Header hdr = iter.next();
    //Only remove inbound marked headers..
    if (hdr == null || hdr.getDirection() == Header.Direction.DIRECTION_IN) {
      iter.remove();
    }
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-bindings-soap

public void handleMessage(SoapMessage message) throws Fault {
  Iterator<Header> iter = message.getHeaders().iterator();
  while (iter.hasNext()) {
    Header hdr = iter.next();
    //Only remove inbound marked headers..
    if (hdr == null || hdr.getDirection() == Header.Direction.DIRECTION_IN) {
      iter.remove();
    }
  }
}

代码示例来源:origin: apache/cxf

protected void updateHeader(Exchange exchange, MessageContext ctx) {
  if (ctx.containsKey(Header.HEADER_LIST)
      && ctx.get(Header.HEADER_LIST) instanceof List<?>) {
    List<?> list = (List<?>) ctx.get(Header.HEADER_LIST);
    if (list != null && !list.isEmpty()) {
      SoapMessage sm = (SoapMessage) createResponseMessage(exchange);
      if (sm != null) {
        Iterator<?> iter = list.iterator();
        while (iter.hasNext()) {
          Header header = (Header) iter.next();
          if (header.getDirection() != Header.Direction.DIRECTION_IN
            && !header.getName().getNamespaceURI().
              equals("http://docs.oasis-open.org/wss/2004/01/"
                  + "oasis-200401-wss-wssecurity-secext-1.0.xsd")
                && !header.getName().getNamespaceURI().
                  equals("http://docs.oasis-open.org/"
                     + "wss/oasis-wss-wssecurity-secext-1.1.xsd")) {
            //don't copy over security header, out interceptor chain will take care of it.
            sm.getHeaders().add(header);
          }
        }
      }
    }
  }
}

代码示例来源:origin: apache/cxf

public void handleMessage(SoapMessage soapMessage) throws Fault {
  SoapVersion soapVersion = soapMessage.getVersion();
  Set<QName> notFound = new HashSet<>();
  List<Header> heads = soapMessage.getHeaders();
  for (Header header : heads) {
    if (header instanceof SoapHeader
      && ((SoapHeader)header).isMustUnderstand()
      && header.getDirection() == Header.Direction.DIRECTION_IN
      && !knownHeaders.contains(header.getName())
      && (StringUtils.isEmpty(((SoapHeader)header).getActor())
        || soapVersion.getUltimateReceiverRole()
          .equals(((SoapHeader)header).getActor()))) {
      notFound.add(header.getName());
    }
  }
  if (!notFound.isEmpty()) {
    soapMessage.remove(UNKNOWNS);
    throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notFound),
            soapVersion.getMustUnderstand());
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-bindings-soap

public void handleMessage(SoapMessage soapMessage) throws Fault {
  SoapVersion soapVersion = soapMessage.getVersion();
  Set<QName> notFound = new HashSet<>();
  List<Header> heads = soapMessage.getHeaders();
  for (Header header : heads) {
    if (header instanceof SoapHeader
      && ((SoapHeader)header).isMustUnderstand()
      && header.getDirection() == Header.Direction.DIRECTION_IN
      && !knownHeaders.contains(header.getName())
      && (StringUtils.isEmpty(((SoapHeader)header).getActor())
        || soapVersion.getUltimateReceiverRole()
          .equals(((SoapHeader)header).getActor()))) {
      notFound.add(header.getName());
    }
  }
  if (!notFound.isEmpty()) {
    soapMessage.remove(UNKNOWNS);
    throw new SoapFault(new Message("MUST_UNDERSTAND", BUNDLE, notFound),
            soapVersion.getMustUnderstand());
  }
}

相关文章