use of org.apache.cxf.ws.transfer.dialect.Dialect 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;
}
use of org.apache.cxf.ws.transfer.dialect.Dialect 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);
}
use of org.apache.cxf.ws.transfer.dialect.Dialect 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();
}
use of org.apache.cxf.ws.transfer.dialect.Dialect 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;
}
Aggregations