Accessing raw POST data

44 views
Skip to first unread message

Jørn Wildt

unread,
Jan 10, 2012, 4:09:37 PM1/10/12
to OpenRasta
Is it possible to get the raw payload data from a POST? I want to
upload a file "as is", not using multipart/form-data. Something like
this:

ResourceSpace.Has.ResourcesOfType<byte[]>()
.AtUri("/file-upload")
.HandledBy<FileHandler>();


public class FileHandler
{
public object Post()
{
byte[] data = ... READ POSTED DATA ...
... do stuff with data
}
}

Jørn Wildt

unread,
Jan 10, 2012, 4:13:19 PM1/10/12
to OpenRasta
BTW: this also means accepting *any* media-type.

Does this makes sense at all with OR?

/Jørn

Sebastien Lambla

unread,
Jan 11, 2012, 9:53:17 AM1/11/12
to open...@googlegroups.com
We really need to put some guidance out there.

Do not, ever, ever, ever, register base types as resources, it'll lead you to break an arm and leg, be unhappy and probably sterile and will lead to your disappearance in a quantum singularity.

You could try to register the ApplicationOctetStreamCodec with a */* media type for the resource type you want, and use Post(Stream incoming), that may work, or at least there's nothing in the code that ought to make it not work.

Seb
________________________________________
From: open...@googlegroups.com [open...@googlegroups.com] on behalf of Jørn Wildt [j...@fjeldgruppen.dk]
Sent: 10 January 2012 21:13
To: OpenRasta
Subject: [openrasta] Re: Accessing raw POST data

Reply all
Reply to author
Forward
0 new messages