本文整理汇总了Java中org.springframework.http.HttpStatus.ACCEPTED属性的典型用法代码示例。如果您正苦于以下问题:Java HttpStatus.ACCEPTED属性的具体用法?Java HttpStatus.ACCEPTED怎么用?Java HttpStatus.ACCEPTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.springframework.http.HttpStatus
的用法示例。
在下文中一共展示了HttpStatus.ACCEPTED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validate
@Override
public ValidationResponse validate(UserVO user) {
ValidationResponse validationResponse;
String firstName = user.getFirst();
if (!firstName.equals("")) {
validationResponse = new ValidationResponse("OK first", HttpStatus.ACCEPTED);
} else {
validationResponse = new ValidationResponse("First name required", HttpStatus.NOT_ACCEPTABLE);
}
return validationResponse;
}
示例2: deleteSprint
@JsonView(JsonViews.Basique.class)
@RequestMapping(value = "/api/sprint/delete/{id}", method = RequestMethod.DELETE, produces = "application/json")
public ResponseEntity<Sprint> deleteSprint(@PathVariable("id") Long id)
{
LOGGER.debug("ApiController - deleteSprint");
Sprint sprint = null;
if(sprintService.exists(id))
{
sprint = sprintService.findOneById(id);
sprintService.deleteOneById(sprint.getId());
return new ResponseEntity<Sprint>(sprint, HttpStatus.ACCEPTED);
}
return new ResponseEntity<Sprint>(sprint, HttpStatus.NOT_FOUND);
}
示例3: updateStory
@JsonView(JsonViews.Basique.class)
@RequestMapping(value = "/api/story/update/{idStory}", method = RequestMethod.POST, produces = "application/json")
public ResponseEntity<Story> updateStory(@PathVariable Long idStory, @RequestBody Story story, @RequestParam Long idSprint)
{
LOGGER.debug("ApiController - updateStory");
if(idSprint != null)
{
Sprint sprint = sprintService.findOneById(idSprint);
if(null==sprint) {
LOGGER.debug("ApiController - updateStory - Sprint inexistant");
return new ResponseEntity<Story>(story, HttpStatus.NOT_FOUND);
}
story.setStorySprint(sprint);
}
storyService.updateStory(idStory, story);
LOGGER.debug("ApiController - updateStory - Story maj");
return new ResponseEntity<Story>(story, HttpStatus.ACCEPTED);
}
示例4: login
@RequestMapping(value = "/login/user", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<UserClientProfile> login(UserForm userForm) {
userForm.setLogin(((UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal()).getUsername());
User user = userService.login(userForm);
ResponseEntity<UserClientProfile> ret = null;
if (user != null) {
ret = new ResponseEntity<UserClientProfile>(UserClientProfile.builder().from(user).build(), HttpStatus.ACCEPTED);
} else {
ret = new ResponseEntity<UserClientProfile>(HttpStatus.FORBIDDEN); //Should log in again
}
return ret;
}
示例5: updateThreadDefinition
@Test
public void updateThreadDefinition() {
String tapestryId = "tapestryId";
String threadId = "threadId";
ThreadDefinition threadDefiniton = new ThreadDefinition();
new ResponseEntity<Void>(HttpStatus.ACCEPTED);
String url = restClient.baseUrl + ApiConfig.TAPESTRY_BASE + "/" + tapestryId + "/threads/" + threadId;
restTemplate.put(url, threadDefiniton);
restClient.updateThreadDefinition(tapestryId, threadId, threadDefiniton);
Mockito.verify(restTemplate).put(url, threadDefiniton);
assertEquals(sessionId, restClient.getSessionId());
}
示例6: getPathTest
@RequestMapping(produces = "application/json")
public ResponseEntity<HttpJson> getPathTest(@RequestBody String test) {
HttpJson inObj = new HttpJson(test);
HttpJson json = new HttpJson();
UserExtend ue = new UserExtend();
json.setClassObject(ue);
json.setClassName(String.class.toString());
return new ResponseEntity<HttpJson>(json, HttpStatus.ACCEPTED);
}
示例7: getTapestryDefinitions
@Test
public void getTapestryDefinitions() {
TapestryDefinitionList tapestryDefinitionList = new TapestryDefinitionList();
ResponseEntity<TapestryDefinitionList> response =
new ResponseEntity<TapestryDefinitionList>(tapestryDefinitionList, HttpStatus.ACCEPTED);
String url = restClient.baseUrl + ApiConfig.TAPESTRY_BASE;
when(restTemplate.getForEntity(url, TapestryDefinitionList.class)).thenReturn(response);
assertNotNull(restClient.getTapestryDefinitions());
Mockito.verify(restTemplate).getForEntity(url, TapestryDefinitionList.class);
assertEquals(sessionId, restClient.getSessionId());
}
示例8: delete
@ApiOperation("删除用户")
@DeleteMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(value = HttpStatus.ACCEPTED)
public BaseResponse delete(@PathVariable String id, Boolean logic){
log.debug("delete request received");
DeleteCommand command = new DeleteCommand(createAudit(), id, logic);
UCError error = commandGateway.sendAndWait(command);
if (error != null) {
throw new BusinessException(error);
}
log.debug(DeleteCommand.class.getSimpleName() + " sent to command gateway: user [{}] ", command.getId());
return BaseResponse.create();
}
示例9: updateSprint
@JsonView(JsonViews.Basique.class)
@RequestMapping(value = "/api/sprint/update/{idSprint}", method = RequestMethod.POST, produces = "application/json")
public ResponseEntity<Sprint> updateSprint(@PathVariable Long idSprint, @RequestBody Sprint sprint)
{
LOGGER.debug("ApiController - updateSprint");
sprintService.updateSprint(idSprint, sprint);
LOGGER.debug("ApiController - updateSprint - Project maj");
return new ResponseEntity<Sprint>(sprint, HttpStatus.ACCEPTED);
}
示例10: updatePassword
@ApiOperation(value = "Change password.")
@PutMapping("/{userId}/change-password")
@ResponseStatus(HttpStatus.ACCEPTED)
public void updatePassword(@PathVariable("userId") Long userId, @RequestBody PasswordRequest passwordRequest) {
User user = userRepository.findOne(userId);
if (user != null) {
if (user.getPassword().equals(passwordRequest.getOldPassword())) {
user.setPassword(passwordRequest.getNewPassword());
userRepository.save(user);
}
}
}
示例11: getThreadDefinition
@Test
public void getThreadDefinition() {
String tapestryId = "tapestryId";
String threadId = "threadId";
ThreadDefinition threadDefinition = new ThreadDefinition();
ResponseEntity<ThreadDefinition> response =
new ResponseEntity<ThreadDefinition>(threadDefinition, HttpStatus.ACCEPTED);
String url = restClient.baseUrl + ApiConfig.TAPESTRY_BASE + "/" + tapestryId + "/threads/" + threadId;
when(restTemplate.getForEntity(url, ThreadDefinition.class)).thenReturn(response);
assertNotNull(restClient.getThreadDefinition(tapestryId, threadId));
Mockito.verify(restTemplate).getForEntity(url, ThreadDefinition.class);
assertEquals(sessionId, restClient.getSessionId());
}
示例12: getPattern
@Test
public void getPattern() {
PatternDefinition patternDefinition = new PatternDefinition();
ResponseEntity<PatternDefinition> response =
new ResponseEntity<PatternDefinition>(patternDefinition, HttpStatus.ACCEPTED);
String id = "123";
String url = restClient.baseUrl + ApiConfig.PATTERNS_BASE + "/" + id;
when(restTemplate.getForEntity(url, PatternDefinition.class)).thenReturn(response);
assertNotNull(restClient.getPattern(id));
Mockito.verify(restTemplate).getForEntity(url, PatternDefinition.class);
assertEquals(sessionId, restClient.getSessionId());
}
示例13: receiveHack
@RequestMapping(value = "/receive-hack", method = RequestMethod.POST)
public @ResponseBody ResponseEntity<Object> receiveHack(HttpServletRequest request) {
log.info("hack sent account details: " + request.getParameter("accountInfo"));
String accountInfo = request.getParameter("accountInfo");
try {
OutputStreamWriter os = new FileWriter("hack-output.txt", true);
os.append(accountInfo);
os.append("\n");
os.close();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
return new ResponseEntity<>(HttpStatus.ACCEPTED);
}
示例14: updateTaskStatus
@JsonView(JsonViews.Basique.class)
@RequestMapping(value = "/api/task/{idTask}/update/status", method = RequestMethod.POST, produces = "application/json")
public ResponseEntity<Task> updateTaskStatus(@PathVariable("idTask") Long idTask,@RequestBody String status)
{
LOGGER.debug("ApiController - updateTaskStatus");
Task task = null;
if(taskService.exists(idTask))
{
task = taskService.findOneById(idTask);
switch(status)
{
case "todo":
task.setStatus(StoryStatus.TODO);
break;
case "doing":
task.setStatus(StoryStatus.DOING);
break;
case "done":
task.setStatus(StoryStatus.DONE);
break;
default:
return new ResponseEntity<Task>(task, HttpStatus.NO_CONTENT);
}
// TODO REVENIR ICI
task = taskService.save(task);
return new ResponseEntity<Task>(task, HttpStatus.ACCEPTED);
}
return new ResponseEntity<Task>(task, HttpStatus.NOT_FOUND);
}
示例15: Regist
@RequestMapping(value = "common",produces = "application/json;charset=UTF-8")
public ResponseEntity<HttpJson> Regist(@RequestBody String inObj){
HttpJson re = new HttpJson(), input = new HttpJson(inObj);
String thisFormType = input.getClassName();
if (!thisFormType.equals("form:regist")){
re.setStatusCode(250);
re.setMessage("不匹配的请求");
return new ResponseEntity<HttpJson>(re, HttpStatus.BAD_REQUEST);
}
String getRegistType = input.getPara("style");
String getUserName = input.getPara("username");
String getUserPwd = input.getPara("password");
Login login = new Login();
login.setUPwd(getUserPwd);
login.setUAName(getUserName);
String flag = "-2";
try {
flag = registService.registUserWithType(login,getRegistType);
} catch (Exception e) {
e.printStackTrace();
re.setMessage("服务器出错");
re.setStatusCode(202);
re.constractJsonString();
return new ResponseEntity<HttpJson>(re,HttpStatus.BAD_GATEWAY);
}
if (flag.equals("-1")){
re.setMessage("用户已存在,请检查用户名");
re.setStatusCode(201);
}else if(flag.equals("-2")){
re.setStatusCode(202);
re.setMessage("服务器太忙,请稍后再试");
}else{
re.setMessage("UserUUid");
re.setClassObject(String.class.toString());
re.setClassObject(flag);
}
re.constractJsonString();
return new ResponseEntity<HttpJson>(re,HttpStatus.ACCEPTED);
}