@RequestMapping(value = "/{doctype}", method = RequestMethod.PUT)
 @ResponseBody
 public DOMSource putItems(@RequestBody Collection content, @PathVariable String doctype) {
   RestfulModel model = m_loginService.getModel();
   RestfulResponse response = new RestfulResponse(RESPONSE_TRANSACTIONTICKET);
   content.setType(model.getType(doctype));
   response.setContent(model.setTrollingObjects(content).toString());
   return response.getBody();
 }
 @RequestMapping(value = "/userinfo", method = RequestMethod.POST, headers = "Accept=text/xml")
 @ResponseBody
 public DOMSource setUser(@RequestBody User user) {
   RestfulModel model = m_loginService.getModel();
   model.setUser(user);
   return RestfulResponse.getResponse(RESPONSE_RESPONSE, "OK");
 }
 @RequestMapping(value = "/userinfo", method = RequestMethod.PUT, headers = "Accept=text/xml")
 @ResponseBody
 public DOMSource addUser(@RequestBody User user) {
   PublicModel model = new PublicModel();
   model.setUser(user);
   return RestfulResponse.getResponse(RESPONSE_RESPONSE, "OK");
 }
 @RequestMapping(value = "/{doctype}/{identifier}", method = RequestMethod.PUT)
 @ResponseBody
 public DOMSource putItem(
     @RequestBody Trollingobject object,
     @RequestParam Integer revision,
     @PathVariable String doctype,
     @PathVariable Integer identifier) {
   RestfulModel model = m_loginService.getModel();
   object.setObjectIdentifier(identifier.intValue());
   object.setCollection(model.getTrollingObjects(doctype));
   model.updateTrollingObject(object, revision.intValue());
   return RestfulResponse.getResponse(RESPONSE_RESPONSE, "OK");
 }
Exemple #5
0
  public RestfulResponse<JsonRepresentation> execute() {
    try {
      if (!args.isEmpty()) {
        clientRequestConfigurer.configureArgs(args);
      }
      final Response response = clientRequestConfigurer.getClientRequest().execute();

      // this is a bit hacky
      @SuppressWarnings("unchecked")
      final BaseClientResponse<String> restEasyResponse = (BaseClientResponse<String>) response;
      restEasyResponse.setReturnType(String.class);

      return RestfulResponse.ofT(response);
    } catch (final Exception ex) {
      throw new RuntimeException(ex);
    }
  }
 @RequestMapping(value = "/login", method = RequestMethod.GET)
 @ResponseBody
 public DOMSource login(@RequestParam String j_username, @RequestParam String j_password) {
   m_loginService.login(j_username, j_password);
   return RestfulResponse.getResponse(RESPONSE_RESPONSE, "OK");
 }
 @RequestMapping(value = "/logout", method = RequestMethod.GET)
 @ResponseBody
 public DOMSource logout() {
   m_loginService.logout();
   return RestfulResponse.getResponse(RESPONSE_RESPONSE, "OK");
 }
 @ResponseStatus(value = HttpStatus.BAD_REQUEST)
 @ExceptionHandler(RestfulException.class)
 @ResponseBody
 public DOMSource handleException(RestfulException ex) {
   return RestfulResponse.getResponse(RESPONSE_EXCEPTION, ex.toString());
 }