Skip to content
Advertisement

Tag: java

How to verify that a string is JWT token?

In Java How can we verify that i given String is a JWT Token without using Signature? I am using This works fine but I want to verify this without SECRET_KEY. I Just want to verify whether it is a JWT token or not. Answer Here is an example to check the structure of the JWT. You only need to

ArrayList gets overwritten everytime a new instance is created

I’m a new programmer, I’m terribly sorry for the walls of code, but I simply can’t find the error. I am tring to create an arrayList that stores input values, but everytime I create the 2nd instance, the first instance gets overwritten. It does print two instances, but both instances have the same value. Main block: The problem area is

How to send a list of custom objects over a socket?

How can I send elements of this ArrayList over a socket from a client to a server? I tried some structures but all needed one String to send. Answer The easiest way is to use object streams. In order to do this, shapeInfo should be Serializable: Then, you can send it using an ObjectOutputStream: On the other side, you can

How to validate spaces between two words using regex in a string [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question I am trying to validate string to accept spaces between two words (in the middle). I want a regex that will accept “hello world”. I

Using Java Optional in Kotlin DTOs

Currently I’m using Java 8’s Optional in my Kotlin DTOs as follows: The purpose of it is that for some properties like prop2 I want to also allow delete in the request. So the value of prop2 in the DTO is understood as follows: null => do nothing non-empty optional => update value empty optional => delete value (set value

How can i add data to th:action form

I have a spring-boot application. Full url that I need: localhost:8080/company/{companyName}/users?name={name}. In the beginning i choose company, for ex. : localhost:8080/company/google. The controller redirects me to the page with the form (company.html), where i type name. Controller: In Data class i simply store company and name; My form, where i type name: So after i submit, the result url is

Advertisement