org.apache.catalina.servlet4preview.http.HttpServletRequest Java Examples
The following examples show how to use
org.apache.catalina.servlet4preview.http.HttpServletRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AssetController.java From ZTuoExchange_framework with MIT License | 6 votes |
/** * 查询所有记录 * * @param member * @param pageNo * @param pageSize * @return */ @RequestMapping("transaction/all") public MessageResult findTransaction(@SessionAttribute(SESSION_MEMBER) AuthMember member, HttpServletRequest request, int pageNo, int pageSize, @RequestParam(value = "startTime",required = false) String startTime, @RequestParam(value = "endTime",required = false) String endTime, @RequestParam(value = "symbol",required = false) String symbol, @RequestParam(value = "type",required = false) String type) throws ParseException { MessageResult mr = new MessageResult(); TransactionType transactionType = null; if (StringUtils.isNotEmpty(type)) { transactionType = TransactionType.valueOfOrdinal(Convert.strToInt(type, 0)); } mr.setCode(0); mr.setMessage("success"); mr.setData(transactionService.queryByMember(member.getId(), pageNo, pageSize, transactionType, startTime, endTime,symbol)); return mr; }
Example #2
Source File: AssetController.java From ZTuoExchange_framework with MIT License | 6 votes |
/** * 查询所有记录 * * @param member * @param pageNo * @param pageSize * @return */ @RequestMapping("transaction/all") public MessageResult findTransaction(@SessionAttribute(SESSION_MEMBER) AuthMember member, HttpServletRequest request, int pageNo, int pageSize, @RequestParam(value = "startTime",required = false) String startTime, @RequestParam(value = "endTime",required = false) String endTime, @RequestParam(value = "symbol",required = false) String symbol, @RequestParam(value = "type",required = false) String type) throws ParseException { MessageResult mr = new MessageResult(); TransactionType transactionType = null; if (StringUtils.isNotEmpty(type)) { transactionType = TransactionType.valueOfOrdinal(Convert.strToInt(type, 0)); } mr.setCode(0); mr.setMessage("success"); mr.setData(transactionService.queryByMember(member.getId(), pageNo, pageSize, transactionType, startTime, endTime,symbol)); return mr; }
Example #3
Source File: SimpleCORSFilter.java From angular-spring-api with MIT License | 6 votes |
@Override public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) resp; HttpServletRequest request = (HttpServletRequest) req; response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with, authorization, Content-Type, Authorization, credential, X-XSRF-TOKEN"); if ("OPTIONS".equalsIgnoreCase(request.getMethod())) { response.setStatus(HttpServletResponse.SC_OK); } else { chain.doFilter(req, resp); } }
Example #4
Source File: TestController.java From shield-ratelimter with Apache License 2.0 | 5 votes |
@ResponseBody @RequestMapping("ratelimiter") @RateLimiter(key = "ratedemo:1.0.0", limit = 5, expire = 10, message = MESSAGE) public String sendPayment(HttpServletRequest request) throws Exception { return "正常请求"; }
Example #5
Source File: SinkerTableController.java From DBus with Apache License 2.0 | 5 votes |
@GetMapping(path = "/searchAll") public ResultEntity searchSinkerTopologySchema(HttpServletRequest request) { try { return service.searchAll(URLDecoder.decode(request.getQueryString(), "UTF-8")); } catch (Exception e) { logger.error("Exception encountered while get sinker topology table", e); return resultEntityBuilder().status(MessageCode.EXCEPTION).build(); } }
Example #6
Source File: SinkerTableController.java From DBus with Apache License 2.0 | 5 votes |
@GetMapping(path = "/search") public ResultEntity search(HttpServletRequest request) { try { return service.search(URLDecoder.decode(request.getQueryString(), "UTF-8")); } catch (Exception e) { logger.error("Exception encountered while get sinker topology table", e); return resultEntityBuilder().status(MessageCode.EXCEPTION).build(); } }
Example #7
Source File: SinkerSchemaController.java From DBus with Apache License 2.0 | 5 votes |
@GetMapping(path = "/searchAll") public ResultEntity searchSinkerTopologySchema(HttpServletRequest request) { try { return service.searchAll(URLDecoder.decode(request.getQueryString(), "UTF-8")); } catch (Exception e) { logger.error("Exception encountered while get sinker topology schema", e); return resultEntityBuilder().status(MessageCode.EXCEPTION).build(); } }
Example #8
Source File: SinkerSchemaController.java From DBus with Apache License 2.0 | 5 votes |
@GetMapping(path = "/search") public ResultEntity search(HttpServletRequest request) { try { return service.search(URLDecoder.decode(request.getQueryString(), "UTF-8")); } catch (Exception e) { logger.error("Exception encountered while get sinker topology schema", e); return resultEntityBuilder().status(MessageCode.EXCEPTION).build(); } }
Example #9
Source File: ExceptionHandlerControllerAdvice.java From springboot-seed with MIT License | 5 votes |
@ExceptionHandler(ResourceNotFoundException.class) public ResponseEntity<?> resourceNotFoundExceptionHandler(HttpServletRequest request, ResourceNotFoundException e) { logError(request, e); return ResponseEntity .status(HttpStatus.NOT_FOUND) .body(new Error() .setCode(ErrorCode.RESOURCE_NOT_FOUND_ERROR) .setMessage(e.getMessage())); }
Example #10
Source File: ExceptionHandlerControllerAdvice.java From springboot-seed with MIT License | 5 votes |
@ExceptionHandler(ParameterIllegalException.class) public ResponseEntity<?> parameterIllegalExceptionHandler(HttpServletRequest request, ParameterIllegalException e) { logError(request, e); return ResponseEntity .status(HttpStatus.BAD_REQUEST) .body(new Error() .setCode(ErrorCode.PARAMETER_ILLEGAL_ERROR) .setMessage("An invalid value was specified for one of the query parameters in the request URL.")); }
Example #11
Source File: ExceptionHandlerControllerAdvice.java From springboot-seed with MIT License | 5 votes |
@ExceptionHandler(ServerInternalErrorException.class) public ResponseEntity<?> serverInternalErrorExceptionHandler(HttpServletRequest request, ServerInternalErrorException e) { logError(request, e); return ResponseEntity .status(HttpStatus.INTERNAL_SERVER_ERROR) .body(new Error() .setCode(ErrorCode.RESOURCE_NOT_FOUND_ERROR) .setMessage("The server encountered an internal error. Please retry the request.")); }
Example #12
Source File: SinkerController.java From DBus with Apache License 2.0 | 5 votes |
@GetMapping(path = "/search") public ResultEntity search(HttpServletRequest request) { try { return service.search(request.getQueryString()); } catch (Exception e) { logger.error("Exception encountered while search sinker topology", e); return new ResultEntity(MessageCode.EXCEPTION, e.getMessage()); } }
Example #13
Source File: LogoutController.java From hauth-java with MIT License | 5 votes |
@RequestMapping(value = "/signout", method = RequestMethod.GET) @ResponseBody public String logout(HttpServletResponse response, HttpServletRequest request) { Cookie cookie = new Cookie("Authorization", ""); cookie.setMaxAge(0); cookie.setPath("/"); response.addCookie(cookie); return Hret.success(200, "success", null); }
Example #14
Source File: TestController.java From shield-ratelimter with Apache License 2.0 | 5 votes |
@ResponseBody @RequestMapping("ratelimiter1") @RateLimiter(key = "ratedemo:1.0.1", limit = 5, expire = 10, message = MESSAGE) public String sendPayment1(HttpServletRequest request) throws Exception { return "正常请求"; }
Example #15
Source File: SimpleFilterTest.java From demo3_zuul_api_gateway with Apache License 2.0 | 5 votes |
@Test public void testRun() { HttpServletRequest req = mock(HttpServletRequest.class); when(req.getMethod()).thenReturn("GET"); when(req.getRequestURL()).thenReturn(new StringBuffer("http://foo")); RequestContext context = mock(RequestContext.class); when(context.getRequest()).thenReturn(req); RequestContext.testSetCurrentContext(context); filter.run(); this.outputCapture.expect(Matchers.containsString("GET request to http://foo")); }
Example #16
Source File: ExceptionHandlerControllerAdvice.java From springboot-seed with MIT License | 5 votes |
@ExceptionHandler(Exception.class) public ResponseEntity<?> exceptionHandler(HttpServletRequest request, Exception e) { logError(request, e); return ResponseEntity .status(HttpStatus.INTERNAL_SERVER_ERROR) .body(new Error() .setCode(ErrorCode.SERVER_INTERNAL_ERROR) .setMessage("The server met an unexpected error. Please contact administrators.")); }
Example #17
Source File: AdvertiseController.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * 个人所有广告 * * @param shiroUser * @return */ @RequestMapping(value = "all") public MessageResult allNormal( PageModel pageModel, @SessionAttribute(SESSION_MEMBER) AuthMember shiroUser, HttpServletRequest request) { BooleanExpression eq = QAdvertise.advertise.member.id.eq(shiroUser.getId()). and(QAdvertise.advertise.status.ne(AdvertiseControlStatus.TURNOFF));; if(request.getParameter("status") != null){ eq.and(QAdvertise.advertise.status.eq(AdvertiseControlStatus.valueOf(request.getParameter("status")))); } Page<Advertise> all = advertiseService.findAll(eq, pageModel.getPageable()); return success(all); }
Example #18
Source File: AdvertiseController.java From ZTuoExchange_framework with MIT License | 5 votes |
/** * 个人所有广告 * * @param shiroUser * @return */ @RequestMapping(value = "all") public MessageResult allNormal( PageModel pageModel, @SessionAttribute(SESSION_MEMBER) AuthMember shiroUser, HttpServletRequest request) { BooleanExpression eq = QAdvertise.advertise.member.id.eq(shiroUser.getId()). and(QAdvertise.advertise.status.ne(AdvertiseControlStatus.TURNOFF));; if(request.getParameter("status") != null){ eq.and(QAdvertise.advertise.status.eq(AdvertiseControlStatus.valueOf(request.getParameter("status")))); } Page<Advertise> all = advertiseService.findAll(eq, pageModel.getPageable()); return success(all); }
Example #19
Source File: TestController.java From SpringBootLearn with Apache License 2.0 | 5 votes |
/** * http://127.0.0.1:8080/test/createIndex * 创建索引 * @param request * @param response * @return */ @PutMapping("/createIndex") public String createIndex(HttpServletRequest request, HttpServletResponse response) { if (!ElasticsearchUtil.isIndexExist(indexName)) { ElasticsearchUtil.createIndex(indexName); } else { return "索引已经存在"; } return "索引创建成功"; }
Example #20
Source File: TestController.java From SpringBootLearn with Apache License 2.0 | 5 votes |
@DeleteMapping("/deleteIndex") public String deleteIndex(String indexName, HttpServletRequest request, HttpServletResponse response) { boolean b = ElasticsearchUtil.deleteIndex(indexName); if (!b){ return "失败"; } return "索引删除成功"; }
Example #21
Source File: TestController.java From SpringBootLearn with Apache License 2.0 | 5 votes |
/** * 创建索引以及类型,并给索引某些字段指定iK分词,以后向该索引中查询时,就会用ik分词。 * @param: [request, response] * @return: java.lang.String * @auther: LHL * @date: 2018/10/15 17:11 */ @PutMapping("/createIndexTypeMapping") public String createIndexTypeMapping(HttpServletRequest request, HttpServletResponse response) { if (!ElasticsearchUtil.isIndexExist(indexName)) { ElasticsearchUtil.createIndex(indexName,esType); } else { return "索引已经存在"; } return "索引创建成功"; }
Example #22
Source File: ExceptionHandlerControllerAdvice.java From springboot-seed with MIT License | 4 votes |
private void logError(HttpServletRequest request, Exception e) { log.error("[URI: " + request.getRequestURI() + "]", e); }
Example #23
Source File: SinkController.java From DBus with Apache License 2.0 | 4 votes |
@GetMapping(path = "/search-by-user-project") public ResultEntity searchByUserProject(HttpServletRequest request) { return service.searchByUserProject(request.getQueryString()); }
Example #24
Source File: SinkController.java From DBus with Apache License 2.0 | 4 votes |
@GetMapping(path = "/search") public ResultEntity search(HttpServletRequest request) { return service.search(request.getQueryString()); }
Example #25
Source File: FullPullHistoryController.java From DBus with Apache License 2.0 | 4 votes |
@PostMapping("/dsNames") public ResultEntity updata(HttpServletRequest request) throws Exception { return service.getDSNames(request.getQueryString()); }
Example #26
Source File: FullPullHistoryController.java From DBus with Apache License 2.0 | 4 votes |
@GetMapping("/dsNames") public ResultEntity getDSNames(HttpServletRequest request) throws Exception { return service.getDSNames(request.getQueryString()); }
Example #27
Source File: FullPullHistoryController.java From DBus with Apache License 2.0 | 4 votes |
@GetMapping("/project-names") public ResultEntity queryProjectFullpullHistory(HttpServletRequest request) throws Exception { return service.queryProjectNames(request.getQueryString()); }
Example #28
Source File: FullPullHistoryController.java From DBus with Apache License 2.0 | 4 votes |
@GetMapping("/search") public ResultEntity search(HttpServletRequest request) throws Exception { return service.search(URLDecoder.decode(request.getQueryString(), "UTF-8")); }
Example #29
Source File: GlobalExceptionHandler.java From blog-sample with Apache License 2.0 | 4 votes |
@ExceptionHandler(value = Exception.class) @ResponseBody public String globalException(HttpServletRequest request, Exception e) { return "发生错误: " + e.getMessage(); }
Example #30
Source File: RequestFacade.java From Tomcat8-Source-Read with MIT License | 4 votes |
public PushBuilder newPushBuilder(javax.servlet.http.HttpServletRequest request) { return this.request.newPushBuilder(request); }