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 7680205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:03:42+00:00 2026-05-31T18:03:42+00:00

I’m developing a REST api which needs to support optional filtering of properties based

  • 0

I’m developing a REST api which needs to support optional filtering of properties based on a request parameter (based on Spring MVC 3.0.x and Jackson).

What I’m looking into implementing is getting a string parameter (in the format of “fieldName1,fieldName2…”), filtering out property names which aren’t allowed, filtering out property names which don’t exist and adding mandatory properties.

Once I have the final string I want to use the jackson @JSONFilter to seralize only the desired properties like this:

SimpleBeanPropertyFilter someFilter = 
    SimpleBeanPropertyFilter.filterOutAllExcept(builtString);
filterProvider = 
    new SimpleFilterProvider().addFilter("someGenericName",someFilter);
String pojoIntoJsonParse =
    objectMapper.writer(filterProvider).writeValueAsString(pojo);

My questions are:

  1. Do I have to use the ModelAndView mechanism (since I’m manipulating the objectMapper on a per request basis) or can I do notify spring of my desired filter somehow and still have it do the heavy lifting?

  2. Is this solution feasible performance wise as I think I’ll have to reconstruct the filterProvider and the filter for each request.

  3. What are the optimizations (if any) jackson tries to perform with respect to filter caching?

  4. Are there any alternative paths I should try to look into with respect to the above problem?

  • 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-31T18:03:43+00:00Added an answer on May 31, 2026 at 6:03 pm

    I don’t know enough about Spring to know about ModelAndView part, but I know enough about Jackson to say that the performance is unlikely to be problematic for Jackson filtering.
    One reason why filtering approaches are not trivially simple is because they try to balance usability with performance — and as such, both JSON Views and Filters have very low overhead.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I have a text area in my form which accepts all possible characters from
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I am writing an app with both english and french support. The app requests

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.