jbrowsetix / jbrowse

jbrowse non-fork to test tix migration
Other
1 stars 0 forks source link

Problem with dataRoot property in mixed environments (tomcat/apache) #7

Open jbrowsetix opened 13 years ago

jbrowsetix commented 13 years ago

Hi,

I’m integrating JBrowse inside a Grails application. I keep JBrowse .js,.css,images,... inside the web-app and left the static JSON content in an apache server.

The Grails controller generates the trackInfo.json and refSeq.js files and the html page that shows the browser object. To make it work together I have to use the dataRoot property and modify the urls of the {seq}/{track}/trackData.json files, for instance:

with this settings the browsers doesn’t shows the track contents (the track appears but not its content)

Could be the port an issue? In any place of the program the urls are not builded concatenating dataRoot with the relative urls?

original LH ticket

This ticket has 0 attachment(s).

jbrowsetix commented 13 years ago

Problem with dataRoot property in mixed environments (tomcat/apache)

The problem is about Cross-site HTTP requests and dojo xhrGet method

by Victor Poten

jbrowsetix commented 13 years ago

Problem with dataRoot property in mixed environments (tomcat/apache)

I found out the solution:

First: you must configure apache to accept some headers, for instance:

Make sure that headers.load module is enabled.

Second: jbrowse.js code must be fixed: At line 2067:

@@@ javascript
LazyArray.prototype.range=function(_4,_5,_6,_7,_8){ _4=Math.max(0,_4); _5=Math.min(_5,this.length-1); var _9=Math.floor(_4/this.chunkSize); var _a=Math.floor(_5/this.chunkSize); if(_7===undefined){ _7=function(){ }; } var _b=new Finisher(_7); for(var _c=_9;_c<=_a;_c++){ if(this.chunks[_c]){ this._processChunk(_4,_5,_c,_6,_8); }else{ var _d={start:_4,end:_5,callback:_6,param:_8,finish:_b}; _b.inc(); if(this.toProcess[_c]){ this.toProcess[_c].push(_d); }else{ this.toProcess[_c]=[_d]; var _e=this.urlTemplate.replace(/{chunk}/g,_c); var _f=this; dojo.xhrGet({url:_e,handleAs:"json",load:this._makeLoadFun(_c),error:function(){ _b.dec(); }}); } } } _b.finish(); }; @@@

This line must be fixed: @@@ javascript dojo.xhrGet({url:_e,handleAs:"json",load:this._makeLoadFun(_c),error:function(){ _b.dec(); }}); @@@

the _e url string is not prefixed with the dataRoot, which must be passed to LazyArray class (for instance, at construction time)

by Victor Poten

jbrowsetix commented 13 years ago

Problem with dataRoot property in mixed environments (tomcat/apache)

I have noticed that the LazyArray.js class is fixed in 1.2 version, the bug comes from 1.1

by Victor Poten