I have to display a webpage
inside my Java
software.( you can think it is one the page of a Wireless Device
configuration)
But when Im gonna go to that page in browser,browser displays a user
and password
popup and I enter the user
and password
and go to that page.( notice that username is always root, but password can be different)
Now I am gonna display the page from Java software, I could link the page and open the page via Java
, But the host inside the wireless device displays :
401 Unauthorized
, The URL of the page I want to display is http://192.168.1.2/Wireless
I used Fiddler
to monitor its behavior, that URL is continuously reloading.
And here is the Header of the Get method of that :
GET /Wireless HTTP/1.1
Host: 192.168.1.2
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.1.2/Wireless
Authorization: Basic xxxxxxxxx
Connection: keep-alive
How can I do that? With HttpClient
?
Does anybody knows how to do that? And give me a solution?
Or a sample or anything can help me?|
Thanks.
EDIT :
Here is my code to display the webview :
myFrame.setSize(mainJTabbed.getSize());
myFrame.setLocationRelativeTo(mainJTabbed);
myFrame.setVisible(true);
myFrame.add(myFXPanel);
Platform.runLater(() -> {
BorderPane borderPane = new BorderPane();
WebView webComponent = new WebView();
webComponent.getEngine().load("myURL");
borderPane.setCenter(webComponent);
Scene scene = new Scene(borderPane,450,450);
myFXPanel.setScene(scene);
});
And even it is a GET method, the user and password does not post via URL
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…