@POST @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response action( @Context HttpServletRequest httpRequest, @FormParam("csrfToken") String csrfToken, @FormParam("key") @DefaultValue("") String key, @FormParam("name") @DefaultValue("") String name, @FormParam("description") @DefaultValue("") String description, @FormParam("rollback") @DefaultValue("") String rollback, @FormParam("version") @DefaultValue("") String version, @FormParam("upgrade") @DefaultValue("") String upgrade, @FormParam("repository") @DefaultValue("") String repository, @FormParam("email") @DefaultValue("") String email, @FormParam("autoRelease") @DefaultValue("false") boolean autoRelease, @FormParam("action") @DefaultValue("") String action) { return shiroRequestHelper.csrfCall( csrfToken, "releases/action", (csrfToken1) -> { if (action.startsWith("export")) { String export = pluginRegion.doExport( new ReleasesPluginRegionInput( key, name, description, rollback, version, upgrade, repository, email, autoRelease, "export"), httpRequest.getRemoteUser()); return Response.ok(export, MediaType.APPLICATION_OCTET_STREAM_TYPE); } else { String rendered = soyService.renderPlugin( httpRequest.getRemoteUser(), csrfToken1, pluginRegion, new ReleasesPluginRegionInput( key, name, description, rollback, version, upgrade, repository, email, autoRelease, action)); return Response.ok(rendered, MediaType.TEXT_HTML); } }); }
@GET @Produces(MediaType.TEXT_HTML) public Response releases(@Context HttpServletRequest httpRequest) { return shiroRequestHelper.call( "releases", (csrfToken) -> { String rendered = soyService.renderPlugin( httpRequest.getRemoteUser(), csrfToken, pluginRegion, new ReleasesPluginRegionInput("", "", "", "", "", "", "", "", false, "")); return Response.ok(rendered); }); }