PDA

View Full Version : Tomcat Authentification Dialog is displayed with GridPanel



peterpaul
20 Jul 2009, 2:55 AM
Hi,

Whenever i use a gridpanel or formpanel which request data from server (tomcat) the tomcat authentification dialog is shown (please enter username und pwd for localhost). if i cancel these dialogs everything works out fine (data is retrieved).

if i do an explicit ajax call no authentification dialog is shown:


Ext.Ajax.request({
url: '/Data',
method: 'GET',
success: function(response){
console.info('successful');
},
failure: function(response){
console.error('error ');
},
params: {
operation: 'search',
}
});
works fine!
But with the following the authentification dialog is shown:



var conn = new Ext.data.Connection().request({
url: '/Data',
method: 'GET',
params: {
operation: 'search'
},
failure: function(){console.info('failure');},
success: function(){
console.info('success');
}
});

var store = new Ext.data.JsonStore({
root: 'data',
idProperty: '1',
autoLoad: true,
fields: [
{name: '2', mapping: '2', type: 'date', dateFormat: 'timestamp'},
{name: '3', mapping: '3'},
{name: '4', mapping: '4'},
{name: '5', mapping: '5'},
{name: '6', mapping: '6'}
],
listeners: {
load: function(){
console.debug("Loaded");
},
loadexception: function(){
console.debug("Not loaded");
}
},

proxy: new Ext.data.HttpProxy(conn)
});

var grid = new Ext.grid.GridPanel({
width:700,
height:500,
title:' ',
store: store,
trackMouseOver:false,
disableSelection:true,
loadMask: true,

// grid columns
columns:[
{
header: '1',
dataIndex: '1',
width: 0,
sortable: false,
hidden: true
},{
header: ' ',
dataIndex: '2',
width: 100,
sortable: true
},{
header: ' ',
dataIndex: '3',
width: 100,
hidden: false,
sortable: true
},{
header: ' ',
dataIndex: '4',
width: 100,
align: 'right',
sortable: true
},{
header: ' ',
dataIndex: '5',
width: 200,
sortable: true
}]
});


Any ideas what i am missing?!

ty

greatings from austria
peterpaul :-/

Condor
20 Jul 2009, 3:09 AM
There is no difference between these two requests (apart from the parameters).

Is the URL part of a <security-constraint>? In that case you will always get this stupid dialog if you do a request when not yet authenticated or if your session expired.

If finally got around this problem by rerouting the 401 error to a page with a 403 error.

peterpaul
20 Jul 2009, 3:20 AM
no there is no <security-constraint> specified.

i forgot to mention that if i cancel the dialogs everything works fine (the error page is NOT displayed) and the data is retrieved from server (the request was successful)!

strange?

Condor
20 Jul 2009, 3:22 AM
Your Tomcat server is sending a 401 HTTP error code. You'll need to find out why.

(can't help you much, using WebSphere myself...)

peterpaul
20 Jul 2009, 4:11 AM
thx for your help. i got it!

i use liferay and portlets and i created one portlet which imports extjs.
BUT: in order to prevent the above error i have to import extjs for every portlet (until i found a better solution for the import in liferay (maybe my theme could do such things ...))

but now i get the following error:


uncaught exception: Ext.data.DataProxy: DataProxy attempted to execute an API-action but found an undefined url / function. Please review your Proxy url/api-configuration.
what am i missing at this point?

thx
peterpaul