Skip to content

Commit a69fdfc

Browse files
committed
Return HTTP 403 if UnsupportedOperationException is thrown.
1 parent 0786641 commit a69fdfc

File tree

7 files changed

+20
-5
lines changed

7 files changed

+20
-5
lines changed

.idea/compiler.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ protected boolean isAuthorized(HttpServletRequest request, Method method) { ...
223223
The first argument contains the current request, and the second the service method to be invoked. If `isAuthorized()` returns `true` (the default), method execution will proceed. Otherwise, the method will not be invoked, and an HTTP 403 response will be returned.
224224

225225
### Exceptions
226-
If an exception is thrown by a service method and the response has not yet been committed, the exception message (if any) will be returned as plain text in the response body. If the exception is an instance of `IllegalArgumentException`, an HTTP 403 response will be returned. For `IllegalStateException`, HTTP 409 will be returned. For any other exception type, HTTP 500 will be returned.
226+
If an exception is thrown by a service method and the response has not yet been committed, the exception message (if any) will be returned as plain text in the response body. If the exception is an instance of `IllegalArgumentException` or `UnsupportedOperationException`, an HTTP 403 response will be returned. For `IllegalStateException`, HTTP 409 will be returned. For any other exception type, HTTP 500 will be returned.
227227

228228
### Inter-Service Communication
229229
A service implementation can obtain a reference to another service instance via the `getService()` method of the `WebService` class. This can be useful when the behavior of one service relies on logic provided by a different service. The target service must be annotated with `javax.servlet.annotation.WebServlet`.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
subprojects {
1616
group = 'org.httprpc'
17-
version = '7.2.3'
17+
version = '7.2.4'
1818

1919
apply plugin: 'java-library'
2020
apply plugin: 'maven-publish'

httprpc-client/src/main/java/org/httprpc/beans/BeanAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ public static <T> T adapt(Object value, Type type) {
419419
} else if (type instanceof WildcardType) {
420420
WildcardType wildcardType = (WildcardType)type;
421421

422-
return (T)adapt(value, wildcardType.getUpperBounds()[0]);
422+
return adapt(value, wildcardType.getUpperBounds()[0]);
423423
} else if (type instanceof ParameterizedType) {
424424
if (value != null) {
425425
ParameterizedType parameterizedType = (ParameterizedType)type;

httprpc-server/src/main/java/org/httprpc/WebService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response)
356356

357357
if (cause != null) {
358358
int status;
359-
if (cause instanceof IllegalArgumentException) {
359+
if (cause instanceof IllegalArgumentException || cause instanceof UnsupportedOperationException) {
360360
status = HttpServletResponse.SC_FORBIDDEN;
361361
} else if (cause instanceof IllegalStateException) {
362362
status = HttpServletResponse.SC_CONFLICT;

0 commit comments

Comments
 (0)