Mailing List Message #449
From: Hugi Thordarson <>
Subject: Re: [WO-DEV] Https request examples?
Date: Fri, 19 May 2023 10:27:43 +0000
To: WebObjects & WOnder Development <>
Weirdness like this is a little hard to debug without seeing code/seeing it in action. But my initial guess would be that if you're loading a document that has resources with relative URLs, those will probably be pounding your application (and even the component request handler) and might be putting your session's page cache into a weird state? Only a wild guess.

As for the resources, if they're relative URLs referencing a different server you might want to try insert a <base> tag into the iframe's HTML head, something like: <base href=""> . This will give the frame a, well, base, for fetching those relative resources.

If you want to avoid modifying the response, you apparently have the option of doing this via JS (again, something I've never done so YMMV):

If for some reason you can't do that, you could go through every href= and src= attribute in your fetched iframe HTML and convert to absolute URLs? Very fun indeed.

Regarding the usage of an iframe as a whole; you could also use a direct action as the "src" for the iframe, passing in parameters as query parameters to the direct action. But that would require you to expose your parameters which of course, you might not want to do (although you could of course obfuscate the parameters somehow, or store the parameters in the session and pass them through there… But this is starting to sound like a hassle :).

So; nothing concrete. Just grabbing at straws, but hopefully there's at least something that can help you out here.

- hugi

On 18 May 2023, at 16:36, Markus Ruggiero (rucotec) <> wrote:

On 8 May 2023, at 19:16, Hugi Thordarson <> wrote:

Hi Markus,

is the server using a self-signed certificate? If not, i.e. it's just good ol' https with a cert issued by a trusted CA, you should be fine using the build in java http client with https, something like…


public static String post( final String url, final String requestBody ) throws IOException, InterruptedException {
// Create a client (the client can be reused so for performance sensitive code, I wouldn't do this within the method)
final HttpClient client = HttpClient

// Construct a request to submit
final HttpRequest request = HttpRequest
.uri( URI.create( url ) )
.POST( BodyPublishers.ofString( requestBody, StandardCharsets.UTF_8 ) )

// Submit the request
final HttpResponse<String> response = client.send( request, HttpResponse.BodyHandlers.ofString( StandardCharsets.UTF_8 ) );
return response.body();


thanks a lot, this works perfectly.

But (there is always a but)

What do I do with the returned result?
My problem is that no matter what I try the resultant string is not properly used as the content of the iFrame. I am probably just thoroughly confused but WO seems to mix and match things in a way that either the initial POST body is displayed instead of the result or the resultant string is parsed but no linked resources are found as they are all tried to be accessed through my application. And of course there they aren’t.

I have the following def in my WOD

iFrame : ERXIFrame {
action = createMyIFrameContent;
style = "width:100%; height:90vh; border:solid 2px green";

I cannot use either pageName nor src bindings because I need to create some xml content and a POST request. So I use the action createMyIFrameContent() to create the content for the iFrame. But how?

Inside createMyIFrameContent() I built the xml and used your code to submit the POST. Worked and I did get a result back. But then? When I create a new WOResponse and set the result as its content WO displays the original request body (the xml), not the resulting content.
So I created a new WOComponent that createMyIFrameContent() instantiates with pageWithName(), passes some data to it for the generation of the xml and returns this to the iFrame. In the new component I override appendToResponse(), execute the POST and set the result as the content. I also tried overriding generateResponse(). In both cases I do get the result from the POST rendered but no externally linked resources are found because they are seen as relative to my application (css, images, etc).

Basically the question is “how do I break out of my application and have that dynamically generated remote page inside my iFrame?” As I said, I am confused and don’t see the forest for the trees anymore.



- hugi

On 8 May 2023, at 14:34, Markus Ruggiero (rucotec) <> wrote:

I need to make a https POST request to a 3rd party web server sending xml along in the body of the request. The server is supposed to return a html page which I should then display inside an iFrame.

Does any body have some example code how to do such an https request? Easy to create the xml but I am not quite sure about the SSL/TLS part.

Thanks a lot

This message is sent to you because you are subscribed to
the mailing list <>.
To unsubscribe, E-mail to: <>
To switch to the DIGEST mode, E-mail to <>
To switch to the INDEX mode, E-mail to <>
Send administrative queries to  <>

Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to Listmaster