[Wicket-user] WicketFilter NPE if filter-mapping is servlet-name rather than url-mapping

2007-06-25 Thread James Renfro
Hi All,
I'm working in 1.3.0 snapshot. Two or three weeks ago it used to be 
possible to use a filter-mapping like this one:

filter-mapping
filter-namemy.wicket.filter/filter-name
servlet-namemy.servlet/servlet-name
/filter-mapping

But it looks like a recent change to getFilterPath now forces you to use 
url-mapping instead. This was encouraged before in all the 
documentation, but not explicitly enforced. The exception I'm seeing is 
at line 467 in WicketFilter.

I know it may seem pointless to have a servlet consumer at the end of 
the wicket filter chain, but not allowing us to do it feels like an 
unnecessary limitation, and given the codebase I'm working within 
(Sakai) -- my initial guess is that it's going to represent a serious 
hurdle to making use of Wicket.

So I guess I'm wondering if there's any chance getFilterPath could be 
massaged to allow servlet-name as well?

Thanks,
James.

-- 
James Renfro
[EMAIL PROTECTED]



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] HttpServletRequest's attributes?

2007-05-16 Thread James Renfro
Does anyone know if Wicket exposes the HttpServletRequest's attributes 
somewhere? I can get them through

((WebRequest)getRequest()).getHttpServletRequest().getAttribute(myattr);

But the javadoc says that it's not recommended to call 
getHttpServletRequest.

Thanks,
James.

-- 
James Renfro
Programmer
IET Mediaworks, UC Davis
[EMAIL PROTECTED]
W: 530-754-5097


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] PopupSettings with no window name set generates invalid xhtml on Link

2007-05-11 Thread James Renfro
Hi,
I've just switched my code over from 1.2 to 1.3 beta, and I'm running 
into a problem where Wicket seems to be generating invalid xhtml -- 
specifically, it produces an href tag with a blank target attribute, as 
here:

a href=?wicket:interface=:6:rows:1:launch::ILinkListener: target 
wicket:id=launch onclick=var w = window.open(href, '', 
'scrollbars=yes,location=no,menuBar=no,resizable=yes,status=no,toolbar=no'); 
if(w.blur) w.focus(); return false;Launch/a


Notice right after the href=, there's a naked 'target' attribute. I'm 
guessing this is because the Link popupPageMap.getName() method is 
returning a null. Looks like the code checks to make sure that 
popupPageMap is NOT null, but it doesn't check getName(). 

In the Wicket code I can see the following:

snip class=org.apache.wicket.markup.html.link.Link lines=460:467
if (popupSettings != null)
{
IPageMap popupPageMap = popupSettings.getPageMap(this);
if (popupPageMap != null)
{
tag.put(target, popupPageMap.getName());
}
}
/snip


Here's my code:

snip
item.add(new Link(launch) {
 public void onClick() {
 setResponsePage(new LaunchFrameset());
 }
 }.setPopupSettings(new 
PopupSettings(PopupSettings.RESIZABLE | PopupSettings.SCROLLBARS)));
/snip

If I add .setWindowName to my new PopupSettings object, everything seems 
to work. But I'm guessing it should work even if I forget to specify a 
window name.

Thanks,
James.


-- 
James Renfro
Programmer
IET Mediaworks, UC Davis
[EMAIL PROTECTED]
W: 530-754-5097


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Using AJAX wicketSubmitFormById like a method call

2007-05-04 Thread James Renfro
Igor,
I had a feeling that was the situation. I'll take a closer look at my 
code with that in mind and if I can come up with a clear follow up 
question, I'll post some relevant excerpts.

Thanks very much for your help,
James.

Igor Vaynberg wrote:
 the short answer is: you cant do that. javascript is asynchronous, so 
 the request will start _and_ your function will continue running. 
 usually what is done is that you create a request object, and then 
 register success and failure handlers that are executed after the 
 request is done.

 you can do that using iajaxcalldecorator, or what you tried...calling 
 ajaxtarget.appendjavascript() should work as well.

 if you show us some more code/try to describe your actual usecase we 
 can probably help you more, right now its all very abstract.

 -igor


 On 5/3/07, *James Renfro* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 Hi,
 I'd like to do something slightly unusual and wrap the
 wicketSubmitFormById call in another javascript function -- I'm
 able to
 do this with no problem by overriding
 AjaxFormSubmitBehavor.onRenderHeadInitContribution and calling
 JavascriptUtils.writeJavascript on a wrapped getEventHandler. I
 can stop
 the normal attribute for 'onclick' or whatever from appearing
 inside the
 component tag by overriding onComponentTag. And by using text input
 boxes, I can pass 'arguments' to my method on the server inside using
 FormComponent.getConvertedInput. So far so good.

 The problem I have is that I'd like to actually 'return' a value back
 from the server in that Javascript function... so my function ends up
 looking just like a normal function call inside of my Javascript and
 returns the value that the server provides.

 I can see inside of wicket-ajax.js that there are three special tags:
 component, evaluate and header-contribution, each with their
 appropriate purpose -- I tried messing around with
 AjaxRequestTarget.prependJavascript so I could pass something through
 the 'evaluate' tag, but my javascript isn't sufficient to the
 task. Then
 I tried using AjaxRequestTarget.addComponent to modify another
 TextField
 and return the value through the DOM tree -- that works fine
 except for
 the fact that the order is wrong, so my method returns _before_ the
 component is updated.

 Then I noticed this interesting Wicket.Ajax.invokePostCallHandlers()
 call, which makes me wonder if there is already some nice clean
 mechanism in place for updating javascript variables thru wicket's
 java
 code.

 Apologies if this all makes no sense, but any advice or suggestions
 would be much appreciated. The basic requirement is just that I
 make a
 call in Javascript and get data back from the server as a 'returned'
 variable on the client.

 Thanks,
 James

 --
 James Renfro
 Programmer
 IET Mediaworks, UC Davis
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 W: 530-754-5097


 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 mailto:Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user


 

 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user
   

-- 
James Renfro
Programmer
IET Mediaworks, UC Davis
[EMAIL PROTECTED]
W: 530-754-5097


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Using AJAX wicketSubmitFormById like a method call

2007-05-04 Thread James Renfro
So although clearly AJAX is supposed to be mostly asynchronous. it looks 
like the underlying XMLHttpRequest object _can_ be synchronous.

If I modify wicket-ajax.js and set 'Wicket.Ajax.Request.async' to 
*false* -- suddenly my code works... i.e. I can code an 
AjaxFormSubmitBehavor.onSubmit so it takes a value from one 
FormComponent (the argument to the function), modifies it (in this case 
toUppercase), and sends it back to another FormComponent, whose node I 
can grab from the DOM tree and return inside my function.

So I guess my question is -- am I going to break something fundamental 
by doing this? It seem to work fine in my test case.

Javascript_function

script type=text/javascript id=onTestMethod1!--/*--![CDATA[/*!--*/
TestMethod1 = function () { 
var wcall=wicketSubmitFormById('form', 
'/portal/tool/52480496-d4f6-4278-0002-e65fdefcc0ef/?wicket:interface=wicket-247:0:form:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=true',
 null, function() { }, function() { }); 
return document.getElementById('form_result').value;;};
/*--]]*//script

/Javascript_function

AjaxFormSubmitBehavior.onSubmit
@Override
protected void onSubmit(AjaxRequestTarget target) {
FormComponent c = (FormComponent)form.get(argument);
String testValue = (String)c.getConvertedInput();

FormComponent r = (FormComponent)form.get(result);
bean.setResult(testValue.toUpperCase());
target.addComponent(r);
}
/AjaxFormSubmitBehavior.onSubmit

wicket-ajax.js
Wicket.Ajax.Request.prototype = {
initialize: function(url, loadedCallback, parseResponse, randomURL, 
failureHandler, channel) {
this.url = url;
this.loadedCallback = loadedCallback;
this.parseResponse = parseResponse != null ? parseResponse : true;
this.randomURL = randomURL != null ? randomURL : true;
this.failureHandler = failureHandler != null ? failureHandler : 
function() { };
this.async = *true;*
this.channel = channel;
this.suppressDone = false;
this.instance = Math.random();
this.debugContent = true;
},
/wicket-ajax.js

Thanks,
James


Igor Vaynberg wrote:
 the short answer is: you cant do that. javascript is asynchronous, so 
 the request will start _and_ your function will continue running. 
 usually what is done is that you create a request object, and then 
 register success and failure handlers that are executed after the 
 request is done.

 you can do that using iajaxcalldecorator, or what you tried...calling 
 ajaxtarget.appendjavascript() should work as well.

 if you show us some more code/try to describe your actual usecase we 
 can probably help you more, right now its all very abstract.

 -igor


 On 5/3/07, *James Renfro* [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 Hi,
 I'd like to do something slightly unusual and wrap the
 wicketSubmitFormById call in another javascript function -- I'm
 able to
 do this with no problem by overriding
 AjaxFormSubmitBehavor.onRenderHeadInitContribution and calling
 JavascriptUtils.writeJavascript on a wrapped getEventHandler. I
 can stop
 the normal attribute for 'onclick' or whatever from appearing
 inside the
 component tag by overriding onComponentTag. And by using text input
 boxes, I can pass 'arguments' to my method on the server inside using
 FormComponent.getConvertedInput. So far so good.

 The problem I have is that I'd like to actually 'return' a value back
 from the server in that Javascript function... so my function ends up
 looking just like a normal function call inside of my Javascript and
 returns the value that the server provides.

 I can see inside of wicket-ajax.js that there are three special tags:
 component, evaluate and header-contribution, each with their
 appropriate purpose -- I tried messing around with
 AjaxRequestTarget.prependJavascript so I could pass something through
 the 'evaluate' tag, but my javascript isn't sufficient to the
 task. Then
 I tried using AjaxRequestTarget.addComponent to modify another
 TextField
 and return the value through the DOM tree -- that works fine
 except for
 the fact that the order is wrong, so my method returns _before_ the
 component is updated.

 Then I noticed this interesting Wicket.Ajax.invokePostCallHandlers()
 call, which makes me wonder if there is already some nice clean
 mechanism in place for updating javascript variables thru wicket's
 java
 code.

 Apologies if this all makes no sense, but any advice or suggestions
 would be much appreciated. The basic requirement is just that I
 make a
 call in Javascript and get data back from the server as a 'returned'
 variable on the client.

 Thanks,
 James

 --
 James Renfro

Re: [Wicket-user] Using AJAX wicketSubmitFormById like a method call

2007-05-04 Thread James Renfro
Good point. What I'm planning on is to inject my own ResourceReference 
version with the async set to false, but only for the one page where I 
need it to be synchronous. Since I'm overriding 
onRenderHeadInitContribution, I can just choose not to call super and 
the default .js files won't get included. But it would be much cleaner 
to be able to just set it programmatically, so I'd be very happy to see 
that parameter get worked into a future release.

Unfortunately, the spec I'm trying to implement (SCORM) requires that I 
expose a bunch of javascript methods with synchronous behavior, 
otherwise I would definite go the success handler route in this case.

Thanks very much,
James.


Igor Vaynberg wrote:
 if you change wicket-ajax.js in the way you showed below then all ajax 
 requests will become synchronous. while you wont break anything 
 foundamental you will make parallel ajax requests impossible. not a 
 good thing imho. i guess we need to add a parameter so that you can 
 set the request to synchronous just for that one call.

 or do what i suggested and add a success handler that will execute the 
 rest of the function.

 -igor


 On 5/4/07, *James Renfro*  [EMAIL PROTECTED] 
 mailto:[EMAIL PROTECTED] wrote:

 So although clearly AJAX is supposed to be mostly asynchronous. it
 looks
 like the underlying XMLHttpRequest object _can_ be synchronous.

 If I modify wicket-ajax.js and set 'Wicket.Ajax.Request.async' to
 *false* -- suddenly my code works... i.e. I can code an
 AjaxFormSubmitBehavor.onSubmit so it takes a value from one
 FormComponent (the argument to the function), modifies it (in this
 case
 toUppercase), and sends it back to another FormComponent, whose node I
 can grab from the DOM tree and return inside my function.

 So I guess my question is -- am I going to break something fundamental
 by doing this? It seem to work fine in my test case.

 Javascript_function

 script type=text/javascript
 id=onTestMethod1!--/*--![CDATA[/*!--*/
 TestMethod1 = function () {
 var wcall=wicketSubmitFormById('form',
 
 '/portal/tool/52480496-d4f6-4278-0002-e65fdefcc0ef/?wicket:interface=wicket-247:0:form:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=true',
 null, function() { }, function() { });
 return document.getElementById('form_result').value;;};
 /*--]]*//script

 /Javascript_function

 AjaxFormSubmitBehavior.onSubmit
 @Override
 protected void onSubmit(AjaxRequestTarget target) {
 FormComponent c = (FormComponent)form.get(argument);
 String testValue = (String)c.getConvertedInput();

 FormComponent r = (FormComponent)form.get(result);
 bean.setResult(testValue.toUpperCase());
 target.addComponent(r);
 }
 /AjaxFormSubmitBehavior.onSubmit

 wicket-ajax.js
 Wicket.Ajax.Request.prototype = {
 initialize: function(url, loadedCallback, parseResponse,
 randomURL,
 failureHandler, channel) {
 this.url = url;
 this.loadedCallback = loadedCallback;
 this.parseResponse = parseResponse != null ? parseResponse
 : true;
 this.randomURL = randomURL != null ? randomURL : true;
 this.failureHandler = failureHandler != null ?
 failureHandler :
 function() { };
 this.async = *true;*
 this.channel = channel;
 this.suppressDone = false;
 this.instance = Math.random();
 this.debugContent = true;
 },
 /wicket-ajax.js

 Thanks,
 James


 Igor Vaynberg wrote:
  the short answer is: you cant do that. javascript is
 asynchronous, so
  the request will start _and_ your function will continue running.
  usually what is done is that you create a request object, and then
  register success and failure handlers that are executed after the
  request is done.
 
  you can do that using iajaxcalldecorator, or what you
 tried...calling
  ajaxtarget.appendjavascript() should work as well.
 
  if you show us some more code/try to describe your actual
 usecase we
  can probably help you more, right now its all very abstract.
 
  -igor
 
 
  On 5/3/07, *James Renfro* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
  mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
 
  Hi,
  I'd like to do something slightly unusual and wrap the
  wicketSubmitFormById call in another javascript function -- I'm
  able to
  do this with no problem by overriding
  AjaxFormSubmitBehavor.onRenderHeadInitContribution and calling
  JavascriptUtils.writeJavascript on a wrapped getEventHandler. I
  can stop
  the normal attribute for 'onclick

[Wicket-user] Using AJAX wicketSubmitFormById like a method call

2007-05-03 Thread James Renfro
Hi,
I'd like to do something slightly unusual and wrap the 
wicketSubmitFormById call in another javascript function -- I'm able to 
do this with no problem by overriding 
AjaxFormSubmitBehavor.onRenderHeadInitContribution and calling 
JavascriptUtils.writeJavascript on a wrapped getEventHandler. I can stop 
the normal attribute for 'onclick' or whatever from appearing inside the 
component tag by overriding onComponentTag. And by using text input 
boxes, I can pass 'arguments' to my method on the server inside using 
FormComponent.getConvertedInput. So far so good.

The problem I have is that I'd like to actually 'return' a value back 
from the server in that Javascript function... so my function ends up 
looking just like a normal function call inside of my Javascript and 
returns the value that the server provides.

I can see inside of wicket-ajax.js that there are three special tags: 
component, evaluate and header-contribution, each with their 
appropriate purpose -- I tried messing around with 
AjaxRequestTarget.prependJavascript so I could pass something through 
the 'evaluate' tag, but my javascript isn't sufficient to the task. Then 
I tried using AjaxRequestTarget.addComponent to modify another TextField 
and return the value through the DOM tree -- that works fine except for 
the fact that the order is wrong, so my method returns _before_ the 
component is updated.

Then I noticed this interesting Wicket.Ajax.invokePostCallHandlers() 
call, which makes me wonder if there is already some nice clean 
mechanism in place for updating javascript variables thru wicket's java 
code.

Apologies if this all makes no sense, but any advice or suggestions 
would be much appreciated. The basic requirement is just that I make a 
call in Javascript and get data back from the server as a 'returned' 
variable on the client.

Thanks,
James

--
James Renfro
Programmer
IET Mediaworks, UC Davis
[EMAIL PROTECTED]
W: 530-754-5097


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user