File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes HTTp Request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "HTTp Request" Watch "HTTp Request" New topic

HTTp Request

Singh gurpreet

Joined: Apr 07, 2008
Posts: 3
Hi all,

I need http request in non-httpreuqest aware class.

I mean for example i have a class

public class XYZ{

public String getMessage(String key){
//I Need request object here . Actually this method is called by some framework and i dont want to pass request object as input parameter to this method.

Is there any way , i can get HttpRequest object in this method.

Thanks in advance.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Hello "preetdude"-

Welcome to JavaRanch.

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do using the "My Profile" link at the top of the page.

As to your question, what framework is this? Most web frameworks provide a way to make the request object available where it is needed. Have you checked the documentation of whichever one you're using?
Singh gurpreet

Joined: Apr 07, 2008
Posts: 3
i am using Struts framework, and that method is called by a TLD (<bean:message key=""/>

public class HAZMessageResources extends MessageResources {


public String getMessage(Locale locale, String key) {

// TODO - Remove this hard coding, get clientId from some process
String clientId = //look into request to see client Id



Singh gurpreet

Joined: Apr 07, 2008
Posts: 3
Any idea about this....
I agree. Here's the link:
subject: HTTp Request
It's not a secret anymore!