Say, I have a simple REST service, that get content of PDF file:
@Path("/pdf")
@Stateless
public class GroupSheetEJB {
. . .
@GET
@Path("examsheet/{groupId: \\d+}/{course: \\d+}/{semester: \\d+}/{subjectId: \\d+}")
@Produces("application/pdf")
public Response examSheet(@PathParam("groupId") int groupCode, @PathParam("course") int course,
@PathParam("semester") int semester, @PathParam("subjectId") int subjectCode) {
try {
StudyGroup grp = groups.get(groupCode);
Subject sub = subjects.get(subjectCode);
ResponseBuilder response = Response.ok(getExamSheet(grp, sub, course, semester));
return response.build();
} catch (Exception e) {
throw new NotFoundException(e.getMessage());
}
}
}
Is any way to easily get link for this REST service from <h:link>
component?
Now I use plain HTML tag:
<a target="examsheet" href="#{request.contextPath}/webresources/#{semesterSubjectMarksMB.examSheetLink}">REST link</a>
outcome
parameter of with value /webresources/#{semesterSubjectMarksMB.examSheetLink}
gets a disabled link.
Best regards.