-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rest api 302 Temporary Redirect #119
Labels
question
Further information is requested
Comments
Tigase XMPP Server does not support |
How do I use it? This is my code, error reported 302 temporary redirection HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("https://im.aeeago.com:8080/rest/stream");
String sendString ="<message xmlns=\"jabber:client\" type=\"chat\" to=\"[email protected]\"><body>{\"type\":1,\"msgid\":\"dsf\",\"content\":\"test\"} </body></message>";
System.out.println(sendString);
StringEntity entity = new StringEntity(sendString,"utf-8");
entity.setContentType("application/xml");
entity.setContentEncoding("utf-8");
post.setEntity(entity);
HttpResponse response= null;
try {
response = client.execute(post);
} catch (IOException e) {
e.printStackTrace();
}``` |
In order to make HTTP request you need to:
val httpClient: HttpClient = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(10))
.authenticator(object : Authenticator() {
override fun getPasswordAuthentication(): PasswordAuthentication {
return PasswordAuthentication("admin", "password".toCharArray())
}
})
.version(HttpClient.Version.HTTP_1_1)
.build()
val request = HttpRequest.newBuilder()
.GET()
.uri(URI.create("https://im.aeeago.com:8080/rest/stream"))
.build()
val httpResponse = httpClient.send(request, BodyHandlers.ofString())
println("httpResponse statusCode = ${httpResponse.statusCode()}")
println(httpResponse.body()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a problem with…
After I pass "api_key" as a parameter, I report an error of "302 temporary redirection". After I write "open_access" in the configuration file, I do not pass "api_key", but I also report the same error of temporary redirection. There is no configuration about redirection in my configuration file. How should I solve it? Thank you very much
Details (please complete the following information):
The text was updated successfully, but these errors were encountered: