error in html???

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

error in html???

satya swaroop-2
Hi All,

         I am able to get the response in the success case in json format by
stating wt=json in the query. But as in case if any errors i am geting in
html format.
 1) Is there any specified reason to get in html format??
  2)cant we get the error result in json format??

Regards,
satya
Reply | Threaded
Open this post in threaded view
|

Re: error in html???

Erick Erickson
What html format? Solr responds in XML, not HTML. Any HTML
has to be created somewhere in the chain. Your browser
may not be set up to render XML, so you could be seeing problems
because of that.

If hit is off-base, could you explain your issue in a bit more detail?

Best
Erick

On Thu, Dec 23, 2010 at 6:30 AM, satya swaroop <[hidden email]>wrote:

> Hi All,
>
>         I am able to get the response in the success case in json format by
> stating wt=json in the query. But as in case if any errors i am geting in
> html format.
>  1) Is there any specified reason to get in html format??
>  2)cant we get the error result in json format??
>
> Regards,
> satya
>
Reply | Threaded
Open this post in threaded view
|

Re: error in html???

Markus Jelsma-2
These

HTTP Status 500 - null java.lang.NullPointerException at
java.io.StringReader.<init>(StringReader.java:50) at

are returned in HTML. I use Nginx to detect the HTTP error code and return a
JSON encoded body with the appropriate content type. Maybe it could be done in
the servlet container but i never tried.

> What html format? Solr responds in XML, not HTML. Any HTML
> has to be created somewhere in the chain. Your browser
> may not be set up to render XML, so you could be seeing problems
> because of that.
>
> If hit is off-base, could you explain your issue in a bit more detail?
>
> Best
> Erick
>
> On Thu, Dec 23, 2010 at 6:30 AM, satya swaroop
<[hidden email]>wrote:

> > Hi All,
> >
> >         I am able to get the response in the success case in json format
> >         by
> >
> > stating wt=json in the query. But as in case if any errors i am geting in
> > html format.
> >
> >  1) Is there any specified reason to get in html format??
> >  2)cant we get the error result in json format??
> >
> > Regards,
> > satya
Reply | Threaded
Open this post in threaded view
|

Re: error in html???

satya swaroop-2
In reply to this post by Erick Erickson
Hi Erick,
           Every result comes in xml format. But when you get any errors
like http 500 or http 400 like wise we will get in html format. My query is
cant we make that html file into json or vice versa..

Regards,
satya
Reply | Threaded
Open this post in threaded view
|

Re: error in html???

lee carroll
Hi Satya,

This is not a solr issue. In your client which makes the json request you
need to have some error checking so you catch the error.

Occasionally people have apache set up to return a 200 ok http response with
a custom page on http errors (often for spurious security considerations)
but this breaks REST like services which SOLR implements and IMO should not
be done.

Take a look at the response coming back from solr and make sure you are
getting the correct http header response 500 etc when your queries errors.
If you are, great stuff you can then check your json invocation
documentation and catch and deal with these http errors in the client. if
your getting a 200 response check your apache config

lee c

On 24 December 2010 05:18, satya swaroop <[hidden email]> wrote:

> Hi Erick,
>           Every result comes in xml format. But when you get any errors
> like http 500 or http 400 like wise we will get in html format. My query is
> cant we make that html file into json or vice versa..
>
> Regards,
> satya
>