This file contains 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
@Component | |
public class JwtFilter extends OncePerRequestFilter { | |
@Autowired | |
private UserRepository userRepository; | |
@Autowired | |
private JWTUtils jwtUtils; | |
@Override |
This file contains 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Action": "ec2:*", | |
"Effect": "Allow", | |
"Resource": "*" | |
}, | |
{ | |
"Effect": "Allow", |
This file contains 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
@Controller | |
@RequestMapping("/rest") | |
public class MyController { | |
@GetMapping("/get") | |
public ResponseEntity<String> getExample() { | |
return new ResponseEntity<String>("Get Example", HttpStatus.OK); | |
} | |
@GetMapping("/getvar/{id}") | |
public ResponseEntity<String> getExampleWithVariable(@PathVariable String id){ | |
return new ResponseEntity<String>("Get With Variable Example" +id,HttpStatus.OK); } |
This file contains 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
@RestController | |
@RequestMapping("/rest") | |
public class MyRestController { | |
@RequestMapping(value="/requestparamexample", method = RequestMethod.GET) | |
public ResponseEntity<String> getRequestParmParam(@RequestParam("value") String value) { | |
System.out.println("Request Param Value: "+value); | |
return new ResponseEntity<String>(value,HttpStatus.OK); | |
} | |
} |
This file contains 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
@RestController | |
@RequestMapping("/rest") | |
public class MyRestController { | |
@RequestMapping(value="/pathparamexample/{value}", method = RequestMethod.GET) | |
public ResponseEntity<String> getPathParam(@PathVariable String value) { | |
System.out.println("Path Variable Value: "+value); | |
return new ResponseEntity<String>(value,HttpStatus.OK); | |
} | |
} |
This file contains 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
@RestController | |
@RequestMapping("/user") | |
public class UserController { | |
@RequestMapping(value={"/find", "/search*","/get/*","**/findall"}, method = RequestMethod.GET) | |
public String findAllUsers() { | |
return "GettingUsers"; | |
} | |
} |
This file contains 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
@RestController | |
@RequestMapping("/user") | |
public class UserController { | |
@RequestMapping(value="/find", method = RequestMethod.GET) | |
public void findAllUsers() { | |
/** | |
* Adding user logic | |
*/ | |
} |
This file contains 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
@RestController | |
@RequestMapping("/rest") | |
public class MyRestController { | |
@RequestMapping(value="/getdata", method = RequestMethod.GET, produces = "application/json; charset=UTF-8") | |
public String getMyData() { | |
JSONObject obj=new JSONObject(); | |
obj.put("name","Anish Antony"); | |
obj.put("age",27); | |
obj.put("salary",10000); | |
return obj.toJSONString(); |
This file contains 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
@Controller | |
@RequestMapping("/rest1") | |
public class MyController { | |
@RequestMapping(value="/getdata", method = RequestMethod.GET, produces = "application/json; charset=UTF-8") | |
@ResponseBody | |
public String getMyData() { | |
JSONObject obj=new JSONObject(); | |
obj.put("name","Anish Antony"); | |
obj.put("age",27); | |
obj.put("salary",10000); |
This file contains 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
@Target({ElementType.TYPE}) | |
@Retention(RetentionPolicy.RUNTIME) | |
@Documented | |
@Component | |
public @interface Controller { | |
/** | |
* The value may indicate a suggestion for a logical component name, | |
* to be turned into a Spring bean in case of an autodetected component. | |
* @return the suggested component name, if any (or empty String otherwise) |
NewerOlder