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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:21:53+00:00 2026-06-02T10:21:53+00:00

For test reasons I’d like to have a method signature in a spring-mvc-controller with

  • 0

For test reasons I’d like to have a method signature in a spring-mvc-controller with a return value which should be ignored by spring:

@RequestMapping(value = "/{uuid}", params = "question", method = RequestMethod.POST)
@ResponseBody
public IAnswer saveAnswer(UiAnswer json, @PathVariable String uuid, @RequestParam("question") String question, HttpServletResponse response) {}

It’s a post-request where the controller receives data and just responses with response.setStatus(HttpServletResponse.SC_OK); if everything went fine.

  • With @ResponseBody it dies in a internal server error 500
  • Without @ResponseBody spring tries to resolve the view
  • With void as the return value, it works fine

Can I tell spring to ignore my returned object?
Thanks!

  • 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-06-02T10:21:54+00:00Added an answer on June 2, 2026 at 10:21 am
    @RequestMapping(value = "/{uuid}", params = "question", method = RequestMethod.POST)
    @ResponseBody
    public void saveAnswer(UiAnswer json, 
                           @PathVariable String uuid, 
                           @RequestParam("question") String question, 
                           HttpServletResponse response) {
        doSaveAnswer(json, uuid, question, response);
    }
    
    protected IAnswer doSaveAnswer(UiAnswer json, 
                                   String uuid, 
                                   String question, 
                                   HttpServletResponse response) {
        // your original code here
    }
    

    Then unit-test doSaveAnswer().

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

Sidebar

Related Questions

I have a .net test class. In the Initialize method, I create a windsor
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a class test which isn't standard constructable nor assignable due to certain
I have an instance of Tomcat which periodically crashes for unknown reasons. There are
For reasons I can not help I have a varchar column with data like
For reasons I'd rather not get into right now, I have a string like
I have this method: [WebMethod] public OpenAccountResult OpenAccount() { OpenAccountResult test = new OpenAccountResult(/*true*/)//the
Just for testing reasons, I defined my own Where-Method for Linq like so: namespace
I have an applet which when I test run in Eclipse works perfectly yet
test.c: int main() { return 0; } I haven't used any flags (I am

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.