Click here to Skip to main content
15,886,137 members
Home / Discussions / Java
   

Java

 
GeneralRe: Switch from VB.Net to Java Pin
Gerry Schmitz5-Feb-22 18:27
mveGerry Schmitz5-Feb-22 18:27 
AnswerRe: Switch from VB.Net to Java Pin
jschell17-Feb-22 11:33
jschell17-Feb-22 11:33 
QuestionJAVA Pin
Ku Hazwan29-Jan-22 16:15
Ku Hazwan29-Jan-22 16:15 
AnswerRe: JAVA Pin
Dave Kreskowiak29-Jan-22 18:40
mveDave Kreskowiak29-Jan-22 18:40 
AnswerRe: JAVA Pin
jschell30-Jan-22 7:11
jschell30-Jan-22 7:11 
GeneralRe: JAVA Pin
Richard MacCutchan30-Jan-22 22:35
mveRichard MacCutchan30-Jan-22 22:35 
GeneralRe: JAVA Pin
jschell17-Feb-22 11:34
jschell17-Feb-22 11:34 
QuestionHow TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202226-Jan-22 22:23
Tauqeer Ahmad 202226-Jan-22 22:23 
AnswerRe: How TO run the jar file in teradata ? Pin
OriginalGriff26-Jan-22 23:17
mveOriginalGriff26-Jan-22 23:17 
GeneralRe: How TO run the jar file in teradata ? Pin
Slacker00727-Jan-22 2:21
professionalSlacker00727-Jan-22 2:21 
GeneralRe: How TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202227-Jan-22 3:59
Tauqeer Ahmad 202227-Jan-22 3:59 
AnswerRe: How TO run the jar file in teradata ? Pin
jschell30-Jan-22 7:18
jschell30-Jan-22 7:18 
GeneralRe: How TO run the jar file in teradata ? Pin
Tauqeer Ahmad 202230-Jan-22 23:39
Tauqeer Ahmad 202230-Jan-22 23:39 
QuestionLooping Array and Satisfying multiple conditions-Support Pin
Member 1551308825-Jan-22 22:01
Member 1551308825-Jan-22 22:01 
AnswerRe: Looping Array and Satisfying multiple conditions-Support Pin
Afzaal Ahmad Zeeshan5-Feb-22 11:40
professionalAfzaal Ahmad Zeeshan5-Feb-22 11:40 
I would highly encourage using the URL parameterization in whichever HTTP development framework you're using. That would simplify a lot of things.
  1. The HTTP request methods should not be checked in the method body itself. It makes very less sense. If you're going to run a logic based on the HTTP verb, create a separate handler for that verb. Most frameworks support that—Spring Boot, for example, does support HTTP verb-based routing.
  2. The URL itself can be created as a parameterized URL, then you can capture the values inside the parameters for the action.
You can create a request handler like,
Java
@PutMapping("/http/{market}/{state}/{update}")
@ResponseBody
public RecordDto.EventTypeEnum putUpdate(
     @PathVariable String market, 
     @PathVariable String state, 
     @PathVariable String update) {
    // read the values and write the logic
    if (state.equals("state") {
        return RecordDto.EventTypeEnum.MARKET_STATE_UPDATE;
    } else {
        // other cases that test the value for state, etc.
    }
}

This way you leave a lot of processing and parsing to the framework itself. Read more about @PathVariable on Baeldung.

For a basic Java application, it might make sense to write the conditional blocks within the method body, but as your application scales, it becomes difficult to understand the flow of a program. That is why keep everything separated; that's one of the SOLID principles.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~

QuestionPdf em java (PDF in Java) Pin
Daniel Carvalho 202221-Jan-22 1:54
Daniel Carvalho 202221-Jan-22 1:54 
AnswerRe: Pdf em java (PDF in Java) Pin
OriginalGriff21-Jan-22 2:00
mveOriginalGriff21-Jan-22 2:00 
GeneralRe: Pdf em java (PDF in Java) Pin
Daniel Carvalho 202224-Jan-22 5:53
Daniel Carvalho 202224-Jan-22 5:53 
QuestionRe: Pdf em java (PDF in Java) Pin
David Crow24-Jan-22 6:06
David Crow24-Jan-22 6:06 
AnswerRe: Pdf em java (PDF in Java) Pin
Daniel Carvalho 202225-Jan-22 4:19
Daniel Carvalho 202225-Jan-22 4:19 
AnswerRe: Pdf em java (PDF in Java) Pin
Richard Deeming25-Jan-22 5:10
mveRichard Deeming25-Jan-22 5:10 
GeneralRe: Pdf em java (PDF in Java) Pin
englebart12-Feb-22 14:40
professionalenglebart12-Feb-22 14:40 
QuestionGetting data from a web site using Jsoup Pin
David Crow20-Jan-22 4:59
David Crow20-Jan-22 4:59 
AnswerRe: Getting data from a web site using Jsoup Pin
englebart12-Feb-22 14:44
professionalenglebart12-Feb-22 14:44 
Questionjava program Pin
Ricca Marie Fantilanan11-Jan-22 2:21
Ricca Marie Fantilanan11-Jan-22 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.