Solved the problem.
We need to extend WebRequestCycleProcessor and return that from our
Application class. We also need to extend WebRequestCodingStrategy and
return that from our WebRequestCycleProcessor . Following is the code.
public class MyWicketApp extends WebApplication{
protected IRequestCycleProcessor newRequestCycleProcessor(){
return new MyWebRequestCycleProcessor();
}
}
public class MyWebRequestCycleProcessor extends WebRequestCycleProcessor{
protected IRequestCodingStrategy newRequestCodingStrategy(){
return new MyWebRequestCodingStrategy("/app");
}
}
The real stuff is in the following class.
public class MyWebRequestCodingStrategy extends WebRequestCodingStrategy{
// The path to appent to the contextPath to get the filter path.
private String wicketFilterPath;
public MyWebRequestCodingStrategy(String wicketFilterPath){
this.wicketFilterPath = wicketFilterPath;
}
protected CharSequence encode(RequestCycle requestCycle,
IListenerInterfaceRequestTarget requestTarget){
// We know that WebRequestCodingStrategy#encode(RequestCycle,
IListenerInterfaceRequestTarget) returns a AppendingStringBuffer.
AppendingStringBuffer url =
(AppendingStringBuffer)super.encode(requestCycle, requestTarget);
if(isRequestFromDIV((WebRequest)requestCycle.getRequest())){
if(url.indexOf("?") > -1){
url.append("&");
}
url.append("pageLoadedInDiv=true");
* String urlPrefix = getRequestURI((WebRequest)requestCycle.getRequest());
//TODO: optimize. Work with AppendingStringBuffer.value().
url = new AppendingStringBuffer(urlPrefix + url);*
}
return url;
}
protected CharSequence encode(RequestCycle requestCycle,
ISharedResourceRequestTarget requestTarget){
AppendingStringBuffer url =
(AppendingStringBuffer)super.encode(requestCycle, requestTarget);
// Make an absolut reference to the resource. Reletive will not work.
String urlPrefix =
getContextPath((WebRequest)requestCycle.getRequest())+wicketFilterPath+'/';
//TODO: optimize.
url = new AppendingStringBuffer(urlPrefix+url);
return url;
}
private String getContextPath(WebRequest request) {
return request.getHttpServletRequest().getContextPath();
}
private String getRequestURI(WebRequest request) {
return request.getHttpServletRequest().getRequestURI();
}
private boolean isRequestFromDIV(WebRequest request) {
// To identify our special request. We dont need this if we choose to make
every path absolute.
return "true".equals(request.getParameter("pageLoadedInDiv"));
}
}
The html file.
http://www.w3.org/1999/xhtml";>
http://wicket.apache.org";>
]^]^>*/
function loadWicketContainer(){
*new Ajax.Updater('wicketContainer',
'/wsb/app/page_1.jas?pageLoadedInDiv=true', { method: 'get' }); *
}
Thanks
Avinash P
On Wed, Aug 26, 2009 at 7:09 AM, Avinash palicharla <
avinashredd...@gmail.com> wrote:
> Thank you :)
>
> Yes, the page comes from the same server.
>
> I got the Head to work by including the following.
>
> =
> src="app/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js">
>
> src="app/resources/org.apache.wicket.ajax.WicketAjaxReference/wicket-ajax.js">
>
> src="app/resources/org.apache.wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js">
>
> id="wicket-ajax-debug-enable">]^]^>*/
>