io.github.hapjava.server.impl.responses.InternalServerErrorResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hap Show documentation
Show all versions of hap Show documentation
Homekit Accessory Protocol for Java
package io.github.hapjava.server.impl.responses;
import io.github.hapjava.server.impl.http.HttpResponse;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
public class InternalServerErrorResponse implements HttpResponse {
private final Exception e;
public InternalServerErrorResponse(Exception e) {
this.e = e;
}
@Override
public int getStatusCode() {
return 500;
}
@Override
public ByteBuffer getBody() {
return ByteBuffer.wrap(e.getClass().getName().getBytes(StandardCharsets.UTF_8));
}
public Exception getException() {
return e;
}
}