Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 16 19:36

    odrotbohm on 2.0.0

    (compare)

  • Nov 16 19:36

    odrotbohm on main

    #1881 - Release version 2.0.0. #1881 - Prepare next developmen… (compare)

  • Nov 16 19:28

    odrotbohm on release

    #1881 - Release version 2.0.0. (compare)

  • Nov 16 19:26

    odrotbohm on main

    #1882 - Fix settings.xml to use… (compare)

  • Nov 16 19:19

    odrotbohm on release

    #1881 - Release version 2.0.0. (compare)

  • Nov 16 19:19

    odrotbohm on release

    (compare)

  • Nov 16 19:17

    odrotbohm on main

    #1881 - Configure Maven Release… (compare)

  • Nov 16 17:53

    odrotbohm on main

    #1881 - Fix flaky test. (compare)

  • Nov 16 17:49

    odrotbohm on main

    #1881 - Fix flaky test. (compare)

  • Nov 16 17:29

    odrotbohm on main

    Debugging CI failures. (compare)

  • Nov 16 17:23

    odrotbohm on main

    Debugging CI failures. (compare)

  • Nov 16 16:53

    odrotbohm on main

    Debugging CI failures. (compare)

  • Nov 16 16:46

    odrotbohm on main

    Debugging CI failures. (compare)

  • Nov 16 16:35

    odrotbohm on main

    #1882 - Switching to Github act… (compare)

  • Nov 16 16:32

    odrotbohm on main

    #1882 - Switching to Github act… (compare)

  • Nov 16 11:53

    odrotbohm on release-2.0

    #1868 - Continue development on… #1863 - Upgrade to Jackson 2.14. #1873 - Upgrade to Mockk 1.13.2. and 12 more (compare)

  • Nov 16 11:48

    odrotbohm on main

    #1881 - Update changelog. #1881 - Remove obsolete snapsho… (compare)

  • Nov 16 11:43

    odrotbohm on main

    #1880 - Upgrade to Spring Plugi… #1877 - Upgrade to Spring Frame… #1881 - Polish POM. (compare)

  • Nov 15 22:31

    odrotbohm on main

    #1873 - Upgrade to Mockk 1.13.2. #1874 - Upgrade to Kotlin 1.7.2… #1875 - Upgrade to Servlet API … and 4 more (compare)

  • Nov 07 00:04
    fakhreddinedhifallah closed #40
Deniz Dalkilic
@dnzdlklc

Hello

Has anyone got any ideas on this?

Knut Schleßelmann
@kschlesselmann
Is it somehow possible to create plain links (no templates) with linkTo(methodOn())? I have some optional parameters and I don't want to include them at all in the URI if I call the method with null
3 replies
Ingo Griebsch
@ingogriebsch
Shameless cross posting from the Spring Data room (if not okay, please let me know). But because it is in some way related I would like to ask here as well...
"Hello, I would like to ask if there is any documentation or if there are any examples, guides or tutorials available to integrate a custom hypermedia-type into a Spring Data REST driven application?"
5 replies
Greg L. Turnquist
@gregturn

"I want to use the RepresentationModelAssemblerSupport to make the assembler aware of the resources controller to get the free self links, and for code organization purposes, but I'm using HAL and I also want to potentially embed objects on single resources.

It seems if I use the Hal builder I can no longer use that assembler because it's typed to go from T to D extends RepresentationModel 😕"

7 replies
Brian Zitzow
@bzitzow
Given a resource that has links to other resources, can I force those links to become embedded?
Marcel Widmer
@marzelwidmer
Hello is there any documentation about the rest-message.properties and normal message.properties https://docs.spring.io/spring-hateoas/docs/current/reference/html/#mediatypes.hal.configuration the sampe about the HEATOAS problems is this used of the message.properties when not I don't know how I can call the messges in my program code from a rest-message.properties I am not sure if this related in this channel because of this I post the same message in the sprong-boot
Knut Schleßelmann
@kschlesselmann
Anyone an idea regarding spring-projects/spring-hateoas#1547 ? After upgrading to 2.5.0 I cannot stream ResponseEntity subclasses any more :-(
Ingo Griebsch
@ingogriebsch

I'm really happy to announce the next release of Spring HATEOAS Siren! Version 1.2.0 is available through Maven Central and based on Spring HATEOAS 1.3.1!

Source: https://github.com/ingogriebsch/spring-hateoas-siren
Documentation: https://ingogriebsch.github.io/spring-hateoas-siren/1.2.0/index.html

The examples project is also updated to reflect the latest changes. Feel free to check it out to understand how to use the features provided by the library.

https://github.com/ingogriebsch/spring-hateoas-siren-samples

Every feedback is very welcome! :)

Preben Asmussen
@pax95
Created this issue in spring-framework spring-projects/spring-framework#27078, but the root cause is in spring-hateoas and should be moved there.
Almir James Lucena
@talentedasian
Are there any plans to support decimal values for HalFormsProperties and not just plain whole numbers without decimals? Only @Min and @Max are supported. spring-projects/spring-hateoas#1557 Github issue for reference.
Kai Toedter
@toedter
Hi all, I have an interesting issue in JSON:API for Spring HATEOAS. Currently I have no clue, why ResponseEntity<EntityModel<Payload>> does not work as expected. Could you please take a look at toedter/spring-hateoas-jsonapi#34 and give me some hints? Thanks a lot!
Kai Toedter
@toedter
This has something to do with the Kotlin coroutine mechanism (it works when removing suspend), but I did not figure out the details...
Kai Toedter
@toedter
I replaced the media type used in the demo of the above issue with the built-in UBER media type => same behavior so I guess the behavior cannot be addressed in JSON:API for Spring HATEOAS.
Marcel Widmer
@marzelwidmer
Hello is HATEOAS allrady supported for Spring Boot Native Builds I got an error. [ERROR] java.lang.NullPointerException [ERROR] [org.springframework.hateoas.config.HateoasHints.lastInvocationAwareProxyDescriptor(HateoasHints.java:35
1 reply
Preben Asmussen
@pax95

Hi
It seems that Links have a problem with java 17 records since they are final.

java.lang.IllegalArgumentException: Cannot subclass final class com.example.demo.DemoApplication$Hello at org.springframework.cglib.proxy.Enhancer.generateClass(Enhancer.java:660) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.ClassLoaderAwareGeneratorStrategy.generate(ClassLoaderAwareGeneratorStrategy.java:57) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:358) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-5.3.10.jar:5.3.10] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na] at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.proxy.Enhancer.createHelper(Enhancer.java:572) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.cglib.proxy.Enhancer.createClass(Enhancer.java:419) ~[spring-core-5.3.10.jar:5.3.10] at org.springframework.aop.framework.ObjenesisCglibAopProxy.createProxyClassAndInstance(ObjenesisCglibAopProxy.java:57) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.aop.framework.CglibAopProxy.getProxy(CglibAopProxy.java:206) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.hateoas.server.core.DummyInvocationUtils.getProxyWithInterceptor(DummyInvocationUtils.java:193) ~[spring-hateoas-1.4.0-M3.jar:1.4.0-M3] at org.springframework.hateoas.server.core.DummyInvocationUtils.access$000(DummyInvocationUtils.java:38) ~[spring-hateoas-1.4.0-M3.jar:1.4.0-M3] at org.springframework.hateoas.server.core.DummyInvocationUtils$InvocationRecordingMethodInterceptor.invoke(DummyInvocationUtils.java:90) ~[spring-hateoas-1.4.0-M3.jar:1.4.0-M3] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:750) ~[spring-aop-5.3.10.jar:5.3.10] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:692) ~[spring-aop-5.3.10.jar:5.3.10] at com.example.demo.DemoApplication$DemoController$$EnhancerBySpringCGLIB$$19e5f7b7.hi(<generated>) ~[classes/:na]

Josh Gough
@JogoShugh
Is there a way to get rid of the "default" under _templates?
Josh Gough
@JogoShugh

or at least to control its definition? I'm not sure why the default is going to the "abandon" link in this:

@EnableHypermediaSupport(type = EnableHypermediaSupport.HypermediaType.HAL_FORMS)
public class TransactionController {
    @PostMapping("/sca/transactions")
    EntityModel<?> createTransaction(@RequestBody TransactionCreate transaction) {
        var model = TransactionSummary.builder()
                .scaTransactionId(UUID.randomUUID())
                .status("threeDSMethodNotificationPending")
                .threeDSMethodData("base64-encoded-json-string")
                .threeDSVersion("2.2.0")
                .threeDSMethodURL("http://host/route")
                .build();

        var methodInvocation = methodOn(TransactionController.class).getTransaction(model.getScaTransactionId());
        var link = Affordances.of(linkTo(methodInvocation).withSelfRel()).toLink();
        model.add(link);

        model.add(createLink("abandonTransaction", TransactionAbandon.class,
                methodOn(TransactionController.class).abandonTransaction(model.getScaTransactionId(), null)));

        model.add(createLink("threeDSMethodNotification", ThreeDSMethodNotification.class,
                methodOn(TransactionController.class).threeDSMethodNotification(model.getScaTransactionId(), null)));

        model.add(createLink("challengeResponseNotification", ChallengeResponseNotification.class,
                methodOn(TransactionController.class).challengeResponseNotification(model.getScaTransactionId(), null)));

        model.add(createLink("challengeResultsNotification", ChallengeResponseNotification.class,
                methodOn(TransactionController.class).challengeResultsNotification(model.getScaTransactionId(), null))); // todo fix input type

        return EntityModel.of(model);
    }

produces this:

  "scaTransactionId": "05da9337-13f1-4fe1-92a1-0cbc18b8384c",
  "status": "threeDSMethodNotificationPending",
  "threeDSVersion": "2.2.0",
  "threeDSMethodURL": "http://host/route",
  "threeDSMethodData": "base64-encoded-json-string",
  "_links": {
    "self": {
      "href": "http://localhost:8080/sca/transactions/05da9337-13f1-4fe1-92a1-0cbc18b8384c"
    },
    "abandonTransaction": {
      "href": "http://localhost:8080/sca/transactions/05da9337-13f1-4fe1-92a1-0cbc18b8384c/abandon"
    },
    "threeDSMethodNotification": {
      "href": "http://localhost:8080/sca/transactions/05da9337-13f1-4fe1-92a1-0cbc18b8384c/threeDSMethodNotification"
    },
    "challengeResponseNotification": {
      "href": "http://localhost:8080/sca/transactions/05da9337-13f1-4fe1-92a1-0cbc18b8384c/challengeResponseNotification"
    },
    "challengeResultsNotification": {
      "href": "http://localhost:8080/sca/transactions/05da9337-13f1-4fe1-92a1-0cbc18b8384c/challengeResultsNotification"
    }
  },
  "_templates": {
    "challengeResultsNotification": {
      "method": "post",
      "properties": [
        {
          "name": "cres",
          "readOnly": true,
          "type": "text"
        }
      ],
      "target": "http://localhost:8080/sca/transactions/05da9337-13f1-4fe1-92a1-0cbc18b8384c/challengeResultsNotification"
    },
    "default": {
      "method": "post",
      "properties": [
        {
          "name": "reason",
          "readOnly": true,
          "type": "text"
        }
      ],
      "target": "http://localhost:8080/sca/transactions/05da9337-13f1-4fe1-92a1-0cbc18b8384c/abandon"
    },
    "abandonTransaction": {
      "method": "post",
      "properties": [
        {
          "name": "reason",
          "readOnly": true,
          "type": "text"
        }
      ],
      "target": "http://localhost:8080/sca/transactions/05da9337-13f1-4fe1-92a1-0cbc18b8384c/abandon"
    }, etc etc etc
Josh Gough
@JogoShugh
Seems like it adds default to the first link it finds that is not the same as self
i guess i'll just add one to the postmapping to create a new transaction
Josh Gough
@JogoShugh
What would be the simplest way to slightly modify the HAL json format? Do I need a full-blown CustomHypermediaType, or is there something else I can do? Posted question about it here: https://stackoverflow.com/questions/69770845/simplest-path-for-custom-media-type-in-spring-hateoas
Felipe Adorno
@FelipeAdorno

Hi everyone I upgraded my project to spring boot 2.5.6 with hateoas starter 2.5.6 and some of my tests start to broke, I have test for my assembler support to guarantee the links are generated, like this:

    @Test
    public void should_process_user() {
        assertEquals(expected(), assemblerSupport.toModel(user));
    }

    private EntityModel<User> expected() {
        return EntityModel.of(user).add(linkTo(methodOn(UserRestService.class).update(new UpdateUserResource()))
                .withRel(UPDATE.getRel()).withType(PUT.name()));
    }

And my assembler support has the same code as in expected, but I have erro on my assertEquals I was debbuging the code and the problem occours because TypeBasedPayloadMetadata doen't has a implementation of equals and hashcode. I forked the project and changed the TypeBasedPayloadMetadata and all my tests are passing now.

I'm doing anything wrong or I can open a pullrequest with the equals and hash code implementation for TypeBasedPayloadMetadata?

2 replies
ogenodisho
@ogenodisho
Hi all, sorry if this is a bit off topic because it's not specifically to do with Spring HATEOAS but it's the closest room I could find. I have a conceptual question about PUT vs PATCH in a RESTful API.
Let's say I have an endpoint /games/{id} which returns a resource with media type application/vnd.mycompany.game+json. I could PUT to that endpoint but it would only be RESTful if I was replacing the entire resource. I.e., if I just wanted to update the title of a game, PUTing to it would not be RESTful, I would need to PATCH to that endpoint to change the title.
However, what if I defined another resource with media type application/vnd.mycompany.game.title+json, would it be RESTful to PUT to /games/{id}/title and then return the entire game in the response?
1 reply
arthur-noseda
@arthur-noseda
Hi everyone.
I intend to talk about Spring HATEOAS to the Lyon JUG, and I am struggling with getting references to projects or companies implementing Spring HATEOAS or RESTful APIs with hypermedia (sorry if this sounds pleonasmic). I would be very interested if you had names to share.
shifalijain96
@shifalijain96

Hi everyone,
I'm trying to store an object that extends RepresentationModel in Redis cache, upon retrieval I get a serialisation error:

Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'org.springframework.hateoas.Links' as a subtype of java.util.List<org.springframework.hateoas.Link>: Not a subtype at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 507] (through reference chain:

Can somebody help me with it?

emanuelsWorld
@emanuelsWorld
Hi everyone. Quick question: I made an upgrade of spring hateoas library and the object mapper _halObjectMapper is not injected anymore. The doc doesn’t mention anything about it. Is someone having any idea ?