@Test public void index_stripped_off() { RequestSecurityManager manager = mockRequestSecurityManager(); Response response = mockResponse(); ContextPathEncoder contextPathEncoder = getService(ContextPathEncoder.class); expect(manager.checkPageSecurity("admin/Index")).andReturn(LinkSecurity.INSECURE); train_encodeURL(response, "/admin/abc", "MAGIC"); replay(); ComponentEventLinkEncoder encoder = new ComponentEventLinkEncoderImpl(null, contextPathEncoder, null, response, manager, null, null, false, "", "", null, null); PageRenderRequestParameters parameters = new PageRenderRequestParameters("admin/Index", new ArrayEventContext( typeCoercer, "abc")); Link link = encoder.createPageRenderLink(parameters); assertEquals(link.toURI(), "MAGIC"); verify(); }
public Link createPageRenderLink(PageRenderRequestParameters parameters) { StringBuilder builder = new StringBuilder(BUFFER_SIZE); String activePageName = parameters.getLogicalPageName(); builder.append(contextPath); encodeAppFolderAndLocale(builder); builder.append(SLASH); String encodedPageName = encodePageName(activePageName); builder.append(encodedPageName); appendContext(encodedPageName.length() > 0, parameters.getActivationContext(), builder); Link link = new LinkImpl(builder.toString(), false, requestSecurityManager.checkPageSecurity(activePageName), response, contextPathEncoder, baseURLSource); if (parameters.isLoopback()) { link.addParameter(TapestryConstants.PAGE_LOOPBACK_PARAMETER_NAME, "t"); } return link; }
ComponentEventLinkEncoderImpl implements ComponentEventLinkEncoder { public Link createPageRenderLink(PageRenderRequestParameters parameters) { StringBuilder builder = new StringBuilder(BUFFER_SIZE); String activePageName = parameters.getLogicalPageName(); builder.append(contextPath); encodeAppFolderAndLocale(builder); builder.append(SLASH); String encodedPageName = encodePageName(activePageName); builder.append(encodedPageName); appendContext(encodedPageName.length() > 0, parameters.getActivationContext(), builder); Link link = new LinkImpl(builder.toString(), false, requestSecurityManager.checkPageSecurity(activePageName), response, contextPathEncoder, baseURLSource); if (parameters.isLoopback()) { link.addParameter(TapestryConstants.PAGE_LOOPBACK_PARAMETER_NAME, "t"); } return link; } }
ComponentEventLinkEncoderImpl implements ComponentEventLinkEncoder { public Link createPageRenderLink(PageRenderRequestParameters parameters) { StringBuilder builder = new StringBuilder(BUFFER_SIZE); String activePageName = parameters.getLogicalPageName(); builder.append(contextPath); encodeAppFolderAndLocale(builder); builder.append(SLASH); String encodedPageName = encodePageName(activePageName); builder.append(encodedPageName); appendContext(encodedPageName.length() > 0, parameters.getActivationContext(), builder); Link link = new LinkImpl(builder.toString(), false, requestSecurityManager.checkPageSecurity(activePageName), response, contextPathEncoder, baseURLSource); if (parameters.isLoopback()) { link.addParameter(TapestryConstants.PAGE_LOOPBACK_PARAMETER_NAME, "t"); } return link; } ComponentEventLinkEncoderImpl(ComponentClassResolver componentClassResolver,
                                         ContextPathEncoder contextPathEncoder, LocalizationSetter localizationSetter,
                                         Response response, RequestSecurityManager requestSecurityManager, BaseURLSource baseURLSource,
                                         PersistentLocale persistentLocale,
                                         @Symbol(SymbolConstants.ENCODE_LOCALE_INTO_PATH)
                                         boolean encodeLocaleIntoPath,
                                         @Symbol(SymbolConstants.CONTEXT_PATH)
                                         String contextPath,
                                         @Symbol(SymbolConstants.APPLICATION_FOLDER) String applicationFolder,
                                         MetaDataLocator metaDataLocator,
                                         ClientWhitelist clientWhitelist); }
ComponentEventLinkEncoderImpl implements ComponentEventLinkEncoder { public Link createPageRenderLink(PageRenderRequestParameters parameters) { StringBuilder builder = new StringBuilder(BUFFER_SIZE); String activePageName = parameters.getLogicalPageName(); builder.append(contextPath); encodeAppFolderAndLocale(builder); builder.append(SLASH); String encodedPageName = encodePageName(activePageName); builder.append(encodedPageName); appendContext(encodedPageName.length() > 0, parameters.getActivationContext(), builder); Link link = new LinkImpl(builder.toString(), false, requestSecurityManager.checkPageSecurity(activePageName), response, contextPathEncoder, baseURLSource); if (parameters.isLoopback()) { link.addParameter(TapestryConstants.PAGE_LOOPBACK_PARAMETER_NAME, "t"); } return link; } ComponentEventLinkEncoderImpl(ComponentClassResolver componentClassResolver,
                                         ContextPathEncoder contextPathEncoder, LocalizationSetter localizationSetter,
                                         Response response, RequestSecurityManager requestSecurityManager, BaseURLSource baseURLSource,
                                         PersistentLocale persistentLocale,
                                         @Symbol(SymbolConstants.ENCODE_LOCALE_INTO_PATH)
                                         boolean encodeLocaleIntoPath,
                                         @Symbol(SymbolConstants.CONTEXT_PATH)
                                         String contextPath,
                                         @Symbol(SymbolConstants.APPLICATION_FOLDER) String applicationFolder,
                                         MetaDataLocator metaDataLocator,
                                         ClientWhitelist clientWhitelist); Link createPageRenderLink(PageRenderRequestParameters parameters); Link createComponentEventLink(ComponentEventRequestParameters parameters, boolean forForm); ComponentEventRequestParameters decodeComponentEventRequest(Request request); PageRenderRequestParameters decodePageRenderRequest(Request request); void appendContext(boolean seperatorRequired, EventContext context, StringBuilder builder); }
ComponentEventLinkEncoderImpl implements ComponentEventLinkEncoder { public Link createPageRenderLink(PageRenderRequestParameters parameters) { StringBuilder builder = new StringBuilder(BUFFER_SIZE); String activePageName = parameters.getLogicalPageName(); builder.append(contextPath); encodeAppFolderAndLocale(builder); builder.append(SLASH); String encodedPageName = encodePageName(activePageName); builder.append(encodedPageName); appendContext(encodedPageName.length() > 0, parameters.getActivationContext(), builder); Link link = new LinkImpl(builder.toString(), false, requestSecurityManager.checkPageSecurity(activePageName), response, contextPathEncoder, baseURLSource); if (parameters.isLoopback()) { link.addParameter(TapestryConstants.PAGE_LOOPBACK_PARAMETER_NAME, "t"); } return link; } ComponentEventLinkEncoderImpl(ComponentClassResolver componentClassResolver,
                                         ContextPathEncoder contextPathEncoder, LocalizationSetter localizationSetter,
                                         Response response, RequestSecurityManager requestSecurityManager, BaseURLSource baseURLSource,
                                         PersistentLocale persistentLocale,
                                         @Symbol(SymbolConstants.ENCODE_LOCALE_INTO_PATH)
                                         boolean encodeLocaleIntoPath,
                                         @Symbol(SymbolConstants.CONTEXT_PATH)
                                         String contextPath,
                                         @Symbol(SymbolConstants.APPLICATION_FOLDER) String applicationFolder,
                                         MetaDataLocator metaDataLocator,
                                         ClientWhitelist clientWhitelist); Link createPageRenderLink(PageRenderRequestParameters parameters); Link createComponentEventLink(ComponentEventRequestParameters parameters, boolean forForm); ComponentEventRequestParameters decodeComponentEventRequest(Request request); PageRenderRequestParameters decodePageRenderRequest(Request request); void appendContext(boolean seperatorRequired, EventContext context, StringBuilder builder);  }