Я следил за приведенной ниже записью блога
: http://Transparent%20PATCH%20support%20in%20JAX-RS%202.0
http://Sample%20Http%20Patch%20in%20jersey
Чтобы создать конечную точку для поддержки метода HTTP "PATCH" в версиях зависимостей Jersey 2.6:
-Jersey: 2.6
-swagger-jersey2-jaxrs_2.10: 1.3.12
Вопрос? Почему конечная точка Patch
не указана в документации пользовательского интерфейса swagger?
Анализ:
Если я аннотирую эту аннотацию, то создается документация для этой конечной точки, но не происходит взаимодействия.
@com.wordnik.swagger.jaxrs.PATCH
Конфигурации
JerssyApplicationInitializer
packages(true, "com.test.account.endpoint", "com.wordnik.swagger.jaxrs.json");
//Swagger Configuration
register(new ApiListingResourceJSON(), 10);
register(JerseyApiDeclarationProvider.class);
register(JerseyResourceListingProvider.class);
//Genson Converter
register(GensonJsonConverter.class, 1);
register(createMoxyJsonResolver());
Я не уверен, если я что-то упустил, любая помощь или руководство будут полезны.
Документация по методу исправления:
public static final String PATCH_MEDIA_TYPE = "application/json-patch+json";
@PATCH
//@com.wordnik.swagger.jaxrs.PATCH
@PreAuthorize(userAuthenticationRequire=true)
@Consumes(PATCH_MEDIA_TYPE)
@Path("{id: .\\d+}")
@ApiOperation(value = "Update Client Details in UIM System."
, response = State.class
, notes="Requesting User, should be the owner of the Client."
, consumes = PATCH_MEDIA_TYPE)
@ApiResponses({
@ApiResponse(code = _401, message = "If the access token is invalid.", response = String.class),
@ApiResponse(code = _498, message = "If the access token is expired.", response = String.class),
@ApiResponse(code = _420, message = "If Provided Input is not valid according to requirment specification."),
@ApiResponse(code = _404, message = "If no client/app Found."),
@ApiResponse(code = _200, message = "If Client Account has been Updated successfully. ", response=String.class)
})
public State updateClientDetails(@ApiParam(value="Client Id to be Updated.", required=true) @PathParam(CLIENT_ID) String clientId
, @ApiParam(value = "Updated field and Value.", required = true) final State newState){
//LOG.info("[ENTRY]- Received requst for updating Client {} from System.", clientId);
System.out.println("----->" + someBean.test());
//LOG.info("[EXIT]- Client Id {} Updation has been completed.", clientId);
Test t = new Test();
t.name = "Hello Test";
System.out.println(t.name);
return newState;
}