You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Kai Feng Zhang <kf...@gmail.com> on 2010/09/03 16:27:02 UTC

What request will go into GadgetsHandler

Hi,

I am new to Shindig code, Now I am wondering with what request, code will go
into some method of GadgetsHandler.java?

Should it be a rest reqeust? like as:

http://localhost:8080/rest/gadgets/@metadata.supportedFields

or

http://localhost:8080/social/rest/gadgets/@metadata.supportedFields

But there is "no service definied for path
gadgets/@metadata.supportedFields". And page got 501 error.

If I access directly:
http://localhost:8080/gadgets/@metadata.supportedFields, there will be 404
error.

I am confused, could you please help me out?


Thanks,

Kevin Zhang (凯峰)
Gtalk:   kf.zhang@gmail.com
Blog:    http://www.zhangkf.com
Twitter: http://twitter.com/zhangkf

Re: What request will go into GadgetsHandler

Posted by Kai Feng Zhang <kf...@gmail.com>.
Hi,

I think a more simple question is, could I find any sample in shindig, which
will run code into GadgetsHanlder.java? Thanks.


Thanks,

Kevin Zhang (凯峰)
Gtalk:   kf.zhang@gmail.com
Blog:    http://www.zhangkf.com
Twitter: http://twitter.com/zhangkf


2010/9/4 Kai Feng Zhang <kf...@gmail.com>

> Hi,
>
> Just checked past archived mailing list, but unluckily not found any clue
> about how this GadgetsHandler.java works.
>
> I found in DefaultGuiceModule.java:
>
>    /**
>
>    * Sets up multibinding for rpc handlers
>
>    */
>
>   protected void registerGadgetHandlers() {
>
>     Multibinder<Object> handlerBinder = Multibinder.newSetBinder(binder(),
>> Object.class, Names.named("org.apache.shindig.handlers"));
>
>     handlerBinder.addBinding().to(InvalidationHandler.class);
>
>     handlerBinder.addBinding().to(HttpRequestHandler.class);
>
>     handlerBinder.addBinding().to(GadgetsHandler.class);
>
>   }
>
>
> So I guess GadgetsHandler.java is for rpc request, right?
>
> Simply access http://localhost:8080/rpc/gadgets/@metadata.supportedFieldswill not reutrn something, because JsonRpcServlet will check if this is a
> jsonp request or along with some param like as "method" id "id".
>
> I just want to make sure if my guess is correct. And I also want to know
> under what request the method in GadgetsHanlder will be executed:
>
>   @Operation(httpMethods = "GET", path = "/@metadata.supportedFields")
>
>   public Set<String> supportedFields(RequestItem request) {
>
>     return ImmutableSet.copyOf(beanFilter
>
>         .getBeanFields(GadgetsHandlerApi.MetadataResponse.class, 5));
>
>   }
>
>
> I appreciate it.
>
>
>
>
> Thanks,
>
> Kevin Zhang (凯峰)
> Gtalk:   kf.zhang@gmail.com
> Blog:    http://www.zhangkf.com
> Twitter: http://twitter.com/zhangkf
>
>
> On Fri, Sep 3, 2010 at 10:27 PM, Kai Feng Zhang <kf...@gmail.com>wrote:
>
>> Hi,
>>
>> I am new to Shindig code, Now I am wondering with what request, code will
>> go into some method of GadgetsHandler.java?
>>
>> Should it be a rest reqeust? like as:
>>
>> http://localhost:8080/rest/gadgets/@metadata.supportedFields
>>
>> or
>>
>> http://localhost:8080/social/rest/gadgets/@metadata.supportedFields
>>
>> But there is "no service definied for path
>> gadgets/@metadata.supportedFields". And page got 501 error.
>>
>> If I access directly:
>> http://localhost:8080/gadgets/@metadata.supportedFields, there will be
>> 404 error.
>>
>> I am confused, could you please help me out?
>>
>>
>> Thanks,
>>
>> Kevin Zhang (凯峰)
>> Gtalk:   kf.zhang@gmail.com
>> Blog:    http://www.zhangkf.com
>> Twitter: http://twitter.com/zhangkf
>>
>
>

Re: What request will go into GadgetsHandler

Posted by Kai Feng Zhang <kf...@gmail.com>.
Hi,

Just checked past archived mailing list, but unluckily not found any clue
about how this GadgetsHandler.java works.

I found in DefaultGuiceModule.java:

   /**

   * Sets up multibinding for rpc handlers

   */

  protected void registerGadgetHandlers() {

    Multibinder<Object> handlerBinder = Multibinder.newSetBinder(binder(),
> Object.class, Names.named("org.apache.shindig.handlers"));

    handlerBinder.addBinding().to(InvalidationHandler.class);

    handlerBinder.addBinding().to(HttpRequestHandler.class);

    handlerBinder.addBinding().to(GadgetsHandler.class);

  }


So I guess GadgetsHandler.java is for rpc request, right?

Simply access http://localhost:8080/rpc/gadgets/@metadata.supportedFieldswill
not reutrn something, because JsonRpcServlet will check if this is a
jsonp request or along with some param like as "method" id "id".

I just want to make sure if my guess is correct. And I also want to know
under what request the method in GadgetsHanlder will be executed:

  @Operation(httpMethods = "GET", path = "/@metadata.supportedFields")

  public Set<String> supportedFields(RequestItem request) {

    return ImmutableSet.copyOf(beanFilter

        .getBeanFields(GadgetsHandlerApi.MetadataResponse.class, 5));

  }


I appreciate it.




Thanks,

Kevin Zhang (凯峰)
Gtalk:   kf.zhang@gmail.com
Blog:    http://www.zhangkf.com
Twitter: http://twitter.com/zhangkf


On Fri, Sep 3, 2010 at 10:27 PM, Kai Feng Zhang <kf...@gmail.com> wrote:

> Hi,
>
> I am new to Shindig code, Now I am wondering with what request, code will
> go into some method of GadgetsHandler.java?
>
> Should it be a rest reqeust? like as:
>
> http://localhost:8080/rest/gadgets/@metadata.supportedFields
>
> or
>
> http://localhost:8080/social/rest/gadgets/@metadata.supportedFields
>
> But there is "no service definied for path
> gadgets/@metadata.supportedFields". And page got 501 error.
>
> If I access directly:
> http://localhost:8080/gadgets/@metadata.supportedFields, there will be 404
> error.
>
> I am confused, could you please help me out?
>
>
> Thanks,
>
> Kevin Zhang (凯峰)
> Gtalk:   kf.zhang@gmail.com
> Blog:    http://www.zhangkf.com
> Twitter: http://twitter.com/zhangkf
>

Re: What request will go into GadgetsHandler

Posted by Kai Feng Zhang <zh...@cn.ibm.com>.
Hi Paul,

Thank you very much. This rest request works for me now also, it's weird it
did not work before.

Btw, do we have any sample that can be used to test other methods of
GadgetsHandler? such as metadata() with a POST request?


Best Regards,

Kevin, Zhang Kai Feng
IBM Project Vulcan Development
IBM China Software Development Lab



On Tue, Sep 7, 2010 at 5:10 PM, Paul Lindner <pl...@linkedin.com> wrote:

> Answers inline..
>
> On Fri, Sep 3, 2010 at 7:27 AM, Kai Feng Zhang <kf...@gmail.com> wrote:
>
> > Hi,
> >
> > I am new to Shindig code, Now I am wondering with what request, code will
> > go
> > into some method of GadgetsHandler.java?
> >
> > Should it be a rest reqeust? like as:
> >
> > http://localhost:8080/rest/gadgets/@metadata.supportedFields
> >
> >
> This works for me:
>
>
> {"entry":["UserPrefs","UserPrefs.Name","UserPrefs.DefaultValue","UserPrefs.DisplayName","UserPrefs.Required","UserPrefs.DataType","UserPrefs.EnumValues","UserPrefs.OrderedEnumValues","UserPrefs.OrderedEnumValues.Value","UserPrefs.OrderedEnumValues.DisplayValue","Views","Views.Name","Views.Type","Views.Content","Views.Attributes","Views.Href","Views.Quirks","Views.PreferredHeight","Views.PreferredWidth","ModulePrefs","ModulePrefs.Description","ModulePrefs.Links","ModulePrefs.Links.Href","ModulePrefs.Links.Rel","ModulePrefs.Height","ModulePrefs.Width","ModulePrefs.Features","
> ModulePrefs.Features.Name
>
> ","ModulePrefs.Features.Required","ModulePrefs.Title","ModulePrefs.TitleUrl","ModulePrefs.Author","ModulePrefs.AuthorEmail","ModulePrefs.Screenshot","ModulePrefs.Thumbnail","ModulePrefs.DirectoryTitle","ModulePrefs.AuthorAffiliation","ModulePrefs.AuthorLocation","ModulePrefs.AuthorPhoto","ModulePrefs.AuthorAboutme","ModulePrefs.AuthorQuote","ModulePrefs.AuthorLink","ModulePrefs.Scaling","ModulePrefs.Scrolling","ModulePrefs.Categories","Checksum","IframeUrl","Url","Error"]}plin
>
>
>
> > or
> >
> > http://localhost:8080/social/rest/gadgets/@metadata.supportedFields
> >
> > But there is "no service definied for path
> > gadgets/@metadata.supportedFields". And page got 501 error.
> >
> > If I access directly:
> > http://localhost:8080/gadgets/@metadata.supportedFields, there will be
> 404
> > error.
> >
> > I am confused, could you please help me out?
> >
> >
> > Thanks,
> >
> > Kevin Zhang (凯峰)
> > Gtalk:   kf.zhang@gmail.com
> > Blog:    http://www.zhangkf.com
> > Twitter: http://twitter.com/zhangkf
> >
>
>
>
> --
> Paul Lindner -- plindner@linkedin.com -- linkedin.com/in/plindner
>

Re: What request will go into GadgetsHandler

Posted by Paul Lindner <pl...@linkedin.com>.
Answers inline..

On Fri, Sep 3, 2010 at 7:27 AM, Kai Feng Zhang <kf...@gmail.com> wrote:

> Hi,
>
> I am new to Shindig code, Now I am wondering with what request, code will
> go
> into some method of GadgetsHandler.java?
>
> Should it be a rest reqeust? like as:
>
> http://localhost:8080/rest/gadgets/@metadata.supportedFields
>
>
This works for me:

{"entry":["UserPrefs","UserPrefs.Name","UserPrefs.DefaultValue","UserPrefs.DisplayName","UserPrefs.Required","UserPrefs.DataType","UserPrefs.EnumValues","UserPrefs.OrderedEnumValues","UserPrefs.OrderedEnumValues.Value","UserPrefs.OrderedEnumValues.DisplayValue","Views","Views.Name","Views.Type","Views.Content","Views.Attributes","Views.Href","Views.Quirks","Views.PreferredHeight","Views.PreferredWidth","ModulePrefs","ModulePrefs.Description","ModulePrefs.Links","ModulePrefs.Links.Href","ModulePrefs.Links.Rel","ModulePrefs.Height","ModulePrefs.Width","ModulePrefs.Features","
ModulePrefs.Features.Name
","ModulePrefs.Features.Required","ModulePrefs.Title","ModulePrefs.TitleUrl","ModulePrefs.Author","ModulePrefs.AuthorEmail","ModulePrefs.Screenshot","ModulePrefs.Thumbnail","ModulePrefs.DirectoryTitle","ModulePrefs.AuthorAffiliation","ModulePrefs.AuthorLocation","ModulePrefs.AuthorPhoto","ModulePrefs.AuthorAboutme","ModulePrefs.AuthorQuote","ModulePrefs.AuthorLink","ModulePrefs.Scaling","ModulePrefs.Scrolling","ModulePrefs.Categories","Checksum","IframeUrl","Url","Error"]}plin



> or
>
> http://localhost:8080/social/rest/gadgets/@metadata.supportedFields
>
> But there is "no service definied for path
> gadgets/@metadata.supportedFields". And page got 501 error.
>
> If I access directly:
> http://localhost:8080/gadgets/@metadata.supportedFields, there will be 404
> error.
>
> I am confused, could you please help me out?
>
>
> Thanks,
>
> Kevin Zhang (凯峰)
> Gtalk:   kf.zhang@gmail.com
> Blog:    http://www.zhangkf.com
> Twitter: http://twitter.com/zhangkf
>



-- 
Paul Lindner -- plindner@linkedin.com -- linkedin.com/in/plindner