dev@jersey.java.net

Re: [Jersey] Leading Spaces in JAXB

From: Minjal Shah <shahminjal_at_yahoo.co.in>
Date: Mon, 3 Aug 2009 16:51:15 +0530 (IST)

Hi Paul, I understood the point. Thanks for your patience and help ! Regards, Minjal ________________________________ From: Paul Sandoz <Paul.Sandoz@Sun.COM> To: dev@jersey.dev.java.net Sent: Monday, 3 August, 2009 4:41:42 PM Subject: Re: [Jersey] Leading Spaces in JAXB On Aug 3, 2009, at 12:50 PM, Minjal Shah wrote: > Hi Paul, > > POST /abc/xyz HTTP/1.1 > Content-Type: application/xml > Host: localhost:9998 > Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 > Content-Length: 114 > > <VSEDHCPConfigResource><a>value1</a><b>valueb</b><c>valuec</c><d>valued</d><e>valuee</e></VSEDHCPConfigResource> > > Above is the request that has leading spaces in the xml body without XMLDecl and works fine. > Look again at the grammar for XML: http://www.w3.org/TR/REC-xml/#NT-prolog [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') [25] Eq ::= S? '=' S? [26] VersionNum ::= '1.' [0-9]+ [27] Misc ::= Comment | PI | S Notice in [22] that there can be zero or more Misc (in [27]), which can be one of a comment a processing instruction or a white space character. So if there is no XML declaration present there may be zero or more white spaces before the start of the element. Paul. > > > From: Paul Sandoz <Paul.Sandoz@Sun.COM> > To: dev@jersey.dev.java.net > Sent: Monday, 3 August, 2009 4:17:39 PM > Subject: Re: [Jersey] Leading Spaces in JAXB > > > On Aug 3, 2009, at 12:39 PM, Minjal Shah wrote: > > > Hi Paul, > > > > The request that has leading spaces, was sent out using netcat. > > As you pointed out, the grammer does not allow it, BAD REQUEST is justified. Thanks ! > > > > But, now with the request like the below where the XMLDecl is omitted, does not mind getting leading spaces. > > > > > POST /abc/xyz HTTP/1.1 > > Content-Type: application/xml > > Host: localhost:9998 > > Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 > > Content-Length: 112 > > > > <VSEDHCPConfigResource><a>value1</a><b>valueb</b><c>valuec</c><d>valued</d><e>valuee</e></VSEDHCPConfigResource> > > > > Please explain. > > > > I do not see any leading spaces in the above. Note the Content-Length value of 112. That is the number of characters that make up the XML document. > > I think you may be confusing the CRLF that is required for HTTP to demarcate the HTTP headers and the start of the request entity. Look at the grammar specified for HTTP here: > > http://greenbytes.de/tech/webdav/rfc2616.html#http.message > > Paul. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@jersey.dev.java.net > For additional commands, e-mail: dev-help@jersey.dev.java.net > > > Looking for local information? Find it on Yahoo! Local --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@jersey.dev.java.net For additional commands, e-mail: dev-help@jersey.dev.java.net Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8. http://downloads.yahoo.com/in/internetexplorer/