import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.opendaylight.aaa.api.ClaimCache;
* @return a response with all domains stored in the H2 database
*/
@GET
- @Produces("application/json")
+ @Produces(MediaType.APPLICATION_JSON)
public Response getDomains() {
LOG.info("Get /domains");
final Domains domains;
*/
@GET
@Path("/{id}")
- @Produces("application/json")
+ @Produces(MediaType.APPLICATION_JSON)
public Response getDomain(@PathParam("id") final String domainId) {
LOG.info("Get /domains/{}", domainId);
final Domain domain;
* @return A response stating success or failure of domain creation.
*/
@POST
- @Consumes("application/json")
- @Produces("application/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
public Response createDomain(@Context final UriInfo info, final Domain domain) {
LOG.info("Post /domains");
*/
@PUT
@Path("/{id}")
- @Consumes("application/json")
- @Produces("application/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
public Response putDomain(@Context final UriInfo info, final Domain domain,
@PathParam("id") final String domainId) {
LOG.info("Put /domains/{}", domainId);
*/
@POST
@Path("/{did}/users/{uid}/roles")
- @Consumes("application/json")
- @Produces("application/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
public Response createGrant(@Context final UriInfo info, @PathParam("did") final String domainId,
@PathParam("uid") final String userId, final Grant grant) {
LOG.info("Post /domains/{}/users/{}/roles", domainId, userId);
*/
@POST
@Path("/{did}/users/roles")
- @Consumes("application/json")
- @Produces("application/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
public Response validateUser(@Context final UriInfo info, @PathParam("did") final String domainId,
final UserPwd userpwd) {
LOG.info("GET /domains/{}/users", domainId);
*/
@GET
@Path("/{did}/users/{uid}/roles")
- @Produces("application/json")
+ @Produces(MediaType.APPLICATION_JSON)
public Response getRoles(@Context final UriInfo info, @PathParam("did") final String domainId,
@PathParam("uid") final String userId) {
LOG.info("GET /domains/{}/users/{}/roles", domainId, userId);
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.opendaylight.aaa.api.ClaimCache;
* if one is encountered
*/
@GET
- @Produces("application/json")
+ @Produces(MediaType.APPLICATION_JSON)
public Response getRoles() {
LOG.info("get /roles");
final Roles roles;
*/
@GET
@Path("/{id}")
- @Produces("application/json")
+ @Produces(MediaType.APPLICATION_JSON)
public Response getRole(@PathParam("id") final String id) {
LOG.info("get /roles/{}", id);
* internal error if one is encountered
*/
@POST
- @Consumes("application/json")
- @Produces("application/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
public Response createRole(@Context final UriInfo info, final Role role) {
LOG.info("Post /roles");
*/
@PUT
@Path("/{id}")
- @Consumes("application/json")
- @Produces("application/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
public Response putRole(@Context final UriInfo info, final Role role, @PathParam("id") final String id) {
LOG.info("put /roles/{}", id);
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
import org.opendaylight.aaa.api.ClaimCache;
* @return A response containing the users, or internal error if one occurs
*/
@GET
- @Produces("application/json")
+ @Produces(MediaType.APPLICATION_JSON)
public Response getUsers() {
LOG.info("GET /auth/v1/users (extracts all users)");
*/
@GET
@Path("/{id}")
- @Produces("application/json")
+ @Produces(MediaType.APPLICATION_JSON)
public Response getUser(@PathParam("id") final String id) {
LOG.info("GET auth/v1/users/ {} (extract user with specified id)", id);
* @return A response stating success or failure of user creation
*/
@POST
- @Consumes("application/json")
- @Produces("application/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
public Response createUser(@Context final UriInfo info, final User user) {
LOG.info("POST /auth/v1/users (create a user with the specified payload");
*/
@PUT
@Path("/{id}")
- @Consumes("application/json")
- @Produces("application/json")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
public Response putUser(@Context final UriInfo info, final User user, @PathParam("id") final String id) {
LOG.info("PUT /auth/v1/users/{} (Updates a user account)", id);