Skip to content

Instantly share code, notes, and snippets.

@circlee
circlee / ResourceSupport
Created June 28, 2017 12:06
ResourceSupport
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package org.springframework.hateoas;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
@circlee
circlee / HATEOAS test Controller
Created June 28, 2017 12:10
HATEOAS test Controller
package com.hateoas.controller;
import com.hateoas.resources.Greeting;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@circlee
circlee / hateoas hello eldi response
Created June 28, 2017 12:17
hateoas hello eldi response
{
content: "Hello, ELDI!",
_links: {
self: {
href: "http://localhost:8080/hello?name=ELDI"
},
bye: {
href: "http://localhost:8080/bye?name=ELDI"
},
punch: {
@circlee
circlee / hateoas punch eldi response
Created June 28, 2017 12:20
hateoas punch eldi response
{
content: "ELDI do punch!",
_links: {
self: {
href: "http://localhost:8080/punch?name=ELDI"
},
run: {
href: "http://localhost:8080/bye?name=ELDI"
}
}
@circlee
circlee / source structure
Created June 29, 2017 07:38
source structure
/src/main
/com
/test/
/controller
/SPAController.java
/resources
/dist
/index.html
/js
@circlee
circlee / resource handler mapping
Created June 29, 2017 07:41
resource handler mapping
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
@circlee
circlee / SPA requestMapping
Created June 29, 2017 07:54
SPA requestMapping
import javax.inject.Inject;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@circlee
circlee / resource handler mapping
Created June 29, 2017 07:55
resource handler mapping
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class MvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
@circlee
circlee / source structure
Created June 29, 2017 07:58
source structure
/src/main
/com
/test/
/controller
/SPAController.java
/resources
/dist
/index.html
/static
@circlee
circlee / source structure
Created June 29, 2017 08:01
source structure
/src/main
/com
/test/
/controller
/SPAController.java
/resources
/static
/dist
/index.html
/static