/** * Safe version of {@link #getProcessor()} that throws an exception when the processor is null. * * @return the request processor */ private final IRequestCycleProcessor safeGetRequestProcessor() { IRequestCycleProcessor processor = getProcessor(); if (processor == null) { throw new WicketRuntimeException("request cycle processor must be not-null"); } return processor; }
/** * Safe version of {@link #getProcessor()} that throws an exception when the processor is null. * * @return the request processor */ private final IRequestCycleProcessor safeGetRequestProcessor() { IRequestCycleProcessor processor = getProcessor(); if (processor == null) { throw new WicketRuntimeException("request cycle processor must be not-null"); } return processor; }
/** * Returns an encoded URL that references the given request target and clears the * urlForNewWindowEncoding flag. * * @param requestTarget * the request target to reference * @return a URL that references the given request target */ private final CharSequence encodeUrlFor(final IRequestTarget requestTarget) { CharSequence url = getProcessor().getRequestCodingStrategy().encode(this, requestTarget); urlForNewWindowEncoding = false; return url; }
/** * * @param location * @return relative path */ private static final String returnRelativePath(String location) { // WICKET-59 allow external URLs, WICKET-612 allow absolute URLs. if (location.startsWith("http://") || location.startsWith("https://") || location.startsWith("/")) { return location; } else { return RequestCycle.get() .getProcessor() .getRequestCodingStrategy() .rewriteStaticRelativeUrl(location); } }
/** * * @param location * @return relative path */ private static final String returnRelativePath(String location) { // WICKET-59 allow external URLs, WICKET-612 allow absolute URLs. if (location.startsWith("http://") || location.startsWith("https://") || location.startsWith("/")) { return location; } else { return RequestCycle.get() .getProcessor() .getRequestCodingStrategy() .rewriteStaticRelativeUrl(location); } }
/** {@inheritDoc} **/ @Override public void onComponentTag(Component component, ComponentTag tag) { // get path final String path = contextRelativePath.getObject(); final String rewritten = component.getRequestCycle() .getProcessor() .getRequestCodingStrategy() .rewriteStaticRelativeUrl(path); tag.put("src", rewritten); }
/** * Returns an encoded URL that references the given request target and clears the * urlForNewWindowEncoding flag. * * @param requestTarget * the request target to reference * @return a URL that references the given request target */ private final CharSequence encodeUrlFor(final IRequestTarget requestTarget) { CharSequence url = getProcessor().getRequestCodingStrategy().encode(this, requestTarget); url = cutNilChar(url); urlForNewWindowEncoding = false; return url; }
public void respond(RequestCycle requestCycle) { if (pageClassRef != null && pageClassRef.get() != null) { if (requestCycle.isRedirect()) { IRequestCycleProcessor processor = requestCycle.getProcessor(); String redirectUrl = processor.getRequestCodingStrategy() .encode(requestCycle, this) .toString(); // IE does not understand "./" in a path, just "." is okay. if (redirectUrl.startsWith("./")) { redirectUrl = redirectUrl.length() == 2 ? "." : redirectUrl.substring(2); } requestCycle.getResponse().redirect(redirectUrl); } else { // Let the page render itself getPage(requestCycle).renderPage(); } } }
@Override public void onComponentTag(Component component, ComponentTag tag) { IRequestCodingStrategy coder = RequestCycle.get() .getProcessor() .getRequestCodingStrategy(); // Modify all relevant attributes for (int i = 0; i < attributeNames.length; i++) { String attrName = attributeNames[i]; String attrValue = tag.getAttributes().getString(attrName); if ((attrValue != null) && (attrValue.startsWith("/") == false) && (attrValue.indexOf(":") < 0) && !(attrValue.startsWith("#"))) { tag.getAttributes().put(attrName, coder.rewriteStaticRelativeUrl(attrValue)); } } } };
/** * @see org.apache.wicket.IRequestTarget#respond(org.apache.wicket.RequestCycle) */ public void respond(RequestCycle requestCycle) { if (pageClassRef != null && pageClassRef.get() != null) { if (requestCycle.isRedirect()) { IRequestCycleProcessor processor = requestCycle.getProcessor(); String redirectUrl = processor.getRequestCodingStrategy() .encode(requestCycle, this).toString(); requestCycle.getResponse().redirect(redirectUrl); } else { // Let the page render itself getPage(requestCycle).renderPage(); } } }
.getProcessor() .getRequestCodingStrategy() .rewriteStaticRelativeUrl(redirectUrl.substring(1));
IRequestCycleProcessor processor = RequestCycle.get().getProcessor(); final IRequestCodingStrategy encoder = processor.getRequestCodingStrategy(); if (encoder == null)
IRequestCycleProcessor processor = RequestCycle.get().getProcessor(); final IRequestCodingStrategy encoder = processor.getRequestCodingStrategy(); if (encoder == null)
.getProcessor() .getRequestCodingStrategy() .rewriteStaticRelativeUrl(url);
HttpServletRequest request = webRequest.getHttpServletRequest(); HttpsRequestCycleProcessor processor = (HttpsRequestCycleProcessor)requestCycle.getProcessor(); Integer port = null; if (protocol == Protocol.HTTP)
/** * Method for dispatching/calling a interface on a page from the given url. Used by * {@link org.apache.wicket.markup.html.form.Form#onFormSubmitted()} for dispatching events * * @param page * The page where the event should be called on. * @param url * The url which describes the component path and the interface to be called. */ private void dispatchEvent(final Page page, final String url) { RequestCycle rc = RequestCycle.get(); IRequestCycleProcessor processor = rc.getProcessor(); final RequestParameters requestParameters = processor.getRequestCodingStrategy().decode( new FormDispatchRequest(rc.getRequest(), url)); IRequestTarget rt = processor.resolve(rc, requestParameters); if (rt instanceof ListenerInterfaceRequestTarget) { ListenerInterfaceRequestTarget interfaceTarget = ((ListenerInterfaceRequestTarget)rt); interfaceTarget.getRequestListenerInterface().invoke(page, interfaceTarget.getTarget()); } else { throw new WicketRuntimeException( "Attempt to access unknown request listener interface " + requestParameters.getInterfaceName()); } }
/** * Method for dispatching/calling a interface on a page from the given url. Used by * {@link org.apache.wicket.markup.html.form.Form#onFormSubmitted()} for dispatching events * * @param page * The page where the event should be called on. * @param url * The url which describes the component path and the interface to be called. */ private void dispatchEvent(final Page page, final String url) { RequestCycle rc = RequestCycle.get(); IRequestCycleProcessor processor = rc.getProcessor(); final RequestParameters requestParameters = processor.getRequestCodingStrategy().decode( new FormDispatchRequest(rc.getRequest(), url)); IRequestTarget rt = processor.resolve(rc, requestParameters); if (rt instanceof IListenerInterfaceRequestTarget) { IListenerInterfaceRequestTarget interfaceTarget = ((IListenerInterfaceRequestTarget)rt); interfaceTarget.getRequestListenerInterface().invoke(page, interfaceTarget.getTarget()); } else { throw new WicketRuntimeException( "Attempt to access unknown request listener interface " + requestParameters.getInterfaceName()); } }
IRequestCodingStrategy requestCodingStrategy = requestCycle.getProcessor() .getRequestCodingStrategy(); CharSequence path = requestCodingStrategy.pathForTarget(homepageTarget);
IRequestCodingStrategy requestCodingStrategy = requestCycle.getProcessor() .getRequestCodingStrategy(); CharSequence path = requestCodingStrategy.pathForTarget(homepageTarget);
.getProcessor() .getRequestCodingStrategy() .decode(request);