Coder Social home page Coder Social logo

Comments (13)

markbanyang avatar markbanyang commented on August 19, 2024 1

我看了下你修复合包的那个问题的提交,感觉这里有点问题。然后在HttpServletProtocol的ChannelPipeline最前面加了一个ChannelInboundHandlerAdapter,在里面构造DefaultFullHttpRequest向下传递,可以复现这个问题。

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024 1

好吧 那我加下. 然后发个版. 估计这两天就能好. 好了就告诉你

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024

我复现下, 还没有到过有DefaultFullHttpRequest的情况, 因为我把HttpObjectAggregator去掉了, 应该是没有Full请求的情况了.

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024

提交解决了. 不过我没有复现出来啊, 你是如何发现的.

544ede6

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024

FullHttpRequest只有 HttpObjectAggregator这个类, 和http请求行解析失败时, 会收到.
但HttpObjectAggregator这个类的聚合不支持long类型, 所以去掉了.

不过为了代码健壮, 刚才也都加上了. 现在2.0.17这个版本还是没问题的.

from spring-boot-protocol.

markbanyang avatar markbanyang commented on August 19, 2024

2.0.17不支持apache common-fileupload了么。

  public ResponseEntity<String> upload(HttpServletRequest request, HttpServletResponse response)
        throws IOException, FileUploadException {
    boolean isMultipart = ServletFileUpload.isMultipartContent(request);
    if (isMultipart) {
        ServletFileUpload upload = new ServletFileUpload();

        Map<String, String> params = new HashMap<>();
        InputStream is = null;
        FileItemIterator iter = upload.getItemIterator(request);
        while (iter.hasNext()) {
            FileItemStream item = iter.next();
            if (!item.isFormField()) {
                is = item.openStream();
                try {
                      .....
                } catch (Exception e) {
                   e.printStackTrace();
                } finally {
                    if (null != is) {
                        is.close();
                    }
                }
            } else {
                String fieldName = item.getFieldName();
                String value = Streams.asString(item.openStream());
                params.put(fieldName, value);
            }
        }
    }
    return new ResponseEntity<String>("success", HttpStatus.OK);
}

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024

应该是不影响的啊, 我试试咋回事

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024

tomcat也不支持, 这里实现的逻辑和tomcat是一样的. 你可以这样保存文件

try {
Part part = request.getPart("myFile");
InputStream inputStream = part.getInputStream();
IOUtil.writeFile(inputStream,"D://test//upload","myfile.txt",false);
} catch (Exception e) {
e.printStackTrace();
}

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024

解析的逻辑不需要你主动用common-fileupload写, servlet已经实现了.

from spring-boot-protocol.

markbanyang avatar markbanyang commented on August 19, 2024

tomcat 是可以的,另外2.0.15这个用法也是可以的,2.0.17不行。

from spring-boot-protocol.

markbanyang avatar markbanyang commented on August 19, 2024

好的

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024

这次提交解决了这个问题, 已经发版在2.0.18, 过两天就能在maven**仓库拉包了.

acf2eef

from spring-boot-protocol.

wangzihaogithub avatar wangzihaogithub commented on August 19, 2024

多多提意见啊, 感谢感谢

from spring-boot-protocol.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.