Search in sources :

Example 1 with UnknownDialect

use of org.apache.cxf.ws.transfer.shared.faults.UnknownDialect in project cxf by apache.

the class ResourceLocal method get.

@Override
public GetResponse get(Get body) {
    // Getting reference paramaters
    AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context.getMessageContext()).getWrappedMessage().getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
    ReferenceParametersType refParams = addrProps.getToEndpointReference().getReferenceParameters();
    GetResponse response = new GetResponse();
    // Getting representation from the ResourceManager
    Representation representation = manager.get(refParams);
    // Dialect processing
    if (body.getDialect() != null && !body.getDialect().isEmpty()) {
        if (dialects.containsKey(body.getDialect())) {
            Dialect dialect = dialects.get(body.getDialect());
            // Send fragment of resource instead it's representation.
            response.getAny().add(dialect.processGet(body, representation));
        } else {
            throw new UnknownDialect();
        }
    } else {
        // Send representation obtained from ResourceManager.
        response.setRepresentation(representation);
    }
    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) GetResponse(org.apache.cxf.ws.transfer.GetResponse)

Example 2 with UnknownDialect

use of org.apache.cxf.ws.transfer.shared.faults.UnknownDialect in project cxf by apache.

the class ResourceFactoryImpl method create.

@Override
public CreateResponse create(Create body) {
    if (body.getDialect() != null && !body.getDialect().isEmpty()) {
        if (dialects.containsKey(body.getDialect())) {
            Dialect dialect = dialects.get(body.getDialect());
            Representation representation = dialect.processCreate(body);
            body.setRepresentation(representation);
        } else {
            throw new UnknownDialect();
        }
    }
    ValidAndTransformHelper.validationAndTransformation(resourceTypeIdentifiers, body.getRepresentation(), null);
    ResourceReference resourceReference = resourceResolver.resolve(body);
    if (resourceReference.getResourceManager() != null) {
        return createLocally(body, resourceReference);
    }
    return createRemotely(body, resourceReference);
}
Also used : UnknownDialect(org.apache.cxf.ws.transfer.shared.faults.UnknownDialect) UnknownDialect(org.apache.cxf.ws.transfer.shared.faults.UnknownDialect) Dialect(org.apache.cxf.ws.transfer.dialect.Dialect) Representation(org.apache.cxf.ws.transfer.Representation) ResourceReference(org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceReference)

Example 3 with UnknownDialect

use of org.apache.cxf.ws.transfer.shared.faults.UnknownDialect in project cxf by apache.

the class ResourceLocal method delete.

@Override
public DeleteResponse delete(Delete body) {
    // Getting reference paramaters
    AddressingProperties addrProps = (AddressingProperties) ((WrappedMessageContext) context.getMessageContext()).getWrappedMessage().getContextualProperty(JAXWSAConstants.ADDRESSING_PROPERTIES_INBOUND);
    ReferenceParametersType refParams = addrProps.getToEndpointReference().getReferenceParameters();
    boolean delete = true;
    // Dialect processing
    if (body.getDialect() != null && !body.getDialect().isEmpty()) {
        if (dialects.containsKey(body.getDialect())) {
            Dialect dialect = dialects.get(body.getDialect());
            delete = dialect.processDelete(body, manager.get(refParams));
        } else {
            throw new UnknownDialect();
        }
    }
    if (delete) {
        manager.delete(refParams);
    }
    return new DeleteResponse();
}
Also used : UnknownDialect(org.apache.cxf.ws.transfer.shared.faults.UnknownDialect) DeleteResponse(org.apache.cxf.ws.transfer.DeleteResponse) 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)

Example 4 with UnknownDialect

use of org.apache.cxf.ws.transfer.shared.faults.UnknownDialect 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

Dialect (org.apache.cxf.ws.transfer.dialect.Dialect)4 UnknownDialect (org.apache.cxf.ws.transfer.shared.faults.UnknownDialect)4 WrappedMessageContext (org.apache.cxf.jaxws.context.WrappedMessageContext)3 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)3 ReferenceParametersType (org.apache.cxf.ws.addressing.ReferenceParametersType)3 Representation (org.apache.cxf.ws.transfer.Representation)3 FragmentDialect (org.apache.cxf.ws.transfer.dialect.fragment.FragmentDialect)3 DeleteResponse (org.apache.cxf.ws.transfer.DeleteResponse)1 GetResponse (org.apache.cxf.ws.transfer.GetResponse)1 PutResponse (org.apache.cxf.ws.transfer.PutResponse)1 ResourceReference (org.apache.cxf.ws.transfer.resourcefactory.resolver.ResourceReference)1