/** * Factory method for creating header response * * @return new header response */ protected IHeaderResponse newHeaderResponse() { IHeaderResponse headerResponse = RequestContext.get().getHeaderResponse(); if (headerResponse == null) { // no (portlet) headerResponse override, create a default one headerResponse = new HeaderResponse() { protected Response getRealResponse() { return HtmlHeaderContainer.this.getResponse(); } }; } return headerResponse; }
public static final String encodeResourceURL(String url) { // if it is in portlet environment, just wrap the url in portlet resource url. RequestContext requestContext = RequestContext.get(); if (requestContext.isPortletRequest()) { url = ((PortletRequestContext) requestContext).encodeResourceURL(url).toString(); // use relative url (FIXME: why?) if (url.startsWith("http:") || url.startsWith("https:")) { int offset = url.indexOf('/', 8); if (offset != -1) { url = url.substring(offset); } } } return url; }
realResponse.write("<span id=\"" + RequestContext.get().getNamespace() + "_embedded_head\" style=\"display:none\">"); realResponse.write(output);
protected String getContextRelativeValue(String value) { if ("href".equals(attribute) || "src".equals(attribute)) { RequestContext rc = RequestContext.get(); if (rc.isPortletRequest() && !(value.startsWith("http://") || value.startsWith("https://"))) { if ("href".equals(attribute)) { value = ((PortletRequestContext)rc).encodeRenderURL(value).toString(); } else { value = ((PortletRequestContext)rc).encodeSharedResourceURL(value).toString(); } } } return value; }
/** * Factory method for creating header response * * @return new header response */ protected IHeaderResponse newHeaderResponse() { IHeaderResponse headerResponse = RequestContext.get().getHeaderResponse(); if (headerResponse == null) { // no (portlet) headerResponse override, create a default one headerResponse = new HeaderResponse() { @Override protected Response getRealResponse() { return HtmlHeaderContainer.this.getResponse(); } }; } return headerResponse; }
realResponse.write("<span id=\"" + RequestContext.get().getNamespace() + "_embedded_head\" style=\"display:none\">"); realResponse.write(output);
/** * Checks if <code>value</code> represents a path and if it does transforms it into a relative * path * * @param value * @return value as a relative path or untouched if not a path */ protected String getContextRelativeValue(String value) { if ("href".equals(attribute) || "src".equals(attribute)) { RequestContext rc = RequestContext.get(); if (rc.isPortletRequest() && !(value.startsWith("http://") || value.startsWith("https://"))) { if ("href".equals(attribute)) { value = ((PortletRequestContext)rc).encodeRenderURL(value).toString(); } else { value = ((PortletRequestContext)rc).encodeSharedResourceURL(value).toString(); } } } return value; }
public void sendRedirect(String redirectLocation) throws IOException { RequestContext rc = RequestContext.get(); if (rc instanceof PortletRequestContext) { String wicketUrl = ((PortletRequestContext)rc).getLastEncodedPath(redirectLocation); if (wicketUrl != null) { redirectLocation = wicketUrl; } else { String contextPath = ((PortletRequestContext)rc).getPortletRequest() .getContextPath(); if (redirectLocation.startsWith(contextPath + "/")) { redirectLocation = redirectLocation.substring(contextPath.length()); if (redirectLocation.length() == 0) { redirectLocation = "/"; } } } } super.sendRedirect(redirectLocation); } }
RequestContext rc = RequestContext.get(); if (rc instanceof PortletRequestContext)
if (RequestContext.get().isPortletRequest())
if (RequestContext.get().isPortletRequest())
public AppendingStringBuffer filter(AppendingStringBuffer responseBuffer) { RequestContext rc = RequestContext.get(); if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded()) { deleteFragment(responseBuffer, "<?xml", "?>"); deleteFragment(responseBuffer, "<!DOCTYPE", ">"); deleteOpenTag(responseBuffer, "html"); deleteOpenTag(responseBuffer, "head"); deleteOpenTag(responseBuffer, "body"); } return responseBuffer; }
RequestContext rc = RequestContext.get(); if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded())
/** * @see org.apache.wicket.IResponseFilter#filter(AppendingStringBuffer) */ public AppendingStringBuffer filter(AppendingStringBuffer responseBuffer) { RequestContext rc = RequestContext.get(); if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded()) { deleteFragment(responseBuffer, "<?xml", "?>"); deleteFragment(responseBuffer, "<!DOCTYPE", ">"); deleteOpenTag(responseBuffer, "html"); deleteOpenTag(responseBuffer, "head"); deleteOpenTag(responseBuffer, "body"); } return responseBuffer; }
if (redirectUrl.startsWith("/")) RequestContext rc = RequestContext.get(); String continueTo = null; if (rc.isPortletRequest() && ((PortletRequestContext)rc).isEmbedded())
if (form != null) RequestContext rc = RequestContext.get(); if (rc.isPortletRequest())
if (form != null) RequestContext rc = RequestContext.get(); if (rc.isPortletRequest())
/** * @see org.apache.wicket.behavior.AbstractAjaxBehavior#renderHead(org.apache.wicket.markup.html.IHeaderResponse) */ @Override public void renderHead(IHeaderResponse response) { super.renderHead(response); final IDebugSettings debugSettings = Application.get().getDebugSettings(); response.renderJavascriptReference(WicketEventReference.INSTANCE); response.renderJavascriptReference(WicketAjaxReference.INSTANCE); if (debugSettings.isAjaxDebugModeEnabled()) { response.renderJavascriptReference(JAVASCRIPT_DEBUG); response.renderJavascript("wicketAjaxDebugEnable=true;", "wicket-ajax-debug-enable"); } RequestContext context = RequestContext.get(); if (context.isPortletRequest()) { response.renderJavascript("Wicket.portlet=true", "wicket-ajax-portlet-flag"); } }
/** * @see org.apache.wicket.behavior.AbstractAjaxBehavior#renderHead(org.apache.wicket.markup.html.IHeaderResponse) */ public void renderHead(IHeaderResponse response) { super.renderHead(response); final IDebugSettings debugSettings = Application.get().getDebugSettings(); response.renderJavascriptReference(WicketEventReference.INSTANCE); response.renderJavascriptReference(WicketAjaxReference.INSTANCE); if (debugSettings.isAjaxDebugModeEnabled()) { response.renderJavascriptReference(JAVASCRIPT_DEBUG); response.renderJavascript("wicketAjaxDebugEnable=true;", "wicket-ajax-debug-enable"); } RequestContext context = RequestContext.get(); if (context.isPortletRequest()) { response.renderJavascript("Wicket.portlet=true", "wicket-ajax-portlet-flag"); } }
if (form != null) RequestContext rc = RequestContext.get(); if (rc.isPortletRequest())