RE: Is it possible to set the session?

2012-01-11 Thread Serban Balamaci
Hello,

Maybe pass the sessionid in the url like a query parameter to the page you
open in an iframe and then read the url parameter and return from that page
a response with a JSESSIONID header equal to the value of the session.
Subsequent requests to the page in the iframe will have this sessionid. 

However using the same session could cause problems with the PageMap? Not
sure about this as it probably should be the same as opening  the
application in two browser windows.

I'd rather go for storing the information that must be shared in a cache/map
and pass around as an url parameter the key to lookup in the cache but since
I don't know the full story...

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285158.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Is it possible to set the session?

2012-01-11 Thread Serban Balamaci
Hi Cosmin,
What have you tried? 
Sending 1. .../frame_page;jsessionid=123 or 2.
.../frame_page?jsessionid=123.
The first option may work while the second it's normal not to have any
impact on the session but can be used to get the sessionid as a parameter.

The 1. option if it works, is not really fullproof, as from my experience if
the user already has a JSESSIONID cookie, the value in the cookie takes
precedence so the user will come in the frame page with an old sessionid,
but it's simplest.

And since you say that we cannot set cookies for the frame, I'm thinking the
solution is to set the sessionid cookie manually by adding it to the
response from the frame. Since this first request will not have a session
created, we need to force the browser to reload the page/redirect to another
page after we set the session cookie, and the new request will have the
required session with it:

So I'm saying in your frame page page you do something like

FramePage extends WebPage {
...

getRequestCycle().scheduleRequestHandlerAfterCurrent(new
RedirectRequestHandler(/page_to_redirect_after_set_session) {
@Override
public void respond(IRequestCycle requestCycle) {

WebResponse response =
(WebResponse)requestCycle.getResponse();
String sessionId =
getRequest().getQueryParameters().getParameterValue(sessionId).toString();
Cookie cookie = new Cookie(JSESSIONID, sessionId);
cookie.setMaxAge(-1);

response.addCookie(cookie);
super.respond(requestCycle);
}
});
}

Take care that if you decide on throwing RestartResponseException instead it
does a restart of the old response so your addCookie command will be lost.

Firebug is a great tool that helps you in this, as you will need to look on
the response for Set-Cookie with JSESSIONID response from the frame page.


PS: Yes, I'm from Romania.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285390.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



RE: Is it possible to set the session?

2012-01-11 Thread Serban Balamaci
You need two requests because in the first one you don't have yet have any
session attached to the request you make to the server. And the server
response will just be to attach JSESSIONID cookie and tell the browser to
repeat the first request with the JSESSION cookie attached(you can redirect
to the same page or another). So now this new request has the sessionid you
require.

In 1.4 I think you can throw a RedirectToUrlException but take a look at
what/how it does it because I see it extends
AbstractRestartResponseException and if you set the cookie before you throw
it, I'm pretty sure it will reset the addCookie method from the response, so
you may have to override it. 

Again firebug will show you if the cookie was set or not.



-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Is-it-possible-to-set-the-session-tp4281720p4285767.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: AW: adjust my web application for smartphone like iPhone

2011-12-27 Thread Serban Balamaci
Hi,
The way I do this is to use the style attribute in the wicket session.
Wicket's default ResourceStreamLocator looks for files with the pattern
filename_style_locale.html and falls back to filename.html

So I have a RequestCycleListener that decides based on headers what type of
a request it is, and sets the style on the session, say for ex. mobile. 
Wicket in turn serves pages TemplatePage_mobile.html if it finds it,
otherwise it falls back to TemplatePage.html
So I can contribute the mobile.css and have a complete custom mobile view of
the page in a customized _mobile.html if I need to, otherwise the same
version used for desktop is being served.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/adjust-my-web-application-for-smartphone-like-iPhone-tp4235060p4236699.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Overridable css resource

2011-12-26 Thread Serban Balamaci
Hi Martin,
That's a good solution, currently I keep the response.renderCSSReference(new
CustomCssResourceReference(front.css)) but implement a custom
DecoratingHeaderResponse to chose if I return instead of the string the
original packaged css resource in the war file.

DecoratingHeaderResponse 
public void renderCSSReference(ResourceReference reference) {
if(reference.getScope()) and if the css file is available do a
super.renderCSS(reference.getName()) and if not return a new
CssResourceReference(reference.getScope(), reference.getName())


However I was not fully confident about this approach of rendering the css
string, because Wicket cannot apply the caching strategy addition of a
IStaticCacheableResource.

Right now I mounted a that takes the name of the resource from the url.
app.mountResource(/custom/css/${name}, new CustomDirResourceReference());
to solve any requests for /custom/css/front.css

but also have a custom ResourceReferenceRegistry that automatically creates
the ResourceReference for CustomCssResourceReferences:
protected ResourceReferenceRegistry newResourceReferenceRegistry() {
return new ResourceReferenceRegistry() {
@Override
protected ResourceReference
createDefaultResourceReference(ResourceReference.Key key) {
if(key.getScope().equals(CustomCssResource.class.getName()))
{
return new CustomCssResourceReference(key.getName());
}
return super.createDefaultResourceReference(key);
}
};
}

I only need to solve the fact that it mounts it to a package
wicket/resource/com.dada.web.frontend.resource.CustomCssResource/front-ver-1324746271000.css
and not to a nice url perhaps something like
getSharedResources().putClassAlias()

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Overridable-css-resource-tp4229370p4235219.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Overridable css resource

2011-12-23 Thread Serban Balamaci
Hi all,
I'm trying to serve some css files from a custom dir outside the  web dir.
It should get a little more complicated that I'd want to fallback to serve
the file from a package location if it's not found in the custom-css folder,
but let's keep it simple first.

I've created a class
public class CustomCssResource extends AbstractResource implements
IStaticCacheableResource {
public CustomCssResource(String path) {
this.path = path;
}
...
} 
that returns the css file found at path location.

And public class CustomCssResourceReference extends ResourceReference {
public CustomCssResourceReference(String name) {
super(scope, custom-css-dir/ + name);
}
public IResource getResource() {
return new CustomCssResource(name);
}
}

In pages I do something like this:
response.renderCSSReference(new CustomCssResourceReference(front.css));

Problem is that I'd want to mount this serving of resources from
/customcss
But how should this be done? Because I cannot just do 
app.mountResource(/customcss, new CustomCssResourceReference(???));

Should I bind as SharedResources all css files instead of using
CustomCssResourceReference?

Thanks.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Overridable-css-resource-tp4229370p4229370.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: usage of JavascriptFilteredIntoFooterHeaderResponse

2011-12-18 Thread Serban Balamaci
Hi Robert,
Did someone offer you an answer with the fact that the class
JavaScriptFilteredIntoFooterHeaderResponse is final?
I've got the exact same question. 
I mean surely I don't want ALL my JS to end up in the footer like
JavaScriptFilteredIntoFooterHeaderResponse method seems to be doing:

protected JavaScriptAcceptingHeaderResponseFilter createFooterFilter(String
footerBucketName) {
return new JavaScriptAcceptingHeaderResponseFilter(footerBucketName);
}

but rather override it to implement a more selective filter.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/usage-of-JavascriptFilteredIntoFooterHeaderResponse-tp3302046p4212101.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



ResourceResponse to return error status code but also JSON error message

2011-12-13 Thread Serban Balamaci
Hello,
I'm using an AbstractResource to return JSON entities.

Problem is that it seems you cannot also return an error code and also the
JSON string with detailed message in case of error.
response.setWriteCallback(new WriteCallback()
{
@Override
public void writeData(final Attributes attributes) {
   
((WebResponse)attributes.getResponse()).write(errorResponse);
((WebResponse)attributes.getResponse()).sendError(503,
Logical Error);
}
}

Because sendError begins with a checkHeader() method that throws a Header
was already written to response! error

Any ideas how I can get this working?
Thanks.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/ResourceResponse-to-return-error-status-code-but-also-JSON-error-message-tp4189792p4189792.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Bypass CDATA contribution on script tags

2011-12-10 Thread Serban Balamaci
Hi Martin,
Problem was, the JS dev was specific about not wanting to contribute to the
head portion the JS template.
What I've done for a quick solution is that we moved the js templates in a
separate .tmpl files which sit next to the .html
Then I use a PackageTextTemplate to provide the template string to
replaceComponentTagBody of a WebMarkupContainer.

The template file contains all the embeded in script id=template1 tags.
This way he can keep editing the tmpl file and have it cleanly separated.

Thanks.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Bypass-CDATA-contribution-on-script-tags-tp4176752p4180698.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Bypass CDATA contribution on script tags

2011-12-09 Thread Serban Balamaci
Hi all,
Our javascript developer complains that Wicket automatically adds the CDATA
part whenever it encounters the *script* tag.
He's trying to embed a template in the html file(not in the head section)


and he gets a bunch of CDATA along with the html which will get
multiplied(we're creating a breadcrumb component)


we're using underscore.js and the idea it's based on
http://ejohn.org/blog/javascript-micro-templating/


I've said that the CDATA is there to pass the validation of the html, but he
says html5 is not xhtml and is much looser with validations.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Bypass-CDATA-contribution-on-script-tags-tp4176752p4176752.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Avoid creating an HttpSession before login

2011-12-09 Thread Serban Balamaci
This created session on RestartResponseAtInterceptPageException may also lead
to a possible Session Fixation attack in one that a malicious user tries
to access your site and is redirected to the login page but now with a
session created. The malicious user could then pass to a possible victim the
url to your site but also with the jsessionid of his session also in the
url. The victim user would then authenticate in your site and that session
would be marked as authenticaticated. But since the malicious user also
knows the jsessionid of the now authenticated session, he can also act as on
behalf of the user.

This is another reason why you would may want your LoginPage to be
stateless.

But to prevent such an attack reassigning a sessionid would solve this
attack.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Avoid-creating-an-HttpSession-before-login-tp4176286p4178605.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket 1.5 PageParameters vs IRequestParameters question.

2011-04-12 Thread Serban Balamaci
Hello Pedro,
In my mind IRequestParameters and PageParameters should have stemmed from a
common interface, extend some even generic one like(IKeyValues, IParams) but
I trust you guys see the bigger picture maybe IRequestParameters is a very
generic thing that doesn't have to mean a page's parameters.

By 
IRequestParameters interface has PageParameters correspondent API to access 
page parameters. Can be accessed like: 
RequestCycle.get().getRequest().getQueryParameters() you mean that
IRequestParameters has methods present in PageParameters? (yes I know, that
why I thought the methods could have been shared in a common interface).

If you want to recreate page parameters for some request, you can use the 
PageParametersEncoder. It seems that PageParametersEncoder handles how the
parameters are rendered in the url(declared somehow like mounting pages) and
I guess it does not have access to the original page parameters. And not all
the parameters must be cloned, some must get overwritten and reflect the new
state of the page.

What I had in the original code is that I would have a helper method:
public static PageParameters keepPageParameters(PageParameters pageParams,
String[] paramNamesToKeep) {
// iterate through pageParams and recreate those with matching names
}

and pass these parameters to bookmarkablepagelinks. I would use this method
from PageParameters coming both from super(PageParameters) and
RequestCycle.get().getPageParameters().

Now I must have two methods one that handles PageParameters and one that
handles , actually I have just  one method now
public static PageParameters keepRequestPageParameters(IRequestParameters
pageParams, String[] paramNamesToKeep) and always get my parameters from
RequestCycle.get().getRequest().getQueryParameters() not from 

but it would have been better in my opinion to have a 
public static PageParameters keepPageParameters(IParams pageParams, String[]
paramNamesToKeep) {
}

Btw does someone have a better way of keeping page parameters from one page
to another. I like the utility method that I see in the page I'm working on
what parameters I'm working with.

I have not looked upon the new request cycle, I plan to, as migration to 1.5
is triggered by the feeling that somehow stateless ajax behaviours would be
easier to implement in 1.5. My current approach to  was to have zero compile
errors and then understand what is changed internally.

Regards


-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-PageParameters-vs-IRequestParameters-question-tp3442239p3444058.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket 1.5 PageParameters vs IRequestParameters question.

2011-04-11 Thread Serban Balamaci
Hello everybody, I''m in the process of migrating an app from 1.4 to 1.5-RC3
 
I see that the PageParameters and IRequestParameters are pretty separate
things now. Any reason why it's done this way and why they not extend a
Common Interface that exposes methods like getParameterNames
getParameterValue. 

Because I  have this usecase: I try to keep a stateless page by heavily
encoding state in the pageParameters, so on different actions I'm resending
parameters that I initially received on this page.
In 1.4 there was no difference in handling parameters that came from
constructor WebPage(final PageParameters parameters) and those that were
received in the request( RequestCycle.get().getPageParameters()) and there
was very easy to reuse the same parameters received in the request - clone 

Is it an easy method to create PageParameters from IRequestParameters(which
I get from RequestCycle.get().getRequest().getRequestParameters()), or
iterating and adding them to PageParameters is the way to go?

Thank you.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-1-5-PageParameters-vs-IRequestParameters-question-tp3442239p3442239.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Stateless Wicket and Ajax

2011-03-13 Thread Serban Balamaci
Hello everybody.
It is indeed as Robert is saying. And after changing the code, it works
Component component = page.get(pageRelativeComponentPath);

// See {@link
//
BookmarkableListenerInterfaceRequestTarget#processEvents(RequestCycle)}
// We make have to try to look for the component twice, if we hit
the
// same condition.
if (component == null) {
page.prepareForRender(false);
component = page.get(pageRelativeComponentPath);
//Component no longer null


Looking at BookmarkableListenerInterfaceRequestTarget#processEvents we
find the comment:
this is quite a hack to get components in repeater work. But it still can
fail if the repeater is a paging one or on every render it will generate new
index for the items...

I was trying to implement a comment system for articles. The stateless ajax
buttons would be reply buttons for comments that can span multi levels. I
can't feel confident that the comment hierarchy will not change by the time
the user clicks reply. Currently I'm thinking of moving the reply as a
behaviour outside the repeater, and use JQuery to pass the comment id to
that behaviour so I can know to which comment the user is replying.


Thanks everybody.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Stateless-Wicket-and-Ajax-tp3348266p3352490.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Stateless Wicket and Ajax

2011-03-12 Thread Serban Balamaci
Yes I was looking at jolira tools, but I get the exception unable to find
component   and looking at the source:
final Component component = page.get(pageRelativeComponentPath); 
if (component == null) {
throw new WicketRuntimeException(unable to find component with
path 
+ pageRelativeComponentPath
+  on stateless page 
+ page
+  it could be that the component is inside a
repeater make your component return false in getStatelessHint());
}

and yes I'm using it inside a ListView, so this means that
StatelessAjaxFallbackLink cannot be used inside a repeater(and have a
stateless page)?

Martin I see that you have not replaced StatelessWebRequestCodingStrategy in
your  https://github.com/martin-g/wicket-stateless
https://github.com/martin-g/wicket-stateless . So the problem with the ajax
link in the repeater remains?

I'm trying to understand if there is a known case of not using
StatelessAjaxFallbackLink inside repeaters. Or is it somehow my fault? My
repeater model does not change beetween renderings so the
pageRelativeComponentPath should be the same.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Stateless-Wicket-and-Ajax-tp3348266p3350179.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Stateless Wicket and Ajax

2011-03-11 Thread Serban Balamaci
Hello everybody.
I'm interested in Wicket for a public site. I want to use stateless pages in
order to have nice looking pages indexed by Google(no JSESSIONID in the url)

There is an approach to remove JSESSIONID from the url for search bots but I
do not like it since that would mean that any link to another page contained
in that page would cause a Page Expired error since the session is lost thus
no deep page navigation.

So how would you implement AJAX since having AjaxLinks and even
AjaxEventBehaviour makes a stateless page become statefull? 
There is the jolira tools wicket-stateless which provides
StatelessAjaxFallbackLink, but it seems that there is the link is inside a
repeater it could be that the component is inside a repeater make your
component return false in getStatelessHint() which pretty much means that
the page becomes statefull.

I'm even considering using JQuery for AJAX and so looked at WiQuery with
WiQueryAbstractAjaxBehavior but alas it extends AbstractDefaultAjaxBehavior. 

So perhaps using JQuery ajax requesting from with a generic WebPage serving
wicket panels based on page parameters? This seems a poor approach.

In the end, what other framework would you recommend? Preferably JAVA based.
Maybe Play framework(not a fan of the templating sintax)?  

Thank you.

-
http://balamaci.wordpress.com 
--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Stateless-Wicket-and-Ajax-tp3348266p3348266.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Call Ajax on Parent Page from Popup page.

2010-05-10 Thread Serban Balamaci

Thank you Jeremy,
It's working this way, although that label was a simple container for the
script:
script language=JavaScript wicket:id=refreshJS/script
I do not understand why it was not working. 

Now I have a problem in the sense that it's working only let's say the
first time. Because I get:
Ajax GET stopped because of precondition check,
url:?wicket:interface=:13:right-content-panel-container:right-content-panel-id:details-panel:tabs:panel:create-proposal-panel::IBehaviorListener:0:-1

I believe it's because this behavior is added in an ajax tab panel. If I
change the tab panel and then return back, I guess the behavior it's being
added again in the header and somehow gets mixed up. 

If I do not change tab panels it works every time.

It's not related to calling the function from the popup, I get this error
even if I do call the method as onclick in the same page.


-
http://balamaci.wordpress.com http://balamaci.wordpress.com 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Call-Ajax-on-Parent-Page-from-Popup-page-tp2134034p2165281.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Call Ajax on Parent Page from Popup page.

2010-05-10 Thread Serban Balamaci

I have solved it by overiding getPreconditionScript() in the behaviour to
return return true;:
protected CharSequence getPreconditionScript() {
return return true;
}

I hope I do not run into any problems with this.

Cheers.


-
http://balamaci.wordpress.com http://balamaci.wordpress.com 
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Call-Ajax-on-Parent-Page-from-Popup-page-tp2134034p2165297.html
Sent from the Wicket - User mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Call Ajax on Parent Page from Popup page.

2010-05-07 Thread Serban Balamaci

Hello.

I have a case where I'm trying to refresh the parent page from a popup page.

On the parent page I have:

AbstractDefaultAjaxBehavior clientSideCallingBehavior =
new AbstractDefaultAjaxBehavior() {
protected void respond(AjaxRequestTarget target) {
System.out.println(Refreshing ...);
}
};

Label lblCallback = new Label(refreshJS, new 
LoadableDetachableModel() {


protected Object load() {
String callbackScript = var callRefresh = 
function(value) { wicketAjaxGet('

+ clientSideCallingBehavior.getCallbackUrl(false)
+ ', null, null, function() {return true;}); 
return false;};

return callbackScript;
}
});
lblCallback.add(clientSideCallingBehavior);
lblCallback.setEscapeModelStrings(false);
add(lblCallback);


In the popup page I have on a link call the callRefresh method:
AjaxLink cancel = new AjaxLink(cancel) {
public void onClick(AjaxRequestTarget target) {
target.appendJavascript(window.opener.callRefresh(););
}
};

org.apache.wicket.protocol.http.request.InvalidUrlException: 
org.apache.wicket.WicketRuntimeException: component 
right-content-panel-container:right-content-panel-id:details-panel:tabs:panel:refreshJS 
not found on page 
com.asf.ufe.web.pages.evaluation.AccountEvaluationPage[id = 2], listener 
interface = [RequestListenerInterface name=IBehaviorListener, 
method=public abstract void 
org.apache.wicket.behavior.IBehaviorListener.onRequest()]
at 
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:262)

at org.apache.wicket.RequestCycle.step(RequestCycle.java:1310)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
at 
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
at 
org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1115)
Caused by: org.apache.wicket.WicketRuntimeException: component 
right-content-panel-container:right-content-panel-id:details-panel:tabs:panel:refreshJS 
not found on page 
com.asf.ufe.web.pages.evaluation.AccountEvaluationPage[id = 2], listener 
interface = [RequestListenerInterface name=IBehaviorListener, 
method=public abstract void 
org.apache.wicket.behavior.IBehaviorListener.onRequest()]
at 
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerInterfaceTarget(AbstractRequestCycleProcessor.java:426)
at 
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedPage(AbstractRequestCycleProcessor.java:471)
at 
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequestCycleProcessor.java:144)

... 26 more

If I do make the call to callRefresh from the Parent Page(the same page 
where the behaviour is located) with onclick=callRefresh();return 
false; it works.


Do you have any ideeas? Does it have to be the last page in the PageMap 
for ajax to work?

Thanks.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Model to use for static Label text

2010-02-23 Thread Serban Balamaci

Yes you are right, if we set the variable in the constructor but make it null
on detach, we will not have it on getObject on next render, so we need to
keep a reference to it. I guess the only choice would be to the
LoadableDetachableModel, which could be thought detrimental for code
clearness outweighing the storage impact, maybe would make sense maybe for a
large string - for ex. setting some generated javascript on a label. 
But is a page consider stateless if we only have this static string ending
in the page store?


bgooren wrote:
 
 Well, a couple of strings more or less usually don't make that much of a
 difference. I personally prefer to save some typing and have better
 readability then to save a few bytes here and there.
 
 Furthermore, if you were to create an implementation of IModel
 specifically for this case, you would always need to store the string as
 an instance variable, thus creating the problem you are trying to solve.
 
 
 Serban Balamaci wrote:
 
 Hello.
 I've always used
 add(new Label(alabel, new Model(A message)); - does this not save the
 A message string in the page store?
 Is it not better to do add(new Label(alabel, new
 LoadableDetachableModelString() {
 
 @Override
 protected String load() {
 return A message;
 }
 })); - while this option does not save it in the page store.
 Is it because of the coding amount that nobody is using this? I guess not
 because we could extend IModel and create a label model with a string
 property that is cleared on detach.
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Model-to-use-for-static-Label-text-tp27695054p27700379.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Model to use for static Label text

2010-02-22 Thread serban . balamaci
Hello.
I've always used
add(new Label(alabel, new Model(A message)); - does this not save the
A message string in the page store?
Is it not better to do add(new Label(alabel, new
LoadableDetachableModelString() {

@Override
protected String load() {
return A message;
}
})); - while this option does not save it in the page store.
Is it because of the coding amount that nobody is using this? I guess not
because we could extend IModel and create a label model with a string
property that is cleared on detach.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Wicket, Ajax and JSON

2009-07-31 Thread Serban Balamaci
Hello. I'm trying to create a wicket component out of FlexiGrid
http://www.flexigrid.info/ .

The javascript for the component requires an address from which it will
receive data in the form of a JSON response.

 

I'm not sure what is the best way to go about it. Simple and most ugly
approach would be to have something of a Controller Page

a page that takes parameters such as the entity that is being retrieved and
also paging info, sort order, etc and returns the JSON response.

I do not like this aproach as, most obvious reason is that it would not be
obvious from the component what you need to do in order to get it to work.

 

I would much more preffer to having a callback method that returns the json.
So I have created a

 

AbstractDefaultAjaxBehavior clientConnectBehavior = new
AbstractDefaultAjaxBehavior() {

 

protected void respond(AjaxRequestTarget ajaxRequestTarget) {

   ajaxRequestTarget.prependJavascript({page: 1, total: 239
});

 

}

and used clientConnectBehavior.getCallbackUrl() as the url passed to the
flexigrid.

 

Unfortunately the problem is the response when invoked is wrapped in a
ajax-responseevaluate encoding=wicket1

?xml version=1.0 encoding=UTF-8?

ajax-responseevaluate encoding=wicket1![CDATA[{page: 1,total:
239}]]/evaluate/ajax-response

 

So my question is how to get only the JSON part without the ?xml version.,
ajax-response . and CDATA decoration. Can it be bypassed? Shoul I
override something in AbstractDefaultAjaxBehavior? 

Or any other ideea to go about the problem.

 

Thank you,

 

Serban



RE: Wicket, Ajax and JSON

2009-07-31 Thread Serban Balamaci
Hello John.

This I would put in the same category as the Controller Page solution. And
well, that kind of separation will not make a nice reusable component. I
want in the end to get maybe even with something of a model behind it and
not have such a separation, although I guess the model of the component
would know to pass the parameters to the JSON servlet. And to get over the
problem of authentication and injection of other beans that can even be
coded as a Wicket Page.

Curently I'm looking in the direction of not extending
AbstractDefaultAjaxBehavior but looking more at the base classes in
AbstractDefaultAjaxBehavior and implement something like

public final void respond(final RequestCycle requestCycle)
{
final Application app = Application.get();

// Determine encoding
final String encoding =
app.getRequestCycleSettings().getResponseRequestEncoding();

// Set content type based on markup type for page
final WebResponse response =
(WebResponse)requestCycle.getResponse();
response.setCharacterEncoding(encoding);
response.setContentType(text/xml; charset= + encoding);

response.write(json data);
 }



-Original Message-
From: John Armstrong [mailto:siber...@siberian.org] 
Sent: 31 iulie 2009 17:33
To: users@wicket.apache.org
Subject: Re: Wicket, Ajax and JSON

Maybe you are trying to drive screw into a board with a hammer?
I recommend just creating servlet to serve up these json style responses and
then use the excellent json.org libraries(instead of hand constructing json
transform your data structures into json automatically). The only issue
you'll have here is authentication so if you need a unified auth system you
will need to get that up and running in your json responder (wicket would do
it automatically).

 filter-mapping

filter-nameWebApplication/filter-name

url-pattern/*/url-pattern

  /filter-mapping



 servlet

descriptionThis is the JSON Gatewayn/description

display-nameJSON Gateway/display-name

servlet-nameJsonGateway/servlet-name

servlet-classyour.package.json.JsonGateway/servlet-class

  /servlet

servlet-mapping

servlet-namegetSomeData/servlet-name

url-pattern/json/getSomeData/url-pattern

  /servlet-mapping


John-

On Fri, Jul 31, 2009 at 6:34 AM, Serban Balamaci
serban.balam...@asf.rowrote:

 Hello. I'm trying to create a wicket component out of FlexiGrid
 http://www.flexigrid.info/ .

 The javascript for the component requires an address from which it will
 receive data in the form of a JSON response.



 I'm not sure what is the best way to go about it. Simple and most ugly
 approach would be to have something of a Controller Page

 a page that takes parameters such as the entity that is being retrieved
and
 also paging info, sort order, etc and returns the JSON response.

 I do not like this aproach as, most obvious reason is that it would not be
 obvious from the component what you need to do in order to get it to work.



 I would much more preffer to having a callback method that returns the
 json.
 So I have created a



 AbstractDefaultAjaxBehavior clientConnectBehavior = new
 AbstractDefaultAjaxBehavior() {



protected void respond(AjaxRequestTarget ajaxRequestTarget) {

   ajaxRequestTarget.prependJavascript({page: 1, total:
239
 });



}

 and used clientConnectBehavior.getCallbackUrl() as the url passed to the
 flexigrid.



 Unfortunately the problem is the response when invoked is wrapped in a
 ajax-responseevaluate encoding=wicket1

 ?xml version=1.0 encoding=UTF-8?

 ajax-responseevaluate encoding=wicket1![CDATA[{page: 1,total:
 239}]]/evaluate/ajax-response



 So my question is how to get only the JSON part without the ?xml
 version.,
 ajax-response . and CDATA decoration. Can it be bypassed? Shoul I
 override something in AbstractDefaultAjaxBehavior?

 Or any other ideea to go about the problem.



 Thank you,



 Serban




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Wicket, Ajax and JSON

2009-07-31 Thread serban . balamaci
Thanks guys, loved the AbstractAjaxBehavior solution, and by the way
jqgrid seems to be more active and the way to go(thanks for pointing it
Richard). Keeping fingers crossed for wiQuery and if they even bring the
flexi or jqgrid to wicket it's gonna prove you can have awesome visual
components in Wicket too.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org