Example usage for org.springframework.http MediaType APPLICATION_JSON_VALUE

List of usage examples for org.springframework.http MediaType APPLICATION_JSON_VALUE

Introduction

In this page you can find the example usage for org.springframework.http MediaType APPLICATION_JSON_VALUE.

Prototype

String APPLICATION_JSON_VALUE

To view the source code for org.springframework.http MediaType APPLICATION_JSON_VALUE.

Click Source Link

Document

A String equivalent of MediaType#APPLICATION_JSON .

Usage

From source file:com.github.leonardoxh.temporeal.controller.GcmTokenController.java

@RequestMapping(value = "/gcm/token/new", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
public GcmToken newGcmToken(@RequestBody(required = true) GcmToken newToken) {
    GcmTokenDao.saveOrUpdate(newToken);/*w  w w.  j a v a  2 s  .  c o  m*/
    return newToken;
}

From source file:be.ucll.udas.rest.controller.CodeSnippetRESTController.java

@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public Collection<CodeSnippet> getCodeSnippets() throws HTTPWrapperException {
    try {// w ww  .ja  v a 2  s.  c o  m
        return udas.getCodeSnippets();
    } catch (DomainException ex) {
        Logger.getLogger(CodeSnippetRESTController.class.getName()).log(Level.SEVERE, null, ex);
        throw new HTTPWrapperException(ex);
    }
}

From source file:com.github.leonardoxh.temporeal.controller.UserController.java

@RequestMapping(value = "/user/new", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public User newUser(@RequestBody(required = true) User user) {
    UserDao.saveOrUpdate(user);/*from  w w  w  .j av  a2  s .  co  m*/
    return user;
}

From source file:at.ac.univie.isc.asio.FlockIntegrationSuite.java

@BeforeClass
public static void start() {
    final String[] args = new String[] { "--asio.metadata-repository=" + IntegrationTest.atos.address() };
    application.profile("flock-test").run(args);

    IntegrationTest.configure().baseService(URI.create("http://localhost:" + application.getPort() + "/"))
            .auth(AuthMechanism.uri().overrideCredentialDelegationHeader(HttpHeaders.AUTHORIZATION))
            .rootCredentials("root", "change").timeoutInSeconds(10).defaults().schema("public")
            .role(Role.NONE.name());

    IntegrationTest.deploy("public",
            ByteSource.wrap(Payload.encodeUtf8("{\"identifier\":\"urn:asio:dataset:integration\"}")),
            MediaType.APPLICATION_JSON_VALUE);
    IntegrationTest.warmup();//  w ww .jav  a2  s  . c  om
}

From source file:com.github.leonardoxh.temporeal.controller.CommentController.java

@RequestMapping(value = "/comment/new", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
public Comment newComment(@RequestBody(required = true) Comment comment) {
    CommentDao.saveOrUpdate(comment);//  w  w  w .j  a v  a2 s.  co m
    return comment;
}

From source file:com.blstream.patronage.ctf.common.web.controller.RestController.java

/**
 * This method creates a new document.// w  ww  .java  2 s  .  co  m
 * @param resource
 * @return T
 */
@RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE }, produces = {
        MediaType.APPLICATION_JSON_VALUE })
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
T create(@RequestBody T resource);

From source file:com.pengjieran.ui.mvc.MessageController.java

@ApiOperation(value = "?", notes = "")
@RequestMapping(value = "/list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String get() {

    return "{\"code\":\"-1\"}";
}

From source file:com.orange.clara.pivotaltrackermirror.controllers.ConverterTypeController.java

@ApiOperation(value = "Get the list of all available converter in the app", response = ConverterTypeResponse.class, responseContainer = "List")
@RequestMapping(method = RequestMethod.GET, value = "", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getAll() {
    List<ConverterTypeResponse> converterTypeResponses = Lists.newArrayList();
    for (ConverterType converterType : ConverterType.values()) {
        converterTypeResponses.add(new ConverterTypeResponse(converterType));
    }/*from w  w w.  j  a  va2  s. c o m*/
    return ResponseEntity.ok(converterTypeResponses);
}

From source file:business.controllers.AgreementFormTemplateController.java

@RequestMapping(value = "/public/agreementFormTemplate", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public AgreementFormTemplateRepresentation getTemplate(UserAuthenticationToken user) {
    log.info("GET /public/agreementFormTemplate");

    AgreementFormTemplate template = agreementFormTemplateService.get();
    return new AgreementFormTemplateRepresentation(template);
}

From source file:com.codekul.simpleboot.controller.ControllerRestServices.java

@RequestMapping(value = "/user", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public /*@ResponseBody*/ ResponseEntity<User> userInfo() {

    User userBody = new User();
    userBody.setUserName("Android");
    userBody.setPassword("android");

    HttpHeaders headers = new HttpHeaders();

    ResponseEntity<User> entity = new ResponseEntity<>(userBody, headers, HttpStatus.OK);
    return entity;
}