You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Koen C <ko...@gmail.com> on 2010/04/23 09:24:31 UTC

accessing servers from the pivot applet

Hello,

I starting some tests with apache pivot.

And I would like to access a server, I'm using the example from the site and
thus I'm connecting to pipes.yahoo.com.

My code

> public void startup(Display display, Map<String, String> properties)

throws Exception {

System.out.println("tuut");

WTKXSerializer wtkxSerializer = new WTKXSerializer();

 GetQuery getQuery = new GetQuery("pipes.yahoo.com", "/pipes/pipe.run");

        getQuery.getParameters().put("_id",
> "43115761f2da5af5341ae2e56a93d646");

        getQuery.getParameters().put("_render", "json");



        getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>()
> {

            @Override

            public void taskExecuted(Task<Object> task) {

             System.out.println("task executed");

System.out.println(task.getResult());


>  //listView.setListData(JSONSerializer.getList(task.getResult(),
> "value.items"));

                //loadingLabel.setVisible(false);

            }



            @Override

            public void executeFailed(Task<Object> task) {

             System.out.println("execute failed");

System.out.println(task.getFault().getMessage());

            }

        }));

    ...


In the 1.6.0_19 console I get the following logging

execute failed
access denied (java.net.SocketPermission pipes.yahoo.com:80 connect,resolve)

On the net I found some information pointing me to the catalina.policy file
so I added the following with no result.

grant codeBase "file:${catalina.home}/webapps/pivot-tutorials/-" {
    permission java.security.AllPermission;
    permission java.util.PropertyPermission "catalina.base", "read";
    permission java.net.SocketPermission "localhost:8080", "connect,
resolve";
    permission java.net.SocketPermission "pipes.yahoo.com:80", "connect,
resolve";
};

grant codeBase "file:${catalina.home}/webapps/pivot-tutorials/lib/-" {
    permission java.security.AllPermission;
    permission java.util.PropertyPermission "catalina.base", "read";
    permission java.net.SocketPermission "localhost:8080", "connect,
resolve";
    permission java.net.SocketPermission "pipes.yahoo.com:80", "connect,
resolve";
};

I also read somewhere that this wil never work from inside an applet.

Any help or clue would nice.

Thanks,

KC

Re: accessing servers from the pivot applet

Posted by Todd Volkert <tv...@gmail.com>.
KC,

Did you end up getting this working?  I've had weird behavior with Yahoo
Pipes in the past where the response was fine when the user agent was a
browser, but not when the user agent was the JRE.

-T

On Fri, Apr 23, 2010 at 7:33 AM, Greg Brown <gk...@mac.com> wrote:

> Hi KC,
>
> I'm moving this to the user list since it is more of a user question (the
> dev list is for issues related to the development of the platform itself,
> not applications that use the platform). You should probably subscribe to
> the user list as well - otherwise, you may not see any future responses.
>
> You'll need to sign your applet in order to allow it to communicate with
> Yahoo Pipes. In general, an unsigned applet can only make connections to the
> server it was downloaded from. However, if the server you want to connect to
> has a crossdomain.xml file, you can connect to it with an unsigned applet.
> Unfortunately Yahoo Pipes does not, so you'll need to use a signed applet.
>
> See this page for more info:
>
> https://jdk6.dev.java.net/plugin2/#CROSSDOMAINXML
>
> Hope this helps,
> Greg
>
>
> On Apr 23, 2010, at 3:24 AM, Koen C wrote:
>
> > Hello,
> >
> > I starting some tests with apache pivot.
> >
> > And I would like to access a server, I'm using the example from the site
> and
> > thus I'm connecting to pipes.yahoo.com.
> >
> > My code
> >
> >> public void startup(Display display, Map<String, String> properties)
> >
> > throws Exception {
> >
> > System.out.println("tuut");
> >
> > WTKXSerializer wtkxSerializer = new WTKXSerializer();
> >
> > GetQuery getQuery = new GetQuery("pipes.yahoo.com", "/pipes/pipe.run");
> >
> >        getQuery.getParameters().put("_id",
> >> "43115761f2da5af5341ae2e56a93d646");
> >
> >        getQuery.getParameters().put("_render", "json");
> >
> >
> >
> >        getQuery.execute(new TaskAdapter<Object>(new
> TaskListener<Object>()
> >> {
> >
> >            @Override
> >
> >            public void taskExecuted(Task<Object> task) {
> >
> >             System.out.println("task executed");
> >
> > System.out.println(task.getResult());
> >
> >
> >> //listView.setListData(JSONSerializer.getList(task.getResult(),
> >> "value.items"));
> >
> >                //loadingLabel.setVisible(false);
> >
> >            }
> >
> >
> >
> >            @Override
> >
> >            public void executeFailed(Task<Object> task) {
> >
> >             System.out.println("execute failed");
> >
> > System.out.println(task.getFault().getMessage());
> >
> >            }
> >
> >        }));
> >
> >    ...
> >
> >
> > In the 1.6.0_19 console I get the following logging
> >
> > execute failed
> > access denied (java.net.SocketPermission pipes.yahoo.com:80connect,resolve)
> >
> > On the net I found some information pointing me to the catalina.policy
> file
> > so I added the following with no result.
> >
> > grant codeBase "file:${catalina.home}/webapps/pivot-tutorials/-" {
> >    permission java.security.AllPermission;
> >    permission java.util.PropertyPermission "catalina.base", "read";
> >    permission java.net.SocketPermission "localhost:8080", "connect,
> > resolve";
> >    permission java.net.SocketPermission "pipes.yahoo.com:80", "connect,
> > resolve";
> > };
> >
> > grant codeBase "file:${catalina.home}/webapps/pivot-tutorials/lib/-" {
> >    permission java.security.AllPermission;
> >    permission java.util.PropertyPermission "catalina.base", "read";
> >    permission java.net.SocketPermission "localhost:8080", "connect,
> > resolve";
> >    permission java.net.SocketPermission "pipes.yahoo.com:80", "connect,
> > resolve";
> > };
> >
> > I also read somewhere that this wil never work from inside an applet.
> >
> > Any help or clue would nice.
> >
> > Thanks,
> >
> > KC
>
>

Re: accessing servers from the pivot applet

Posted by Greg Brown <gk...@mac.com>.
Hi KC,

I'm moving this to the user list since it is more of a user question (the dev list is for issues related to the development of the platform itself, not applications that use the platform). You should probably subscribe to the user list as well - otherwise, you may not see any future responses.

You'll need to sign your applet in order to allow it to communicate with Yahoo Pipes. In general, an unsigned applet can only make connections to the server it was downloaded from. However, if the server you want to connect to has a crossdomain.xml file, you can connect to it with an unsigned applet. Unfortunately Yahoo Pipes does not, so you'll need to use a signed applet.

See this page for more info:

https://jdk6.dev.java.net/plugin2/#CROSSDOMAINXML

Hope this helps,
Greg


On Apr 23, 2010, at 3:24 AM, Koen C wrote:

> Hello,
> 
> I starting some tests with apache pivot.
> 
> And I would like to access a server, I'm using the example from the site and
> thus I'm connecting to pipes.yahoo.com.
> 
> My code
> 
>> public void startup(Display display, Map<String, String> properties)
> 
> throws Exception {
> 
> System.out.println("tuut");
> 
> WTKXSerializer wtkxSerializer = new WTKXSerializer();
> 
> GetQuery getQuery = new GetQuery("pipes.yahoo.com", "/pipes/pipe.run");
> 
>        getQuery.getParameters().put("_id",
>> "43115761f2da5af5341ae2e56a93d646");
> 
>        getQuery.getParameters().put("_render", "json");
> 
> 
> 
>        getQuery.execute(new TaskAdapter<Object>(new TaskListener<Object>()
>> {
> 
>            @Override
> 
>            public void taskExecuted(Task<Object> task) {
> 
>             System.out.println("task executed");
> 
> System.out.println(task.getResult());
> 
> 
>> //listView.setListData(JSONSerializer.getList(task.getResult(),
>> "value.items"));
> 
>                //loadingLabel.setVisible(false);
> 
>            }
> 
> 
> 
>            @Override
> 
>            public void executeFailed(Task<Object> task) {
> 
>             System.out.println("execute failed");
> 
> System.out.println(task.getFault().getMessage());
> 
>            }
> 
>        }));
> 
>    ...
> 
> 
> In the 1.6.0_19 console I get the following logging
> 
> execute failed
> access denied (java.net.SocketPermission pipes.yahoo.com:80 connect,resolve)
> 
> On the net I found some information pointing me to the catalina.policy file
> so I added the following with no result.
> 
> grant codeBase "file:${catalina.home}/webapps/pivot-tutorials/-" {
>    permission java.security.AllPermission;
>    permission java.util.PropertyPermission "catalina.base", "read";
>    permission java.net.SocketPermission "localhost:8080", "connect,
> resolve";
>    permission java.net.SocketPermission "pipes.yahoo.com:80", "connect,
> resolve";
> };
> 
> grant codeBase "file:${catalina.home}/webapps/pivot-tutorials/lib/-" {
>    permission java.security.AllPermission;
>    permission java.util.PropertyPermission "catalina.base", "read";
>    permission java.net.SocketPermission "localhost:8080", "connect,
> resolve";
>    permission java.net.SocketPermission "pipes.yahoo.com:80", "connect,
> resolve";
> };
> 
> I also read somewhere that this wil never work from inside an applet.
> 
> Any help or clue would nice.
> 
> Thanks,
> 
> KC