Vraptor (Method with URL connection)

Asked

Viewed 59 times

0

Good afternoon, I am trying to execute a code in Vraptor, that when running my route, I need the system to trigger a connection using URL to a page and return the body.

This is a method of my controller

public void exe(){
        try{
            URL oracle = new URL("http://www.google.com");
            URLConnection yc = oracle.openConnection();
            BufferedReader in = new BufferedReader(new InputStreamReader(
                                        yc.getInputStream()));
            String inputLine;
            while ((inputLine = in.readLine()) != null) 
                System.out.println(inputLine);
            in.close();
        }catch(Exception e){
            System.out.println("ERROR");
        }
        result.redirectTo(HomeController.class).index();
        return;
    }

I put here a test-only example, and the following error is returned:

WELD-001435: Normal scoped bean class br.com.teste.controllers.ModuloController is not proxyable because it has no no-args constructor - <unknown javax.enterprise.inject.spi.Bean instance>.

Can someone help me?

  • 2

    It looks like a CDI error, you happen to have an empty constructor in the controller?

  • I really had not attacked myself that the class did not possess the empty builder. vlw

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.