Skip to content
Advertisement

Tag: api

How to create an endpoint which takes a path, load the image and serve it to the client

I want to serve an image to a client by converting it to a byte but for some reason byteArrayOutputStream.toByteArray() is empty. I get a response status of 200 which means it is served. I looked at various documentations on reading an image file from a directory using BufferedImage and then converting BufferedImage to a byteArray from oracle https://docs.oracle.com/javase/tutorial/2d/images/loadimage.html and

Sending an email at a specific time using spring boot [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 months ago. Improve this question in the application I am developing I can specify an expiration date of a license and now I want to

Specifying sort order direction in a JSON API

Does Restful API define proper ways to give Sort Order Direction, (Ascending or Descending) for API user parameters ? I am letting a user input a request string, that only allows two options for API to work “Ascending” or “Descending” . Is there a more formal way of doing this per standards? Request: Specifying sort order in a JSON API

Unable to receive data out of api call with webclient

So I’m trying to get my head around the webclient, but I keep getting a nullpointerexception, though my test work fine and say that object is not null. I also see my console making connection to the api. But when I ask the value, I get null. Here are the two objects I use for it: and then here I

How to customize sso(single sign on) by keycloak?

sorry for my poor english… I ‘ll do my best to write question. Basically, keycloak provide loginPage where login form has a some name and value parameter determined by keycloak (forexample session_code, excustion, client_id, tab_id). this way is Server side randering(SSR). However, I want to login process with keycloak in API way. In this case, it’s not possible to use

How to properly convert HashMap<String,List> to Json with array of json object

I have a stream of Kafka messages and wanted to build a HashMap<String,List<Object>> to be used as API response in Json format. expected response: actual response: Answer It is now working using these changes: Convert Kafka message string to JSONObject new JSONObject(consumerRecord.value()) Construct a JSONObject from a Map using jsonObject = new JSONObject(responses); Return Map<String, Object> using jsonObject.toMap();

POST: Exception Status expected: but was:

Technically it should be a simple task, but I can’t find the error. I want to write a normal “POST method”, but when I tested it, it came to a problem: enter code here Status expected:<201> but what:<200>. My question is, why do I get an OK and not a CREATED? CODE: PostMapping in Controller Unit Test Answer Because for

Advertisement