<?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"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: Announce: embedded web server for MaxMSP (beta)</title>
		<atom:link href="http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/feed</link>
		<description></description>
		<pubDate>Tue, 18 Jun 2013 13:42:57 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-35404</guid>
					<title><![CDATA[Announce: embedded web server for MaxMSP (beta)]]></title>
					<link>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-35404</link>
					<pubDate>Wed, 16 Jan 2008 18:37:40 +0000</pubDate>
					<dc:creator>nick rothwell / cassiel</dc:creator>

					<description>
						<![CDATA[
						<p>An installation piece I&#8217;m working on requires an embedded web server,  <br />
so I thought I&#8217;d go ahead and wrap up Jetty inside MXJ and release  <br />
the thing as a package under the LGPL, just in case anyone else finds  <br />
it useful to run a web server over bits of MaxMSP&#8217;s search path. You  <br />
can find it here:</p>
<p>	<a href="http://www.loadbang.net/space/Software/net.loadbang.web" rel="nofollow">http://www.loadbang.net/space/Software/net.loadbang.web</a></p>
<p>Instructions, javadocs, examples and sources included. I&#8217;m planning  <br />
to announce it to the general MaxMSP list soon, but thought I&#8217;d let  <br />
people on the developer list give it a bit of a bashing first. I&#8217;ve  <br />
run it on OS X and Windows and it seems pretty happy.</p>
<p>	&#8211; N.</p>
<p>
Nick Rothwell / Cassiel.com Limited<br />
<a href="http://www.cassiel.com" rel="nofollow">http://www.cassiel.com</a><br />
<a href="http://www.myspace.com/cassieldotcom" rel="nofollow">http://www.myspace.com/cassieldotcom</a><br />
<a href="http://www.last.fm/music/cassiel" rel="nofollow">http://www.last.fm/music/cassiel</a><br />
<a href="http://www.reverbnation.com/cassiel" rel="nofollow">http://www.reverbnation.com/cassiel</a><br />
<a href="http://www.linkedin.com/in/cassiel" rel="nofollow">http://www.linkedin.com/in/cassiel</a><br />
<a href="http://www.loadbang.net" rel="nofollow">http://www.loadbang.net</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120626</guid>
					<title><![CDATA[Re: Announce: embedded web server for MaxMSP (beta)]]></title>
					<link>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120626</link>
					<pubDate>Thu, 17 Jan 2008 04:50:35 +0000</pubDate>
					<dc:creator>Adam Murray</dc:creator>

					<description>
						<![CDATA[
						<p>Nice! Thanks Nick, this is great. I had been meaning to try this for a while but never got around to it. </p>
<p>One thing I&#8217;ve wanted to do was to control Max patches from the web. I think using the URL query string would be a good way to do this, but your object doesn&#8217;t expose that to the patch. So I made a few adjustments&#8230;</p>
<p>* In net.loadbang.web.mxj.WebServer<br />
I increased the number of outlets.<br />
declareIO(1, 4);</p>
<p>* In net.loadbang.web.WebServer I added the following code to the top of ReporterHandler.handle() (sorry for the forum messing up my code formatting):</p>
<p>Enumeration params = request.getParameterNames();<br />
			while (params.hasMoreElements()) {<br />
				String param = (String) params.nextElement();<br />
				String[] vals = request.getParameterValues(param);<br />
				if (vals == null) {<br />
					itsOutputter.output(3, param);<br />
				}<br />
				else {<br />
					StringBuffer s = new StringBuffer(param);<br />
					for (int i = 0; i < vals.length; i++) {<br />
						s.append(&#8221; &#8220;).append(vals[i]);<br />
					}<br />
					itsOutputter.output(3, s.toString());<br />
				}<br />
			}<br />
			// or something like this:<br />
			// itsOutputter.output(3, request.getQueryString());<br />
			// but I don&#8217;t feel like doing query string parsing in Max</p>
<p>
Then, as a really simple example, you could serve up the following HTML: </p>
<form>
	<input type="text" name="text1"/>
<p>	<input type="text" name="text2"/></p>
<p>	<input type="submit"/><br />
</p></form>

<p>To control this patch:</p>
<p>#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P window linecount 1;<br />
#P newex 376 147 32 196617 print;<br />
#P user textedit 122 212 270 233 32896 3 9;<br />
#P newex 122 186 62 196617 prepend set;<br />
#P user textedit 306 213 454 234 32896 3 9;<br />
#P newex 306 187 62 196617 prepend set;<br />
#P newex 266 138 90 196617 route text1 text2;<br />
#P window setfont Monaco 9.;<br />
#P user umenu 23 42 100 262183 1 64 57 1;<br />
#X add stop;<br />
#X add start;<br />
#P window linecount 2;<br />
#P newex 113 79 214 262153 mxj net.loadbang.web.mxj.WebServer @port 8080 @placeholder web-root;<br />
#P connect 1 1 0 0;<br />
#P connect 2 0 5 0;<br />
#P connect 5 0 6 0;<br />
#P connect 2 1 3 0;<br />
#P connect 3 0 4 0;<br />
#P connect 0 3 7 0;<br />
#P connect 0 3 2 0;<br />
#P window clipboard copycount 8;</p>
<p>If that seems useful to you, might be worth including in your external. It wouldn&#8217;t take much effort to do something more interactive like using AJAX to update the Max patch on-the-fly (I think there was something like that in the aka.iphone experiements). </p>
<p>It would also be cool to enable JSP support. This could be used to allow the Max patch to communicate back to the browser. I&#8217;m not exactly sure how you do that with an embedded Jetty server. I might look into that some other time (unless you already know how?)</p>
<p>BTW, I was not able to use your build.xml file:<br />
$ ant  <br />
Buildfile: build.xml<br />
/Users/adam/workspace/net.loadbang.web/MXJ-basis/ant-defs.xml could not be found</p>
<p>BUILD FAILED<br />
java.io.FileNotFoundException: /Users/adam/workspace/net.loadbang.web/MXJ-basis/ant-defs.xml (No such file or directory)</p>
<p>Cheers,<br />
Adam</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120627</guid>
					<title><![CDATA[Re: Announce: embedded web server for MaxMSP (beta)]]></title>
					<link>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120627</link>
					<pubDate>Thu, 17 Jan 2008 05:37:37 +0000</pubDate>
					<dc:creator>Adam Murray</dc:creator>

					<description>
						<![CDATA[
						<p>This code is probably better:</p>
<p>Enumeration params = request.getParameterNames();<br />
			while (params.hasMoreElements()) {<br />
				String param = (String) params.nextElement();<br />
				String[] vals = request.getParameterValues(param);<br />
				if (vals == null) {<br />
					itsOutputter.output(3, param);<br />
				}<br />
				else {<br />
					for (int i = 0; i < vals.length; i++) {<br />
						itsOutputter.output(3, param + &#8221; &#8221; + vals[i]);<br />
					}<br />
				}<br />
			}</p>
<p>Adam</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120628</guid>
					<title><![CDATA[Re: Announce: embedded web server for MaxMSP (beta)]]></title>
					<link>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120628</link>
					<pubDate>Thu, 17 Jan 2008 07:14:51 +0000</pubDate>
					<dc:creator>Adam Murray</dc:creator>

					<description>
						<![CDATA[
						<p>I got JSPs to work. Just needed to add the jars from Jetty&#8217;s lib/jsp directory (I used jsp-2.1), and then add the following handler in the handlers.setHandlers() call:</p>
<p>new WebAppContext(directory.toURL().toString(), &#8220;/&#8221;)</p>
<p>This seems to break the DefaultHandler&#8217;s behavior for favicon though (who cares?)</p>
<p>I also have some other changes that let me send messages like &#8220;set attrName attrValue&#8221; to the WebServer object in Max, and then I can access the value in the JSP with the ${attrName} syntax. So 2-way communication between the web browser and the Max patch is easily possible. Let me know if you would like to see the code.</p>
<p>-Adam</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120629</guid>
					<title><![CDATA[Re: Announce: embedded web server for MaxMSP (beta)]]></title>
					<link>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120629</link>
					<pubDate>Thu, 17 Jan 2008 09:38:09 +0000</pubDate>
					<dc:creator>nick rothwell / cassiel</dc:creator>

					<description>
						<![CDATA[
						<p>> I got JSPs to work.</p>
<p>Wow. Quick work&#8230;!</p>
<p>I had been playing around with the servlet support, and had thought  <br />
about having the MXJ object call out into Max, but hadn&#8217;t thought  <br />
about JSP support. Thanks for all the effort. If you&#8217;re happy with  <br />
it, I&#8217;ll integrate your enhancements into the main release (credited,  <br />
natch).</p>
<p>	&#8211; N.</p>
<p>
   nick rothwell &#8212; composition, systems, performance &#8212; http:// <br />
<a href="http://www.cassiel.com" rel="nofollow">http://www.cassiel.com</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120630</guid>
					<title><![CDATA[Re: Announce: embedded web server for MaxMSP (beta)]]></title>
					<link>http://cycling74.com/forums/topic/announce-embedded-web-server-for-maxmsp-beta/#post-120630</link>
					<pubDate>Thu, 17 Jan 2008 12:24:57 +0000</pubDate>
					<dc:creator>nick rothwell / cassiel</dc:creator>

					<description>
						<![CDATA[
						<p>> BTW, I was not able to use your build.xml file:<br />
> $ ant<br />
> Buildfile: build.xml<br />
> /Users/adam/workspace/net.loadbang.web/MXJ-basis/ant-defs.xml could  <br />
> not be found</p>
<p>Oh yeah, sorry about that: the various references between the Ant  <br />
files (and for that matter, the class paths) are dependent on the way  <br />
I&#8217;ve laid out my Eclipse projects, and it&#8217;ll take a bit of effort to  <br />
get that into a form which can be used by anyone else. Well done on  <br />
getting it all into the air regardless.</p>
<p>	&#8211; N.</p>
<p>
Nick Rothwell / Cassiel.com Limited<br />
<a href="http://www.cassiel.com" rel="nofollow">http://www.cassiel.com</a><br />
<a href="http://www.myspace.com/cassieldotcom" rel="nofollow">http://www.myspace.com/cassieldotcom</a><br />
<a href="http://www.last.fm/music/cassiel" rel="nofollow">http://www.last.fm/music/cassiel</a><br />
<a href="http://www.reverbnation.com/cassiel" rel="nofollow">http://www.reverbnation.com/cassiel</a><br />
<a href="http://www.linkedin.com/in/cassiel" rel="nofollow">http://www.linkedin.com/in/cassiel</a><br />
<a href="http://www.loadbang.net" rel="nofollow">http://www.loadbang.net</a></p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

