use of io.vertigo.vega.webservice.stereotype.PUT in project vertigo by KleeGroup.
the class AnnotationsWebServiceScannerUtil method buildWebServiceDefinition.
private static Optional<WebServiceDefinition> buildWebServiceDefinition(final Method method) {
final WebServiceDefinitionBuilder builder = WebServiceDefinition.builder(method);
final PathPrefix pathPrefix = method.getDeclaringClass().getAnnotation(PathPrefix.class);
if (pathPrefix != null) {
builder.withPathPrefix(pathPrefix.value());
}
for (final Annotation annotation : method.getAnnotations()) {
if (annotation instanceof GET) {
builder.with(Verb.GET, ((GET) annotation).value());
} else if (annotation instanceof POST) {
builder.with(Verb.POST, ((POST) annotation).value());
} else if (annotation instanceof PUT) {
builder.with(Verb.PUT, ((PUT) annotation).value());
} else if (annotation instanceof PATCH) {
builder.with(Verb.PATCH, ((PATCH) annotation).value());
} else if (annotation instanceof DELETE) {
builder.with(Verb.DELETE, ((DELETE) annotation).value());
} else if (annotation instanceof AnonymousAccessAllowed) {
builder.withNeedAuthentication(false);
} else if (annotation instanceof SessionLess) {
builder.withNeedSession(false);
} else if (annotation instanceof SessionInvalidate) {
builder.withSessionInvalidate(true);
} else if (annotation instanceof ExcludedFields) {
builder.addExcludedFields(((ExcludedFields) annotation).value());
} else if (annotation instanceof IncludedFields) {
builder.addIncludedFields(((IncludedFields) annotation).value());
} else if (annotation instanceof AccessTokenPublish) {
builder.withAccessTokenPublish(true);
} else if (annotation instanceof AccessTokenMandatory) {
builder.withAccessTokenMandatory(true);
} else if (annotation instanceof AccessTokenConsume) {
builder.withAccessTokenMandatory(true);
builder.withAccessTokenConsume(true);
} else if (annotation instanceof ServerSideSave) {
builder.withServerSideSave(true);
} else if (annotation instanceof AutoSortAndPagination) {
builder.withAutoSortAndPagination(true);
} else if (annotation instanceof Doc) {
builder.withDoc(((Doc) annotation).value());
}
}
if (builder.hasVerb()) {
final Type[] paramType = method.getGenericParameterTypes();
final Annotation[][] parameterAnnotation = method.getParameterAnnotations();
for (int i = 0; i < paramType.length; i++) {
final WebServiceParam webServiceParam = buildWebServiceParam(parameterAnnotation[i], paramType[i]);
builder.addWebServiceParam(webServiceParam);
}
// ---
return Optional.of(builder.build());
}
return Optional.empty();
}
use of io.vertigo.vega.webservice.stereotype.PUT in project vertigo by KleeGroup.
the class SimplerTestWebServices method putLocalDate.
@PUT("/localDate")
public UiContext putLocalDate(@QueryParam("date") final LocalDate localDate) {
final UiContext result = new UiContext();
result.put("input", localDate);
result.put("inputAsString", localDate.toString());
return result;
}
use of io.vertigo.vega.webservice.stereotype.PUT in project vertigo by KleeGroup.
the class SimplerTestWebServices method putInstant.
@PUT("/instant")
public UiContext putInstant(@QueryParam("date") final Instant instant) {
final UiContext result = new UiContext();
result.put("input", instant);
result.put("inputAsString", instant.toString());
return result;
}
use of io.vertigo.vega.webservice.stereotype.PUT in project vertigo by KleeGroup.
the class SimplerTestWebServices method putZonedDateTime.
@PUT("/zonedDateTime")
public UiContext putZonedDateTime(@QueryParam("date") final ZonedDateTime zonedDateTime) {
final UiContext result = new UiContext();
result.put("input", zonedDateTime);
result.put("inputAsString", zonedDateTime.toString());
return result;
}
Aggregations