mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
better error message
This commit is contained in:
@@ -62,8 +62,10 @@ public class PubSubHubbubCallbackREST {
|
|||||||
@QueryParam("hub.challenge") String challenge,
|
@QueryParam("hub.challenge") String challenge,
|
||||||
@QueryParam("hub.lease_seconds") String leaseSeconds,
|
@QueryParam("hub.lease_seconds") String leaseSeconds,
|
||||||
@QueryParam("hub.verify_token") String verifyToken) {
|
@QueryParam("hub.verify_token") String verifyToken) {
|
||||||
Preconditions.checkState(applicationSettingsService.get()
|
if (!applicationSettingsService.get()
|
||||||
.isPubsubhubbub());
|
.isPubsubhubbub()) {
|
||||||
|
return Response.status(Status.FORBIDDEN).entity("pubsubhubbub is disabled").build();
|
||||||
|
}
|
||||||
|
|
||||||
Preconditions.checkArgument(StringUtils.isNotEmpty(topic));
|
Preconditions.checkArgument(StringUtils.isNotEmpty(topic));
|
||||||
Preconditions.checkArgument("subscribe".equals(mode));
|
Preconditions.checkArgument("subscribe".equals(mode));
|
||||||
@@ -90,8 +92,10 @@ public class PubSubHubbubCallbackREST {
|
|||||||
@POST
|
@POST
|
||||||
@Consumes({ MediaType.APPLICATION_ATOM_XML, "application/rss+xml" })
|
@Consumes({ MediaType.APPLICATION_ATOM_XML, "application/rss+xml" })
|
||||||
public Response callback() {
|
public Response callback() {
|
||||||
Preconditions.checkState(applicationSettingsService.get()
|
if (!applicationSettingsService.get()
|
||||||
.isPubsubhubbub());
|
.isPubsubhubbub()) {
|
||||||
|
return Response.status(Status.FORBIDDEN).entity("pubsubhubbub is disabled").build();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
byte[] bytes = IOUtils.toByteArray(request.getInputStream());
|
byte[] bytes = IOUtils.toByteArray(request.getInputStream());
|
||||||
FetchedFeed fetchedFeed = parser.parse(null, bytes);
|
FetchedFeed fetchedFeed = parser.parse(null, bytes);
|
||||||
|
|||||||
Reference in New Issue
Block a user