@Test public void testCreate() { Form form = new Form(); form.param("title", params[0]); form.param("description", params[1]); form.param("urls", new StringJoiner(",").add(params[2]).add(params[3]).toString()); form.param("refreshPeriod", params[4]); Response response = target().request().post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE)); assertEquals(Status.OK.getStatusCode(), response.getStatus()); String html = response.readEntity(String.class); assertTrue(html.contains(params[0]) && html.contains(params[1]) && html.contains(params[2]) && html.contains(params[3]) && html.contains(params[4])); }
@POST @Template(name = "/index.ftl") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Viewable create(@Valid @BeanParam FeedRequestBean request) { String[] urlArray = createUrls(request.getUrls()).stream().toArray(String[]::new); CombinedFeed feed = new CombinedFeed.CombinedFeedBuilder(null, urlArray) .title(request.getTitle()) .description(request.getDescription()) .refreshPeriod(request.getRefreshPeriod()).build(); feedService.save(feed); return new Viewable("/index.ftl", getModel()); }
CombinedFeedController { @POST @Template(name = "/index.ftl") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Viewable create(@Valid @BeanParam FeedRequestBean request) { String[] urlArray = createUrls(request.getUrls()).stream().toArray(String[]::new); CombinedFeed feed = new CombinedFeed.CombinedFeedBuilder(null, urlArray) .title(request.getTitle()) .description(request.getDescription()) .refreshPeriod(request.getRefreshPeriod()).build(); feedService.save(feed); return new Viewable("/index.ftl", getModel()); } }
CombinedFeedController { @POST @Template(name = "/index.ftl") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Viewable create(@Valid @BeanParam FeedRequestBean request) { String[] urlArray = createUrls(request.getUrls()).stream().toArray(String[]::new); CombinedFeed feed = new CombinedFeed.CombinedFeedBuilder(null, urlArray) .title(request.getTitle()) .description(request.getDescription()) .refreshPeriod(request.getRefreshPeriod()).build(); feedService.save(feed); return new Viewable("/index.ftl", getModel()); }  }
CombinedFeedController { @POST @Template(name = "/index.ftl") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Viewable create(@Valid @BeanParam FeedRequestBean request) { String[] urlArray = createUrls(request.getUrls()).stream().toArray(String[]::new); CombinedFeed feed = new CombinedFeed.CombinedFeedBuilder(null, urlArray) .title(request.getTitle()) .description(request.getDescription()) .refreshPeriod(request.getRefreshPeriod()).build(); feedService.save(feed); return new Viewable("/index.ftl", getModel()); }  @POST @Template(name = "/index.ftl") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Viewable create(@Valid @BeanParam FeedRequestBean request); @POST @Template(name = "/index.ftl") @Path("/delete/{feedId}") Viewable delete(@PathParam("feedId") String feedId); @GET @Template(name = "/index.ftl") Viewable getAll(); @GET @Template(name = "/feed-entries.ftl") @Path("/{id}") CombinedFeed get(@PathParam("id") String feedId); }
CombinedFeedController { @POST @Template(name = "/index.ftl") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Viewable create(@Valid @BeanParam FeedRequestBean request) { String[] urlArray = createUrls(request.getUrls()).stream().toArray(String[]::new); CombinedFeed feed = new CombinedFeed.CombinedFeedBuilder(null, urlArray) .title(request.getTitle()) .description(request.getDescription()) .refreshPeriod(request.getRefreshPeriod()).build(); feedService.save(feed); return new Viewable("/index.ftl", getModel()); }  @POST @Template(name = "/index.ftl") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Viewable create(@Valid @BeanParam FeedRequestBean request); @POST @Template(name = "/index.ftl") @Path("/delete/{feedId}") Viewable delete(@PathParam("feedId") String feedId); @GET @Template(name = "/index.ftl") Viewable getAll(); @GET @Template(name = "/feed-entries.ftl") @Path("/{id}") CombinedFeed get(@PathParam("id") String feedId);  }