Problem is solved now:
i extract the application-relative-path with:
String path = Strings.stripJSessionId(request.getRequestURI());
the trick is to overwrite method "onComponentTag(ComponentTag tag)" of class
ResourceLink and prepend the application -relative path so i end up with
e.g.:
/mybaseurl/mypath/?wicket:interface=:85:border:_body:dialogContainer:contentPanels:infoTextContentPanel:externalLinks:0:externalLink::IResourceListener::
complete code:
public class CustomResourceLink extends ResourceLink<Void> {
private static final long serialVersionUID = -4848428865939435963L;
private boolean applicationRelative = false;
private PopupSettings popupSettings = null;
public CustomResourceLink (String id, Resource resource) {
super(id, resource);
}
@Override
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
if (isLinkEnabled() == false)
{
disableLink(tag);
}
else
{
if (getURL() != null)
{
String url = getURL().toString();
if (applicationRelative)
{
if (url.length() > 0 && url.charAt(0)
== '/')
{
url = url.substring(1);
}
url = RequestUtils.getBaseUrl(this) +
url;
}
// if the tag is an anchor proper
if (tag.getName().equalsIgnoreCase("a") ||
tag.getName().equalsIgnoreCase("link") ||
tag.getName().equalsIgnoreCase("area"))
{
// generate the href attribute
tag.put("href", Strings.replaceAll(url,
"&", "&"));
// Add any popup script
if (popupSettings != null)
{
// NOTE: don't encode to HTML
as that is not valid
// JavaScript
tag.put("onclick",
popupSettings.getPopupJavaScript());
}
}
else
{
// generate a popup script by asking
popup settings for one
if (popupSettings != null)
{
popupSettings.setTarget("'" +
url + "'");
String popupScript =
popupSettings.getPopupJavaScript();
tag.put("onclick", popupScript);
}
else
{
// or generate an onclick JS
handler directly
tag.put("onclick",
"window.location.href='" + url + "';return
false;");
}
}
}
if (popupSettings != null)
{
IPageMap popupPageMap =
popupSettings.getPageMap(this);
if (popupPageMap != null &&
popupPageMap.getName() != null)
{
tag.put("target",
popupPageMap.getName());
}
}
}
}
public void setApplicationRelative(boolean contextRelative) {
this.applicationRelative = contextRelative;
}
}
public class RequestUtils {
public static String getBaseUrl(Component comp) {
ServletWebRequest servletWebRequest = (ServletWebRequest) comp
.getRequest();
HttpServletRequest request =
servletWebRequest.getHttpServletRequest();
String path = Strings.stripJSessionId(request.getRequestURI());
return path;
}
}
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/custom-non-wicket-modal-dialog-Problem-with-urls-tp3726196p3735554.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]