forked from Archives/Athou_commafeed
validate more inputs
This commit is contained in:
@@ -2,6 +2,9 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -12,9 +15,12 @@ import lombok.Data;
|
|||||||
public class AddCategoryRequest implements Serializable {
|
public class AddCategoryRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "name", required = true)
|
@ApiModelProperty(value = "name", required = true)
|
||||||
|
@NotEmpty
|
||||||
|
@Size(max = 128)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "parent category id, if any")
|
@ApiModelProperty(value = "parent category id, if any")
|
||||||
|
@Size(max = 128)
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -12,12 +15,15 @@ import lombok.Data;
|
|||||||
public class CategoryModificationRequest implements Serializable {
|
public class CategoryModificationRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "id", required = true)
|
@ApiModelProperty(value = "id", required = true)
|
||||||
|
@NotEmpty
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new name, null if not changed")
|
@ApiModelProperty(value = "new name, null if not changed")
|
||||||
|
@Size(max = 128)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new parent category id")
|
@ApiModelProperty(value = "new parent category id")
|
||||||
|
@Size(max = 128)
|
||||||
private String parentId;
|
private String parentId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new display position, null if not changed")
|
@ApiModelProperty(value = "new display position, null if not changed")
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -12,6 +15,8 @@ import lombok.Data;
|
|||||||
public class FeedInfoRequest implements Serializable {
|
public class FeedInfoRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "feed url", required = true)
|
@ApiModelProperty(value = "feed url", required = true)
|
||||||
|
@NotEmpty
|
||||||
|
@Size(max = 4096)
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.commafeed.frontend.model.request;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
@ApiModel(description = "Feed merge Request")
|
|
||||||
@Data
|
|
||||||
public class FeedMergeRequest implements Serializable {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "merge into this feed", required = true)
|
|
||||||
private Long intoFeedId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "id of the feeds to merge", required = true)
|
|
||||||
private List<Long> feedIds;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,8 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -15,15 +17,18 @@ public class FeedModificationRequest implements Serializable {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new name, null if not changed")
|
@ApiModelProperty(value = "new name, null if not changed")
|
||||||
|
@Size(max = 128)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new parent category id")
|
@ApiModelProperty(value = "new parent category id")
|
||||||
|
@Size(max = 128)
|
||||||
private String categoryId;
|
private String categoryId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "new display position, null if not changed")
|
@ApiModelProperty(value = "new display position, null if not changed")
|
||||||
private Integer position;
|
private Integer position;
|
||||||
|
|
||||||
@ApiModelProperty(value = "JEXL string evaluated on new entries to mark them as read if they do not match")
|
@ApiModelProperty(value = "JEXL string evaluated on new entries to mark them as read if they do not match")
|
||||||
|
@Size(max = 4096)
|
||||||
private String filter;
|
private String filter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -12,8 +15,11 @@ import lombok.Data;
|
|||||||
public class LoginRequest implements Serializable {
|
public class LoginRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "username", required = true)
|
@ApiModelProperty(value = "username", required = true)
|
||||||
|
@Size(min = 3, max = 32)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "password", required = true)
|
@ApiModelProperty(value = "password", required = true)
|
||||||
|
@NotEmpty
|
||||||
|
@Size(max = 128)
|
||||||
private String password;
|
private String password;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ package com.commafeed.frontend.model.request;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -13,6 +16,8 @@ import lombok.Data;
|
|||||||
public class MarkRequest implements Serializable {
|
public class MarkRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "entry id, category id, 'all' or 'starred'", required = true)
|
@ApiModelProperty(value = "entry id, category id, 'all' or 'starred'", required = true)
|
||||||
|
@NotEmpty
|
||||||
|
@Size(max = 128)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "mark as read or unread", required = true)
|
@ApiModelProperty(value = "mark as read or unread", required = true)
|
||||||
@@ -24,6 +29,7 @@ public class MarkRequest implements Serializable {
|
|||||||
private Long olderThan;
|
private Long olderThan;
|
||||||
|
|
||||||
@ApiModelProperty(value = "only mark read if a feed has these keywords in the title or rss content", required = false)
|
@ApiModelProperty(value = "only mark read if a feed has these keywords in the title or rss content", required = false)
|
||||||
|
@Size(max = 128)
|
||||||
private String keywords;
|
private String keywords;
|
||||||
|
|
||||||
@ApiModelProperty(value = "if marking a category or 'all', exclude those subscriptions from the marking", required = false)
|
@ApiModelProperty(value = "if marking a category or 'all', exclude those subscriptions from the marking", required = false)
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.commafeed.frontend.model.request;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -13,6 +15,6 @@ import lombok.Data;
|
|||||||
public class MultipleMarkRequest implements Serializable {
|
public class MultipleMarkRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "list of mark requests", required = true)
|
@ApiModelProperty(value = "list of mark requests", required = true)
|
||||||
private List<MarkRequest> requests;
|
private List<@Valid MarkRequest> requests;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -17,5 +18,6 @@ public class PasswordResetRequest implements Serializable {
|
|||||||
@ApiModelProperty(value = "email address for password recovery", required = true)
|
@ApiModelProperty(value = "email address for password recovery", required = true)
|
||||||
@Email
|
@Email
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
|
@Size(max = 255)
|
||||||
private String email;
|
private String email;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import com.commafeed.frontend.auth.ValidPassword;
|
import com.commafeed.frontend.auth.ValidPassword;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
@@ -13,9 +16,12 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class ProfileModificationRequest implements Serializable {
|
public class ProfileModificationRequest implements Serializable {
|
||||||
@ApiModelProperty(value = "current user password, required to change profile data", required = true)
|
@ApiModelProperty(value = "current user password, required to change profile data", required = true)
|
||||||
|
@NotEmpty
|
||||||
|
@Size(max = 128)
|
||||||
private String currentPassword;
|
private String currentPassword;
|
||||||
|
|
||||||
@ApiModelProperty(value = "changes email of the user, if specified")
|
@ApiModelProperty(value = "changes email of the user, if specified")
|
||||||
|
@Size(max = 255)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@ApiModelProperty(value = "changes password of the user, if specified")
|
@ApiModelProperty(value = "changes password of the user, if specified")
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
import javax.validation.constraints.Email;
|
import javax.validation.constraints.Email;
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import com.commafeed.frontend.auth.ValidPassword;
|
import com.commafeed.frontend.auth.ValidPassword;
|
||||||
|
|
||||||
@@ -19,18 +18,19 @@ import lombok.Data;
|
|||||||
public class RegistrationRequest implements Serializable {
|
public class RegistrationRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "username, between 3 and 32 characters", required = true)
|
@ApiModelProperty(value = "username, between 3 and 32 characters", required = true)
|
||||||
@Length(min = 3, max = 32)
|
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
|
@Size(min = 3, max = 32)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty(value = "password, minimum 6 characters", required = true)
|
@ApiModelProperty(value = "password, minimum 6 characters", required = true)
|
||||||
@ValidPassword
|
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
|
@ValidPassword
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
@ApiModelProperty(value = "email address for password recovery", required = true)
|
@ApiModelProperty(value = "email address for password recovery", required = true)
|
||||||
@Email
|
@Email
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
|
@Size(max = 255)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -12,6 +15,8 @@ import lombok.Data;
|
|||||||
public class StarRequest implements Serializable {
|
public class StarRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "id", required = true)
|
@ApiModelProperty(value = "id", required = true)
|
||||||
|
@NotEmpty
|
||||||
|
@Size(max = 128)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@ApiModelProperty(value = "feed id", required = true)
|
@ApiModelProperty(value = "feed id", required = true)
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.commafeed.frontend.model.request;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -12,12 +15,17 @@ import lombok.Data;
|
|||||||
public class SubscribeRequest implements Serializable {
|
public class SubscribeRequest implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "url of the feed", required = true)
|
@ApiModelProperty(value = "url of the feed", required = true)
|
||||||
|
@NotEmpty
|
||||||
|
@Size(max = 4096)
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
@ApiModelProperty(value = "name of the feed for the user", required = true)
|
@ApiModelProperty(value = "name of the feed for the user", required = true)
|
||||||
|
@NotEmpty
|
||||||
|
@Size(max = 128)
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
@ApiModelProperty(value = "id of the user category to place the feed in")
|
@ApiModelProperty(value = "id of the user category to place the feed in")
|
||||||
|
@Size(max = 128)
|
||||||
private String categoryId;
|
private String categoryId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import javax.validation.Valid;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.DefaultValue;
|
import javax.ws.rs.DefaultValue;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
@@ -244,7 +245,7 @@ public class CategoryREST {
|
|||||||
@ApiOperation(value = "Mark category entries", notes = "Mark feed entries of this category as read")
|
@ApiOperation(value = "Mark category entries", notes = "Mark feed entries of this category as read")
|
||||||
@Timed
|
@Timed
|
||||||
public Response markCategoryEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response markCategoryEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "category id, or 'all'", required = true) MarkRequest req) {
|
@Valid @ApiParam(value = "category id, or 'all'", required = true) MarkRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -285,7 +286,8 @@ public class CategoryREST {
|
|||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Add a category", notes = "Add a new feed category", response = Long.class)
|
@ApiOperation(value = "Add a category", notes = "Add a new feed category", response = Long.class)
|
||||||
@Timed
|
@Timed
|
||||||
public Response addCategory(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(required = true) AddCategoryRequest req) {
|
public Response addCategory(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
|
@Valid @ApiParam(required = true) AddCategoryRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getName());
|
Preconditions.checkNotNull(req.getName());
|
||||||
|
|
||||||
@@ -343,7 +345,7 @@ public class CategoryREST {
|
|||||||
@ApiOperation(value = "Rename a category", notes = "Rename an existing feed category")
|
@ApiOperation(value = "Rename a category", notes = "Rename an existing feed category")
|
||||||
@Timed
|
@Timed
|
||||||
public Response modifyCategory(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response modifyCategory(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(required = true) CategoryModificationRequest req) {
|
@Valid @ApiParam(required = true) CategoryModificationRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import javax.validation.Valid;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
@@ -48,7 +49,7 @@ public class EntryREST {
|
|||||||
@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")
|
||||||
@Timed
|
@Timed
|
||||||
public Response markEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response markEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "Mark Request", required = true) MarkRequest req) {
|
@Valid @ApiParam(value = "Mark Request", required = true) MarkRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -62,7 +63,7 @@ public class EntryREST {
|
|||||||
@ApiOperation(value = "Mark multiple feed entries", notes = "Mark feed entries as read/unread")
|
@ApiOperation(value = "Mark multiple feed entries", notes = "Mark feed entries as read/unread")
|
||||||
@Timed
|
@Timed
|
||||||
public Response markEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response markEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "Multiple Mark Request", required = true) MultipleMarkRequest req) {
|
@Valid @ApiParam(value = "Multiple Mark Request", required = true) MultipleMarkRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getRequests());
|
Preconditions.checkNotNull(req.getRequests());
|
||||||
|
|
||||||
@@ -79,7 +80,7 @@ public class EntryREST {
|
|||||||
@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")
|
||||||
@Timed
|
@Timed
|
||||||
public Response starEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response starEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "Star Request", required = true) StarRequest req) {
|
@Valid @ApiParam(value = "Star Request", required = true) StarRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
Preconditions.checkNotNull(req.getFeedId());
|
Preconditions.checkNotNull(req.getFeedId());
|
||||||
@@ -105,7 +106,7 @@ public class EntryREST {
|
|||||||
@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")
|
||||||
@Timed
|
@Timed
|
||||||
public Response tagEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response tagEntry(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "Tag Request", required = true) TagRequest req) {
|
@Valid @ApiParam(value = "Tag Request", required = true) TagRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getEntryId());
|
Preconditions.checkNotNull(req.getEntryId());
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import javax.validation.Valid;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.DefaultValue;
|
import javax.ws.rs.DefaultValue;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
@@ -263,7 +264,7 @@ public class FeedREST {
|
|||||||
@ApiOperation(value = "Fetch a feed", notes = "Fetch a feed by its url", response = FeedInfo.class)
|
@ApiOperation(value = "Fetch a feed", notes = "Fetch a feed by its url", response = FeedInfo.class)
|
||||||
@Timed
|
@Timed
|
||||||
public Response fetchFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response fetchFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "feed url", required = true) FeedInfoRequest req) {
|
@Valid @ApiParam(value = "feed url", required = true) FeedInfoRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getUrl());
|
Preconditions.checkNotNull(req.getUrl());
|
||||||
|
|
||||||
@@ -315,7 +316,7 @@ public class FeedREST {
|
|||||||
@ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read (unread is not supported)")
|
@ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read (unread is not supported)")
|
||||||
@Timed
|
@Timed
|
||||||
public Response markFeedEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response markFeedEntries(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "Mark request", required = true) MarkRequest req) {
|
@Valid @ApiParam(value = "Mark request", required = true) MarkRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
@@ -384,7 +385,7 @@ public class FeedREST {
|
|||||||
@ApiOperation(value = "Subscribe to a feed", notes = "Subscribe to a feed")
|
@ApiOperation(value = "Subscribe to a feed", notes = "Subscribe to a feed")
|
||||||
@Timed
|
@Timed
|
||||||
public Response subscribe(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response subscribe(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "subscription request", required = true) SubscribeRequest req) {
|
@Valid @ApiParam(value = "subscription request", required = true) SubscribeRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getTitle());
|
Preconditions.checkNotNull(req.getTitle());
|
||||||
Preconditions.checkNotNull(req.getUrl());
|
Preconditions.checkNotNull(req.getUrl());
|
||||||
@@ -458,7 +459,7 @@ public class FeedREST {
|
|||||||
@ApiOperation(value = "Modify a subscription", notes = "Modify a feed subscription")
|
@ApiOperation(value = "Modify a subscription", notes = "Modify a feed subscription")
|
||||||
@Timed
|
@Timed
|
||||||
public Response modifyFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
public Response modifyFeed(@ApiParam(hidden = true) @SecurityCheck User user,
|
||||||
@ApiParam(value = "subscription id", required = true) FeedModificationRequest req) {
|
@Valid @ApiParam(value = "subscription id", required = true) FeedModificationRequest req) {
|
||||||
Preconditions.checkNotNull(req);
|
Preconditions.checkNotNull(req);
|
||||||
Preconditions.checkNotNull(req.getId());
|
Preconditions.checkNotNull(req.getId());
|
||||||
|
|
||||||
|
|||||||
@@ -251,7 +251,8 @@ public class UserREST {
|
|||||||
@UnitOfWork
|
@UnitOfWork
|
||||||
@ApiOperation(value = "Login and create a session")
|
@ApiOperation(value = "Login and create a session")
|
||||||
@Timed
|
@Timed
|
||||||
public Response login(@ApiParam(required = true) LoginRequest req, @ApiParam(hidden = true) @Context SessionHelper sessionHelper) {
|
public Response login(@Valid @ApiParam(required = true) LoginRequest req,
|
||||||
|
@ApiParam(hidden = true) @Context SessionHelper sessionHelper) {
|
||||||
Optional<User> user = userService.login(req.getName(), req.getPassword());
|
Optional<User> user = userService.login(req.getName(), req.getPassword());
|
||||||
if (user.isPresent()) {
|
if (user.isPresent()) {
|
||||||
sessionHelper.setLoggedInUser(user.get());
|
sessionHelper.setLoggedInUser(user.get());
|
||||||
|
|||||||
Reference in New Issue
Block a user