How to open a webpage in your preferred user browser as a mail request in Java

Ok, so I know how to send an HTTP POST request to a website in code, and I know how to open a URL in a browser (HTTP GET). But how to open HTTP POST in a browser.

EDIT: Details: On a website you can open a page to add a new entry, you can sow this page with information by POSTing this information. I have this information in my Java Desktop application, so from my Java application I want to open a new input page in my preferred user browser, seeded with known information.

EDIT: I tried Lees to answer and managed to create a webpage with a submit button, when you click on it, it goes to the final page with the fields filled in, but I can not get javascript to work so that it automatically goes there, without having to press the submit button . Here is the webpage I'm generating

<html><head>
<script type = "text/javascript">
function onLoad() 
{
    document.getElementById('form').submit();
}
</script>
</head>
<body>
<form name="form" action="http://test.musicbrainz.org/release/add" method="post">
<input name="name" type="hidden" value="Porcupine"/>
<input type="submit" value="send">
</form>
</body>
+3
source share
3 answers

Since there is no way to POSTing through the address bar, you need to submit a page containing an HTML form and submit it. You can try compiling a javascript: URI (like a favelet) that creates an HTML form and publishes it. But I'm not 100% sure that the JavaScript URI is associated with your preferred OS browser. Therefore, I will be mistaken on the side of "you can not."

JavaScript, . JavaScript .

+4

, , "POST", . , , . , , , . , , - . , , httpclient, . javascript ( ), ( ).

+1

Poster Firefox:

"A developer tool for interacting with web services and other web resources, which allows you to make HTTP requests, set the entity body and content type, which allows you to interact with web services and check the results ..."

Or if you prefer Google Chrome .

0
source

Source: https://habr.com/ru/post/1790557/


All Articles