Java Code Examples for javax.ws.rs.core.Response#getStringHeaders()
The following examples show how to use
javax.ws.rs.core.Response#getStringHeaders() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileName.java From raml-java-client-generator with Apache License 2.0 | 6 votes |
/** * Creates or updates the given file * */ public SimpleApiResponse<Void> put(Object body, FileNamePUTHeader headers) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); if (headers.getXBaseCommitId()!= null) { invocationBuilder.header("x-base-commit-id", headers.getXBaseCommitId()); } if (headers.getXCommitMessage()!= null) { invocationBuilder.header("x-commit-message", headers.getXCommitMessage()); } Response response = invocationBuilder.put(Entity.entity(body, "*/*")); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new SimpleApiException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } SimpleApiResponse<Void> apiResponse = new SimpleApiResponse<Void>(null, response.getStringHeaders(), response); return apiResponse; }
Example 2
Source File: Exec.java From raml-java-client-generator with Apache License 2.0 | 6 votes |
public DataWeaveAPIResponse<Void> post(ExecPOSTBody body) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); FormDataMultiPart multiPart = new FormDataMultiPart(); if (body.getFile()!= null) { multiPart.bodyPart(new FileDataBodyPart("file", body.getFile())); } if (body.getFrom()!= null) { multiPart.field("From", body.getFrom().toString()); } Response response = invocationBuilder.post(Entity.entity(multiPart, multiPart.getMediaType())); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new DataWeaveAPIException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } DataWeaveAPIResponse<Void> apiResponse = new DataWeaveAPIResponse<Void>(null, response.getStringHeaders(), response); return apiResponse; }
Example 3
Source File: WnsClient.java From java-wns with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @param channelUri * @param resourceBuilder * @param notification * @param retriesLeft to push the notification if the token expires * @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> * @throws WnsException when authentication fails */ public WnsNotificationResponse push(WnsResourceBuilder resourceBuilder, String channelUri, WnsAbstractNotification notification, int retriesLeft, WnsNotificationRequestOptional optional) throws WnsException { WebTarget target = client.target(channelUri); Invocation.Builder webResourceBuilder = resourceBuilder.build(target, notification, getToken().access_token, optional); String type = notification.getType().equals(WnsNotificationType.RAW) ? MediaType.APPLICATION_OCTET_STREAM : MediaType.TEXT_XML; Response response = webResourceBuilder.buildPost(Entity.entity(resourceBuilder.getEntityToSendWithNotification(notification), type)).invoke(); WnsNotificationResponse notificationResponse = new WnsNotificationResponse(channelUri, response.getStatus(), response.getStringHeaders()); if (notificationResponse.code == 200) { return notificationResponse; } if (notificationResponse.code == 401 && retriesLeft > 0) { retriesLeft--; // Access token may have expired refreshAccessToken(); // Retry return this.push(resourceBuilder, channelUri, notification, retriesLeft, optional); } // Assuming push failed return notificationResponse; }
Example 4
Source File: Exec.java From raml-java-client-generator with Apache License 2.0 | 6 votes |
public void post(ExecPOSTBody body) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); FormDataMultiPart multiPart = new FormDataMultiPart(); if (body.getFile()!= null) { multiPart.bodyPart(new FileDataBodyPart("file", body.getFile())); } if (body.getFrom()!= null) { multiPart.field("From", body.getFrom().toString()); } Response response = invocationBuilder.post(Entity.entity(multiPart, multiPart.getMediaType())); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new DataWeaveAPIException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } }
Example 5
Source File: Id.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public BuyosExperienceLayerResponse<securedby_with_uses.resource.users.id.model.IdGETResponseBody> get() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.get(); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new BuyosExperienceLayerException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } BuyosExperienceLayerResponse<securedby_with_uses.resource.users.id.model.IdGETResponseBody> apiResponse = new BuyosExperienceLayerResponse<securedby_with_uses.resource.users.id.model.IdGETResponseBody>(response.readEntity(securedby_with_uses.resource.users.id.model.IdGETResponseBody.class), response.getStringHeaders(), response); return apiResponse; }
Example 6
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public void get() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.get(); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new CoreServicesAPIReferenceException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } }
Example 7
Source File: Rename.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
/** * Rename a project * */ public void put(Object body) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.put(Entity.json(body)); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new DesignCenterProjectsServiceException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } }
Example 8
Source File: Api.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
/** * Returns the list of all users * */ public List<ApiGETResponse> get(String authorizationToken) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); invocationBuilder.header("Authorization", ("Bearer "+ authorizationToken)); Response response = invocationBuilder.get(); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new CoreServicesAPIReferenceException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } return response.readEntity(( new javax.ws.rs.core.GenericType<java.util.List<oauth_override.resource.api.model.ApiGETResponse>>() {})); }
Example 9
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public FooResponse<String> post() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.post(null); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } FooResponse<String> apiResponse = new FooResponse<String>(((String) response.readEntity(Object.class)), response.getStringHeaders(), response); return apiResponse; }
Example 10
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public simple.resource.cs.login.model.LoginGETResponse get() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.get(); if (response.getStatusInfo().getFamily()!= javax.ws.rs.core.Response.Status.Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } return response.readEntity(simple.resource.cs.login.model.LoginGETResponse.class); }
Example 11
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public simple.resource.cs.login.model.LoginPOSTResponse post(LoginPOSTBody body) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.post(Entity.json(body)); if (response.getStatusInfo().getFamily()!= javax.ws.rs.core.Response.Status.Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } return response.readEntity(simple.resource.cs.login.model.LoginPOSTResponse.class); }
Example 12
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public MultiBodyResponse<multi_body.resource.cs.login.model.LoginPOSTResponseBody> post(LoginPOSTBody body) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.post(javax.ws.rs.client.Entity.json(body)); if (response.getStatusInfo().getFamily()!= javax.ws.rs.core.Response.Status.Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new MultiBodyException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } MultiBodyResponse<multi_body.resource.cs.login.model.LoginPOSTResponseBody> apiResponse = new MultiBodyResponse<multi_body.resource.cs.login.model.LoginPOSTResponseBody>(response.readEntity(multi_body.resource.cs.login.model.LoginPOSTResponseBody.class), response.getStringHeaders(), response); return apiResponse; }
Example 13
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public FooResponse<simple.resource.cs.login.model.LoginPOSTResponseBody> post(LoginPOSTBody body) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.post(Entity.json(body)); if (response.getStatusInfo().getFamily()!= javax.ws.rs.core.Response.Status.Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } FooResponse<simple.resource.cs.login.model.LoginPOSTResponseBody> apiResponse = new FooResponse<simple.resource.cs.login.model.LoginPOSTResponseBody>(response.readEntity(simple.resource.cs.login.model.LoginPOSTResponseBody.class), response.getStringHeaders(), response); return apiResponse; }
Example 14
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public FooResponse<List<AuthorizationJson>> post() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.post(null); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } FooResponse<List<AuthorizationJson>> apiResponse = new FooResponse<List<AuthorizationJson>>(response.readEntity(( new javax.ws.rs.core.GenericType<java.util.List<include_schema.resource.cs.login.model.AuthorizationJson>>() {})), response.getStringHeaders(), response); return apiResponse; }
Example 15
Source File: Rename.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
/** * Rename a project * */ public DesignCenterProjectsServicewithsubresourceonsamelineResponse<Void> put(Object body) { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.put(Entity.json(body)); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new DesignCenterProjectsServicewithsubresourceonsamelineException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } DesignCenterProjectsServicewithsubresourceonsamelineResponse<Void> apiResponse = new DesignCenterProjectsServicewithsubresourceonsamelineResponse<Void>(null, response.getStringHeaders(), response); return apiResponse; }
Example 16
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public FooResponse<List<AuthorizationJson>> post() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.post(null); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } FooResponse<List<AuthorizationJson>> apiResponse = new FooResponse<List<AuthorizationJson>>(response.readEntity(( new javax.ws.rs.core.GenericType<java.util.List<java_8_dates.resource.cs.login.model.AuthorizationJson>>() {})), response.getStringHeaders(), response); return apiResponse; }
Example 17
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public List<AuthorizationJson> post() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.post(null); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } return response.readEntity(( new javax.ws.rs.core.GenericType<java.util.List<include_schema.resource.cs.login.model.AuthorizationJson>>() {})); }
Example 18
Source File: Users.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
/** * Returns the list of all users * */ public List<UsersGETResponse> get() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.get(); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } return response.readEntity(( new javax.ws.rs.core.GenericType<java.util.List<list.resource.users.model.UsersGETResponse>>() {})); }
Example 19
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public MultiBodyResponse<multi_body.resource.cs.login.model.LoginGETResponseBody> get() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.get(); if (response.getStatusInfo().getFamily()!= javax.ws.rs.core.Response.Status.Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new MultiBodyException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } MultiBodyResponse<multi_body.resource.cs.login.model.LoginGETResponseBody> apiResponse = new MultiBodyResponse<multi_body.resource.cs.login.model.LoginGETResponseBody>(response.readEntity(multi_body.resource.cs.login.model.LoginGETResponseBody.class), response.getStringHeaders(), response); return apiResponse; }
Example 20
Source File: Login.java From raml-java-client-generator with Apache License 2.0 | 5 votes |
public String post() { WebTarget target = this._client.target(getBaseUri()); final javax.ws.rs.client.Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON_TYPE); Response response = invocationBuilder.post(null); if (response.getStatusInfo().getFamily()!= Family.SUCCESSFUL) { Response.StatusType statusInfo = response.getStatusInfo(); throw new FooException(statusInfo.getStatusCode(), statusInfo.getReasonPhrase(), response.getStringHeaders(), response); } return ((String) response.readEntity(Object.class)); }