Package org.apache.tapestry.services

Examples of org.apache.tapestry.services.Response


    }

    @Test
    public void to_form_URI_does_not_include_parameters()
    {
        Response response = mockResponse();

        train_encodeURL(response, "/foo/bar", ENCODED);

        replay();
View Full Code Here


        url_with_anchor("", "/foo/bar");
    }

    private void url_with_anchor(String anchor, String url)
    {
        Response response = mockResponse();

        train_encodeURL(response, url, ENCODED);

        replay();
View Full Code Here

    }

    @Test
    public void url_with_anchor_and_parameters()
    {
        Response response = mockResponse();

        train_encodeURL(response, "/foo/bar?barney=rubble&fred=flintstone#wilma", ENCODED);

        replay();
View Full Code Here

    @Test
    public void set_locale_and_service() throws IOException
    {
        RequestHandler handler = mockRequestHandler();
        Request request = mockRequest();
        Response response = mockResponse();
        LocalizationSetter setter = newMock(LocalizationSetter.class);

        train_getLocale(request, Locale.CANADA_FRENCH);

        // We don't actually verify that setThreadLocale() occurs before service(),
View Full Code Here

    @Test
    public void unprotected_asset() throws Exception
    {
        Request request = mockRequest();
        Response response = mockResponse();
        ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
        ResourceCache cache = mockResourceCache();
        ResourceStreamer streamer = mockResourceStreamer();

        train_getPath(request, SMILEY_CLIENT_URL);
View Full Code Here

    @Test
    public void protected_asset_without_an_extension() throws Exception
    {
        Request request = mockRequest();
        Response response = mockResponse();
        ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
        ResourceCache cache = mockResourceCache();
        ResourceStreamer streamer = mockResourceStreamer();

        String clientURL = "/assets/app1/pages/smiley_png";
        String resourcePath = "org/apache/tapestry/integration/app1/pages/smiley_png";

        train_getPath(request, clientURL);

        train_toResourcePath(aliasManager, clientURL, resourcePath);

        train_requiresDigest(cache, new ClasspathResource(resourcePath), true);

        response.sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains(resourcePath));

        replay();

        Dispatcher d = new AssetDispatcher(streamer, aliasManager, cache);
View Full Code Here

    @Test
    public void protected_asset_with_incorrect_digest_in_url() throws Exception
    {
        Request request = mockRequest();
        Response response = mockResponse();
        ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
        ResourceCache cache = mockResourceCache();
        ResourceStreamer streamer = mockResourceStreamer();

        String clientURL = "/assets/app1/pages/smiley.WRONG.png";
        String resourcePath = "org/apache/tapestry/integration/app1/pages/smiley.WRONG.png";

        train_getPath(request, clientURL);

        train_toResourcePath(aliasManager, clientURL, resourcePath);

        train_requiresDigest(cache, new ClasspathResource(resourcePath), true);

        train_getDigest(cache, SMILEY, "RIGHT");

        response.sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains(SMILEY_PATH));

        replay();

        Dispatcher d = new AssetDispatcher(streamer, aliasManager, cache);
View Full Code Here

    @Test
    public void protected_asset_wth_correct_digest_in_url() throws Exception
    {
        Request request = mockRequest();
        Response response = mockResponse();
        ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
        ResourceCache cache = mockResourceCache();
        ResourceStreamer streamer = mockResourceStreamer();

        String clientURL = TapestryConstants.ASSET_PATH_PREFIX + "app1/pages/smiley.RIGHT.png";
View Full Code Here

    @Test
    public void protected_asset_without_digest() throws Exception
    {
        Request request = mockRequest();
        Response response = mockResponse();
        ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
        ResourceCache cache = mockResourceCache();
        ResourceStreamer streamer = mockResourceStreamer();

        train_getPath(request, SMILEY_CLIENT_URL);

        train_toResourcePath(aliasManager, SMILEY_CLIENT_URL, SMILEY_PATH);

        train_requiresDigest(cache, SMILEY, true);

        response.sendError(eq(HttpServletResponse.SC_FORBIDDEN), contains(SMILEY_PATH));

        replay();

        Dispatcher d = new AssetDispatcher(streamer, aliasManager, cache);
View Full Code Here

    @Test
    public void client_cache_upto_date() throws Exception
    {
        Request request = mockRequest();
        Response response = mockResponse();
        ClasspathAssetAliasManager aliasManager = mockClasspathAssetAliasManager();
        ResourceCache cache = mockResourceCache();
        ResourceStreamer streamer = mockResourceStreamer();
        long now = System.currentTimeMillis();

        train_getPath(request, SMILEY_CLIENT_URL);

        train_toResourcePath(aliasManager, SMILEY_CLIENT_URL, SMILEY_PATH);

        train_requiresDigest(cache, SMILEY, false);

        train_getDateHeader(request, AssetDispatcher.IF_MODIFIED_SINCE_HEADER, now);

        train_getTimeModified(cache, SMILEY, now - 1000);

        response.sendError(HttpServletResponse.SC_NOT_MODIFIED, "");

        replay();

        Dispatcher d = new AssetDispatcher(streamer, aliasManager, cache);
View Full Code Here

TOP

Related Classes of org.apache.tapestry.services.Response

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.