Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Param interceptors for @Rest #479

Description

@yDelouis

Hi,

I'm using AndroidAnnotations for an application which deals with a Rest API.
For this API, I need to pass an access token as a query parameter of each request.
This access token can't be hard coded in the URL so I use a ClientHttpRequestInterceptor to add this parameter dynamically.

The problem is that I need to add this interceptor each time I use the @Rest annotations in Activity or Fragment which is a bit annoying, the more so as if I forget to do it, it leads me to long times of debugging...

So, I was wondering if there were possible to add a parameter for the annotation @Rest. The value of this annotations would be an array of classes implementing ClientHttpRequestInterceptor.

This would also enable us to add interceptors for logging purposes easily (and maybe a built-in log interceptor).

Sorry for not proposing code to solve this issue.
Edit: I will submit a pull request soon.

Thanks for your awesome work.

Activity

  1. yDelouis commented on Feb 4, 2013

    @yDelouis
    ContributorAuthor

    Fixed by PR #485.

  2. pyricau commented on Feb 27, 2013

    @pyricau
    Contributor

    #485 (don't forget the #, this will automatically create a link and a trackback)

  3. diegovar commented on Apr 15, 2013

    @diegovar

    Can you post code on how you would use the addition in PR #485 to add query string parameters? An API with querystring params seems like a common enough scenario to warrant a simpler way of binding to them right?

  4. mathieuboniface commented on Apr 15, 2013

    @mathieuboniface
    Contributor

    Ok, we need to document this part on this wiki page : https://github.com/excilys/androidannotations/wiki/Rest-API

    Can you create a separate issue on that subject ?

  5. diegovar commented on Apr 15, 2013

    @diegovar

    Done: #557

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions