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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:39:52+00:00 2026-06-02T18:39:52+00:00

In one of my @RequestMapping POST methods I need to return HttpServletResponse (which is

  • 0

In one of my @RequestMapping POST methods I need to return HttpServletResponse (which is an xml file) and I want to refresh the view. Normally I would just return path but in this case it gets appended to the xml file which is being downloaded by user.
Is there any way to close and send response first and then generate(refresh) view?

  • 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-02T18:39:53+00:00Added an answer on June 2, 2026 at 6:39 pm

    I would say no, it’s not. Not a 100 percent sure though. You could try to send the file and also set the redirect header in your response. I didn’t try it just now but I guess you will just be redirected. Really depends on the browser though. A browser could decide to still download the file.

    Once you sent the response a new request needs to be generated by the client, so there is no way to close it server-side and just create a new one.

    I would suggest a solution using Javascript. Either AJAX or just setting the current location twice (first the download, then the new view). I’m not sure, I guess via location.href

    Let me know if you need an actual code example, as it would take me some time to manufacture something.

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

Sidebar

Related Questions

I'm running Spring MVC 3.x and I have one Controller with RequestMapping annotations (
I am trying to upload a File with one parameter using spring 3. This
I have a REST service which takes a JSON request. I want to validate
I'm trying ot write an integration test for one of my methods, that handles
I have a SpringMVC web service for uploading files which looks like this: @RequestMapping(value=/upload.json,
Here is one of my controller method, @ResourceMapping(value=petPortalAction) @RequestMapping(params={transactionType=BUY_PET}) public String handlePetPurchaseAction( @RequestParam(required=true, value=petId)
Imagine a code like this one: @RequestMapping(value=/users, method=RequestMethod.GET) public String list(Model model) { ...
Lets say i have a Controller like this one : @RequestMapping(method=RequestMethod.GET, value=/error) public void
I've added a new method/mapping to one of my servlets: @RequestMapping(value = /user/prefs/order, method
I've defined this method in my Spring MVC Controller : @RequestMapping(value = {id}/content, method=RequestMethod.POST)

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.