0

I am trying to send a csv,png,gzip etc. files into my server . In order to process these files it needs to be filtered based on the proper extension ( csv,png,gzip).

If I can get the filename then I can parse it to get the extension. This is the way i am sending file:

curl -u user:password -H "Transfer-Encoding: chunked" -T file_name_location -v --noproxy server_name -X POST http://server_name:8080/

I am new to java servlet. I tried printing the httprequest but unable to do so.

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {

    HttpServletRequest httpRequest = (HttpServletRequest) request;
    HttpServletResponse httpResponse = (HttpServletResponse) response;

    System.out.println("The http request is " + httpRequest );

I cannot send any header except "Tranfer-encoding" in curl command. That is the limitation. Thanks

user2044000
  • 53
  • 1
  • 1
  • 5

1 Answers1

0

You can pass the file name in the URL as a query parameter, i.e.:

http://my-server/some/path?filename=foo.bar

...or in a HTTP header. See here: How to send a header using a HTTP request through a curl call?

Community
  • 1
  • 1
vstrom coder
  • 297
  • 1
  • 8