mime type in URL

31 views
Skip to first unread message

Glyn Jackson

unread,
Apr 11, 2012, 7:13:59 AM4/11/12
to taffy...@googlegroups.com
Hi,

When I have floating points in my URL for example....

taffy_uri="/somewhere/poi/{latitude}/{longitude}" 

Taffy thinks that I am setting the mime type.

I tracked the issue down to the line 478 in api.cfc


<cfif listlen(arguments.uri,".") gt 1>
            <cfset local.mime = listLast(arguments.uri, ".") />
            <cfset local.returnData["_taffy_mime"] = local.mime />
            <cfheader name="x-deprecation-warning" value="Specifying return format as '.#local.mime#' is deprecated. Please use the HTTP Accept header when possible." />
 </cfif>

Is this something overlooked or my misunderstanding?

Thanks in Advanced.

Glyn

AJ Mercer

unread,
Apr 11, 2012, 8:42:40 AM4/11/12
to taffy...@googlegroups.com
I think taffy is trying to guess the mime from the url
eg 
/api/myResource.json
/api/myResource.xml

In you rest call, set 'Accept' to the mime you would like returned
eg application/json

Glyn Jackson

unread,
Apr 11, 2012, 8:49:45 AM4/11/12
to taffy...@googlegroups.com
Hi AJ,

Thanks for the response.

Yep this is what I assumed, I changed it to application/json. Any '.' In the URL skipped the default setting in Taffy. Maybe not a bug but something to watch out for.

Thanks

Glyn

Adam Tuttle

unread,
Apr 11, 2012, 9:15:52 AM4/11/12
to taffy...@googlegroups.com
Indeed, my recommendation is that if you have a token that will always (or could on occasion) contain a period, you should send it as a query string param (?lat=432.5453&long=32.432654) or in the request body...

I hope to be able to mitigate this to some extent in a future version, but I don't think it will ever be completely resolved.

Thanks for chiming in, AJ! :)

Adam

Matt Gersting

unread,
Apr 11, 2012, 10:55:56 AM4/11/12
to taffy...@googlegroups.com
Just in case anyone wasn't around for this, there's been talk previously of deprecating the auto-detect file extension altogether.

http://groups.google.com/group/taffy-users/browse_thread/thread/34bfb44a6fcb1664

Any new thoughts on this, Adam?

Adam Tuttle

unread,
Apr 11, 2012, 11:04:01 AM4/11/12
to taffy...@googlegroups.com
One thought I had this morning was that something we're exploring for a future version is a way for you to use de-serializer objects, sort of the opposite of representation classes. (The idea was Barney Boisvert's) So that if you're expecting XML input to look a specific way, your de-serializer class would be able to transform the request body into native CF objects that we could then pass to resources.

Each of these classes would define the mime types / extensions it could handle, so I was thinking/hoping that we could use this to create a whitelist of extensions to look for in the URI. If something's there that's not on the whitelist, the idea would be to assume it's part of the token.

Just speculation at this point, though.

Adam
Reply all
Reply to author
Forward
0 new messages