Java Code Examples for io.gravitee.common.utils.UUID#toString()
The following examples show how to use
io.gravitee.common.utils.UUID#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VertxHttpServerRequest.java From graviteeio-access-management with Apache License 2.0 | 6 votes |
public VertxHttpServerRequest(HttpServerRequest httpServerRequest) { this.httpServerRequest = httpServerRequest; this.timestamp = System.currentTimeMillis(); this.id = UUID.toString(UUID.random()); this.transactionId = UUID.toString(UUID.random()); this.contextPath = httpServerRequest.path() != null ? httpServerRequest.path().split("/")[0] : null; this.metrics = Metrics.on(timestamp).build(); this.metrics.setRequestId(id()); this.metrics.setHttpMethod(method()); this.metrics.setLocalAddress(localAddress()); this.metrics.setRemoteAddress(remoteAddress()); this.metrics.setHost(httpServerRequest.host()); this.metrics.setUri(uri()); this.metrics.setUserAgent(httpServerRequest.getHeader(HttpHeaders.USER_AGENT)); }
Example 2
Source File: TransactionProcessorTest.java From gravitee-gateway with Apache License 2.0 | 6 votes |
@Test public void shouldPropagateSameTransactionId() throws InterruptedException { final CountDownLatch lock = new CountDownLatch(1); String transactionId = UUID.toString(UUID.random()); request.headers().set(TransactionProcessor.DEFAULT_TRANSACTIONAL_ID_HEADER, transactionId); new TransactionProcessor() .handler(context -> { Assert.assertNotNull(context.request().transactionId()); Assert.assertEquals(transactionId, context.request().transactionId()); Assert.assertEquals(transactionId, context.request().headers().getFirst(TransactionProcessor.DEFAULT_TRANSACTIONAL_ID_HEADER)); Assert.assertEquals(transactionId, context.request().metrics().getTransactionId()); Assert.assertEquals(context.request().transactionId(), response.headers().getFirst(TransactionProcessor.DEFAULT_TRANSACTIONAL_ID_HEADER)); lock.countDown(); }).handle(context); Assert.assertTrue(lock.await(10000, TimeUnit.MILLISECONDS)); }
Example 3
Source File: TransactionProcessorTest.java From gravitee-gateway with Apache License 2.0 | 6 votes |
@Test public void shouldPropagateSameTransactionIdWithCustomHeader() throws InterruptedException { final CountDownLatch lock = new CountDownLatch(1); String transactionId = UUID.toString(UUID.random()); request.headers().set(CUSTOM_TRANSACTION_ID_HEADER, transactionId); new TransactionProcessor(CUSTOM_TRANSACTION_ID_HEADER) .handler(context -> { Assert.assertNotNull(context.request().transactionId()); Assert.assertEquals(transactionId, context.request().transactionId()); Assert.assertEquals(transactionId, context.request().headers().getFirst(CUSTOM_TRANSACTION_ID_HEADER)); Assert.assertEquals(transactionId, context.request().metrics().getTransactionId()); Assert.assertEquals(context.request().transactionId(), response.headers().getFirst(CUSTOM_TRANSACTION_ID_HEADER)); lock.countDown(); }).handle(context); Assert.assertTrue(lock.await(10000, TimeUnit.MILLISECONDS)); }
Example 4
Source File: TransactionHandler.java From graviteeio-access-management with Apache License 2.0 | 5 votes |
@Override public void handle(RoutingContext context) { String transactionId = context.request().headers().get(transactionHeader); if (transactionId == null) { transactionId = UUID.toString(UUID.random()); context.request().headers().set(transactionHeader, transactionId); } context.response().headers().set(transactionHeader,transactionId); context.next(); }
Example 5
Source File: JettyHttpServerRequest.java From graviteeio-access-management with Apache License 2.0 | 5 votes |
public JettyHttpServerRequest(HttpServletRequest httpServerRequest) { this.httpServerRequest = httpServerRequest; this.timestamp = System.currentTimeMillis(); this.id = UUID.toString(UUID.random()); this.transactionId = UUID.toString(UUID.random()); this.contextPath = httpServerRequest.getContextPath() != null ? httpServerRequest.getContextPath().split("/")[0] : null; }
Example 6
Source File: VertxHttpServerRequest.java From gravitee-gateway with Apache License 2.0 | 5 votes |
public VertxHttpServerRequest(HttpServerRequest httpServerRequest) { this.httpServerRequest = httpServerRequest; this.timestamp = System.currentTimeMillis(); this.id = UUID.toString(UUID.random()); this.metrics = Metrics.on(timestamp).build(); this.metrics.setRequestId(id()); this.metrics.setHttpMethod(method()); this.metrics.setLocalAddress(localAddress()); this.metrics.setRemoteAddress(remoteAddress()); this.metrics.setHost(httpServerRequest.host()); this.metrics.setUri(uri()); this.metrics.setUserAgent(httpServerRequest.getHeader(HttpHeaders.USER_AGENT)); }
Example 7
Source File: RandomString.java From graviteeio-access-management with Apache License 2.0 | 4 votes |
public static String generate() { return UUID.toString(UUID.random()); }
Example 8
Source File: RandomString.java From gravitee-management-rest-api with Apache License 2.0 | 4 votes |
public static String generate() { return UUID.toString(UUID.random()); }