mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
return responses when no value is expected
This commit is contained in:
@@ -7,6 +7,8 @@ import javax.ws.rs.DefaultValue;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import com.commafeed.backend.model.Feed;
|
||||
import com.commafeed.backend.model.FeedCategory;
|
||||
@@ -134,7 +136,7 @@ public class EntriesREST extends AbstractREST {
|
||||
|
||||
@Path("mark")
|
||||
@GET
|
||||
public void mark(@QueryParam("type") Type type,
|
||||
public Response mark(@QueryParam("type") Type type,
|
||||
@QueryParam("id") String id, @QueryParam("read") boolean read) {
|
||||
Preconditions.checkNotNull(type);
|
||||
Preconditions.checkNotNull(id);
|
||||
@@ -154,6 +156,7 @@ public class EntriesREST extends AbstractREST {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
|
||||
private void markEntry(FeedEntry entry, boolean read) {
|
||||
|
||||
@@ -8,6 +8,8 @@ import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.apache.commons.fileupload.FileItemFactory;
|
||||
@@ -29,7 +31,7 @@ public class SubscriptionsREST extends AbstractREST {
|
||||
|
||||
@POST
|
||||
@Path("subscribe")
|
||||
public void subscribe(SubscriptionRequest req) {
|
||||
public Response subscribe(SubscriptionRequest req) {
|
||||
Preconditions.checkNotNull(req);
|
||||
Preconditions.checkNotNull(req.getTitle());
|
||||
Preconditions.checkNotNull(req.getUrl());
|
||||
@@ -48,20 +50,21 @@ public class SubscriptionsREST extends AbstractREST {
|
||||
sub.setTitle(req.getTitle());
|
||||
sub.setUser(getUser());
|
||||
feedSubscriptionService.save(sub);
|
||||
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("unsubscribe")
|
||||
public void unsubscribe(@QueryParam("id") Long subscriptionId) {
|
||||
public Response unsubscribe(@QueryParam("id") Long subscriptionId) {
|
||||
feedSubscriptionService.deleteById(subscriptionId);
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("import")
|
||||
@Consumes(MediaType.MULTIPART_FORM_DATA)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void importOpml() {
|
||||
public Response importOpml() {
|
||||
try {
|
||||
FileItemFactory factory = new DiskFileItemFactory(1000000, null);
|
||||
ServletFileUpload upload = new ServletFileUpload(factory);
|
||||
@@ -76,6 +79,7 @@ public class SubscriptionsREST extends AbstractREST {
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage(), e);
|
||||
}
|
||||
return Response.ok(Status.OK).build();
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
Reference in New Issue
Block a user