cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-5309) Support Bean Validation API for JAX-RS
Date Thu, 14 Nov 2013 18:03:24 GMT

    [ https://issues.apache.org/jira/browse/CXF-5309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13822689#comment-13822689
] 

Sergey Beryozkin commented on CXF-5309:
---------------------------------------

If you could take on a JAXRSInvoker test then it would be nice :-).
{code:java}
@Path("/bookstore/")
public class BookStoreWithValidationPerRequest  {
    private Map<String, BookWitthValidation> books = 
        Collections.singletonMap("123", new BookWitthValidation("CXF", 123L)); 
    
    private String id;
    
    public BookStoreWithValidationPerRequest() {
    }

    @QueryParam("id")
    public void setId(String id) {
        this.id = id;
    }

    @Valid
    public String getId() {
        return this.id;
    }
    
    @GET
    @Path("books")
    public BookWithValidation getBook() {
        return books.get(id);
    }
}
{code}

and JAXRSValidationInvoker will enforce that before BookStoreWithValidationPerRequest#getBook
is invoked, the exception will be thrown if BookStoreWithValidationPerRequest#id does not
match some validation rules.

You can create say JAXRSPerRequestValidationTest, copy the server setup from JAXRSClientServerValidationTest,
refer to BookStoreWithValidationPerRequest and drop a setResourceProvider call (so the default
per-request lifecycle mode will be activated) and then I guess add just a single test for
a start.

Give it a go please :-)
Thanks, Sergey


 

> Support Bean Validation API for JAX-RS
> --------------------------------------
>
>                 Key: CXF-5309
>                 URL: https://issues.apache.org/jira/browse/CXF-5309
>             Project: CXF
>          Issue Type: Sub-task
>          Components: JAX-RS, JAX-WS Runtime
>            Reporter: Sergey Beryozkin
>         Attachments: patch-validation-exception-mapper.txt, patch-validation-paramnameprovider.txt,
patch-validation-poc.txt, patch-validation-spring-tests.txt, patch-validation-tests.txt
>
>




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message