Copy link to clipboard
Copied
I've migrated the app and only one endpoint is having an issue. Java server does a form post to it. Every time I get this error. It looks like its failing where it validates data being passed in so my try catch inside the endpoint isn't catching it.
The @FormParam is utilized when the content type of the request entity is not application/x-www-form-urlencoded The specific sequence of files included or processed is: d:\xx\xx.cfc
java.lang.IllegalStateException: The @FormParam is utilized when the content type of the request entity is not application/x-www-form-urlencoded
at org.glassfish.jersey.server.internal.inject.FormParamValueFactoryProvider$FormParamValueFactory.ensureValidRequest(FormParamValueFactoryProvider.java:176)
at org.glassfish.jersey.server.internal.inject.FormParamValueFactoryProvider$FormParamValueFactory.getForm(FormParamValueFactoryProvider.java:160)
at org.glassfish.jersey.server.internal.inject.FormParamValueFactoryProvider$FormParamValueFactory.provide(FormParamValueFactoryProvider.java:116)
at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.getParameterValues(ParameterValueHelper.java:81)
The opening of my endpoint looks like this.
/**
* @function save
* @verb POST
* @DESCRIPTION
* @Return JSON
*/
remote void function save( build='{"null":"null"}' restargsource='form' ) httpmethod='POST' restpath='save' {
Copy link to clipboard
Copied
Phil, what update of cf2018 is this? And have you confirmed there were 0 fatalerrors in the install log for the latest update? That's in the update's folder in the hf-updates directory.
Copy link to clipboard
Copied
This is happening on CF2018 update 11.
I kept digging and found this in the Adobe bug tracker. https://tracker.adobe.com/#/view/CF-4158293
Looks like there was an issue with CF 2016 about needing to use APPLICATION/X-WWW-FORM-URLENCODED
I then looked into our Java app and saw that its using application/json. I tested calling the endpoint with application/json and it failed, I then changed it to APPLICATION/X-WWW-FORM-URLENCODED and it worked with out issue.
My guess is this may have to do with the Eclipse Jersey implementation in CF that took place after CF10. Thats expected considering the length of time between upgrading.
Copy link to clipboard
Copied
@FormParam is shorthand for the annotation @javax.ws.rs.FormParam in Java's standard REST API, JAX-RS. ColdFusion 2018's REST API ia an implementation of JAX-RS.
@FormParam requires that the request body of the input be of type application/x-www-form-urlencoded. That is, it requires that your service receive input from an HTML form. This in turn implies that the value of the request's Content-Type header must be application/x-www-form-urlencoded.
The 2 most likely causes of the error are therefore:
The likeliest scenario, to cut a long story short:
Copy link to clipboard
Copied
There is a break in backward compatibility. So, all said and done, what you have observed might be a bug.
Copy link to clipboard
Copied
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more