Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

With more than 20,000 members, join one of the biggest and most active Java Communities on Discord! ☕

Join

java-help

❓︱qotw-answers

Apache Mina SSHD server

hi guys.. I built a SSH server using Apache Mina and StackOverflow. Now, I ran into the problem, that I am unable to get the String which was input as username or password... This is annoying and the documentation is pure shit. If anyone can tell me what I need to read the client input properly, please help me. CNCServer: https://pastebin.com/Ab1mkdEM Commands: https://pastebin.com/C0yzEvsG PasswordAuth: ```public class CNCPasswordAuthenticator implements PasswordAuthenticator{ ...
No description

Will Pay for Help

The highlighted part is the problem but idk how to stop it from happening ```import java.util.Scanner; import java.util.Random; ...
No description

where do config values come from?

usually in configs you have smth like this: . where you specify from where the value comes from. in this screenshot it comes from application.yaml file. but idk where it comes from in my BankAccountConfig?: ```java @Component...
No description

what the hell is model and why controller returns random string?

hey guys. can smb explain what the hell model is? bc i tried googling and its just vaguely said that model is your data. yes, i know its from MVC pattern, but it still doesnt make any sense, can smb explain what the f is going on here: ```java @GetMapping("/importBgwEod") public String importBgwEod(Model model) throws JAXBException, IOException { importService.importBgwEod(getUserId());...

Spring MVC checking user password

I am Trying to check the user is already registered or not as well as the password is correct or not but i am getting error as i mentioned down here is the both controller -> ```@GetMapping("/login") public String loginPage(Model model) { model.addAttribute("movieFinderLoginUserPojo", new MovieFinderLoginUserPojo());...

how to store XML if i want to change its values in my service?

hey guys. in my service want to use XML. in the service Id change needed values of my XML tags. how can i do that? i was thinking about storing the XMLsomewhere, and then 'importing'/using it in my service methods. how can i do that? thanks

Spring MVC Static files

i dont know why but my browser is not adding the css file to my jsp file.. I dont Know How to resolve the issue can anyone help ?
No description

using String to represent date

hey guys. i want to have a method that accepts fromDate and toDate args. and then later in this method i will concat the args to the string:
"<FrDt>"+fromDate+"</FrDt>\n" +
"<ToDt>"+toDate+"</ToDt>\n"
"<FrDt>"+fromDate+"</FrDt>\n" +
"<ToDt>"+toDate+"</ToDt>\n"
...

Richardson Mapping With Spring Security

Hi, Im curious about, how to properly create mappings for security endpoints. I have now a UserController. So where would you like to put mappings like "login, register and verify email", to UserController or AuthController. And how would you like to create endpoints. ...

Apache Mina weird session behaviour

Hello there, I am building a CNC / Telnet server using Apache Mina and ran into some issues from the very beginng... First, I will be showing my Classes which are in the relation of the CNC... CNCServerHandler: https://pastebin.com/A5ea3AgF (Class with the username Input) CNCServer: https://pastebin.com/HEJedJ1F CNCClient: https://pastebin.com/qk2Au8Bf...
No description

Session not being created after explicitly authenticating user in spring security

I'm currently trying to implement a session based authentication using spring security and have managed to get the registration and email verification functionality working. I want the user to be authenticated after verifying their email and then be redirected to the onboarding page and then to dashboard on completion of onboarding. I have logged the authentication to console to debug and when there isn't any user then I get a console log with the authentication object containing anonymousUser and also a sessionId. But, when I explicitly try to authenticate the user, the authentication object contains all the info about the user such as principal, etc but not sessionId. any help, please? ...

Autocomplete not working

Java extension autocomplete doesn´t work VS-code

how to make my controller accept XML body?

hey guys. i have this controller: ```java GetMapping(value = "/transactions", produces = "application/xml") public String getCurrentTransactions() throws JAXBException, IOException { return bgwService.getCurrentTransactions();...

how to find my project's classpath?

hey guys. can smb in a simple manner explain how to see what is my classpath in intellij idea project? bc googling is worthless and theres no proper answer anywhere. can smb help me out? thx alot

Apache Mina

Hello there, I am building a CNC / Telnet server using Apache Mina and ran into some issues from the very beginng... First, I will be showing my Classes which are in the relation of the CNC... CNCServerHandler: https://pastebin.com/A5ea3AgF CNCServer: https://pastebin.com/HEJedJ1F CNCClient: https://pastebin.com/qk2Au8Bf...
No description

Spring MVC Suggestion

Currently I am Learning Spring MVC So should I also have to cover the part like Validation , Data Blinding , Filters , Interceptors or should I have to leave them right now and jump to spring boot ? please Mentor me .

Injecting objects into custom controls FXML

How can that be done? i cant pass it through ctor as it doesnt allow ctors with any params in fxml

started getting Class Not Found Exception randomly

hey guys. when i start my spring boot app i get this error: java.lang.ClassNotFoundException: lt.mycompany.myapp.service.XmlParserUtil. The thing is that XmlParserUtil was used just fine in this app. Now im adding new functionality, and for some reason i cant even start my app. XmlParserUtil looks like this: ```java...

how to use RFC1123 date in http header?

hey guys. can smb explain to me how to use DateTimeFormatter RFC_1123_DATE_TIME? Im making a request to the api and i need to have Date header with its value being in RFC1123 format. can smb help me out? i dont understand what to write here:
HttpHeaders headers = new HttpHeaders();
headers.set();
HttpHeaders headers = new HttpHeaders();
headers.set();
...