Package org.springframework.http

Examples of org.springframework.http.HttpHeaders


    }

  @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, headers = "Accept=application/json")
    public ResponseEntity<String> deleteFromJson(@PathVariable("id") Long id) {
        Userinfo userinfo = userService.findUserinfo(id);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        if (userinfo == null) {
            return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
        }
        userService.deleteUserinfo(userinfo);
        return new ResponseEntity<String>(headers, HttpStatus.OK);
View Full Code Here


        message.setReceiverName("kiran");
        message.setSenderEmail(feedback.getEmail());
        message.setSubject("Todo : feedback");
       
        emailService.send(message);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        return new ResponseEntity<String>(headers, HttpStatus.CREATED);
    }
View Full Code Here

  @RequestMapping(method = RequestMethod.DELETE, headers = "Accept=application/json")
  public ResponseEntity<String> deleteAllTodos(Authentication authentication) {
     User user=(User) authentication.getPrincipal();
     List<Todo> todos = todoService.findTodosByUserName(user.getUsername());
    HttpHeaders headers = new HttpHeaders();
    headers.add("Content-Type", "application/json");
    for (Todo todo : todos) {
      todo.setUserName(null);
      todoService.deleteTodo(todo);
    }
    return new ResponseEntity<String>(headers, HttpStatus.OK);
View Full Code Here

    return new ResponseEntity<String>(headers, HttpStatus.OK);
  }

  @RequestMapping(value = "/{id}", method = RequestMethod.PUT, headers = "Accept=application/json")
    public ResponseEntity<String> updateFromJson(@RequestBody String json, @PathVariable("id") Long id) {
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        Todo todo = Todo.fromJsonToTodo(json.toString());
        if (todoService.updateTodo(todo) == null) {
            return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
        }
        return new ResponseEntity<String>(headers, HttpStatus.OK);
View Full Code Here

  @RequestMapping(value = "/{id}", method = RequestMethod.GET, headers = "Accept=application/json")
    @ResponseBody
    public ResponseEntity<String> showJson(@PathVariable("id") Long id) {
        Todo todo = todoService.findTodo(id);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json; charset=utf-8");
        if (todo == null) {
            return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
        }
        return new ResponseEntity<String>(todo.toJson(), headers, HttpStatus.OK);
    }
View Full Code Here


  @Bean
  public WebSocketConnectionManager connectionManager() {

    HttpHeaders headers = new HttpHeaders();
    headers.setOrigin("http://websocket.mtgox.com");

    WebSocketConnectionManager cm = new WebSocketConnectionManager(wsClient(), wsHandler(), WS_URL);
    cm.setHeaders(headers);
    cm.setAutoStartup(true);
    return cm;
View Full Code Here

    @Before
    public void setUp() throws Exception {
        dropbox = new DropboxTemplate("API_KEY", "API_SECRET", "ACCESS_TOKEN", "ACCESS_TOKEN_SECRET", false);
        mockServer = MockRestServiceServer.createServer(dropbox.getRestTemplate());
        responseHeaders = new HttpHeaders();
        responseHeaders.setContentType(MediaType.APPLICATION_JSON);
    }
View Full Code Here

     }
   
    @Test
  public void getFile() throws Exception {
     
      HttpHeaders h = new HttpHeaders();
        h.setContentType(MediaType.APPLICATION_JSON);
        h.setContentLength(1234);
       
      mockServer
        .expect(requestTo(DropboxTemplate.FILE_URL
            .replaceFirst("\\{appFolderUrl\\}", "dropbox")
            .replaceFirst("\\{path\\}", "Getting%20Started.pdf")))
View Full Code Here

   * @throws IOException
   */
  @RequestMapping(value="/get-captcha")
  public ResponseEntity<byte[]> getCaptcha(HttpSession session) throws IOException {
   
    HttpHeaders headers = new HttpHeaders();
    headers.setContentType(MediaType.IMAGE_JPEG);
   
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    String captcha = CaptchaUtils.getCaptcha(70, 32, 4, outputStream).toLowerCase();
   
    session.setAttribute(CaptchaAuthenticationFilter.DEFAULT_CAPTCHA_PARAM,captcha);
View Full Code Here

          parsedScale);
    } catch (IOException e) {
      e.printStackTrace();
    }

    HttpHeaders responseHeaders = httpHeaderAttachment(filename, mime,
        stream.size());
    return new ResponseEntity<byte[]>(stream.toByteArray(),
        responseHeaders, HttpStatus.OK);
  }
View Full Code Here

TOP

Related Classes of org.springframework.http.HttpHeaders

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.