Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTp Request

 
Singh gurpreet
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am using Struts framework, and that method is called by a TLD (<bean:message key="lable.name"/>


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
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any idea about this....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic