├── .classpath
├── .gitignore
├── .project
├── .settings
├── org.eclipse.core.resources.prefs
├── org.eclipse.jdt.core.prefs
└── org.maven.ide.eclipse.prefs
├── LICENSE
├── README.markdown
├── pom.xml
└── src
├── main
└── java
│ └── com
│ └── podio
│ ├── APIApplicationException.java
│ ├── APIFactory.java
│ ├── APITransportException.java
│ ├── AuthProvider.java
│ ├── BaseAPI.java
│ ├── CustomJacksonJsonProvider.java
│ ├── DryRunFilter.java
│ ├── ExceptionFilter.java
│ ├── LoginFilter.java
│ ├── RateLimitFilter.java
│ ├── RateLimits.java
│ ├── ResourceFactory.java
│ ├── app
│ ├── AppAPI.java
│ ├── Application.java
│ ├── ApplicationConfiguration.java
│ ├── ApplicationConfigurationBase.java
│ ├── ApplicationConfigurationCreate.java
│ ├── ApplicationCreate.java
│ ├── ApplicationCreateResponse.java
│ ├── ApplicationField.java
│ ├── ApplicationFieldConfiguration.java
│ ├── ApplicationFieldCreate.java
│ ├── ApplicationFieldCreateResponse.java
│ ├── ApplicationFieldSettings.java
│ ├── ApplicationFieldStatus.java
│ ├── ApplicationFieldType.java
│ ├── ApplicationFieldUpdate.java
│ ├── ApplicationInstall.java
│ ├── ApplicationTask.java
│ ├── ApplicationTaskBase.java
│ ├── ApplicationTaskCreate.java
│ ├── ApplicationUpdate.java
│ ├── ApplicationViewType.java
│ ├── CategoryOption.java
│ ├── CategoryOptionStatus.java
│ ├── DateFieldEndDateType.java
│ ├── DateFieldTimeEntryType.java
│ ├── Dependencies.java
│ └── TextFieldSize.java
│ ├── calendar
│ ├── CalendarAPI.java
│ ├── Event.java
│ └── ParticipationStatus.java
│ ├── comment
│ ├── Comment.java
│ ├── CommentAPI.java
│ ├── CommentCreate.java
│ ├── CommentCreateResponse.java
│ └── CommentUpdate.java
│ ├── common
│ ├── AuthorizationEntity.java
│ ├── AuthorizationEntityType.java
│ ├── AuthorizationInterface.java
│ ├── AvatarType.java
│ ├── CSVUtil.java
│ ├── CreatedBase.java
│ ├── Empty.java
│ ├── Reference.java
│ ├── ReferenceType.java
│ ├── Right.java
│ ├── Role.java
│ └── ToStringUtil.java
│ ├── connection
│ └── ConnectionType.java
│ ├── contact
│ ├── ConnectionContactTotal.java
│ ├── ConnectionTypeContactTotal.java
│ ├── ConnectionsContactTotal.java
│ ├── ContactAPI.java
│ ├── ContactCreate.java
│ ├── ContactCreateResponse.java
│ ├── ContactOrder.java
│ ├── ContactTotal.java
│ ├── ContactType.java
│ ├── ContactUpdate.java
│ ├── OrganizationContactTotal.java
│ ├── Profile.java
│ ├── ProfileBase.java
│ ├── ProfileField.java
│ ├── ProfileFieldValues.java
│ ├── ProfileMini.java
│ ├── ProfileType.java
│ ├── ProfileUpdate.java
│ ├── SpaceContactTotal.java
│ ├── SpaceContactTotals.java
│ └── UserContactTotal.java
│ ├── conversation
│ ├── Conversation.java
│ ├── ConversationAPI.java
│ ├── ConversationCreate.java
│ ├── ConversationCreateResponse.java
│ ├── Message.java
│ ├── MessageCreate.java
│ └── MessageCreateResponse.java
│ ├── device
│ ├── DeviceAPI.java
│ └── PushSubscription.java
│ ├── embed
│ ├── Embed.java
│ ├── EmbedAPI.java
│ ├── EmbedCreate.java
│ └── EmbedType.java
│ ├── file
│ ├── File.java
│ ├── FileAPI.java
│ ├── FileError.java
│ ├── FileReference.java
│ ├── FileSize.java
│ ├── FileUpdate.java
│ ├── FileUploadResponse.java
│ └── FileUploadResult.java
│ ├── filter
│ ├── AbsolutePodioDate.java
│ ├── AppFieldFilterBy.java
│ ├── BaseAuthListFilterBy.java
│ ├── BaseDateFilterBy.java
│ ├── BaseIntListFilterBy.java
│ ├── CreatedByFilterBy.java
│ ├── CreatedOnFilterBy.java
│ ├── CreatedViaFilterBy.java
│ ├── DateFieldFilterBy.java
│ ├── ExternalIdFilterBy.java
│ ├── FieldFilterBy.java
│ ├── FieldSortBy.java
│ ├── FilterBy.java
│ ├── FilterByValue.java
│ ├── LastEditByFilterBy.java
│ ├── LastEditOnFilterBy.java
│ ├── LastEditViaFilterBy.java
│ ├── MemberFieldFilterBy.java
│ ├── NumberFieldFilterBy.java
│ ├── NumberInterval.java
│ ├── PodioDate.java
│ ├── PodioDateInterval.java
│ ├── ProgressFieldFilterBy.java
│ ├── ProgressInterval.java
│ ├── RelativePodioDate.java
│ ├── SortBy.java
│ ├── StandardSortBy.java
│ ├── StateFieldFilterBy.java
│ └── TitleFilterBy.java
│ ├── hook
│ ├── Hook.java
│ ├── HookAPI.java
│ ├── HookCreate.java
│ ├── HookCreateResponse.java
│ ├── HookStatus.java
│ ├── HookType.java
│ └── HookValidate.java
│ ├── item
│ ├── AppActivities.java
│ ├── AppActivity.java
│ ├── FieldValuesUpdate.java
│ ├── FieldValuesView.java
│ ├── Item.java
│ ├── ItemAPI.java
│ ├── ItemActivityType.java
│ ├── ItemBadge.java
│ ├── ItemCreate.java
│ ├── ItemCreateResponse.java
│ ├── ItemFieldDifference.java
│ ├── ItemMicro.java
│ ├── ItemMini.java
│ ├── ItemReference.java
│ ├── ItemRevision.java
│ ├── ItemUpdate.java
│ ├── ItemsResponse.java
│ ├── filter
│ │ ├── Filter.java
│ │ ├── FilterCreatedOn.java
│ │ ├── FilterDateField.java
│ │ ├── FilterFieldValue.java
│ │ ├── FilterInterval.java
│ │ └── ItemFilter.java
│ └── map
│ │ ├── ExternalId.java
│ │ ├── Field.java
│ │ ├── FieldMap.java
│ │ ├── ItemMap.java
│ │ ├── MappedItemAPI.java
│ │ ├── MoneyField.java
│ │ ├── NameUtil.java
│ │ ├── Transient.java
│ │ └── converter
│ │ ├── CategoryConverter.java
│ │ ├── CategoryConverterProvider.java
│ │ ├── ExternalIdConverter.java
│ │ ├── FieldConverter.java
│ │ ├── FieldConverterProvider.java
│ │ ├── FieldConverterRegistry.java
│ │ ├── MoneyConverter.java
│ │ ├── MoneyConverterProvider.java
│ │ ├── NumberConverter.java
│ │ ├── NumberConverterProvider.java
│ │ ├── ProgressConverter.java
│ │ ├── ProgressConverterProvider.java
│ │ ├── TextConverter.java
│ │ └── TextConverterProvider.java
│ ├── notification
│ ├── InboxNewCount.java
│ ├── NotificationAPI.java
│ ├── NotificationContextType.java
│ ├── NotificationDateType.java
│ └── NotificationType.java
│ ├── oauth
│ ├── OAuthAPI.java
│ ├── OAuthAppCredentials.java
│ ├── OAuthClientCredentials.java
│ ├── OAuthCodeCredentials.java
│ ├── OAuthRefreshTokenCredentials.java
│ ├── OAuthToken.java
│ ├── OAuthUserCredentials.java
│ └── OAuthUsernameCredentials.java
│ ├── org
│ ├── EndMemberInfo.java
│ ├── OrgAPI.java
│ ├── Organization.java
│ ├── OrganizationCreate.java
│ ├── OrganizationCreateResponse.java
│ ├── OrganizationMember.java
│ ├── OrganizationMini.java
│ ├── OrganizationStatistics.java
│ ├── OrganizationStatus.java
│ └── OrganizationWithSpaces.java
│ ├── rating
│ ├── Rating.java
│ ├── RatingAPI.java
│ ├── RatingCreateResponse.java
│ ├── RatingType.java
│ ├── RatingTypeKeyDeserializer.java
│ ├── RatingValue.java
│ ├── RatingValuesMap.java
│ ├── SingleRatingValue.java
│ ├── TypeRating.java
│ └── ValueRatings.java
│ ├── search
│ ├── Counts.java
│ ├── ReferenceTypeSearchInApp.java
│ ├── SearchAPI.java
│ ├── SearchInAppResponse.java
│ └── SearchResult.java
│ ├── serialize
│ ├── DateTimeDeserializer.java
│ ├── DateTimeSerializer.java
│ ├── DateTimeUtil.java
│ ├── LocalDateDeserializer.java
│ ├── LocalDateSerializer.java
│ ├── LocaleDeserializer.java
│ ├── LocaleSerializer.java
│ ├── TimeZoneDeserializer.java
│ └── TimeZoneSerializer.java
│ ├── share
│ └── Share.java
│ ├── space
│ ├── Space.java
│ ├── SpaceAPI.java
│ ├── SpaceCreate.java
│ ├── SpaceCreateResponse.java
│ ├── SpaceInvitation.java
│ ├── SpaceInvitationUpdate.java
│ ├── SpaceMember.java
│ ├── SpaceMemberAdd.java
│ ├── SpaceMemberDetails.java
│ ├── SpaceMemberUpdate.java
│ ├── SpaceMemberV2.java
│ ├── SpaceMini.java
│ ├── SpaceStatistics.java
│ ├── SpaceTopMemberGroup.java
│ ├── SpaceTopMembers.java
│ ├── SpaceUpdate.java
│ └── SpaceWithOrganization.java
│ ├── status
│ ├── Status.java
│ ├── StatusAPI.java
│ ├── StatusCreate.java
│ ├── StatusCreateResponse.java
│ ├── StatusFull.java
│ └── StatusUpdate.java
│ ├── stream
│ ├── StreamAPI.java
│ ├── StreamActivity.java
│ ├── StreamActivityType.java
│ ├── StreamObject.java
│ └── StreamObjectV2.java
│ ├── subscription
│ ├── Subscription.java
│ └── SubscriptionAPI.java
│ ├── tag
│ ├── TagAPI.java
│ ├── TagCount.java
│ └── TagReference.java
│ ├── task
│ ├── AssignValue.java
│ ├── Task.java
│ ├── TaskAPI.java
│ ├── TaskActionType.java
│ ├── TaskCreate.java
│ ├── TaskCreateResponse.java
│ ├── TaskDueDate.java
│ ├── TaskDueStatus.java
│ ├── TaskPrivate.java
│ ├── TaskStatus.java
│ ├── TaskText.java
│ ├── TaskTotal.java
│ ├── TaskTotals.java
│ ├── TasksByDue.java
│ └── TasksWithResponsible.java
│ └── user
│ ├── ProfileFieldMultiValue.java
│ ├── ProfileFieldSingleValue.java
│ ├── PropertyValue.java
│ ├── User.java
│ ├── UserAPI.java
│ ├── UserMini.java
│ ├── UserStatus.java
│ ├── UserStatusType.java
│ ├── UserType.java
│ └── UserUpdate.java
└── test
└── java
└── com
└── podio
├── APIFactoryProvider.java
├── ResourceFactoryProvider.java
├── app
└── AppAPITest.java
├── calendar
└── CalendarAPITest.java
├── comment
└── CommentAPITest.java
├── contact
└── ContactAPITest.java
├── conversation
└── ConversationAPITest.java
├── device
└── DeviceAPITest.java
├── embed
└── EmbedAPITest.java
├── file
└── FileAPITest.java
├── hook
└── HookAPITest.java
├── item
├── ItemAPITest.java
└── map
│ ├── BugMap1.java
│ ├── BugMap2.java
│ ├── BugMap3.java
│ ├── HireStatus.java
│ ├── ItemMapTest.java
│ ├── MappedItemAPITest.java
│ ├── NameUtilTest.java
│ └── converter
│ └── MoneyConverterTest.java
├── notification
└── NotificationAPITest.java
├── org
└── OrgAPITest.java
├── rating
└── RatingAPITest.java
├── space
└── SpaceAPITest.java
├── status
└── StatusAPITest.java
├── stream
└── StreamAPITest.java
├── subscription
└── SubscriptionAPITest.java
├── tag
└── TagAPITest.java
├── task
└── TaskAPITest.java
└── user
└── UserAPITest.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | .idea
3 | *.iml
4 |
5 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | podio-java
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | #Wed Dec 22 15:42:05 CET 2010
2 | eclipse.preferences.version=1
3 | encoding/=UTF-8
4 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | #Fri Oct 22 23:39:37 CEST 2010
2 | eclipse.preferences.version=1
3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.6
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13 | org.eclipse.jdt.core.compiler.source=1.6
14 |
--------------------------------------------------------------------------------
/.settings/org.maven.ide.eclipse.prefs:
--------------------------------------------------------------------------------
1 | #Fri Oct 22 22:46:39 CEST 2010
2 | activeProfiles=
3 | eclipse.preferences.version=1
4 | fullBuildGoals=process-test-resources
5 | includeModules=false
6 | resolveWorkspaceProjects=true
7 | resourceFilterGoals=process-resources resources\:testResources
8 | skipCompilerPlugin=true
9 | version=1
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2010-2011 Podio
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | [](http://unmaintained.tech/)
2 |
3 | Podio Java API Client
4 | ---------------------
5 |
6 | This is the Java client for the [Podio](http://podio.com) API. Detailed documentation for the API is available on https://developers.podio.com. There you will find details on how to create an API key and use the API.
7 |
8 | An introduction to the Java client is also available at https://developers.podio.com/clients/java
--------------------------------------------------------------------------------
/src/main/java/com/podio/APIApplicationException.java:
--------------------------------------------------------------------------------
1 | package com.podio;
2 |
3 | import java.util.Map;
4 |
5 | import com.sun.jersey.api.client.ClientResponse.Status;
6 |
7 | public class APIApplicationException extends RuntimeException {
8 |
9 | private static final long serialVersionUID = -4533177892434958205L;
10 |
11 | private final Status status;
12 |
13 | private final String error;
14 |
15 | private final String description;
16 |
17 | private final Map parameters;
18 |
19 | public APIApplicationException(Status status, String error,
20 | String description, Map parameters) {
21 | super();
22 | this.status = status;
23 | this.error = error;
24 | this.description = description;
25 | this.parameters = parameters;
26 | }
27 |
28 | @Override
29 | public String toString() {
30 | return "APIException [status=" + status + ", error=" + error
31 | + ", description=" + description + ", parameters=" + parameters
32 | + "]";
33 | }
34 |
35 | public Status getStatus() {
36 | return status;
37 | }
38 |
39 | public String getError() {
40 | return error;
41 | }
42 |
43 | public String getDescription() {
44 | return description;
45 | }
46 |
47 | public Map getParameters() {
48 | return parameters;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/podio/APIFactory.java:
--------------------------------------------------------------------------------
1 | package com.podio;
2 |
3 | import java.lang.reflect.InvocationTargetException;
4 |
5 | /**
6 | * Factory to make it simple to get a specific API to work with
7 | */
8 | public class APIFactory {
9 |
10 | private final ResourceFactory resourceFactory;
11 |
12 | public APIFactory(ResourceFactory resourceFactory) {
13 | super();
14 | this.resourceFactory = resourceFactory;
15 | }
16 |
17 | public T getAPI(Class apiClass) {
18 | try {
19 | return apiClass.getConstructor(ResourceFactory.class).newInstance(
20 | this.resourceFactory);
21 | } catch (InstantiationException e) {
22 | throw new RuntimeException(e);
23 | } catch (IllegalAccessException e) {
24 | throw new RuntimeException(e);
25 | } catch (InvocationTargetException e) {
26 | throw new RuntimeException(e);
27 | } catch (NoSuchMethodException e) {
28 | throw new RuntimeException(e);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/podio/APITransportException.java:
--------------------------------------------------------------------------------
1 | package com.podio;
2 |
3 | public class APITransportException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 5668433811286152593L;
6 |
7 | public APITransportException(Throwable cause) {
8 | super(cause);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/com/podio/AuthProvider.java:
--------------------------------------------------------------------------------
1 | package com.podio;
2 |
3 | import com.podio.oauth.OAuthAPI;
4 | import com.podio.oauth.OAuthClientCredentials;
5 | import com.podio.oauth.OAuthRefreshTokenCredentials;
6 | import com.podio.oauth.OAuthToken;
7 | import com.podio.oauth.OAuthUserCredentials;
8 |
9 | /**
10 | * Manages tokens based on client credentials and user credentials.
11 | */
12 | public class AuthProvider {
13 |
14 | private final OAuthClientCredentials clientCredentials;
15 | private final OAuthUserCredentials userCredentials;
16 | private final OAuthAPI oauthAPI;
17 |
18 | private OAuthToken token;
19 |
20 | private long expireTime;
21 |
22 | public AuthProvider(ResourceFactory baseAPI,
23 | OAuthClientCredentials clientCredentials,
24 | OAuthUserCredentials userCredentials) {
25 | this.clientCredentials = clientCredentials;
26 | this.userCredentials = userCredentials;
27 | this.oauthAPI = new OAuthAPI(baseAPI);
28 | }
29 |
30 | private void updateToken(OAuthUserCredentials credentials) {
31 | this.token = oauthAPI.getToken(clientCredentials, credentials);
32 | this.expireTime = System.currentTimeMillis() + token.getExpiresIn()
33 | * 1000;
34 | }
35 |
36 | private void newToken() {
37 | updateToken(userCredentials);
38 | }
39 |
40 | private void refreshToken() {
41 | updateToken(new OAuthRefreshTokenCredentials(
42 | this.token.getRefreshToken()));
43 | }
44 |
45 | public synchronized OAuthToken getToken() {
46 | if (token == null) {
47 | newToken();
48 | } else if (expireTime < System.currentTimeMillis() - 30 * 1000) {
49 | refreshToken();
50 | }
51 |
52 | return token;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/com/podio/BaseAPI.java:
--------------------------------------------------------------------------------
1 | package com.podio;
2 |
3 | public abstract class BaseAPI {
4 |
5 | private final ResourceFactory resourceFactory;
6 |
7 | public BaseAPI(ResourceFactory resourceFactory) {
8 | this.resourceFactory = resourceFactory;
9 | }
10 |
11 | protected ResourceFactory getResourceFactory() {
12 | return resourceFactory;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/podio/CustomJacksonJsonProvider.java:
--------------------------------------------------------------------------------
1 | package com.podio;
2 |
3 | import javax.ws.rs.Consumes;
4 | import javax.ws.rs.core.MediaType;
5 |
6 | import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
7 | import org.codehaus.jackson.map.ObjectMapper;
8 |
9 | /**
10 | * Custom jackson provider to accept multiple kinds of data as JSON
11 | */
12 | @Consumes({ MediaType.APPLICATION_JSON, "text/json", "text/javascript",
13 | "application/x-javascript", "text/plain" })
14 | public class CustomJacksonJsonProvider extends JacksonJsonProvider {
15 |
16 | public CustomJacksonJsonProvider(ObjectMapper mapper) {
17 | super(mapper);
18 | }
19 |
20 | @Override
21 | protected boolean isJsonType(MediaType mediaType) {
22 | if (super.isJsonType(mediaType)) {
23 | return true;
24 | }
25 |
26 | return mediaType != null
27 | && (mediaType.getType().equalsIgnoreCase("text") && mediaType
28 | .getSubtype().equals("javascript"))
29 | || (mediaType.getType().equalsIgnoreCase("application") && mediaType
30 | .getSubtype().equals("x-javascript"))
31 | || (mediaType.getType().equalsIgnoreCase("text") && mediaType
32 | .getSubtype().equals("plain"));
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/podio/DryRunFilter.java:
--------------------------------------------------------------------------------
1 | package com.podio;
2 |
3 | import com.sun.jersey.api.client.ClientHandlerException;
4 | import com.sun.jersey.api.client.ClientRequest;
5 | import com.sun.jersey.api.client.ClientResponse;
6 | import com.sun.jersey.api.client.filter.ClientFilter;
7 |
8 | /**
9 | * Used to put the API in testmode
10 | */
11 | public class DryRunFilter extends ClientFilter {
12 |
13 | @Override
14 | public ClientResponse handle(ClientRequest cr)
15 | throws ClientHandlerException {
16 | if (!cr.getURI().getPath().startsWith("/oauth")) {
17 | cr.getHeaders().putSingle("X-Podio-Dry-Run", "steYut44");
18 | }
19 |
20 | return getNext().handle(cr);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/com/podio/ExceptionFilter.java:
--------------------------------------------------------------------------------
1 | package com.podio;
2 |
3 | import java.util.Map;
4 |
5 | import javax.ws.rs.core.Response.Status.Family;
6 |
7 | import com.sun.jersey.api.client.ClientHandlerException;
8 | import com.sun.jersey.api.client.ClientRequest;
9 | import com.sun.jersey.api.client.ClientResponse;
10 | import com.sun.jersey.api.client.GenericType;
11 | import com.sun.jersey.api.client.filter.ClientFilter;
12 |
13 | public class ExceptionFilter extends ClientFilter {
14 |
15 | @SuppressWarnings("unchecked")
16 | @Override
17 | public ClientResponse handle(ClientRequest cr)
18 | throws ClientHandlerException {
19 | try {
20 | ClientResponse response = getNext().handle(cr);
21 | if (response.getClientResponseStatus() == null
22 | || response.getClientResponseStatus().getFamily() != Family.SUCCESSFUL) {
23 | Map errorData = response
24 | .getEntity(new GenericType