diff options
author | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2019-05-03 20:54:32 +0200 |
---|---|---|
committer | Thomas Lenz <thomas.lenz@egiz.gv.at> | 2019-05-03 20:54:32 +0200 |
commit | 2e921528557a23b96fb6b52b2b53a28048a826fd (patch) | |
tree | 316ecd98df021149e91d4d4c4656925b070d181f /eaaf_core/src/main/java/at | |
parent | 804cef0be970ac118dc5df42019e72f56f7e82b5 (diff) | |
download | EAAF-Components-2e921528557a23b96fb6b52b2b53a28048a826fd.tar.gz EAAF-Components-2e921528557a23b96fb6b52b2b53a28048a826fd.tar.bz2 EAAF-Components-2e921528557a23b96fb6b52b2b53a28048a826fd.zip |
update abstract protocols/RequestImpl.java to inject an external generated transactionId
Diffstat (limited to 'eaaf_core/src/main/java/at')
-rw-r--r-- | eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java index 5667fad7..f037f4ab 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/controller/protocols/RequestImpl.java @@ -35,13 +35,13 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import javax.naming.ConfigurationException; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.lang.NonNull; +import org.springframework.lang.Nullable; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.data.EAAFConstants; @@ -96,14 +96,37 @@ public abstract class RequestImpl implements IRequest, Serializable{ private final Map<String, Object> genericDataStorage = new HashMap<String, Object>(); + /** + * Initialize this pendingRequest object + * + * @param req {@link HttpServletRequest} + * @param authConfig {@link IConfiguration} + * @throws EAAFException + * + */ + public final void initialize(HttpServletRequest req, IConfiguration authConfig) throws EAAFException { + initialize(req, authConfig, null); + + } /** - * @throws ConfigurationException + * Initialize this pendingRequest object + * + * @param req {@link HttpServletRequest} + * @param authConfig {@link IConfiguration} + * @param transactionId transactionId that should be used in this pendingRequest for logging. If 'null' a new one will be generated + * + * @throws EAAFException * */ - public final void initialize(HttpServletRequest req, IConfiguration authConfig) throws EAAFException { + public final void initialize(@NonNull HttpServletRequest req, @NonNull IConfiguration authConfig, @Nullable String transactionId) throws EAAFException { + //use external transactionId or create new one if empty or null + if (StringUtils.isNotEmpty(transactionId)) + uniqueTransactionIdentifer = transactionId; + else + uniqueTransactionIdentifer = Random.nextLongRandom(); + //set unique transaction identifier for logging - uniqueTransactionIdentifer = Random.nextLongRandom(); TransactionIDUtils.setTransactionId(uniqueTransactionIdentifer); //initialize session object |