Je souhaiterai pouvoir donner mon user / mot de passe pour l'ouverture d'une connection en HTTP.
J'ai donc appliquer ce bout de code, trouver chez Sun :
Ainsi que cette méthode :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 try { String username="XXX"; String password="XXX"; String endpointAddress = "http://...."; Stub stub = createProxy(); stub._setProperty( javax.xml.rpc.Stub.USERNAME_PROPERTY, username); stub._setProperty( javax.xml.rpc.Stub.PASSWORD_PROPERTY, password); stub._setProperty (javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, endpointAddress); HelloIF hello = (HelloIF)stub; System.out.println(hello.sayHello("Duke (secure)"));
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 private static Stub createProxy() { // Note: MyHelloService_Impl is implementation-specific. return (Stub)(new MyHelloService_Impl().getHelloIFPort()); }
Voir chapitre 32 : Security
Mais je ne vois pas ce que c'est que leur classe MyHelloService_Impl(). Et comment l'appliquer à mon cas d'utilisation, qui consiste à juste foutre dans mon appli, tu prends ces identifiants quand tu vas sur cette page, pour m'autoriser l'accès. Sachant que c'est dans l'ApplicationContext.xml de Spring que j'appel ma page HTTP.
Merci beaucoup.
Partager