Skip to content

(Html)Page.getBaseUrl() not returning base URL #83

@black-snow

Description

@black-snow

getBaseUrl() does not seem to actually return the base URL anymore - in some cases at least.

The URL I loaded was something like this: https://www.example.org/details/a_b_60327_c-15651212_1;jsessionid=7132CE8CE959709FD76D745BA600BC9A?x=y&z=zz

But then

final String pdfUrl = "/a/b/c";
System.out.println(page.getBaseURL().toString()+ pdfUrl);

returns https://www.example.org/details/a_b_60327_c-15651212_1;jsessionid=7132CE8CE959709FD76D745BA600BC9A?x=y&z=zz/a/b/c

HtmlUnit 2.36.0

I circumvent this by checking whether it's a relative URL or not and then using HtmlPage.getFullyQualifiedUrl().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions