Kathir jeyap

Ranch Hand
+ Follow
since Jan 31, 2018
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Kathir jeyap

Looking for a Java Swing or JavaFx Frame where whenever a user drag and drop a file or a folder a certain operation needs to be done.

A stanadlone java class which creates UI with java swing or javafx.

Now after launching the jar or the class when the user drags a file or folder in his machine to the frame a certain operations needs to be done.

Can someone help me with a java program for the same?
2 weeks ago
There are two situations in our project

Send Base 64 String to the server. This is needed since a third party API needs a base 64 string instead of stream

Send actual image as stream to the server in another use case. This is needed since another third party API needs a stream instead of base 64 string

We have a unique or single API in the back-end to handle both of them.


saving the base 64 string in the database. on retrieve, changing the base 64 to actual image in the front end

saving the image in a folder and path in the database. on retrieve, sending the image stream. converting the image stream to base 64 string in the front end to populate.

What would be the generic way to handle both of them in a single method?

Can we have a single method by converting any thing to Base URL in the back-end and later process the same?
1 month ago
Which is the Best OCR engine for most accuracy - commerical or open source in terms of very high quality
1 month ago
The last update was 2004. see the modified date.


I dont find enough example on how to implement it. Can you please help me with a sample code snippet please?
1 month ago
We have both standalone and web application.

Now we need to use license generator for the standalone and web app.

After searching, come across a link - https://sourceforge.net/projects/jicense/?source=navbar

Checking for a good open source license generator and reference links for standalone as well as for web application.

The open source specified above is modified on 2004 which was quite a long time ago.

Help me with comments.

1 month ago

1. How does session will be stored in the server in spring mvc application ? Do we need to save explicitly ?

2. What are the different ways to store session in spring mvc application ?

3. Which approach would be efficient (client side or server side) ?

4. How to list ALL the sessions created in the server ?

5. How to invalidate a particular session which is active in the server - session id is available ?
2 months ago
We are working in java web development applications. We are having huge constants for our application and most of them are general constants. It grows heavily large.

I saw the same approach followed in several enterprise applications and it is unavoidable and they are creating Constants.java

Most of the constants are most generic which can be used in any project.

Example as follows

created date
created time
start date
end date

Is there a way to cut down the constants via any third party library which has inbuilt huge constants ???

Why Java doesn't have give support with own constants to standardize all J2EE applications ???

Says if the primary key should be named as "primary key" or "id" or "key" then it would be a standard practice for all and easy for maintenance by any J2EE developer.

2 months ago
Spring Boot Version: 2.0
Spring Version: 5.0.4

Facing the following problems when trying to implement AccessDecisionManager

1. When used

public class WebConfig implements WebMvcConfigurer

Issue:  uanble to override protected void configure(HttpSecurity http) throws Exception {

2. When used

public class WebConfig extends WebSecurityConfigurerAdapter {

Issue: unable to override the following

a. public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
b. public void addResourceHandlers(ResourceHandlerRegistry registry) {
c. public void addInterceptors(InterceptorRegistry registry) {

3. Throws error "java.lang.IllegalStateException: No ServletContext set" when used as below

public class WebConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {

URL for reference:  http://www.baeldung.com/spring-security-custom-voter

2 months ago
I come across the following video https://www.youtube.com/watch?v=Lpw4CkNTfiois about Spring Security - A Custom AccessDecisionVoter (LSS - Module 9 - Lesson 4)

i'm trying to authorize user for a specific action but we don't have hasRole concept in our application but certain values needs to be verified before authorization.

Can we comment hasRole('Admin') line in the above video and just use the Custom Decision Voter to have the custom code to validate the user and grant the access ???

Please kindly suggest

2 months ago
I went through couple of API and look for an Equivalent interceptor to PreProcessInterceptor.java (org.jboss.resteasy.spi.interception.PreProcessInterceptor ) (https://howtodoinjava.com/resteasy/jax-rs-resteasy-basic-authentication-and-authorization-tutorial/)

Trying to find a interceptor with code snippet to get the user and check whether he has permission to access the requested URL

1. Equivalent interceptor to PreProcessInterceptor.java in Spring MVC
2. Interceptor code to authorize user action

Please kindly help me with a code snippet.
2 months ago
I have the below tables - group table. Each group or A Single group may have like the following and corresponding will be inserted in to tables

User                 Module    Permissions
Sales Rep         Sales       Read
Admin              Sales       Read, Write, Delete
Order Rep        Order       Read, Write
Admin              Order      Read, Write, Delete

One user can be associated with ONLY ONE group.

Now when the user access sales or order or any action we need to authorize it after login.

i thought of going through spring AccessDecisionVoter.

Please suggest whether AccessDecisionVoter (OR) WebSecurityConfigurerAdapter -> configAuthentication method which will be most suitable for this

Need code snippet to proceed for any of the above.

2 months ago
Thanks and we can close this question as resolved.
3 months ago
Created enum as follows

public enum OrderStatusEnum {


private String desc;

private OrderStatusEnum(String desc) {
this.desc = desc;
public String getDesc() {
return desc;
public void setDesc(String desc) {
this.desc = desc;


However when i used OrderStatusEnum.valueOf("awaiting_order") i am getting the exception Exception in thread "main" java.lang.IllegalArgumentException: No enum constant com.mkyong.model.OrderStatusEnum.awaiting_order

How to resolve it..Basically

1. valueOf should work
2. not sure which string needs to be returned on toString
3. How to save the value in the database.
3 months ago

I insert a row in the table as follows

final SqlParameterSource namedParameters = new MapSqlParameterSource.addValue("xParam", X.getName).addValue("yParam", Y.getName).addValue("zParam", Z.getName);

I have a enum colum in the database which is of enum OrderStatusEnum

I have an enum as follows

public enum OrderStatusEnum {
    ACTIVE("A","Active Order"),
    AWAITING("I","Awaiting Order")

I want to save ACTIVE, AWAITING in the database. Also retrieve the same on query

I'm getting exception when entity is getting set as enum and saved via JdbcTemplate. Data Truncate exception


1. Do i need to save ACTIVE/AWAITING in the database or Active Order/Awaiting Order i.e enum description ??
2. How to save the enum value and not sure how to save it

If i put Types.VARCHAR as an additional parameter the value is getting saved as ACTIVE/AWAITING ORDER and seems description is getting saved

Which one is the right approach - saving enum value or description. I think saving enum value would be the right option. However unable to save the enum using the above

3 months ago

Link For Reference https://www.mkyong.com/spring-boot/spring-boot-ajax-example/

1. Don't type any name and hit search button - Bad Request - It Comes to Error Function of Ajax - User Can't be Empty - Form Validation. Ajax response is error in this case.

2. Type "Somu" in name field and hit search button - Business Error - Returned with Success Function. Ajax response is success in this case.

3. Assume i have thrown a run time exception in getSearchResultViaAjax() as below

AjaxResponseBody result = new AjaxResponseBody();
        if(1==1) {
              throw new RuntimeException();

The same Ajax error block is getting called.

error: function (e) {

            var json = "<h4>Ajax Response Error </h4><pre>"
                + e.responseText + "</pre>";

            console.log("ERROR pp : ", e);
            $("#btn-search").prop("disabled", false);


So for Bad Request and Any Exception which comes Out side the box comes in error block

Which one is the right approach in the follow ? If both of them is incorrect, help me with the best practice

1. Throw form validation errors as as Ajax Response is ERROR with failure message to display
2. Throw Business validation errors as Ajax Response is SUCCESS with failure message to display
3. Throw any other exception as Ajax Response is ERROR with failure message to display



1. Throw form validation error as Ajax Response is ERROR with failure message to display ('User Field is Empty')
2. Throw Business validation errors as Ajax Response is FAILURE with failure message to display ('User Name doesn't exist')
3. Throw any other exception as Ajax Response is ERROR with failure message to display

Please advise with suggestions or comments.
3 months ago