List of usage examples for org.springframework.web HttpSessionRequiredException HttpSessionRequiredException
public HttpSessionRequiredException(String msg)
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/licenses/from/{offset}", method = RequestMethod.GET) public List<License> find(HttpSession session, @PathVariable long offset) throws Exception { logger.debug("{}.{}() accessed.", this.getClass().getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName()); Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else {/* w ww .jav a2 s. c o m*/ return service.find(offset, GlobalConstants.PAGINATION_LIMIT); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/licenses/{id}", method = RequestMethod.GET) public License findById(HttpSession session, @PathVariable long id) throws Exception { logger.debug("{}.{}() accessed.", this.getClass().getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName()); Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else {/*www . j a v a2 s . com*/ return service.findById(id); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/licenses", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED)//from ww w . j a va2 s. com public void create(HttpSession session, @RequestBody License license) throws Exception { logger.debug("{}.{}() accessed.", this.getClass().getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName()); Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else { Date date = new Date(); license.setDateCreated(date); license.setDateUpdated(date); service.create(license); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/licenses/{id}", method = RequestMethod.PATCH) public void update(HttpSession session, @RequestBody License license, @PathVariable long id) throws Exception { logger.debug("{}.{}() accessed.", this.getClass().getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName()); Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else {/*from w w w . j ava2 s . com*/ license.setLicenseId(id); Date date = new Date(); license.setDateUpdated(date); service.update(license); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/licenses", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT)// w ww .ja v a 2 s.co m public void deleteByIds(HttpSession session, @RequestBody long[] licenseIds) throws Exception { logger.debug("{}.{}() accessed.", this.getClass().getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName()); Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else { service.deleteByIds(licenseIds); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/licenses/{id}", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT)/*from ww w .j a v a 2s .c o m*/ public void deleteById(HttpSession session, @PathVariable long id) throws Exception { logger.debug("{}.{}() accessed.", this.getClass().getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName()); Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else { service.deleteById(id); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/search/licenses", method = RequestMethod.GET) public List<License> searchDataOfFirstPageByName(HttpSession session, @RequestParam String q) throws Exception { logger.debug("{}.{}() accessed.", this.getClass().getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName()); Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else {/*from w w w. j a v a 2 s . co m*/ return service.searchByName(q, 0, GlobalConstants.PAGINATION_LIMIT); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/search/licenses/from/{offset}", method = RequestMethod.GET) public List<License> searchByName(HttpSession session, @PathVariable long offset, @RequestParam String q) throws Exception { logger.debug("{}.{}() accessed.", this.getClass().getSimpleName(), Thread.currentThread().getStackTrace()[1].getMethodName()); Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else {/*from ww w . j a va 2s . c o m*/ return service.searchByName(q, offset, GlobalConstants.PAGINATION_LIMIT); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/licenses/count", method = RequestMethod.GET) public long findCount(HttpSession session) throws Exception { Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else {// w w w. j a v a 2 s.c om return service.findCount(); } }
From source file:com.mocktpo.api.LicenseApiController.java
@RequestMapping(value = "/api/search/licenses/count", method = RequestMethod.GET) public long searchByNameCount(HttpSession session, @RequestParam String q) throws Exception { Agent agent = (Agent) session.getAttribute("agent"); if (null == agent) { throw new HttpSessionRequiredException(""); } else {/*from w w w . j av a 2 s. c o m*/ return service.searchByNameCount(q); } }