Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ecf-dev] New topic in forum Eclipse Communications Framework (ECF), called @InjectLink, by Gennadii Vakulenko

Title: Eclipse Community Forums
Subject: @InjectLink Author: Gennadii Vakulenko Date: Wed, 22 January 2020 06:16

Hello dear forum users. I apologize if I write off topic and not here.

I have a question about Jersey, namely @InjectLink annotations - Declarative Hyperlinking eclipse-ee4j.github.io/jersey.github.io/documentation/latest/declarative-linking.html

I can't do it, and I ask for your help.
I have two classes, as shown here eclipse-ee4j.github.io/jersey.github.io/documentation/latest/declarative-linking.html#d0e10567
Class WidgetsResource

import javax.ws.rs.GET;
import javax.ws.rs.Path;

@Path("/widgets")
public class WidgetsResource {

    @GET
    public Widgets get() {
        return new Widgets();
    }
}


and class widgets

import org.glassfish.jersey.linking.InjectLink;
import java.net.URI;

public class Widgets {

    @InjectLink(resource=WidgetsResource.class)
    URI u;

    public Widgets() {
        System.out.println(this.u);
    }
}


If I understand correctly, then in the Widgets class in the field URI u there should be a link

import org.glassfish.jersey.linking.InjectLink;
import java.net.URI;

public class Widgets {

    @InjectLink(resource=WidgetsResource.class)
    URI u;

    public Widgets() {
        System.out.println(this.u);
    }
}


Where /context is the application deployment context.
But for some reason, there is nothing there. It returns NULL to me.
Please tell me what am I doing wrong?
[ Reply ][ Quote ][ View Topic/Message ][ Unsubscribe from this forum ]

Back to the top