diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceDispatcher.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceDispatcher.java index 0500247f4..a6d39b62c 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceDispatcher.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/ServiceDispatcher.java @@ -57,6 +57,7 @@ import org.apache.olingo.server.core.requests.DataRequest; import org.apache.olingo.server.core.requests.FunctionRequest; import org.apache.olingo.server.core.requests.MediaRequest; import org.apache.olingo.server.core.requests.MetadataRequest; +import org.apache.olingo.server.core.requests.OperationRequest; import org.apache.olingo.server.core.requests.ServiceDocumentRequest; import org.apache.olingo.server.core.uri.parser.Parser; import org.apache.olingo.server.core.uri.validator.UriValidator; @@ -178,8 +179,13 @@ public class ServiceDispatcher extends RequestURLHierarchyVisitor { @Override public void visit(UriResourceCount option) { - DataRequest dataRequest = (DataRequest) this.request; - dataRequest.setCountRequest(option != null); + if (this.request instanceof DataRequest) { + DataRequest dataRequest = (DataRequest) this.request; + dataRequest.setCountRequest(option != null); + } else if (this.request instanceof OperationRequest) { + OperationRequest opRequest = (OperationRequest) this.request; + opRequest.setCountRequest(option != null); + } } @Override diff --git a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/OperationRequest.java b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/OperationRequest.java index 927dd13ad..9bc797140 100644 --- a/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/OperationRequest.java +++ b/lib/server-core-ext/src/main/java/org/apache/olingo/server/core/requests/OperationRequest.java @@ -33,6 +33,8 @@ import org.apache.olingo.server.core.ServiceRequest; public abstract class OperationRequest extends ServiceRequest { + private boolean countRequest; + public OperationRequest(OData odata, ServiceMetadata serviceMetadata) { super(odata, serviceMetadata); } @@ -114,4 +116,12 @@ public abstract class OperationRequest extends ServiceRequest { public boolean isReturnTypeComplex() { return getReturnType().getType().getKind() == EdmTypeKind.COMPLEX; } + + public boolean isCountRequest() { + return countRequest; + } + + public void setCountRequest(boolean countRequest) { + this.countRequest = countRequest; + } } \ No newline at end of file