• 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

Help me on URL issues

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
 
Maybe he went home and went to bed. And took this tiny ad with him:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic