It's all about the answers!

Ask a question

OSCL--cannot return JSON representation

matthew sessoms (122) | asked Feb 17 '12, 3:02 p.m.
I create a query and represent it in a URL,

Assuming the URL is stored in variable url, I execute the following:

HttpGet getMethod = new HttpGet(url);
getMethod.addHeader("Content-Type", "application/json");
getMethod.addHeader("Accept", "text/json");

I then get the response as follows:

InputStream is = httpResponse.getEntity().getContent();
String json = convertStreamToString(is);

However, the response (stored in variable json), is not in json format. I've tried using different resource formats such as rdf, xml, etc. but each time I get the same result. Is there something that I'm missing or need to do?

Any help is appreciated. Below is the value of my json variable after getting the response.



#net-jazz-ajax-NoScriptMessage {
width: 100%;
color: #D0D0D0;
font-size: 2em;
text-align: center;
position: absolute;
top: 1%;
z-index: 999;


<noscript><div>Javascript is either disabled or not available in your


djConfig = {
isDebug: false,
usePlainJson: true,
baseUrl: "/jazz/web/dojo/",
locale: "en-us",
localizationComplete: true
net = {jazz: {ajax: {}}};
net.jazz.ajax._contextRoot = "/jazz";
net.jazz.ajax._webuiPrefix = "/web/";


/* <CDATA> */

/* <CDATA> */

One answer

permanent link
Sean G Wilbur (87212421) | answered Mar 08 '12, 2:06 p.m.

Are you already authenticated ? This looks like it may be the challenge form auth part.

This could be part of your snippet that you are leaving out but generally you need to get a secure resource, this will challenge you for auth, then you authenticate based on the challenge, and then you are ready to actually get a secure resource.


Your answer

Register or to post your answer.