/** * Returns context path and servlet path concatenated, typically * /applicationClassName/applicationClassName * * @return The path value * @see javax.servlet.http.HttpServletRequest#getRequestURI() */ @Override public String getRequestURI() { if (url == null) { return getContextPath() + getServletPath(); } else { int index = url.indexOf("?"); if (index != -1) { return url.substring(0, index); } } return url; }
/** * Returns context path and servlet path concatenated, typically * /applicationClassName/applicationClassName * * @return The path value * @see javax.servlet.http.HttpServletRequest#getRequestURI() */ @Override public String getRequestURI() { if (url == null) { return getContextPath() + getServletPath(); } else { int index = url.indexOf("?"); if (index != -1) { return url.substring(0, index); } } return url; }
/** * Try to build a rough URL. * * @return The url * @see javax.servlet.http.HttpServletRequest#getRequestURL() */ @Override public StringBuffer getRequestURL() { StringBuffer buf = new StringBuffer(); buf.append("http://localhost"); buf.append(getContextPath()); if (getPathInfo() != null) { buf.append(getPathInfo()); } // No query parameter. See // http://download.oracle.com/javaee/5/api/javax/servlet/http/HttpServletRequest.html#getRequestURL() return buf; }
/** * Try to build a rough URL. * * @return The url * @see javax.servlet.http.HttpServletRequest#getRequestURL() */ @Override public StringBuffer getRequestURL() { StringBuffer buf = new StringBuffer(); buf.append("http://localhost"); buf.append(getContextPath()); if (getPathInfo() != null) { buf.append(getPathInfo()); } // No query parameter. See // http://download.oracle.com/javaee/5/api/javax/servlet/http/HttpServletRequest.html#getRequestURL() return buf; }
/** * Simulates a request to a mounted {@link ResourceReference} * * @param reference * the resource reference to test * @param pageParameters * the parameters passed to the resource reference * @return the tested resource reference */ public ResourceReference startResourceReference(final ResourceReference reference, final PageParameters pageParameters) { // prepare request request.setURL(request.getContextPath() + request.getServletPath() + "/"); IRequestHandler handler = new ResourceReferenceRequestHandler(reference, pageParameters); // execute request processRequest(request, handler); // the reference processed return reference; }
/** * Simulates a request to a mounted {@link ResourceReference} * * @param reference * the resource reference to test * @param pageParameters * the parameters passed to the resource reference * @return the tested resource reference */ public ResourceReference startResourceReference(final ResourceReference reference, final PageParameters pageParameters) { // prepare request request.setURL(request.getContextPath() + request.getServletPath() + "/"); IRequestHandler handler = new ResourceReferenceRequestHandler(reference, pageParameters); // execute request processRequest(request, handler); // the reference processed return reference; }
path = getContextPath() + getServletPath() + '/' + path; if (path.startsWith(getContextPath())) path = path.substring(getContextPath().length());
path = getContextPath() + getServletPath() + '/' + path; if (path.startsWith(getContextPath())) path = path.substring(getContextPath().length());
/** * Renders the page specified by given {@link IPageProvider}. After render the page instance can * be retrieved using {@link #getLastRenderedPage()} and the rendered document will be available * in {@link #getLastResponse()}. * * Depending on {@link RenderStrategy} invoking this method can mean that a redirect will happen * before the actual render. * * @param pageProvider * @return last rendered page */ public Page startPage(final IPageProvider pageProvider) { // should be null for Pages componentInPage = null; // prepare request request.setURL(request.getContextPath() + request.getServletPath() + "/"); IRequestHandler handler = new RenderPageRequestHandler(pageProvider); // process request processRequest(request, handler); // The page rendered return getLastRenderedPage(); }
/** * Renders the page specified by given {@link IPageProvider}. After render the page instance can * be retrieved using {@link #getLastRenderedPage()} and the rendered document will be available * in {@link #getLastResponse()}. * * Depending on {@link RenderStrategy} invoking this method can mean that a redirect will happen * before the actual render. * * @param pageProvider * @return last rendered page */ public Page startPage(final IPageProvider pageProvider) { // should be null for Pages componentInPage = null; // prepare request request.setURL(request.getContextPath() + request.getServletPath() + "/"); IRequestHandler handler = new RenderPageRequestHandler(pageProvider); // process request processRequest(request, handler); // The page rendered return getLastRenderedPage(); }
private void setupNextRequestCycle() request.setURL(request.getContextPath() + request.getServletPath() + "/");
request.setURL(request.getContextPath() + request.getServletPath() + "/");