use of net.opengis.ows.x11.RequestMethodType in project ddf by codice.
the class CswEndpoint method buildOperation.
/**
* Creates an Operation object for the OperationsMetadata section TODO: We currently don't use
* the constraint or metadata elements, those can be added in as desired
*
* @param name The name of the operation
* @param types The request types supported (GET/POST)
* @return The constructed Operation object
*/
private Operation buildOperation(String name, List<QName> types) {
Operation op = new Operation();
op.setName(name);
ArrayList<DCP> dcpList = new ArrayList<>();
DCP dcp = new DCP();
HTTP http = new HTTP();
for (QName type : types) {
RequestMethodType rmt = new RequestMethodType();
rmt.setHref(uri.getBaseUri().toASCIIString());
JAXBElement<RequestMethodType> requestElement = new JAXBElement<>(type, RequestMethodType.class, rmt);
if (type.equals(CswConstants.POST)) {
requestElement.getValue().getConstraint().add(createDomainType(CswConstants.POST_ENCODING, CswConstants.XML));
}
http.getGetOrPost().add(requestElement);
}
dcp.setHTTP(http);
dcpList.add(dcp);
op.setDCP(dcpList);
return op;
}
use of net.opengis.ows.x11.RequestMethodType in project arctic-sea by 52North.
the class OwsEncoderv110 method encodeOwsDCP.
private void encodeOwsDCP(OwsDCP dcp, DCP xdcp) {
if (dcp.isHTTP()) {
HTTP xhttp = xdcp.addNewHTTP();
OwsHttp http = dcp.asHTTP();
SortedSet<OwsRequestMethod> requestMethods = http.getRequestMethods();
requestMethods.forEach(method -> {
RequestMethodType xmethod;
switch(method.getHttpMethod()) {
case HTTPMethods.GET:
xmethod = xhttp.addNewGet();
break;
case HTTPMethods.POST:
xmethod = xhttp.addNewPost();
break;
default:
return;
}
encodeOnlineResource(method, xmethod);
method.getConstraints().forEach(x -> encodeOwsDomain(x, xmethod.addNewConstraint()));
});
}
}
Aggregations