"400 Your default mime type is not implemented" error

60 views
Skip to first unread message

Jose Gosende

unread,
Jun 3, 2013, 3:40:47 PM6/3/13
to taffy...@googlegroups.com
I just downloaded Taffy earlier today and I'm running into what I'm sure is a simple error, but I can't figure out what's wrong:

"400 Your default mime type is not implemented"

Running ACF 9,0,1,274733 and latest version of Taffy.

File:

/resources/contactCollection.cfc

<cfcomponent extends="taffy.core.resource" taffy:uri="/contacts" taffy:mime="application/json">

<cffunction name="get">

<cfset var local = {} />

<cfquery name="local.qGetcontacts" datasource="#application.dsn#">

SELECT TOP 5 *

FROM contacts

</cfquery>


<cfreturn representationOf( local.qGetcontacts ) />

</cffunction>

</cfcomponent>


Client code:

<cfhttp method="get" url="http://api.myTestBox.net/API/index.cfm/contacts" result="getcontactsRet">

<cfhttpparam type="header" name="content-type" value="application/json"/>

</cfhttp>

<p><cfdump var="#getcontactsRet#"></p>


Response:

struct
Charset[empty string]
ErrorDetail[empty string]
FilecontentBad Request
HeaderHTTP/1.1 400 Your default mime type is not implemented Content-Type: text/html Date: Mon, 03 Jun 2013 17:21:35 GMT Server: Microsoft-IIS/7.0 X-Powered-By: ASP.NET
Mimetypetext/html
Responseheader
struct
Content-Typetext/html
DateMon, 03 Jun 2013 17:21:35 GMT
ExplanationYour default mime type is not implemented
Http_VersionHTTP/1.1
ServerMicrosoft-IIS/7.0
Status_Code400
X-Powered-ByASP.NET
Statuscode400 Your default mime type is not implemented
TextYES



Application.cfc

<cfcomponent extends="taffy.core.api">

<cfscript>


this.name = hash(getCurrentTemplatePath());


variables.framework = {};

variables.framework.debugKey = "debug";

variables.framework.reloadKey = "reload";

variables.framework.reloadPassword = "true";

variables.framework.representationClass = "taffy.core.nativeJsonRepresentation";

variables.framework.returnExceptionsAsJson = true;

variables.framework.reloadOnEveryRequest = true;


// do your onApplicationStart stuff here

function applicationStartEvent(){

application.dsn = "testDSN";

}


// do your onRequestStart stuff here

function requestStartEvent(){}


// this function is called after the request has been parsed and all request details are known

function onTaffyRequest(verb, cfc, requestArguments, mimeExt){

// this would be a good place for you to check API key validity and other non-resource-specific validation

return true;

}


</cfscript>

</cfcomponent>


TIA,

Jose

Adam Tuttle

unread,
Jun 3, 2013, 3:59:02 PM6/3/13
to taffy...@googlegroups.com
Hi Jose,

First, the metadata that you're adding to your resource ("taffy:mime") is not doing anything (Taffy doesn't look for it here) -- not sure where you got that idea from.

Second, I'm glad you figured out the ".json" workaround. :)

Third, just to be sure, you say that you're using the latest version of Taffy. Does that mean you downloaded using the zip download link on the github homepage / cloned the master branch? Or did you download the latest tagged release?

I've been meaning to add a version number comment to api.cfc / the taffy application scope variables, but haven't gotten around to it yet.

This bug has been around for a while but seems to be a whack-a-mole situation. Every time I think I've got it fixed it seems to rear its ugly head elsewhere. I'll see what I can do.

Adam


Adam


--
You received this message because you are subscribed to the Google Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to taffy-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jose Gosende

unread,
Jun 3, 2013, 4:25:13 PM6/3/13
to taffy...@googlegroups.com
Hi Adam,

I downloaded the latest tagged release from http://atuttle.github.io/Taffy/  (atuttle-Taffy-v1.3.2-6-g22bdda0.zip)

Just for kickcs, I decided to restart the instance of JRun hosting this and all of sudden it works.

FYI - I kept the "taffy:mime" code and didn't get an error (I've removed it since).

As I'm just getting started with Taffy I'm sure I'll have more questions, so don't go too far :)

Thanks,
Jose

Adam Tuttle

unread,
Jun 3, 2013, 4:33:45 PM6/3/13
to taffy...@googlegroups.com
Yeah, I wouldn't expect an error for the "taffy:mime" bit, it's just not going to do anything. You could set its value to "text/goat" and it wouldn't hurt anything...

Adam

Adam
Reply all
Reply to author
Forward
0 new messages