Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 1.x and permanent GET parameter for every Action.

 
Lari Alpi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

the problem is that I need to keep certain request parameter in the URL for every Action.

E.g:
/fooApp/something.do?db=foobar
/fooApp/blahblah.do?db=foobar

This 'static' parameter tells the webapp which database to use. HttpSession is out of the question because there's no certain "entrypoint"/login for the webapp.

Any ideas how to accomplish this or any alternative ideas?

Thanks,
- Lari
 
Lari Alpi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lari Alpi wrote:
Any ideas how to accomplish this or any alternative ideas?


Or could somekind of URL rewrite be a possibility?

E.g:
/fooApp/dbname/something.do

- Lari
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ugh.

In any case, I don't see how session is "out of the question"--just because there's no entry point doesn't mean that it can't be captured a single time then stored in session, perhaps using a filter or a custom request processor to put it back into the request if that's *really* necessary. I can't think of why it would be.

In any case, I'd look into a filter or a custom request processor.
 
Lari Alpi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Ugh.


Indeed. This is stupid, but gotta do.

David Newton wrote:
In any case, I don't see how session is "out of the question"--just because there's no entry point doesn't mean that it can't be captured a single time then stored in session,


Yes, you're right. In reality I'll put the parameter to HttpSession when first encountered but I need to keep it in the URL also. This is needed because the URL must be usable as a link for other users also. E.g. /fooApp/showProduct?id=123&db=foo

David Newton wrote:
perhaps using a filter or a custom request processor to put it back into the request if that's *really* necessary. I can't think of why it would be.

In any case, I'd look into a filter or a custom request processor.


Thanks, I'll check it out.

To clarify things little more, the problem is that a single .war on a single server (Tomcat 6.x) serves multiple stores. Stores have their own databases with products and content etc. So far the app has been password protected, thus providing the "entrypoint" for stores and the problem above has not existed.

In the future the app must be "open" and the problem is how to identify the store in the URL.

- Lari
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic