@Path(value="microstory") public class StoryResource extends Object
| Constructor and Description |
|---|
StoryResource() |
| Modifier and Type | Method and Description |
|---|---|
javax.ws.rs.core.Response |
findById(int id)
Returns the story identified by the id.
|
javax.ws.rs.core.Response |
findByText(String text,
int page,
int limit)
Returns a list of stories that matched by the text param.
|
javax.ws.rs.core.Response |
findRecentStories()
Returns the most recent stories.
|
@Path(value="/recent") @GET @Produces(value="application/json") public javax.ws.rs.core.Response findRecentStories()
OK response containing the most recent stories.@Path(value="{id}")
@GET
@Produces(value="application/json")
public javax.ws.rs.core.Response findById(@PathParam(value="id")
int id)
id - the id of a story.OK response containing the Story with the
provided id.IllegalArgumentException - if id is null or
if it does not correspond with any story.@Path(value="/")
@GET
@Produces(value="application/json")
public javax.ws.rs.core.Response findByText(@QueryParam(value="contains")
String text,
@QueryParam(value="page")
int page,
@QueryParam(value="limit")
int limit)
text - the string that has topage - the number of pagelimit - the number of stories in the pageOK response containing the Story list with the provided text param.
A BAD_REQUEST response if the text is null or empty. An empty list if there are not any matches.Copyright © 2018. All rights reserved.