Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 22 06:12
    odrotbohm commented #1259
  • Sep 21 23:11
    durimkryeziu commented #1259
  • Sep 21 16:08
    odrotbohm labeled #1647
  • Sep 21 16:08
    odrotbohm labeled #1651
  • Sep 21 16:07

    odrotbohm on 2.x

    #1651 - Upgrade to Spring Plugi… (compare)

  • Sep 21 16:04
    odrotbohm labeled #1651
  • Sep 21 16:04
    odrotbohm milestoned #1651
  • Sep 21 16:04
    odrotbohm labeled #1651
  • Sep 21 16:04
    odrotbohm opened #1651
  • Sep 21 16:04
    odrotbohm assigned #1651
  • Sep 21 16:03
    odrotbohm closed #1650
  • Sep 21 16:03
    odrotbohm closed #1649
  • Sep 21 16:00

    odrotbohm on 1.2.x

    #1650 - Improve proxy creation … (compare)

  • Sep 21 15:59
    odrotbohm milestoned #1650
  • Sep 21 15:59
    odrotbohm assigned #1650
  • Sep 21 15:59
    odrotbohm labeled #1650
  • Sep 21 15:59
    odrotbohm labeled #1650
  • Sep 21 15:59
    odrotbohm opened #1650
  • Sep 21 15:58

    odrotbohm on 1.3.x

    #1649 - Improve proxy creation … (compare)

  • Sep 21 15:58
    odrotbohm labeled #1649
Marcel Widmer
@marzelwidmer
@gregturn this mean for the quality there are a lot of mappings around....
Jeroen Vandevelde
@jeroenvandevelde

Hi, i am trying to use the Links class for a client-side implementation with a value that comes from the link header.

They return the value linkHeaderValue = 'https://url.com?page=1; rel=first, https://url.com?page=2; rel=last'
But when i call Links.parse(linkHeaderValue), i get an empty Links object.
Links.parse("<https://url.com?page=1>; rel=\"first\", <https://url.com?page=1>; rel=\"last\"")

This is because the linkHeaderValue doesn't match the LINK_HEADER_PATTERN in the Links class.
If they would return 'https://url.com?page=1; rel="first", https://url.com?page=2; rel="last"' it would work.

The docs of the producer say that they implement this spec for the link header.
But i am not really certain if they produce data up to standard of the specs or Links class does.

So i have 2 questions:

  • Does anyone know what the correct spec is? 'https://url.com?page=1; rel="first", https://url.com?page=2; rel="last"' or 'https://url.com?page=1; rel=first, https://url.com?page=2; rel=last'
  • This is a kind of follow-up question but if they don't produce the link header up to the standard. Is it okay if i add a way to overwrite the REGEX eg. Links.parse(source, LINK_HEADER_PATTERN)
    When playing around with this i noticed i also would need to overwrite the LINK_HEADERPATTERN in Links to
    ```Pattern.compile("(\w+)=(\p{Lower}[\p{Lower}\p{Digit}.\-\s]*|(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~
    |!:,.;]*[-a-zA-Z0-9+&@#/%=~_|])")```
    So i don't really know if this is still a smart way to go but looking forward to your feedback.
9 replies
Jeroen Vandevelde
@jeroenvandevelde
Great, thanks for the quick fix!
Oliver Drotbohm
@odrotbohm
Heads up: versions 1.3 M2, 1.2.4 and 1.1.4 have just been released for inclusion into the corresponding Spring Boot releases tomorrow.
4 replies
Christian
@anno1985
Hi! Is there a clever way to use Spring HATEOAS with the HAL flavour together with OpenAPI 3.x so that _link relations only have to be defined in one place, and are then propagated? Ideally, specify them in the OpenAPI spec and have the controller interfaces generated automatically, together with the DTO (which would then explicitly define the possible links). Otherwise, is there a way to have the OpenAPI spec generated from a project's code (the project using Spring HATEOAS)? The rationale being I'd like to define the possible link relations in one place, and then have them represented in my spec (OpenAPI), the server code (Spring) and the client code (Angular)...
4 replies
Christian
@anno1985
I've got another question: it seems that when creating the link relations and embedding resources, we end up tying together a lot of controllers and business objects. It looks a bit like the result are omniscient classes. Is this what usually happens with HAL in Spring, or is that a smell?
2 replies
KnightK0der
@mrabusalah

ERROR!
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.hateoas.hal.Jackson2HalModule$HalLinkListSerializer': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.hateoas.hal.Jackson2HalModule$HalLinkListSerializer]: No default constructor found; nested exception is java.lang.NoSuchMethodException: org.springframework.hateoas.hal.Jackson2HalModule$HalLinkListSerializer.<init>()

any help ?

1 reply
Deniz Dalkilic
@dnzdlklc
Hello

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 anyone help what would be the best way to tackle this?
Greg L. Turnquist
@gregturn
@mrabusalah More details, like version of Spring Boot/HATEOAS, and possibly some code excerpts.
Mark Pruden
@kiwisincebirth

Hi I am having Compile Issue using HalModelBuilder in Kotlin Code. I am on all the latest versions. But it comes down to a single method build() on HalModelBuilder

I have created as simple a test class. The compile error is Not enough information to infer type variable T - a typing issue - Here is the example

it seems like this should be simple to solve. If you need me to I can raise an issue on the project. Sorry if this has been asked before.

import org.springframework.hateoas.mediatype.hal.HalModelBuilder

// My domain class which is does NOT extend RepresentationModel
data class MyDomainDobject(
    val id: Int
)

fun main () {

    // the domain object I want to convert
    val myDomainDobject = MyDomainDobject(123)

    // create a hal model builder, for the domain object
    val builder = HalModelBuilder.halModelOf(myDomainDobject)

    // from here I would add links, embeds etc......

    // the following line causes a compile issue
    // - Not enough information to infer type variable T
    val model = builder.build()

    // the build method (is generically typed, whereas HalModelBuilder is not.
    // so cannot infer any type. Regardless the build method seems to assume it is returning
    // a underlying domain object which extends RepresentationModel<T>, which it isn't in my case!

    // my workaround comes in the form of a JAVA STATIC METHOD, which forces the type
    // conversion for me. It works for now but must compile Java code in Kotlin project

//    public static <T> EntityModel<T> build( HalModelBuilder builder ) {
//        return (EntityModel<T>) builder.build();
//    }
}
Greg L. Turnquist
@gregturn
@kiwisincebirth Please do open a ticket, with all the details you can provide.
1 reply
Francis
@francis-a

Hi everyone, I'm in the process of upgrading Spring Hateoas from 0.8x to the current version. It's quite a big application so I'm working through a large set of changes. There are a few places in our code where we are making use of the injectable _halObjectMapper. It seems like the current version is reusing a copy of an object mapper I define: https://github.com/spring-projects/spring-hateoas/blob/1.2.x/src/main/java/org/springframework/hateoas/config/HypermediaWebClientConfigurer.java#L49

My question is, is there any way to get a handle on the hal configured ObjectMapper via some kind of injectable class?

5 replies
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