<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MetaBinary &#187; upload</title>
	<atom:link href="http://metabinary.com/tag/upload/feed/" rel="self" type="application/rss+xml" />
	<link>http://metabinary.com</link>
	<description>Beyond 0 and 1.</description>
	<lastBuildDate>Tue, 18 Aug 2009 00:35:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Upload Files using REST</title>
		<link>http://metabinary.com/2009/08/upload-files-using-rest/</link>
		<comments>http://metabinary.com/2009/08/upload-files-using-rest/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 03:05:27 +0000</pubDate>
		<dc:creator>redwildfire13</dc:creator>
				<category><![CDATA[Joe's Stories]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://metabinary.com/?p=73</guid>
		<description><![CDATA[I have been working on an interesting problem of trying to upload a file to a server using a REST service in Java. So far things have been quite complicated. I haven&#8217;t been able to find anything that would work. Originally I thought it would be quite easy to just send it a Http Form [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on an interesting problem of trying to upload a file to a server using a REST service in Java. So far things have been quite complicated.<br />
<span id="more-73"></span></p>
<p>I haven&#8217;t been able to find anything that would work. Originally I thought it would be quite easy to just send it a Http Form that held the file, but I cannot get the service to read anything but a String. I was hoping I would be able to handle this without using a framework, but most of the solutions I find use Springs or Struts.</p>
<p>I wanted to send an HttpServletRequest and pull the file out of it, but I cannot get the request into the REST method. There must be a simple way to do this that I am missing. I post here if I manage to solve this.</p>
<p>EDIT: I finally managed to do this but forgot to update my post to explain how I figured it out.</p>
<p>It turned out to be something really simple that I kicked myself for not thinking of earlier.</p>
<pre>createHttpProduct( @Context HttpServletRequest request )</pre>
<p>All I needed was  <em>javax.ws.rs.core.Context</em> to give me access to the data that I needed. I should have known that already because I was using <em>javax.ws.rs.core.SecurityContext</em> earlier. Oh well, live and learn I guess.</p>
]]></content:encoded>
			<wfw:commentRss>http://metabinary.com/2009/08/upload-files-using-rest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
