use POST for operations that modify data

This commit is contained in:
Athou
2013-04-18 09:28:18 +02:00
parent 123c208391
commit 8d04a7c29f
4 changed files with 19 additions and 18 deletions

View File

@@ -135,7 +135,7 @@ public class AdminREST extends AbstractResourceREST {
} }
@Path("/users/delete") @Path("/users/delete")
@GET @POST
@ApiOperation(value = "Delete a user", notes = "Delete a user, and all his subscriptions") @ApiOperation(value = "Delete a user", notes = "Delete a user, and all his subscriptions")
public Response delete( public Response delete(
@ApiParam(value = "user id", required = true) @QueryParam("id") Long id) { @ApiParam(value = "user id", required = true) @QueryParam("id") Long id) {

View File

@@ -6,6 +6,7 @@ import java.util.List;
import javax.ws.rs.DefaultValue; import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
@@ -142,7 +143,7 @@ public class EntriesREST extends AbstractResourceREST {
} }
@Path("/entry/mark") @Path("/entry/mark")
@GET @POST
@ApiOperation(value = "Mark a feed entry", notes = "Mark a feed entry as read/unread") @ApiOperation(value = "Mark a feed entry", notes = "Mark a feed entry as read/unread")
public Response markFeedEntry( public Response markFeedEntry(
@ApiParam(value = "entry id", required = true) @QueryParam("id") String id, @ApiParam(value = "entry id", required = true) @QueryParam("id") String id,
@@ -159,7 +160,7 @@ public class EntriesREST extends AbstractResourceREST {
} }
@Path("/feed/mark") @Path("/feed/mark")
@GET @POST
@ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read") @ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read")
public Response markFeedEntries( public Response markFeedEntries(
@ApiParam(value = "feed id", required = true) @QueryParam("id") String id, @ApiParam(value = "feed id", required = true) @QueryParam("id") String id,
@@ -178,7 +179,7 @@ public class EntriesREST extends AbstractResourceREST {
} }
@Path("/category/mark") @Path("/category/mark")
@GET @POST
@ApiOperation(value = "Mark category entries", notes = "Mark feed entries as read") @ApiOperation(value = "Mark category entries", notes = "Mark feed entries as read")
public Response markCategoryEntries( public Response markCategoryEntries(
@ApiParam(value = "category id, or 'all'", required = true) @QueryParam("id") String id, @ApiParam(value = "category id, or 'all'", required = true) @QueryParam("id") String id,

View File

@@ -85,7 +85,7 @@ public class SubscriptionsREST extends AbstractResourceREST {
return url; return url;
} }
@GET @POST
@Path("/feed/unsubscribe") @Path("/feed/unsubscribe")
@ApiOperation(value = "Unsubscribe to a feed", notes = "Unsubscribe to a feed") @ApiOperation(value = "Unsubscribe to a feed", notes = "Unsubscribe to a feed")
public Response unsubscribe( public Response unsubscribe(
@@ -100,7 +100,7 @@ public class SubscriptionsREST extends AbstractResourceREST {
} }
} }
@GET @POST
@Path("/feed/rename") @Path("/feed/rename")
@ApiOperation(value = "Rename a subscription", notes = "Rename a feed subscription") @ApiOperation(value = "Rename a subscription", notes = "Rename a feed subscription")
public Response rename( public Response rename(
@@ -115,7 +115,7 @@ public class SubscriptionsREST extends AbstractResourceREST {
} }
@Path("/category/add") @Path("/category/add")
@GET @POST
@ApiOperation(value = "Add a category", notes = "Add a new feed category") @ApiOperation(value = "Add a category", notes = "Add a new feed category")
public Response addCategory( public Response addCategory(
@ApiParam(value = "new name", required = true) @QueryParam("name") String name, @ApiParam(value = "new name", required = true) @QueryParam("name") String name,
@@ -134,7 +134,7 @@ public class SubscriptionsREST extends AbstractResourceREST {
return Response.ok().build(); return Response.ok().build();
} }
@GET @POST
@Path("/category/delete") @Path("/category/delete")
@ApiOperation(value = "Delete a category", notes = "Delete an existing feed category") @ApiOperation(value = "Delete a category", notes = "Delete an existing feed category")
public Response deleteCategory( public Response deleteCategory(
@@ -154,7 +154,7 @@ public class SubscriptionsREST extends AbstractResourceREST {
} }
} }
@GET @POST
@Path("/category/rename") @Path("/category/rename")
@ApiOperation(value = "Rename a category", notes = "Rename an existing feed category") @ApiOperation(value = "Rename a category", notes = "Rename an existing feed category")
public Response renameCategory( public Response renameCategory(
@@ -168,7 +168,7 @@ public class SubscriptionsREST extends AbstractResourceREST {
return Response.ok(Status.OK).build(); return Response.ok(Status.OK).build();
} }
@GET @POST
@Path("/category/collapse") @Path("/category/collapse")
@ApiOperation(value = "Collapse a category", notes = "Save collapsed or expanded status for a category") @ApiOperation(value = "Collapse a category", notes = "Save collapsed or expanded status for a category")
public Response collapse( public Response collapse(

View File

@@ -54,42 +54,42 @@ module.factory('SubscriptionService', function($resource, $http) {
} }
}, },
unsubscribe : { unsubscribe : {
method : 'GET', method : 'POST',
params : { params : {
_type : 'feed', _type : 'feed',
_method : 'unsubscribe' _method : 'unsubscribe'
} }
}, },
rename : { rename : {
method : 'GET', method : 'POST',
params : { params : {
_type : 'feed', _type : 'feed',
_method : 'rename' _method : 'rename'
} }
}, },
collapse : { collapse : {
method : 'GET', method : 'POST',
params : { params : {
_type : 'category', _type : 'category',
_method : 'collapse' _method : 'collapse'
} }
}, },
addCategory : { addCategory : {
method : 'GET', method : 'POST',
params : { params : {
_type : 'category', _type : 'category',
_method : 'add' _method : 'add'
} }
}, },
deleteCategory : { deleteCategory : {
method : 'GET', method : 'POST',
params : { params : {
_type : 'category', _type : 'category',
_method : 'delete' _method : 'delete'
} }
}, },
renameCategory : { renameCategory : {
method : 'GET', method : 'POST',
params : { params : {
_type : 'category', _type : 'category',
_method : 'rename' _method : 'rename'
@@ -167,7 +167,7 @@ module.factory('EntryService', function($resource, $http) {
} }
}, },
mark : { mark : {
method : 'GET', method : 'POST',
params : { params : {
_method : 'mark' _method : 'mark'
} }
@@ -222,7 +222,7 @@ module.factory('AdminUsersService', function($resource) {
} }
}, },
remove : { remove : {
method : 'GET', method : 'POST',
params : { params : {
_method : 'delete' _method : 'delete'
} }