Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6236413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:51:02+00:00 2026-05-24T10:51:02+00:00

I am currently investigating using the hibernate validators support for Method validation using JSR

  • 0

I am currently investigating using the hibernate validators support for Method validation using JSR 303 annotations. An initial attempt tried to wrap the resources with a proxy (generated using cglib) that performed the validation, however, this appears to have come to a dead-end, as the proxy methods I have tried do not seem to copy parameter annotations, so resource methods that rely on this end up being called with no parameters. I have another question open at the moment on that item:

How can I create a dynamic proxy in java that retains parameter annotations on methods?

Is there an alternative mechanism to hook into wink’s request chain to do something like this without using proxies?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:51:02+00:00Added an answer on May 24, 2026 at 10:51 am

    You can do this is a partially supported way by creating a RequestHandler, and overriding the actual HandlersFactory to return a list containing your request handler. The configuration for this is discussed here. This request handler will be inserted into the request handling chain directly before the InvokeMethodHandler (which is the last request handler called, and this is the one which actually invokes the resource method).

    Based on reading the source code for the InvokeMethodHandler (which actually calls your JAX/RS resource), you can get the parameters, instance and method parameters as follows:

       // Get Method Validator from hibernate 
       MethodValidator validator = Validation.byProvider(HibernateValidator.class).configure()
                .buildValidatorFactory().getValidator().unwrap(
                        MethodValidator.class);
    
        // Extract the method parameters, object instance and method metadata from the JAX/RS internals.
        Method javaMethod = null;
        Object instance = null;
        Object[] parameters = null;
        SearchResult searchResult = context.getAttribute(SearchResult.class);
    
        javaMethod = searchResult.getMethod().getMetadata()
                .getReflectionMethod();
    
        parameters = searchResult.getInvocationParameters();
        instance = searchResult.getResource().getInstance(context);
    
        // Use all this to perform validation...
        Set<MethodConstraintViolation<Object>> violations = validator
                .validateAllParameters(instance, javaMethod, parameters);
        if (!violations.isEmpty()) {
             // do something with the violations here 
        }
    

    This is somewhat hacky, as it relies on (undocumented as far as I can tell) implementation details of wink to get the instance, parameters, and metadata (it would be nice if they provided a public way to get to this information). However, it is somewhat preferable to using a proxy, because you don’t infer multiple overheads from reflection that occur with a proxy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I come from a CVS background. I'm currently investigating using SVN for a project.
We are currently investigating different remote-desktop support solutions to help our clients if they
I am currently investigating using the selenium-on-rails plug-in for testing an upcoming web app
I am currently investigating whether to build a windows application using unmanaged C/C++ or
We are currently investigating options for migrating a legacy application built using .NET 1.1
I am currently investigating several free/open source OpenGL based 3D engines, and was wondering
I am currently investigating how to make a connection to a SQL Server database
I'm currently investigating the possibility to use custom attributes derived from ActionFilterAttribute. I want
I am currently investigating MVC for a new project we are starting. So far
I'm currently investigating in the field of dev environment for OSGi bundles. My goal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.