use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class SubscriptionManagerImpl method grantSubscriptionManagerReference.
protected void grantSubscriptionManagerReference(SubscriptionTicket ticket, SubscriptionTicketGrantingResponse response) {
EndpointReferenceType subscriptionManagerReference = new EndpointReferenceType();
subscriptionManagerReference.setAddress(getSubscriptionManagerAddress());
// generate a ID for this subscription
UUID uuid = UUID.randomUUID();
JAXBElement<String> idqn = new JAXBElement<String>(new QName(subscriptionIdNamespace, subscriptionIdElementName), String.class, uuid.toString());
subscriptionManagerReference.setReferenceParameters(new ReferenceParametersType());
subscriptionManagerReference.getReferenceParameters().getAny().add(idqn);
ticket.setUuid(uuid);
response.setSubscriptionManagerReference(subscriptionManagerReference);
response.setUUID(uuid);
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class MemoryResourceManager method create.
@Override
public ReferenceParametersType create(Representation initRepresentation) {
// Store xmlResource
String uuid = UUID.randomUUID().toString();
Element representationEl = (Element) initRepresentation.getAny();
if (representationEl == null) {
storage.put(uuid, "");
} else {
storage.put(uuid, StaxUtils.toString(representationEl));
}
Element uuidEl = DOMUtils.getEmptyDocument().createElementNS(REF_NAMESPACE, REF_LOCAL_NAME);
uuidEl.setTextContent(uuid);
// Create referenceParameter
ReferenceParametersType refParam = new ReferenceParametersType();
refParam.getAny().add(uuidEl);
return refParam;
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType 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.addressing.ReferenceParametersType in project cxf by apache.
the class ResourceRemote method create.
@Override
public CreateResponse create(Create body) {
Representation representation = body.getRepresentation();
ValidAndTransformHelper.validationAndTransformation(getResourceTypeIdentifiers(), representation, null);
ReferenceParametersType refParams = getManager().create(representation);
CreateResponse response = new CreateResponse();
response.setResourceCreated(new EndpointReferenceType());
response.getResourceCreated().setReferenceParameters(refParams);
response.setRepresentation(body.getRepresentation());
return response;
}
use of org.apache.cxf.ws.addressing.ReferenceParametersType in project cxf by apache.
the class FragmentGetQNameTest method getMoreValuesTest.
@Test
public void getMoreValuesTest() throws XMLStreamException {
String content = "<root><b>Text1</b><b>Text2</b><b>Text3</b></root>";
ResourceManager resourceManager = new MemoryResourceManager();
ReferenceParametersType refParams = resourceManager.create(getRepresentation(content));
Server resource = createLocalResource(resourceManager);
Resource client = createClient(refParams);
ObjectFactory objectFactory = new ObjectFactory();
Get request = new Get();
request.setDialect(FragmentDialectConstants.FRAGMENT_2011_03_IRI);
ExpressionType expression = new ExpressionType();
expression.setLanguage(FragmentDialectConstants.QNAME_LANGUAGE_IRI);
expression.getContent().add("b");
request.getAny().add(objectFactory.createExpression(expression));
GetResponse response = client.get(request);
ValueType value = getValue(response);
Assert.assertEquals(3, value.getContent().size());
Assert.assertEquals("b", ((Element) value.getContent().get(0)).getLocalName());
Assert.assertEquals("b", ((Element) value.getContent().get(1)).getLocalName());
Assert.assertEquals("b", ((Element) value.getContent().get(2)).getLocalName());
resource.destroy();
}
Aggregations