[opencms-dev] including external content without frames andiframes
Olli Aro
olli_aro at yahoo.co.uk
Wed Oct 27 12:58:53 CEST 2004
With that approach you need to make sure that you don't have any relative
links or image paths as part of the content, since these would point to your
server. Also - if your source site relies on any session information that
would not work correctly.
Such a shame that there is no library available, which would allow you to do
this (a bit like portlets)... Or does someone know one?
Regards,
Olli
-----Original Message-----
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Joachim Arrasz
Sent: 27 October 2004 11:49
To: The OpenCms mailing list
Subject: Re: [opencms-dev] including external content without frames
andiframes
Hi,
>Is there a possibility to do this? Probably parsing this page and stripping
>everything but the "<body>body content</body>" of this page?
>
>
>
we did something like this with just using the Commons-HttpClient and
then included this response into the JSP ...
Is this what you need?
Snippet fpr HttpClient-Usage:
// Create an instance of HttpClient.
HttpClient client = new HttpClient();
String url = "http://www.synyx.de";
// Create a method instance.
GetMethod method = new GetMethod(url);
// Provide custom retry handler is necessary
DefaultMethodRetryHandler retryhandler = new
DefaultMethodRetryHandler();
retryhandler.setRequestSentRetryEnabled(false);
retryhandler.setRetryCount(3);
method.setMethodRetryHandler(retryhandler);
try {
// Execute the method.
int statusCode = client.executeMethod(method);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " +
method.getStatusLine());
}
// Read the response body.
byte[] responseBody = method.getResponseBody();
// Deal with the response.
// Use caution: ensure correct character encoding and is not
binary data
System.out.println(new String(responseBody));
} finally {
// Release the connection.
method.releaseConnection();
}
Hope this helps ...
Bye Joachim Arrasz
Synyx oHG
--
/**
* @author Joachim Arrasz
* --> head of technology research <--
* @phone +49/(0)721/66487932
* @mobile 0160/8021351
* @mail arrasz at synyx.de
* @url http://www.synyx.de
*/
_______________________________________________
This mail is send to you from the opencms-dev mailing list
To change your list options, or to unsubscribe from the list, please visit
http://mail.opencms.org/mailman/listinfo/opencms-dev
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 15/10/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.778 / Virus Database: 525 - Release Date: 15/10/2004
More information about the opencms-dev
mailing list