André Ribeiro
André Ribeiro

Reputation: 79

Stormpath multipartFile

I'm using Stormpath + Spring MVC. I have a issue when I trying to send a request with files attachments.

public ModelAndView insert(@RequestParam("files") MultipartFile files[], @Valid @ModelAttribute("ordemServico") OrdemServico ordemServico,
                               BindingResult result, Model model) throws IOException {

But I got this error below...

2017-03-03 17:00:34,395 ERROR [qtp504672873-22] c.s.s.c.StormpathAuthenticationEntryPoint Couldn't resolve content type
com.stormpath.sdk.servlet.http.UnresolvedMediaTypeException: No MediaType could be resolved for this request (text/css,*/*;q=0.1) and the configured producesMediaTypes settings (application/json,text/html). The ContentNegotiationResolver was not able to come up with a valid MediaType.
    at com.stormpath.sdk.servlet.filter.DefaultContentNegotiationResolver.getContentType(DefaultContentNegotiationResolver.java:59)

And its shows a Access Denied Error...

How to solve this? Thanks.

Upvotes: 0

Views: 40

Answers (1)

André Ribeiro
André Ribeiro

Reputation: 79

I found the solution. Spring Security was blocking de upload...

With this configuration in my html form:

<form method="POST" action="XXX?${_csrf.parameterName}=${_csrf.token}" enctype="multipart/form-data">

Its works for me...

Upvotes: 0

Related Questions