This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
** ##### DOUGHNUT-CHART ##### | |
*/ | |
public doughnutChartLabels: string[] = ['New', 'Pending', 'Granted']; | |
public doughnutChartData: number[] = [250, 150, 100]; | |
public doughnutChartType: string = 'doughnut'; | |
public doughnutChartColors: Array<any> = [{ | |
backgroundColor: ['rgba(81,175,49,0.8)', 'rgba(148, 148, 148,0.8)', 'rgba(0,0,153,0.8)'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.coodoo.medium; | |
/** | |
* @author Markus | |
*/ | |
public class MediumSourceCodeExample { | |
private static int answer = 42; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -i -XPOST -H "Content-Type: application/json" -d "{\"name\": \"d\",\"email\": \"[email protected]\"}" http://localhost:8080/jee-jaxrs-validation/resources/users | |
HTTP/1.1 400 Bad Request | |
{ | |
"exception": null, | |
"fieldViolations": [], | |
"propertyViolations": [], | |
"classViolations": [], | |
"parameterViolations": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -i -XPOST -H "Content-Type: application/json" -d "{\"name\": null,\"email\": null}" http://localhost:8080/jee-jaxrs-validation/resources/users | |
HTTP/1.1 400 Bad Request | |
{ | |
"exception": null, | |
"fieldViolations": [], | |
"propertyViolations": [], | |
"classViolations": [], | |
"parameterViolations": [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/users") | |
public class UserResource { | |
@POST | |
@Path("/") | |
public User createUser(@Valid User user) { | |
user.setId(1l); | |
return user; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
@NotNull(message="Der Name muss angegeben werden") | |
@Size(min=3, max=10, message="Der Name muss zwischen {min} und {max} Zeichen lang sein") | |
private String name; | |
@NotNull(message="Die E-Mail Adresse ist ein Pflichtfeld") | |
private String email; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Markus$ curl -i http://localhost:8080/jee-jaxrs-validation/resources/users/username-unique?name=d | |
HTTP/1.1 400 Bad Request | |
[PARAMETER] | |
[isEmailUnique.arg0] | |
[Der Name muss zwischen 3 und 10 Zeichen lang sein] | |
[d] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Markus$ curl -i http://localhost:8080/jee-jaxrs-validation/resources/users/username-unique | |
HTTP/1.1 400 Bad Request | |
[PARAMETER] | |
[isEmailUnique.arg0] | |
[darf nicht null sein] | |
[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/users") | |
public class UserResource { | |
... | |
@GET | |
@Path("/username-unique") | |
public Response isEmailUnique( | |
@QueryParam("name") | |
@NotNull | |
@Size(min=3, max=10, message="Der Name muss zwischen {min} und {max} Zeichen lang sein") | |
String username) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Path("/auth") | |
@RequestScoped | |
@Produces(MediaType.APPLICATION_JSON) | |
public class AuthResource { | |
@GET | |
@Path("/login") | |
public Response login() { | |
// Do the login stuff and generate the token |