Hi Mikey,

> There was no Content-Type header.  I imagine our server doesn't know
> what to append for *.properties files.

That makes sense.

> I'll have a look at the Tomcat
> docs and see if I can figure that out.

Slightly OT of me, but I might be able to point you in the right
direction if you take it with a grain of salt:  I believe these are in
web.xml; search the file for "mime-mapping" and you should find them.
So $TOMCAT_HOME/conf/web.xml should do it for a server-wide mapping,
or <app>/WEB-INF/web.xml for an app-specific one.
--
T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available


On Apr 14, 2:11 pm, MikeyLikesIt <etov...@gmail.com> wrote:
> T.J.,
>
> There was no Content-Type header.  I imagine our server doesn't know
> what to append for *.properties files.  I'll have a look at the Tomcat
> docs and see if I can figure that out.
>
> Thanks for all the help!
>
> On Apr 13, 10:22 pm, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
>
> > Hi Mikey,
>
> > > In this case, I'm just requesting a static, plain-text file.  As such,
> > > it contains no headers as an HTML response would.
>
> > Not HTML headers, HTTP headers.  Every HTTP response has headers,
> > regardless of the resource being requested.  Your web server does this
> > for you.  Say we have a file "testing.txt" with the contents "This is
> > a test.".  Here's what an HTTP/1.1 response to a request for that file
> > might typically look like this (I've shortened the server header's
> > value):
>
> > * * * *
> > HTTP/1.1 200 OK
> > Date: Tue, 14 Apr 2009 04:08:33 GMT
> > Server: Apache/2.2.4 (Linux/SUSE) ...
> > Last-Modified: Sun, 29 Mar 2009 16:33:43 GMT
> > ETag: "1ae416f-1aac-877147c0"
> > Accept-Ranges: bytes
> > Content-Length: 15
> > Content-Type: text/plain
>
> > This is a test.
> > * * * *
>
> > (Also on Pastie athttp://pastie.org/445728--Google Groups tends to
> > insert blank lines at random, and blank lines are significant in this
> > snippet.)  Everything after the 200 line until the blank line is a
> > header; the blank line indicates the headers are complete and the
> > resource data follows.  Details in the spec[1].  In your case, you're
> > looking to make sure the Content-Type header[2] is correct.  Firebug
> > [3] will show you the headers associated with a response on its Net
> > tab.
>
> > [1]http://tools.ietf.org/html/rfc2616
> > [2]http://tools.ietf.org/html/rfc2616#section-14.17
> > [3]http://getfirebug.com
>
> > HTH,
> > --
> > T.J. Crowder
> > tj / crowder software / com
> > Independent Software Engineer, consulting services available
>
> > On Apr 13, 8:06 pm, MikeyLikesIt <etov...@gmail.com> wrote:
>
> > > T.J.,
>
> > > Thanks for the rapid response!
>
> > > In this case, I'm just requesting a static, plain-text file.  As such,
> > > it contains no headers as an HTML response would.  Additionally, the
> > > text in the response is never displayed by the browser; it's only
> > > parsed into an array of JSON objects.  Since this is a static file,
> > > should I just manually add a header to the file?  If so, do you know
> > > the syntax for the header?
>
> > > Thanks again!
>
> > > On Apr 13, 9:46 am, "T.J. Crowder" <t...@crowdersoftware.com> wrote:
>
> > > > Hey Mikey,
>
> > > > I think the issue isn't the request headers, but rather the response
> > > > headers.  Make sure your server is sending back the correct content
> > > > type.  Firefox will take the server's word for it in terms of what is
> > > > coming back (HTML, XML, JSON, etc.),.  For what you're doing, you
> > > > probably want the server to be sending back the type "text/plain".
> > > > How you do that depends on what kind of server software you're using.
>
> > > > HTH,
> > > > --
> > > > T.J. Crowder
> > > > tj / crowder software / com
> > > > Independent Software Engineer, consulting services available
>
> > > > On Apr 13, 4:33 pm, MikeyLikesIt <etov...@gmail.com> wrote:
>
> > > > > Howdy!
>
> > > > > I'm attempting to use the Ajax.Request object to grab a text file for
> > > > > parsing.  In this context, the file is a *.properties file that
> > > > > contains application constants that are parsed into properties and
> > > > > associated values.
>
> > > > > It works great, except for one, small problem with Mozilla.  Whenever
> > > > > the file is read, Mozilla generates a "not well formed" error, because
> > > > > it is expecting a well-formed HTML response.  This is probably working
> > > > > as intended, but is there a setting in the Ajax.Request object that
> > > > > will allow the browser to expect a plain-text response and not a well-
> > > > > formed HTML response?  I've played around with the requestHeaders
> > > > > option a bit, but that hasn't helped, unless I'm not getting it (which
> > > > > is quite possible).
>
> > > > > A snippet from my object is below, for reference.  Thanks in advance
> > > > > for the help!
>
> > > > > =================================================================
>
> > > > >         , getResponse: function() {
>
> > > > >                 var reader = this;
> > > > >                 new Ajax.Request(
> > > > >                         reader.FILE_PATH
> > > > >                         , {
> > > > >                                 method: 'get'
> > > > >                                 , onSuccess: function(transport) { 
> > > > > reader.parseResponse(transport,
> > > > > reader.properties); }
> > > > >                                 , onFailure: function() { 
> > > > > alert('There was an error processing
> > > > > this request.'); }
> > > > >                 });
> > > > >         }
>
> > > > >         , parseResponse: function(transport, propertiesArray) {
>
> > > > >                 var rawResponse = transport.responseText.split('\n');
> > > > >                 var reader = this;
>
> > > > >                 for(var i = 0; i < rawResponse.length; i++) {
> > > > >                         var line = rawResponse[i];
> > > > >                         var index = line.indexOf('=');
> > > > >                         if(index > -1) {
> > > > >                                 var property = {
> > > > >                                         name: line.substring(0, index)
> > > > >                                         , value: line.substring(index 
> > > > > + 1, line.length)
> > > > >                                 };
> > > > >                                 propertiesArray.push(property);
> > > > >                         }
> > > > >                 }
> > > > >         }
>
> > > > > =================================================================
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to