rest

Receive Image as multipart file to rest service

馋奶兔 提交于 2021-02-18 18:13:42
问题 I am exposing a restful webservice, where i want to accept image as multipart file in the json body request i dont find anywhere a sample json request so as to hit my rest service from a rest client.my rest service uses this field above the class declaration @Consumes({MediaType.APPLICATION_JSON,MediaType.MULTIPART_FORM_DATA}) can anyone please get me a sample json request 回答1: The purpose of multipart/form-data is to send multiple parts in one request. The parts can have different media

Receive Image as multipart file to rest service

穿精又带淫゛_ 提交于 2021-02-18 18:12:21
问题 I am exposing a restful webservice, where i want to accept image as multipart file in the json body request i dont find anywhere a sample json request so as to hit my rest service from a rest client.my rest service uses this field above the class declaration @Consumes({MediaType.APPLICATION_JSON,MediaType.MULTIPART_FORM_DATA}) can anyone please get me a sample json request 回答1: The purpose of multipart/form-data is to send multiple parts in one request. The parts can have different media

How to use ETag to throw exception on insert if ETag doesn't match (except when it's *)

孤街醉人 提交于 2021-02-18 12:59:27
问题 I need to be able to insert an entity to an azure storage table under these conditions: if it doesn't exist, insert. if it exists, but I specify ETag to be *, then replace. if it exists, but ETag has another value, then throw StorageException with code 409 or 412. (for example I would try to insert an entity I have retrieved, but it has been updated from elsewhere in the meantime) I made this simple program to test, but I can't figure out how to get this to work. it never reaches the

TOAuth2Authenticator: How do i refresh an expired token?

一曲冷凌霜 提交于 2021-02-18 12:46:55
问题 I must be missing something here! I have been playing around trying to refresh an expired OAUTH2 token using the new ( new to me anyway, coming from delphi xe2 environment) TOAuth2Authenticator, TRESTClient, TRESTRequest, TRESTResponse components I have set the following authenticator properties with the existing known values for ClientID ClientSecret Scope AccessTokenEndPoint AuthorizationEndPoint RedirectionEndPoint AccessToken AccessTokenExpiry RefreshToken and can successful access

AzureAD JWT Token Audience claim prefix makes JWT Token invalid

早过忘川 提交于 2021-02-18 11:16:28
问题 I'm using the 'adal-node' npm package to authenticate with an AzureAD. This is all working fine and I get a token back. However, the when examining the 'aud' claim in the JWT token I see the audience GUID is prefixed with 'spn:'. I think this is causing me problems when I try to use the JWT token on an already existing Web API. When I authenticate via a WebApp using the same AzureAD the 'aud' claim is NOT prefixed with 'spn:' and I am able to called endpoints on the WebAPI. Can anyone shed

Jenkins json REST api with CORS request using jQuery

给你一囗甜甜゛ 提交于 2021-02-18 08:13:55
问题 I'm trying to use the Jenkins json API and cannot get the authentication to work. setup: Jenkins security: Jenkin’s own user database access: Matrix-gebaseerde beveiliging CORS via Jenkins CORS plugin using username/api token of a registered user tried: var username = "username"; var apiToken = "apiToken"; // username / api-token on url (basic authentication) $.ajax({ url: "http://"+username+":"+apiToken+"@host:port/job/test/api/json", method: "GET" }); // username / api-token supplied using

response redirection(302) not work in angular

旧城冷巷雨未停 提交于 2021-02-18 08:05:25
问题 I Designed a login page for SSO(Single Sign-On) by angular and the services for login developed separately by spring boot framework. In the angular app, when submitted login form, login service call with post-HttpMethod by HttpClient module. In login service if username and password be correct then in the result of login service, set response status to 302 and add a specific URL to the header of the response. in this scenario I expect to browser redirect to specific URL, but this is not

response redirection(302) not work in angular

拜拜、爱过 提交于 2021-02-18 08:05:07
问题 I Designed a login page for SSO(Single Sign-On) by angular and the services for login developed separately by spring boot framework. In the angular app, when submitted login form, login service call with post-HttpMethod by HttpClient module. In login service if username and password be correct then in the result of login service, set response status to 302 and add a specific URL to the header of the response. in this scenario I expect to browser redirect to specific URL, but this is not

BindException thrown instead of MethodArgumentNotValidException in REST application

老子叫甜甜 提交于 2021-02-17 21:45:36
问题 I have a simple Spring Rest Controller with some validation. My understanding is that validation failures would throw a MethodArgumentNotValidException. However, my code throws a BindException instead. In debug messages, I also see the app returning a null ModelAndView. Why would a Rest Controller throw BindException or return a null ModelAndView? Note: I am testing my web application using curl and making an HTTP POST curl -X POST http://localhost:8080/tasks I am intentionally omitting the

Spring JPA REST sort by nested property

淺唱寂寞╮ 提交于 2021-02-17 21:45:01
问题 I have entity Market and Event . Market entity has a column: @ManyToOne(fetch = FetchType.EAGER) private Event event; Next I have a repository: public interface MarketRepository extends PagingAndSortingRepository<Market, Long> { } and a projection: @Projection(name="expanded", types={Market.class}) public interface ExpandedMarket { public String getName(); public Event getEvent(); } using REST query /api/markets?projection=expanded&sort=name,asc I get successfully the list of markets with