mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-5: Consider methods annotated with @Path to be REST methods as well.
This commit is contained in:
@@ -23,6 +23,7 @@ import com.google.inject.matcher.AbstractMatcher;
|
|||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import javax.ws.rs.HttpMethod;
|
import javax.ws.rs.HttpMethod;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +68,7 @@ public class RESTMethodMatcher extends AbstractMatcher<Method> {
|
|||||||
/**
|
/**
|
||||||
* Returns whether the given method is annotated as a REST method. A REST
|
* Returns whether the given method is annotated as a REST method. A REST
|
||||||
* method is annotated with an annotation which is annotated with
|
* method is annotated with an annotation which is annotated with
|
||||||
* <code>@HttpMethod</code>.
|
* <code>@HttpMethod</code> or <code>@Path</code>.
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method
|
||||||
* The method to test.
|
* The method to test.
|
||||||
@@ -86,6 +87,10 @@ public class RESTMethodMatcher extends AbstractMatcher<Method> {
|
|||||||
if (annotationType.isAnnotationPresent(HttpMethod.class))
|
if (annotationType.isAnnotationPresent(HttpMethod.class))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// A method is a REST method if it is annotated with @Path
|
||||||
|
if (Path.class.isAssignableFrom(annotationType))
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A method is also REST method if it overrides a REST method within
|
// A method is also REST method if it overrides a REST method within
|
||||||
|
Reference in New Issue
Block a user