use of org.apache.tapestry5.http.services.Request in project tapestry-5 by apache.
the class IgnoredPathsFilterTest method no_path_info.
@Test
public void no_path_info() throws Exception {
HttpServletRequest request = mockHttpServletRequest();
HttpServletResponse response = mockHttpServletResponse();
HttpServletRequestHandler handler = mockHttpServletRequestHandler();
train_getServletPath(request, "/");
train_getPathInfo(request, null);
train_service(handler, request, response, true);
List<String> configuration = CollectionFactory.newList("/fred");
replay();
HttpServletRequestFilter filter = new IgnoredPathsFilter(configuration);
assertTrue(filter.service(request, response, handler));
verify();
}
use of org.apache.tapestry5.http.services.Request in project tapestry-5 by apache.
the class IgnoredPathsFilterTest method no_match.
@Test
public void no_match() throws IOException {
HttpServletRequest request = mockHttpServletRequest();
HttpServletResponse response = mockHttpServletResponse();
HttpServletRequestHandler handler = mockHttpServletRequestHandler();
train_getServletPath(request, "/");
train_getPathInfo(request, "barney");
train_service(handler, request, response, true);
List<String> configuration = CollectionFactory.newList("/fred");
replay();
HttpServletRequestFilter filter = new IgnoredPathsFilter(configuration);
assertTrue(filter.service(request, response, handler));
verify();
}
use of org.apache.tapestry5.http.services.Request in project tapestry-5 by apache.
the class FlashPersistentFieldStrategyTest method gather_changes_with_active_session.
@Test
public void gather_changes_with_active_session() {
Session session = mockSession();
Request request = mockRequest();
train_getSession(request, false, session);
train_getAttributeNames(session, "flash:foo.Bar:", "flash:foo.Bar::root", "flash:foo.Bar:nested:down");
train_getAttribute(session, "flash:foo.Bar::root", "ROOT");
session.setAttribute("flash:foo.Bar::root", null);
train_getAttribute(session, "flash:foo.Bar:nested:down", "DOWN");
session.setAttribute("flash:foo.Bar:nested:down", null);
replay();
PersistentFieldStrategy strategy = new FlashPersistentFieldStrategy(request);
Collection<PersistentFieldChange> changes = strategy.gatherFieldChanges("foo.Bar");
assertEquals(changes.size(), 2);
Iterator<PersistentFieldChange> i = changes.iterator();
PersistentFieldChange change1 = i.next();
assertEquals(change1.getComponentId(), "");
assertEquals(change1.getFieldName(), "root");
assertEquals(change1.getValue(), "ROOT");
PersistentFieldChange change2 = i.next();
assertEquals(change2.getComponentId(), "nested");
assertEquals(change2.getFieldName(), "down");
assertEquals(change2.getValue(), "DOWN");
verify();
}
use of org.apache.tapestry5.http.services.Request in project tapestry-5 by apache.
the class AlertManagerImpl method addAlertStorageCleanupCallback.
private void addAlertStorageCleanupCallback() {
if (needAlertStorageCleanup.get(true)) {
ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport javascriptSupport) {
// In an Ajax request, the Alerts are added, just so that they can be removed if not persistent.
// Again, this is for the rare case where there's a redirect to another page.
getAlertStorage().dismissNonPersistent();
}
});
needAlertStorageCleanup.set(false);
}
}
use of org.apache.tapestry5.http.services.Request in project tapestry-5 by apache.
the class PageRenderDispatcher method dispatch.
public boolean dispatch(Request request, final Response response) throws IOException {
if (request.getAttribute(InternalConstants.REFERENCED_COMPONENT_NOT_FOUND) != null) {
// This needs to be cleared out because the container may submit a request back into the filter
// for the 404 page and some containers reuse the existing HttpServletRequest. See TAP5-2388.
request.setAttribute(InternalConstants.REFERENCED_COMPONENT_NOT_FOUND, null);
return false;
}
PageRenderRequestParameters parameters = linkEncoder.decodePageRenderRequest(request);
if (parameters == null)
return false;
componentRequestHandler.handlePageRender(parameters);
return true;
}
Aggregations