Package org.apache.cactus.internal

Examples of org.apache.cactus.internal.WebRequestImpl


    /**
     * @see ProtocolHandler#createRequest()
     */
    public Request createRequest()
    {
        return new WebRequestImpl(getConfiguration());
    }
View Full Code Here


     *            redirector servlet.
     */
    private WebTestResult callGetResult(WebRequest theOriginalRequest)
        throws Throwable
    {
        WebRequest resultsRequest = new WebRequestImpl(this.configuration);
        RequestDirectives directives = new RequestDirectives(resultsRequest);
        directives.setService(ServiceEnumeration.GET_RESULTS_SERVICE);

        // Use the same redirector as was used by the original request
        resultsRequest.setRedirectorName(
            theOriginalRequest.getRedirectorName());
       
        // Add authentication details
        if (theOriginalRequest.getAuthentication() != null)
        {
            resultsRequest.setAuthentication(
                theOriginalRequest.getAuthentication());
        }

        // Open the second connection to get the test results
        HttpClientConnectionHelper helper =
View Full Code Here

            HttpClientConnectionHelper helper =
                new HttpClientConnectionHelper(resource);

            WebRequest request =
                new WebRequestImpl((WebConfiguration) theConfiguration);

            // Make the connection using a default web request.
            connection = helper.connect(request, theConfiguration);

            checkPreAuthResponse(connection);
View Full Code Here

     * @exception Exception on error
     */
    public void testCreateHttpStateWhenNoCactusCookieDefined()
        throws Exception
    {
        WebRequest request = new WebRequestImpl();
        HttpState state = new HttpState();
        state.addCookies(CookieUtil.createHttpClientCookies(request,
            new URL("http://jakarta.apache.org")));
        assertEquals(0, state.getCookies().length);
    }
View Full Code Here

     * @exception Exception on error
     */
    public void testCreateHttpStateWhenSeveralCactusCookieExist()
        throws Exception
    {
        WebRequest request = new WebRequestImpl();
        request.addCookie(new Cookie("domain1", "name1", "value1"));
        request.addCookie(new Cookie("domain2", "name2", "value2"));
       
        HttpState state = new HttpState();
        state.addCookies(CookieUtil.createHttpClientCookies(request,
            new URL("http://jakarta.apache.org")));

View Full Code Here

     * Verify that an exception is thrown when an invalid HTTP METHOD is used
     * when adding an HTTP parameter.
     */
    public void testAddParameterInvalidMethod()
    {
        WebRequest request = new WebRequestImpl(new ServletConfiguration());

        try
        {
            request.addParameter("param1", "value1", "INVALIDMETHOD");
            fail("Should have thrown an exception");
        }
        catch (ChainedRuntimeException e)
        {
            assertEquals("The method need to be either \"POST\" or \"GET\"",
View Full Code Here

     * Verify that <code>getParameterGet</code> returns the first parameter
     * that was added to the request.
     */
    public void testGetParametersGetOk()
    {
        WebRequest request = new WebRequestImpl(new ServletConfiguration());

        request.addParameter("param1", "value1", WebRequest.GET_METHOD);
        request.addParameter("param1", "value2", WebRequest.GET_METHOD);

        String result = request.getParameterGet("param1");

        assertEquals("value1", result);
    }
View Full Code Here

     * Verify that <code>getParameterGet</code> returns null if no parameter
     * of a given name was added to the request.
     */
    public void testGetParameterGetNull()
    {
        WebRequest request = new WebRequestImpl(new ServletConfiguration());

        request.addParameter("param1", "value1", WebRequest.POST_METHOD);

        String result = request.getParameterGet("param1");

        assertNull(result);
    }
View Full Code Here

     * Verify that <code>getParameterPost</code> returns the first parameter
     * that was added to the request.
     */
    public void testGetParametersPostOk()
    {
        WebRequest request = new WebRequestImpl(new ServletConfiguration());

        request.addParameter("param1", "value1", WebRequest.POST_METHOD);
        request.addParameter("param1", "value2", WebRequest.POST_METHOD);

        String result = request.getParameterPost("param1");

        assertEquals("value1", result);
    }
View Full Code Here

     * Verify that <code>getParameterPost</code> returns null if no parameter
     * of a given name was added to the request.
     */
    public void testGetParameterPostNull()
    {
        WebRequest request = new WebRequestImpl(new ServletConfiguration());

        request.addParameter("param1", "value1", WebRequest.GET_METHOD);

        String result = request.getParameterPost("param1");

        assertNull(result);
    }
View Full Code Here

TOP

Related Classes of org.apache.cactus.internal.WebRequestImpl

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.