I am trying to make Simple Openfire plugin.I have an ArrayList of usersnames which are phone numbers, i want all the registered users from it.The ArrayList want to send the ArrayList to server by json throung get or post method ,But i donot know how my plugin can listen for that request and respond to that user.
问题:
回答1:
For your specific requirement you should check Openfire Rest-API Plugin.
The plugin already provides Users related operations over HTTP, like: Get overview over all or specific user and to create, update or delete a user.
So you can request all registered users in Openfire or You can query for a specific user if it's already registered or not. And it also supports authentication so your http endpoints will be secure.
Examples:
GET http://example.org:9090/plugins/restapi/v1/users
GET http://example.org:9090/plugins/restapi/v1/users?search=testuser
GET http://example.org:9090/plugins/restapi/v1/users/testuser
Regarding new plugin development, I would suggest you to start with Rest-API, it's already opensource, you can checkout the code and customize it as per your business needs or you can use it to develop your own plugin following it's project structure.
There is also a client library available as Rest-API Client.