How to download PDF by relative path?

In the plug-in,how to download PDF by relative path?
The URL I get this way results in the need for the confluence server to be available to the client as well. Because confluence is acting for nginx.

String url = baseUrlthis.settingsManager.getGlobalSettings().getBaseUrl();

thanks

Having the confluence java wevapp returning back its internal host name would be an issue on multiple fronts; it might be localhost, it might be an internal name only addressable by it and the Nginx server, it might have data in the name that shouldn’t be exposed to the public.

Can you expand on your question? What are you trying to do? Maybe there is an alternative approach?

First, the business scenario is to be able to export PDF based on pageId within the plug-in.

Now, I’m using URL.openConnection() now, but I don’t think it’s appropriate. There should be an class that supports me to download the pdf file by pageID, isn’t downloaded by URL.

thanks.