Skip to content

Instantly share code, notes, and snippets.

View xstefank's full-sized avatar

Martin Stefanko xstefank

View GitHub Profile
@xstefank
xstefank / TestResource.java
Last active November 1, 2018 14:40
Method stereotype usage in JAX-RS
package org.xstefank;
import javax.enterprise.inject.Produces;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@Path("test")
public class TestResource {
@xstefank
xstefank / Stereotypes.java
Created November 2, 2018 10:11
Stereotypes.java
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.TEXT_PLAIN)
@Encoded
@Stereotype
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface TestStereotype {
}
@Path("/resource1")
FROM openjdk:8u141-jdk
COPY target/demo-thorntail.jar .
CMD java ${JAVA_OPTS} -jar demo-thorntail.jar
@LRA(type = REQUIRES_NEW, end = true)
public void doInLRA(@HeaderParam(LRA_HTTP_HEADER) String lraId) {
// lraid = 123
restInvoke(456); \\ REST invocation with LRA id = 456 to doInLRA2 method
// here I would say LRA 123 should be ended (not LRA 456)
}
@LRA(type = MANDATORY, end = false)
public void doInLRA2() {
repository: "xstefank/test-repo"
statusUrl: "https://github.com/wildfly/wildfly/blob/master/.github/PULL_REQUEST_TEMPLATE.md"
format:
skipPatterns:
description: "(NO JIRA REQUIRED|\\[NO JIRA REQUIRED\\]).*"
title:
pattern: "(\\[WFLY-\\d+\\]\\s+.*|WFLY-\\d+\\s+.*)|((WFLY-\\d+,\\s+)+WFLY-\\d+\\s+.*)|((\\[WFLY-\\d+\\])+\\s+.*)|(\\[(WFLY-\\d+,\\s+)+WFLY-\\d+\\]\\s+.*)"
message: "Invalid PR title: must contain issue id"
@Path("lra")
public class InLRA {
...
@PUT
@Path("compensate")
@Compensate
public Response compensate() {
return Response.ok(ParticipantStatus.Completed).build();
}
public class InLRA {
...
@PUT
@Path("complete")
@Complete
public Response complete() {
return Response.accepted().build();
}
package org.eclipse.microprofile.lra.tck.participant.nonjaxrs.valid;
import org.eclipse.microprofile.lra.annotation.Compensate;
import org.eclipse.microprofile.lra.annotation.ParticipantStatus;
import org.eclipse.microprofile.lra.annotation.Status;
import org.eclipse.microprofile.lra.annotation.ws.rs.LRA;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.PUT;
package org.eclipse.microprofile.lra.tck.participant.nonjaxrs.valid;
import org.eclipse.microprofile.lra.annotation.Compensate;
import org.eclipse.microprofile.lra.annotation.ParticipantStatus;
import org.eclipse.microprofile.lra.annotation.Status;
import org.eclipse.microprofile.lra.annotation.ws.rs.LRA;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.Path;
package io.xstefank;
import org.eclipse.microprofile.lra.annotation.Compensate;
import org.eclipse.microprofile.lra.annotation.Complete;
import org.eclipse.microprofile.lra.annotation.ws.rs.LRA;
import javax.ws.rs.GET;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;