• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic