• 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

Filter, Edit and Serve - Looking for the best approach

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am brainstorming on the best approach for a scenario as follows:

1. Lets say I own:
www.example.com
www.example.co.uk
www.example.de
www.example.fr

2. I have say 100 pages on my website:
www.example.com
and it also has several subdomains setup like
mysite1.example.com
mysite2.example.com

All the content is served in English. All 100 pages have several links to *.example.com (say in header, footer, dynamic content on the pages)

3. Now my requirement is that the same English content be also accessible when a user accesses non .com top level domains like:
www.example.co.uk
www.example.de
www.example.fr

However there should be one change in the pages served: any links to *.example.com should change to the top level domain that is requested for (like example.fr for any request made to *.example.fr).

I have considered the approach of putting in a servlet filter (or Perl filter at the web layer) however the performance difference between the pre and post filter is very high.
Addition of filters is degrading performance. I have tried excluding any non text calls (like for images, videos) from passing through the filter.

I am considering if caching could be brought in here (I want to keep the 100 pages as is in the source code, and only change the links I want to on the fly).

What is your suggestion for a scenario like this?

Many thanks!
Rommel.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why is pre and post filter degrading performance. The filter will basically do nothing.

Can't you do this by just registering all these domains to the same ip? Why do you even need a filter?
 
Rommel Sharma
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The different top level domains will have different content - in terms of the links shown on the page as they would depend upon which top level domain was requested for. They are pointing to the same ip.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rommel Sharma wrote:What is your suggestion for a scenario like this?


The first step is to profile the code and see where the time is actually going. It could be a database call or a faulty regular expression or basically anything. Once you know that, is the time to make the decision on tuning it or caching it.
 
Rommel Sharma
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jayesh A Lalwani wrote:Why is pre and post filter degrading performance. The filter will basically do nothing.

Can't you do this by just registering all these domains to the same ip? Why do you even need a filter?



Jayesh, added more details on why filter is needed just below your response.

----

Jeanne Boyarsky wrote:
Once you know that, is the time to make the decision on tuning it or caching it.



Thank you.

For caching: Which caching mechanism, cache available is recommended? It should be able to know that for a particular top level domain the changes have been made to the page so that should be served from cache.

e.g.
User comes to:

winter-clothing.example.de/apparel/collection.html

collection.html has a link:
Also see our [link to: summer-clothing.example.com/apparel/collection.html] summer collection [/link closes]

A java filter detects this page is for example.de, makes a change to the link (note the change fom .com to .de) and sends back:

Also see our [link to: summer-clothing.example.de/apparel/collection.html] summer collection [/link closes]

Next request - from any user to

winter-clothing.example.de/apparel/collection.html

should not go to the java filter but be served from the cache thereby saving processing time and effort.

 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rommel Sharma wrote:A java filter detects this page is for example.de, makes a change to the link (note the change fom .com to .de) and sends back:...


A Java filter? Why? This strikes me as a far more fundamental structural addressing problem; and a Java filter is only ever likely to solve your problem for Java. If it were me, I think I'd be looking to solve it at the DNS level.

Winston
 
Rommel Sharma
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:
A Java filter? Why?



I will rephrase: The filter (Servlet filter) is to look at the content of the page.

The content under winter-clothing.example.de and winter-clothing.example.com is the same and has in the original file (in this case an html/jsp file that is requested) has several links to *.example.com.

The filter is looking for links pointing to "*.example.com" in the page, checks if the request was for .de and changes just such links within the page to "*.example.de".

How could the content of the page be changed at the DNS level?

 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The open-source Cocoon project attempts to provide a general framework for separate manipulation of content and presentation.

It has been years since I looked at Cocoon so I don't know anything about the present version, but you might want to take a look at it.

Bill
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rommel Sharma wrote:How could the content of the page be changed at the DNS level?


It couldn't, but domain and subdomain addressing certainly could; and since you keep referring to "links" that look like DNS names...

However, there may well be other ways of tackling this, and I'm speaking as an old sysadmin rather than a servlet programmer. I still worry a bit about a purely Java-based solution though, because it doesn't seem to attack the basic problem (ie, name-"NAT"ting).

Winston
reply
    Bookmark Topic Watch Topic
  • New Topic