[ofbiz-plugins] branch trunk updated: Improved: specialized exception class added for Service Not Found. Also, changed returned status code for service not exportable or action not defined(OFBIZ-11328)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-plugins] branch trunk updated: Improved: specialized exception class added for Service Not Found. Also, changed returned status code for service not exportable or action not defined(OFBIZ-11328)

grv-2
This is an automated email from the ASF dual-hosted git repository.

grv pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f45a295  Improved: specialized exception class added for Service Not Found. Also, changed returned status code for service not exportable or action not defined(OFBIZ-11328)
f45a295 is described below

commit f45a295061b72e6f6b9d9decef874e5987c92840
Author: Girish Vasmatkar <[hidden email]>
AuthorDate: Thu Oct 1 11:22:16 2020 +0530

    Improved: specialized exception class added for Service Not Found. Also, changed returned status code for service not exportable or action not defined(OFBIZ-11328)
---
 .../ofbiz/ws/rs/ServiceNotFoundException.java      | 31 ++++++++++++++++++++++
 .../apache/ofbiz/ws/rs/ServiceRequestFilter.java   |  4 +--
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceNotFoundException.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceNotFoundException.java
new file mode 100644
index 0000000..3127513
--- /dev/null
+++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceNotFoundException.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.ofbiz.ws.rs;
+
+import javax.ws.rs.NotFoundException;
+
+public class ServiceNotFoundException extends NotFoundException {
+
+    private static final long serialVersionUID = -3002310435429546325L;
+
+    public ServiceNotFoundException(String service) {
+        super("Service '" + service + "' not found.");
+    }
+
+}
diff --git a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceRequestFilter.java b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceRequestFilter.java
index 9021edf..91f5f87 100644
--- a/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceRequestFilter.java
+++ b/ofbiz-rest-impl/src/main/java/org/apache/ofbiz/ws/rs/ServiceRequestFilter.java
@@ -77,7 +77,7 @@ public class ServiceRequestFilter implements ContainerRequestFilter {
             }
 
             if (mdService == null) {
-                throw new NotFoundException("Service '" + service + "' not found.");
+                throw new ServiceNotFoundException(service);
             }
 
             if (mdService != null && !mdService.isExport()) {
@@ -85,7 +85,7 @@ public class ServiceRequestFilter implements ContainerRequestFilter {
             }
 
             if (mdService != null && UtilValidate.isEmpty(mdService.getAction())) {
-                throw new ConflictException("Service '" + service + "' does not have HTTP action defined.");
+                throw new NotFoundException("Service '" + service + "' does not have HTTP action defined.");
             }
 
             if (!mdService.getAction().equalsIgnoreCase(method)) {