Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me on URL issues

 
Mohammad Norouzi
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a servlet in which some part of my page will be displayed by sending a http request to another application (in different context).

Consider this content includes some images and styles and also some hyper links.

I want every hyper links being served through my own servlet. In order to do this, I wrote a filter to manage them.

But the problem is with resources like images. I want to load those resources from their own path. Could you help me how can I do that?

I saw many web applications that bring images and resources from other hosts and applications. Could you please give me an idea on this?
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the question is very confusing to me ( you tried to mention amnay things at a time)

Anyways as far as i understand , for your problem
I would prefer using Jsp Frames .

 
Mohammad Norouzi
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

Let me explain with example. I have an application namely APP1 which is my own application:

http://www.server.com/myapp

in this app, I have a frame or DIV or anything to divide contents. A menu and a content. Menus contains some parameters and when user clicks on an item I build a request to another app namely APP2:

http://www.server.com/otherapp/store.jsp?q=value1

Then I obtain the result from above path and display it in content frame. Now this content contains images and links. but images refer to another path that doesn't exist in my application and they belong to APP2:

<img src="/images/logo.gif" />

and

<a href="/pages/show.jsp" >Show</a>

since these paths are relative the browser adds the context path to them (http://www.server.com/myapp)

I want to rewrite the image sources in a way yo refer to an absolute path which refers to real application like:

<img src="http://www.server.com/otherapp/images/logo.gif" />

but for the links, I dont want to change them because I already manage them with servlet filters.

how can I rewrite image sources?

thanks

Ravi Kiran Va wrote:the question is very confusing to me ( you tried to mention amnay things at a time)

Anyways as far as i understand , for your problem
I would prefer using Jsp Frames .

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but for the links, I dont want to change them because I already manage them with servlet filters.


How did you manage to do for the Links <a href="/pages/show.jsp" >Show</a> , how did you find out how many link tags are present in that Html or Jsp page ??


 
Mohammad Norouzi
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find them when user clicks on that... so I can forward the request to a specific path

Ravi Kiran Va wrote:
but for the links, I dont want to change them because I already manage them with servlet filters.


How did you manage to do for the Links <a href="/pages/show.jsp" >Show</a> , how did you find out how many link tags are present in that Html or Jsp page ??


 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To be frank , i dont know the answer for your question

Why i asked for the links is that , how did you manage to read how many <href> tags are present in your Jsp page , so to append some url to the existing thing .

Anyway , i will proceed in this below mentioned way and hope for the best :

On to the Jsp / Html Page i will read all the Image Tgas using Dom API on to a body onload Java Script function and for each source attribute , i would add this http://www.server.com/myapp
to the existing value .

Hope this could help you , but i am not sure if this is the way to do it .

Thanks .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic