To include a page from another site as part of my page

Discussion in 'Java' started by xxgeorge, Apr 22, 2004.

  1. xxgeorge

    xxgeorge Guest

    hi all,


    sorry if this is a naive question. I'm writing a JSP page which has
    the upper part showing certain information and has the lower part,
    maybe a frame, showing a page from another site, say,
    www.somewhereelse.com. (that site is owned by us as well, so there
    isn't any issue on infringement)

    I can do it by pointing the frame to the site. However, I want to
    keep this URL secret, so that even if users view the HTML source that
    cannot gain any knowledge on the URL.

    I'd be great if I can do it in JSP/servlet. Unfortunately, IIRC
    servletDispatcher.forward() and servletDispatcher.include() can
    applied to pages under the same application only.

    Is there anyway I can keep achieve this? Thanks very much for your
    help.


    george
     
    xxgeorge, Apr 22, 2004
    #1
    1. Advertising

  2. Well,

    you could write a servlet that opens a URLConnection to
    www.somewhereelse.com, reads the page, and provide the retrieved HTML code
    to your HttpResponse.


    xxgeorge wrote:

    > hi all,
    >
    >
    > sorry if this is a naive question. I'm writing a JSP page which has
    > the upper part showing certain information and has the lower part,
    > maybe a frame, showing a page from another site, say,
    > www.somewhereelse.com. (that site is owned by us as well, so there
    > isn't any issue on infringement)
    >
    > I can do it by pointing the frame to the site. However, I want to
    > keep this URL secret, so that even if users view the HTML source that
    > cannot gain any knowledge on the URL.
    >
    > I'd be great if I can do it in JSP/servlet. Unfortunately, IIRC
    > servletDispatcher.forward() and servletDispatcher.include() can
    > applied to pages under the same application only.
    >
    > Is there anyway I can keep achieve this? Thanks very much for your
    > help.
    >
    >
    > george
     
    David Lesaffre, Apr 22, 2004
    #2
    1. Advertising

  3. xxgeorge

    Enrique Guest

    My response is off-topic, but you can pull this off with Javascript.
    Dynamically write the HTML for the frame's src attribute, using
    Javascript. To obscure the Javascript, hide it in a hidden frame.
    Email privately for details, if you don't know what I mean.
     
    Enrique, Apr 23, 2004
    #3
  4. xxgeorge

    xxgeorge Guest

    Thanks for your advice.


    I've done it in another way, simply using response.sendRedirect(). I
    should have remembered it :( This is how I do it:


    [MainPage.jsp]
    <html>
    <body>
    ......
    .....
    <% session.setAttribute( "showInPage", "Y" ); %>
    <iframe src="inPage.jsp"></iframe>
    .....
    </body>
    </html>


    [inPage.jsp]
    <%
    if ( session.setAttribute("showInPage")!=null ) {
    response.sendRedirect("www.somewhereelse.com");
    }
    session.removeAttribute( "showInPage" );
    %>


    I've put the flag "showInPage" in session so that if users try to
    access inPage.jsp directly, they can't access www.somewhereelse.com.


    Feel free to discuss
    george



    David Lesaffre <> wrote in message news:<ieMhc.82039$-ops.be>...
    > Well,
    >
    > you could write a servlet that opens a URLConnection to
    > www.somewhereelse.com, reads the page, and provide the retrieved HTML code
    > to your HttpResponse.
    >
    >
    > xxgeorge wrote:
    >
    > > hi all,
    > >
    > >
    > > sorry if this is a naive question. I'm writing a JSP page which has
    > > the upper part showing certain information and has the lower part,
    > > maybe a frame, showing a page from another site, say,
    > > www.somewhereelse.com. (that site is owned by us as well, so there
    > > isn't any issue on infringement)
    > >
    > > I can do it by pointing the frame to the site. However, I want to
    > > keep this URL secret, so that even if users view the HTML source that
    > > cannot gain any knowledge on the URL.
    > >
    > > I'd be great if I can do it in JSP/servlet. Unfortunately, IIRC
    > > servletDispatcher.forward() and servletDispatcher.include() can
    > > applied to pages under the same application only.
    > >
    > > Is there anyway I can keep achieve this? Thanks very much for your
    > > help.
    > >
    > >
    > > george
     
    xxgeorge, Apr 23, 2004
    #4
  5. xxgeorge

    Roedy Green Guest

    On 22 Apr 2004 01:05:38 -0700, (xxgeorge) wrote or
    quoted :

    >Is there anyway I can keep achieve this?

    You could fetch the page yourself and return it as yours.

    You could to a redirect to the page. That hides the source a little
    bit.

    Here is a mini redirect file:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <meta http-equiv="refresh" content="8; URL=jgloss/jgloss.html">
    <title>Document Moved</title>
    </head>
    <body>
    <h1>Document Moved</h1>
    <p>
    The document you requested <b>http://mindprod.com/jgloss.html</b><br>
    is now called <b>
    <a
    href="http://mindprod.com/jgloss/jgloss.html">http://mindprod.com/jgloss/jgloss.html</a></b>
    <p>
    If you don't hit your browser's <span class="click">back</span> button
    now, you
    should be taken there automatically in 8 seconds. You can go there
    manually by
    clicking the correct URL above.
    <hr>
    </body>
    </html>

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Apr 23, 2004
    #5
  6. xxgeorge wrote:

    > I've done it in another way, simply using response.sendRedirect(). I
    > should have remembered it :( This is how I do it:


    Hmm..
    I'm not sure about this, but if you ask for the page info (Mozilla), it will
    probably show the true origin of the page. After all, a
    response.sendRedirect() makes the browser fetch the page from another
    location. And if the browser knows this location, and it allows for a user
    to retrieve the information about from a page...

    >
    > David Lesaffre <> wrote in message
    > news:<ieMhc.82039$-ops.be>...
    >> Well,
    >>
    >> you could write a servlet that opens a URLConnection to
    >> www.somewhereelse.com, reads the page, and provide the retrieved HTML
    >> code to your HttpResponse.
    >>
    >> xxgeorge wrote:
    >>
    >> > I can do it by pointing the frame to the site. However, I want to
    >> > keep this URL secret, so that even if users view the HTML source that
    >> > cannot gain any knowledge on the URL.


    It would not show in the HTML source, but I think it will show in the page's
    (or frame's) information.
     
    David Lesaffre, Apr 23, 2004
    #6
  7. xxgeorge

    xxgeorge Guest

    thanks for your advice, but I'm not sure if doing it in JavaScript (or
    doing it with HTML redirect) is a good way to hide the URL. If I put
    the URL in JavaScript, the source will inevitably be downloaded to the
    client browser, which means that the users can get it on purpose.

    even if I put it in a hidden frame, or in a seperate js file, users
    can get the location of js file from the HTML source, download it to
    client machine and study it.



    Roedy Green <> wrote in message news:<>...
    > On 22 Apr 2004 01:05:38 -0700, (xxgeorge) wrote or
    > quoted :
    >
    > >Is there anyway I can keep achieve this?

    > You could fetch the page yourself and return it as yours.
    >
    > You could to a redirect to the page. That hides the source a little
    > bit.
    >
    > Here is a mini redirect file:
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    > "http://www.w3.org/TR/html4/loose.dtd">
    > <html>
    > <head>
    > <meta http-equiv="Content-Type" content="text/html;
    > charset=iso-8859-1">
    > <meta http-equiv="refresh" content="8; URL=jgloss/jgloss.html">
    > <title>Document Moved</title>
    > </head>
    > <body>
    > <h1>Document Moved</h1>
    > <p>
    > The document you requested <b>http://mindprod.com/jgloss.html</b><br>
    > is now called <b>
    > <a
    > href="http://mindprod.com/jgloss/jgloss.html">http://mindprod.com/jgloss/jgloss.html</a></b>
    > <p>
    > If you don't hit your browser's <span class="click">back</span> button
    > now, you
    > should be taken there automatically in 8 seconds. You can go there
    > manually by
    > clicking the correct URL above.
    > <hr>
    > </body>
    > </html>
     
    xxgeorge, Apr 26, 2004
    #7
  8. xxgeorge

    Roedy Green Guest

    On 25 Apr 2004 21:29:08 -0700, (xxgeorge) wrote or
    quoted :

    >thanks for your advice, but I'm not sure if doing it in JavaScript (or
    >doing it with HTML redirect) is a good way to hide the URL. If I put
    >the URL in JavaScript, the source will inevitably be downloaded to the
    >client browser, which means that the users can get it on purpose


    Why are you trying to disguise that? Usually you want such things
    obvious to explain for example why only part of a site appears to be
    down.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Apr 26, 2004
    #8
  9. xxgeorge

    xxgeorge Guest

    In my case I'm building a page of two halfs, I am responsible for the
    content of the upper half, while the content of the lower half is
    handled by our partner site, where they don't want to expose their URL
    to ordinary users so that users cannot access their site directly.

    george




    Roedy Green <> wrote in message news:<>...
    > On 25 Apr 2004 21:29:08 -0700, (xxgeorge) wrote or
    > quoted :
    >
    > >thanks for your advice, but I'm not sure if doing it in JavaScript (or
    > >doing it with HTML redirect) is a good way to hide the URL. If I put
    > >the URL in JavaScript, the source will inevitably be downloaded to the
    > >client browser, which means that the users can get it on purpose

    >
    > Why are you trying to disguise that? Usually you want such things
    > obvious to explain for example why only part of a site appears to be
    > down.
     
    xxgeorge, Apr 27, 2004
    #9
  10. xxgeorge

    Roedy Green Guest

    On 26 Apr 2004 19:12:01 -0700, (xxgeorge) wrote or
    quoted :

    >In my case I'm building a page of two halfs, I am responsible for the
    >content of the upper half, while the content of the lower half is
    >handled by our partner site, where they don't want to expose their URL
    >to ordinary users so that users cannot access their site directly.


    If they want to be really safe, they should block access from anybody
    but you. And you should fetch the content from them, and relay it out.

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Apr 27, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BlackIce
    Replies:
    1
    Views:
    17,211
  2. Andreas Bogenberger
    Replies:
    3
    Views:
    974
    Andreas Bogenberger
    Feb 22, 2008
  3. Sio99
    Replies:
    1
    Views:
    314
    Sio99
    Jun 15, 2009
  4. Jack
    Replies:
    8
    Views:
    299
  5. Dr Nic
    Replies:
    0
    Views:
    121
    Dr Nic
    Nov 21, 2006
Loading...

Share This Page