Package org.apache.cxf.headers

Examples of org.apache.cxf.headers.Header


            String act = elem.getAttributeNS(message.getVersion().getNamespace(),
                    message.getVersion().getAttrNameRole());
               
            shead.setActor(act);
            shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu));
            Header oldHdr = message.getHeader(
                    new QName(elem.getNamespaceURI(), elem.getLocalName()));
            if (oldHdr != null) {
                message.getHeaders().remove(oldHdr);
            }
            message.getHeaders().add(shead);                       
View Full Code Here


        }
    }


    private void processUsernameToken(SoapMessage message) {
        Header h = findSecurityHeader(message, false);
        if (h == null) {
            return;
        }
        Element el = (Element)h.getObject();
        Element child = DOMUtils.getFirstElement(el);
        while (child != null) {
            if (SPConstants.USERNAME_TOKEN.equals(child.getLocalName())) {
                try  {
                    final WSUsernameTokenPrincipal princ = getPrincipal(child, message);
View Full Code Here

    }

    private void addUsernameToken(SoapMessage message) {
        UsernameToken tok = assertUsernameTokens(message, null);

        Header h = findSecurityHeader(message, true);
        WSSecUsernameToken utBuilder =
            addUsernameToken(message, tok);
        if (utBuilder == null) {
            AssertionInfoMap aim = message.get(AssertionInfoMap.class);
            Collection<AssertionInfo> ais = aim.getAssertionInfo(SP12Constants.USERNAME_TOKEN);
            for (AssertionInfo ai : ais) {
                if (ai.isAsserted()) {
                    ai.setAsserted(false);
                }
            }
            return;
        }
        Element el = (Element)h.getObject();
        utBuilder.prepare(el.getOwnerDocument());
        el.appendChild(utBuilder.getUsernameTokenElement());
    }
View Full Code Here

    }

    private <T> void setUpHeaderDecode(List<Header> headers, String uri, String name, Class<T> clz,
                                       int index, Unmarshaller unmarshaller) throws Exception {
        Element headerElement = control.createMock(Element.class);
        headers.add(new Header(new QName(uri, name), headerElement));
        headerElement.getNamespaceURI();
        EasyMock.expectLastCall().andReturn(uri);
        headerElement.getLocalName();
        EasyMock.expectLastCall().andReturn(name);
        Object v = expectedValues[index];
View Full Code Here

       
        message.setContent(Node.class, headerInfo[0]);
       
        Node node = ((Element) headerInfo[1]).getChildNodes().item(0);
       
        message.getHeaders().add(new Header(new QName(node.getNamespaceURI(), node.getLocalName()), node));
       
        control.replay();

        SOAPHandlerInterceptor li = new SOAPHandlerInterceptor(binding);
        li.handleMessage(message);
        control.verify();

        // Verify SOAPMessage header
        SOAPMessage soapMessageNew = message.getContent(SOAPMessage.class);      

        Element headerElementNew = DOMUtils.getFirstElement(soapMessageNew.getSOAPHeader());
       
        SoapVersion soapVersion = Soap11.getInstance();
        assertEquals("false", headerElementNew.getAttributeNS(soapVersion.getNamespace(), "mustUnderstand"));

        // Verify XMLStreamReader
        XMLStreamReader xmlReader = message.getContent(XMLStreamReader.class);
        QName qn = xmlReader.getName();
        assertEquals("sendReceiveData", qn.getLocalPart());
       
        // Verify Header Element
        Iterator<Header> iter = message.getHeaders().iterator();
        Element requiredHeader = null;
        while (iter.hasNext()) {
            Header localHdr = iter.next();
            if (localHdr.getObject() instanceof Element) {
                Element elem = (Element) localHdr.getObject();
                if (elem.getNamespaceURI().equals("http://apache.org/hello_world_rpclit/types")
                        && elem.getLocalName().equals("header1")) {
                    requiredHeader = (Element) localHdr.getObject();
                    break;               
                }
            }
        }
       
View Full Code Here

            String act = elem.getAttributeNS(message.getVersion().getNamespace(),
                    message.getVersion().getAttrNameRole());
               
            shead.setActor(act);
            shead.setMustUnderstand(Boolean.valueOf(mu) || "1".equals(mu));
            Header oldHdr = message.getHeader(
                    new QName(elem.getNamespaceURI(), elem.getLocalName()));
            if (oldHdr != null) {
                message.getHeaders().remove(oldHdr);
            }
            message.getHeaders().add(shead);                       
View Full Code Here

    public void handleMessage(SoapMessage message) throws Fault {
        // TODO Auto-generated method stub
        Iterator<Header> iter =  message.getHeaders().iterator();
       
        while (iter.hasNext()) {
            Header hdr  = (Header) iter.next();
            //Only remove inbound marked headers..
            if (hdr.getDirection() == Header.Direction.DIRECTION_IN) {
                iter.remove();
            }
        }
    }
View Full Code Here

        boolean supportsNode = this.supportsDataReader(message, Node.class);
        for (SoapHeaderInfo header : headers) {
            MessagePartInfo mpi = header.getPart();
            if (mpi.getTypeClass() != null) {

                Header param = findHeader(message, mpi);
               
                Object object = null;
                if (param != null) {
                    message.getHeaders().remove(param);
                   
                    if (param.getDataBinding() == null) {
                        Node source = (Node)param.getObject();
                        if (supportsNode) {
                            object = getNodeDataReader(message).read(mpi, source);
                        } else {
                            W3CDOMStreamReader reader = new W3CDOMStreamReader((Element)source);
                            try {
                                reader.nextTag(); //advance into the first tag
                            } catch (XMLStreamException e) {
                                //ignore
                            }
                            object = getDataReader(message, XMLStreamReader.class).read(mpi, reader);
                        }
                    } else {
                        object = param.getObject();
                    }
                   
                }
                parameters.put(mpi, object);
            }
View Full Code Here

        DoubleItPortType2 x509Port =
                service.getPort(portQName, DoubleItPortType2.class);
        updateAddressPort(x509Port, PORT);
       
        List<Header> headers = new ArrayList<Header>();
        Header dummyHeader = new Header(new QName("uri:org.apache.cxf", "dummy"), "dummy-header",
                                        new JAXBDataBinding(String.class));
        headers.add(dummyHeader);
        ((BindingProvider)x509Port).getRequestContext().put(Header.HEADER_LIST, headers);
       
        int response = x509Port.doubleIt(25);
View Full Code Here

                encodeReferenceParameters(maps, hdr, marshaller);
               
                Node childNode = hdr.getFirstChild();
               
                while (childNode != null) {
                    Header holder = new Header(
                                               new QName(childNode.getNamespaceURI(),
                                                         childNode.getLocalName()),
                                                         childNode);
                    header.add(holder);
                    childNode = childNode.getNextSibling();
View Full Code Here

TOP

Related Classes of org.apache.cxf.headers.Header

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.