javax.servlet.http.HttpServletRequestWrapper.getInputStream()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(190)

本文整理了Java中javax.servlet.http.HttpServletRequestWrapper.getInputStream()方法的一些代码示例,展示了HttpServletRequestWrapper.getInputStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpServletRequestWrapper.getInputStream()方法的具体详情如下:
包路径:javax.servlet.http.HttpServletRequestWrapper
类名称:HttpServletRequestWrapper
方法名:getInputStream

HttpServletRequestWrapper.getInputStream介绍

暂无

代码示例

代码示例来源:origin: cloudfoundry/uaa

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. return super.getInputStream();
  4. }

代码示例来源:origin: javamelody/javamelody

  1. final ServletInputStream requestInputStream = super.getInputStream();
  2. if (bufferedInputStream == null) {
  3. return requestInputStream;

代码示例来源:origin: perwendel/spark

  1. private void cacheInputStream() throws IOException {
  2. cachedBytes = IOUtils.toByteArray(super.getInputStream());
  3. }

代码示例来源:origin: perwendel/spark

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. HttpServletRequest request = (HttpServletRequest) super.getRequest();
  4. // disable stream cache for chunked transfer encoding
  5. String transferEncoding = request.getHeader("Transfer-Encoding");
  6. if ("chunked".equals(transferEncoding)) {
  7. return super.getInputStream();
  8. }
  9. // disable stream cache for multipart/form-data file upload
  10. // -> upload might be very large and might lead to out-of-memory error if we try to cache the bytes
  11. String contentType = request.getHeader("Content-Type");
  12. if (contentType != null && contentType.startsWith("multipart/form-data")) {
  13. return super.getInputStream();
  14. }
  15. if (cachedBytes == null) {
  16. cacheInputStream();
  17. }
  18. return new CachedServletInputStream();
  19. }

代码示例来源:origin: prontera/spring-cloud-rest-tcc

  1. /**
  2. * Get request body.
  3. *
  4. * @return Bytes with the request body contents.
  5. * @throws IOException In case stream reqding fails.
  6. */
  7. public byte[] getRequestBody() throws IOException {
  8. final byte[] resultBytes;
  9. if (bufferFilled) {
  10. // 已经填入则直接返回
  11. resultBytes = Arrays.copyOf(requestBody, requestBody.length);
  12. } else {
  13. // 未填入则进行处理
  14. InputStream inputStream = super.getInputStream();
  15. byte[] buffer = new byte[4096];
  16. int bytesRead;
  17. while ((bytesRead = inputStream.read(buffer)) != -1) {
  18. requestBody = Bytes.concat(this.requestBody, Arrays.copyOfRange(buffer, 0, bytesRead));
  19. }
  20. // 置标志位
  21. bufferFilled = true;
  22. resultBytes = Arrays.copyOf(requestBody, requestBody.length);
  23. }
  24. return resultBytes;
  25. }

代码示例来源:origin: pig4cloud/pig

  1. return super.getInputStream();
  2. String json = IOUtils.toString(super.getInputStream(), "utf-8");
  3. if (StringUtils.isBlank(json)) {
  4. return super.getInputStream();

代码示例来源:origin: 58code/Argo

  1. /**
  2. * application/x-www-form-urlencoded
  3. *
  4. */
  5. private void parsePostUrlEncoded() throws IOException {
  6. MultiMap<String> params = new MultiMap<String>();
  7. UrlEncoded.decodeTo(super.getInputStream(), params, "UTF-8", maxFormContentSize, maxFormKeys);
  8. forms = NullToEmptyMap.safeWrapper(params, getSafeParameter());
  9. Builder<String, Collection<String>> builder = ImmutableMap.<String, Collection<String>>builder();
  10. if(queryStrings != null)
  11. builder.putAll(queryStrings);
  12. if(forms != null)
  13. builder.putAll(forms);
  14. this.params = builder.build();
  15. }

代码示例来源:origin: 58code/Argo

  1. private void parsePostMulti() throws IOException, ServletException {
  2. InputStream in = new BufferedInputStream(super.getInputStream());
  3. String content_type = super.getContentType();

代码示例来源:origin: ch.qos.logback/logback-access

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. if (!postedParametersMode) {
  4. return inStream;
  5. } else {
  6. return super.getInputStream();
  7. }
  8. }

代码示例来源:origin: devefx/validator-web

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. if (this.pushbackInputStream != null) {
  4. return this.pushbackInputStream;
  5. }
  6. return super.getInputStream();
  7. }
  8. }

代码示例来源:origin: com.atlassian.jira/jira-core

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException
  3. {
  4. ServletInputStream inputStream = super.getInputStream();
  5. return inputStream;
  6. }

代码示例来源:origin: ESAPI/esapi-java-legacy

  1. public ServletInputStream getInputStream() throws IOException {
  2. if ( isMultipart ) {
  3. return is;
  4. } else {
  5. return super.getInputStream();
  6. }
  7. }

代码示例来源:origin: org.wso2.org.apache.shindig/shindig-common

  1. /**
  2. * Cache the input stream in order to read it multiple times.
  3. *
  4. * @throws IOException
  5. */
  6. private void cacheInputStream() throws IOException {
  7. cachedBytes = new ByteArrayOutputStream();
  8. IOUtils.copy(super.getInputStream(), cachedBytes);
  9. }

代码示例来源:origin: org.apache.knox/gateway-server

  1. public synchronized ServletInputStream getInputStream() throws IOException {
  2. if( log.isTraceEnabled() ) {
  3. if( input == null ) {
  4. input = new TraceInput( super.getInputStream() );
  5. }
  6. return input;
  7. } else {
  8. return super.getInputStream();
  9. }
  10. }

代码示例来源:origin: org.jasig.portal/uPortal-rendering

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. this.checkState();
  4. return super.getInputStream();
  5. }

代码示例来源:origin: com.github.edgar615/spring-boot-util-web

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. ByteArrayInputStream in = new ByteArrayInputStream(body.getBytes());
  4. return new ResettableServletInputStream(in, super.getInputStream());
  5. }

代码示例来源:origin: com.atlassian.jira/jira-core

  1. public ServletInputStream getInputStream() throws IOException
  2. {
  3. if (capturingInputStream == null)
  4. {
  5. capturingInputStream = new CapturingInputStream(super.getInputStream());
  6. }
  7. return capturingInputStream;
  8. }

代码示例来源:origin: zalando/logbook

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. return body == null ?
  4. super.getInputStream() :
  5. new ServletInputStreamAdapter(new ByteArrayInputStream(body));
  6. }

代码示例来源:origin: org.apache.chemistry.opencmis/chemistry-opencmis-server-support

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. this.is = new LoggingInputStream(super.getInputStream());
  4. return is;
  5. }

代码示例来源:origin: apache/cxf

  1. @Override
  2. public ServletInputStream getInputStream() throws IOException {
  3. InputStream is = m.getContent(InputStream.class);
  4. if (is instanceof DelegatingInputStream) {
  5. is = ((DelegatingInputStream)is).getInputStream();
  6. }
  7. if (is instanceof ServletInputStream) {
  8. return (ServletInputStream)is;
  9. }
  10. return super.getInputStream();
  11. }
  12. @Override

相关文章

HttpServletRequestWrapper类方法