Search in sources :

Example 26 with PutResponse

use of org.apache.cxf.ws.transfer.PutResponse in project cxf by apache.

the class ResourceLocal method put.

@Override
public PutResponse put(Put body) {
    // Getting reference paramaters
    AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context.getMessageContext()).getWrappedMessage().getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
    ReferenceParametersType refParams = addrProps.getToEndpointReference().getReferenceParameters();
    // Getting representation from the ResourceManager
    Representation storedRepresentation = manager.get(refParams);
    // Getting representation from the incoming SOAP message. This representation will be stored.
    Representation putRepresentation = body.getRepresentation();
    // Dialect processing
    if (body.getDialect() != null && !body.getDialect().isEmpty()) {
        if (dialects.containsKey(body.getDialect())) {
            Dialect dialect = dialects.get(body.getDialect());
            putRepresentation = dialect.processPut(body, storedRepresentation);
        } else {
            throw new UnknownDialect();
        }
    }
    ValidAndTransformHelper.validationAndTransformation(resourceTypeIdentifiers, putRepresentation, storedRepresentation);
    manager.put(refParams, putRepresentation);
    PutResponse response = new PutResponse();
    response.setRepresentation(putRepresentation);
    return response;
}
Also used : UnknownDialect(org.apache.cxf.ws.transfer.shared.faults.UnknownDialect) WrappedMessageContext(org.apache.cxf.jaxws.context.WrappedMessageContext) FragmentDialect(org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialect) UnknownDialect(org.apache.cxf.ws.transfer.shared.faults.UnknownDialect) Dialect(org.apache.cxf.ws.transfer.dialect.Dialect) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties) ReferenceParametersType(org.apache.cxf.ws.addressing.ReferenceParametersType) Representation(org.apache.cxf.ws.transfer.Representation) PutResponse(org.apache.cxf.ws.transfer.PutResponse)

Aggregations

ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)26 PutResponse (org.apache.cxf.ws.transfer.PutResponse)26 Server (org.apache.cxf.endpoint.Server)25 Put (org.apache.cxf.ws.transfer.Put)25 MemoryResourceManager (org.apache.cxf.ws.transfer.manager.MemoryResourceManager)25 ResourceManager (org.apache.cxf.ws.transfer.manager.ResourceManager)25 Resource (org.apache.cxf.ws.transfer.resource.Resource)25 Test (org.junit.Test)25 Element (org.w3c.dom.Element)25 ExpressionType (org.apache.cxf.ws.transfer.dialect.fragment.ExpressionType)24 Fragment (org.apache.cxf.ws.transfer.dialect.fragment.Fragment)24 ValueType (org.apache.cxf.ws.transfer.dialect.fragment.ValueType)21 Representation (org.apache.cxf.ws.transfer.Representation)7 WrappedMessageContext (org.apache.cxf.jaxws.context.WrappedMessageContext)1 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)1 Dialect (org.apache.cxf.ws.transfer.dialect.Dialect)1 FragmentDialect (org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialect)1 UnknownDialect (org.apache.cxf.ws.transfer.shared.faults.UnknownDialect)1 Document (org.w3c.dom.Document)1