Refine search
/** * Lazily initialize {@link AsyncContext} for this * request processing context. * <p> * The {@code lazyContextValue} will be only invoked once during the first call to {@link #asyncContext()}. * As such, the asynchronous context for this request can be initialized lazily, on demand. * </p> * * @param lazyContextValue lazily initialized {@code AsyncContext} instance bound to this request processing context. */ // TODO figure out how to make this package-private. public void initAsyncContext(Value<AsyncContext> lazyContextValue) { asyncContextValueRef.set(Values.lazy(lazyContextValue)); }
/** * Get a {@link Value} instance holding the asynchronous context associated with this request processing context. * * May return an empty value if no asynchronous context has been initialized in this request processing context yet. * * @return value instance holding the asynchronous context associated with this request processing context. * The returned value may be empty, if no asynchronous context has been initialized yet * (see {@link #initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)}). */ public Value<AsyncContext> asyncContextValue() { return asyncContextValueRef.get(); }
public RestResult delete(String path, Map<String, Object> params) { Ref<WebTarget> target = Refs.of(this.target); for (String key : params.keySet()) { target.set(target.get().queryParam(key, params.get(key))); } Response response = this.request(() -> { return target.get().path(path).request().delete(); }); checkStatus(response, Response.Status.NO_CONTENT, Response.Status.ACCEPTED); return new RestResult(response); }
/** * Lazily initialize {@link AsyncContext} for this * request processing context. * <p> * The {@code lazyContextValue} will be only invoked once during the first call to {@link #asyncContext()}. * As such, the asynchronous context for this request can be initialized lazily, on demand. * </p> * * @param lazyContextValue lazily initialized {@code AsyncContext} instance bound to this request processing context. */ // TODO figure out how to make this package-private. public void initAsyncContext(Value<AsyncContext> lazyContextValue) { asyncContextValueRef.set(Values.lazy(lazyContextValue)); }
/** * Get a {@link Value} instance holding the asynchronous context associated with this request processing context. * * May return an empty value if no asynchronous context has been initialized in this request processing context yet. * * @return value instance holding the asynchronous context associated with this request processing context. * The returned value may be empty, if no asynchronous context has been initialized yet * (see {@link #initAsyncContext(org.glassfish.jersey.internal.util.collection.Value)}). */ public Value<AsyncContext> asyncContextValue() { return asyncContextValueRef.get(); }
public RestResult put(String path, String id, Object object, Map<String, Object> params) { Ref<WebTarget> target = Refs.of(this.target); if (params != null && !params.isEmpty()) { for (String key : params.keySet()) { target.set(target.get().queryParam(key, params.get(key))); } } Response response = this.request(() -> { return target.get().path(path).path(encode(id)).request() .put(Entity.json(object)); }); // If check status failed, throw client exception. checkStatus(response, Response.Status.OK, Response.Status.ACCEPTED); return new RestResult(response); }
varyHeaderValue.set(varyValue);
@Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (!(obj instanceof Ref)) { return false; } Object otherRef = ((Ref) obj).get(); T localRef = this.reference; return localRef == otherRef || (localRef != null && localRef.equals(otherRef)); }
@Override public ClientRequest apply(ClientRequest requestContext) { requestRefProvider.get().set(requestContext); requestContext.setWorkers(workersProvider); requestContext.setWriterInterceptors(writerInterceptors); requestContext.setReaderInterceptors(readerInterceptors); return requestContext; } }
varyHeaderValue.set(varyValue);
@Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (!(obj instanceof Ref)) { return false; } Object otherRef = ((Ref) obj).get(); return this.reference == otherRef || (this.reference != null && this.reference.equals(otherRef)); }
private void processApplicationStatistics(ApplicationEvent event) { final long now = System.currentTimeMillis(); final ApplicationInfo applicationInfo = new ApplicationInfoImpl(event.getResourceConfig(), new Date(now), event.getRegisteredClasses(), event.getRegisteredInstances(), event.getProviders()); applicationInfoRefProvider.get().set(applicationInfo); }
injectionManager.<Ref<ServerRequest>>getInstance(requestType).set(req); injectionManager.<Ref<ServerResponse>>getInstance(responseType).set(res); injectionManager.<Ref<Span>>getInstance(spanType).set(req.span()); injectionManager.<Ref<SpanContext>>getInstance(spanContextType).set(req.spanContext()); });
@Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (!(obj instanceof Ref)) { return false; } Object otherRef = ((Ref) obj).get(); return this.reference == otherRef || (this.reference != null && this.reference.equals(otherRef)); }