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

  • Home
  • SEARCH
  • 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 6165689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:12:35+00:00 2026-05-23T22:12:35+00:00

I have a webapp written with the Spring Framework, Velocity, and (in part) Spring

  • 0

I have a webapp written with the Spring Framework, Velocity, and (in part) Spring Web Flow.

In order to provide a common set of references in all my web pages for my velocity template, I have written a FlowExecutionListener which looks like this:

@Override
public void requestSubmitted(RequestContext context)
{
 Map<String, Object> model = new HashMap<String, Object>();
 populateModel(model);
 context.getRequestScope().putAll(new LocalAttributeMap(model));
}

I can then access the keys stored in the model as Velocity references, e.g. $reference.
In general, this works great.

However, certain exit points from the flow will redirect to a GET request, like so:

<view-state id="startOver" view="redirect:/new"/>

These redirects will do a 302 to a new request, with all the request attributes turned into URL parameters, resulting in a big unwieldy URL instead of the clean /new url I was trying to redirect to.

I would like to detect in the listener when the flow is returning a redirect, so that I can skip the storing of the strings in the request attributes. (I do this with an interceptor with standard Spring MVC by matching whether the view name starts with “redirect:” ). But I can’t seem to find a way in the listener to detect this.

Alternately, are there other ways to prevent the request attributes from being put on the URL after a redirect?

  • 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-23T22:12:37+00:00Added an answer on May 23, 2026 at 10:12 pm

    You can use a custom FlowUrlHandler which builds the URL for the redirect. The best way to see how to implement it is to look at the code of DefaultFlowUrlHandler, but the main idea for you problem is to filter the input from the flowDefinitionUrl, for example:

    class MyFlowHandlerAdapter extends DefaultFlowHandlerAdapter {
      public String createFlowDefinitionUrl(String flowId, AttributeMap input, HttpServletRequest request) {
        MuttableAttributeMap filteredInput = new MuttableAttributeMap(input);
        // remove the velocity parameters
        filteredInput.remove("velocity.param1");
        // build the url
        return super.createFlowDefinitionUrl(flowId,filteredInput,request);
      }
    
    }
    

    To use it, use this Spring configuration:

    <bean id="myFlowUrlHandler" class="com.myapp.MyFlowHandlerAdapter">
    
    <!-- Dispatches requests mapped to flows to FlowHandler implementations -->
    <bean id="flowHandlerAdapter" class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">
      <property name="flowExecutor" ref="flowExecutor" />
      <property name="flowUrlHandler" ref="myFlowUrlHandler" />
      <property name="requireSession" value="true" />
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my web application written in Spring MVC. It is quite simple app
i have written a small webapp using spring-security and spring-mvc with an annotation based
On the Spring-based web app project I'm on now, the developers have written two
I have written a small webapp using the flask framework that involves plotting using
I had the following idea: Say we have a webapp written using django which
We have an old web app written in classic ASP. We don't have the
I have written a web app in PHP which makes use of Ajax requests
I have a webapp that lists all of my artists, albums and songs when
I have a very large problem. I've written a large app using Flex3/Tomcat/BlazeDS/Spring that
I have a web application written in C# and running as a dll under

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.