alex zevenbergen

Greenhorn
+ Follow
since May 31, 2006
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by alex zevenbergen

Thanks for that.

My biggest problem is that the context is always retured as NULL.

ServletContext ctx = this.getServletContext();
ctx.getServletContextName();

ctx always returns NULL

basically i need to get the current web module that is running.
i tried getting it off the session but that also returned NULL

HttpServletRequest httpRequest = (HttpServletRequest)request;
HttpSession session =httpRequest.getSession(false);
AppContext ctx =(AppContext)session.getAttribute (WebConstants.App_CONTEXT_KEY);

AppContext and webconstants are both defined java classes

Note - all code is in the dofilter() of a filter
Thanks
Alex
17 years ago
Hi all

i'm trying to create a filter that takes in a request with a resource loaction as a parameter, removes this and then gets the absolute url of the the resource(eg - /myapp/images/mypic.gif)

i've tried 2 lines but both return null

java.net.URL url= this.getClass().getClassLoader().getResource(/myapp/images/mypic.gif");

InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("/myapp/images/mypic.gif");

Does anybody see anything wrong with these lines?

Also after this i need to rewrite the url and send it to the next filter in the chain - does anyone have any hints for doing this?

Thanks in advance
Alex
17 years ago