Package org.apache.cactus.util

Examples of org.apache.cactus.util.ChainedRuntimeException


        // from the Cactus configuration file.
        String contextURL = System.getProperty(CACTUS_CONTEXT_URL_PROPERTY);

        if (contextURL == null)
        {
            throw new ChainedRuntimeException("Missing Cactus property ["
                + CACTUS_CONTEXT_URL_PROPERTY + "]");
        }

        return contextURL;
    }
View Full Code Here


                config = new PropertyResourceBundle(
                    new FileInputStream(configOverride));
            }
            catch (IOException e)
            {
                throw new ChainedRuntimeException(
                    "Cannot read cactus configuration file ["
                    + configOverride + "]", e);
            }
        }
View Full Code Here

                bundle = new PropertyResourceBundle(
                    new FileInputStream(logConfig));
            }
            catch (IOException e)
            {
                throw new ChainedRuntimeException("Failed to load logging "
                    + "configuration file [" + logConfig + "]");
            }
            addSystemProperties(bundle);
        }
    }
View Full Code Here

        {
            parameters = this.parametersGet;
        }
        else
        {
            throw new ChainedRuntimeException("The method need to be either "
                + "\"POST\" or \"GET\"");
        }

        // If there is already a parameter of the same name, add the
        // new value to the Vector. If not, create a Vector an add it to the
View Full Code Here

     */
    public HttpSessionCookie getSessionCookie()
    {
        if (getConfiguration() == null)
        {
            throw new ChainedRuntimeException("setConfiguration() should have "
                + "been called prior to calling getSessionCookie()");
        }
       
        ConnectionHelper helper = ConnectionHelperFactory.getConnectionHelper(
            ((WebConfiguration) getConfiguration()).getRedirectorURL(this),
            getConfiguration());

        WebRequest obtainSessionIdRequest = new WebRequest(
            (WebConfiguration) getConfiguration());
           
       
        //Not sure whether I should be adding the service parameter to
        //this request (this) or to the obtainSessionIdRequest
        //seems obvious that it should be the obtainSessionIdRequest
        RequestDirectives directives =
            new RequestDirectives(obtainSessionIdRequest);
        directives.setService(ServiceEnumeration.CREATE_SESSION_SERVICE);

        HttpURLConnection resultConnection;
        try
        {
            resultConnection =
                helper.connect(obtainSessionIdRequest, getConfiguration());
        }
        catch (Throwable e)
        {
            throw new ChainedRuntimeException("Failed to connect to ["
                + ((WebConfiguration) getConfiguration()).getRedirectorURL(this)
                + "]", e);
        }

        WebResponse response;
        try
        {
            response =
                (WebResponse) new WebResponseObjectFactory().getResponseObject(
                    WebResponse.class.getName(),
                    obtainSessionIdRequest,
                    resultConnection);
        }
        catch (ClientException e)
        {
            throw new ChainedRuntimeException("Failed to connect to ["
                + ((WebConfiguration) getConfiguration()).getRedirectorURL(this)
                + "]", e);
        }

        Cookie cookie = response.getCookieIgnoreCase("jsessionid");
View Full Code Here

                Class.forName("com.meterware.httpunit.WebResponse");
            Method method = responseClass.getMethod("newResponse",
                new Class[]{URLConnection.class});
            webResponse = method.invoke(null, new Object[]{theConnection});
        } catch (Exception e) {
            throw new ChainedRuntimeException("Error calling "
                + "[public static com.meterware.httpunit.WebResponse "
                + "com.meterware.httpunit.WebResponse.newResponse("
                + "java.net.URLConnection) throws java.io.IOException]", e);
        }
View Full Code Here

        // Open the second connection to get the test results
        WebTestResult result = null;
        try {
            result = callGetResult(theRequest.getAuthentication());
        } catch (ParsingException e) {
            throw new ChainedRuntimeException("Failed to get the test "
                + "results. This is probably due to an error that happened on "
                + "the server side when trying to execute the tests. Here is "
                + "what was returned by the server : ["
                + new WebResponse(theRequest, connection).getText() + "]", e);
        }
View Full Code Here

        if (theMethod.equalsIgnoreCase(WebRequest.POST_METHOD)) {
            parameters = this.parametersPost;
        } else if (theMethod.equalsIgnoreCase(WebRequest.GET_METHOD)) {
            parameters = this.parametersGet;
        } else {
            throw new ChainedRuntimeException("The method need to be either "
                + "\"POST\" or \"GET\"");
        }

        // If there is already a parameter of the same name, add the
        // new value to the Vector. If not, create a Vector an add it to the
View Full Code Here

        if (this.content == null) {

            try {
                this.content = IoUtil.getText(this.connection.getInputStream());
            } catch (IOException e) {
                throw new ChainedRuntimeException(e);
            }
        }

        return this.content;
    }
View Full Code Here

            while (null != (str = input.readLine())) {
                lines.addElement(str);
            }
            input.close();
        } catch (IOException e) {
            throw new ChainedRuntimeException(e);
        }

        // Dummy variable to explicitely tell the object type to copy.
        String[] dummy = new String[lines.size()];
        return (String[]) (lines.toArray(dummy));
View Full Code Here

TOP

Related Classes of org.apache.cactus.util.ChainedRuntimeException

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.