Tabnine Logo
BaseClientResponse.getStreamFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
getStreamFactory
method
in
org.jboss.resteasy.client.core.BaseClientResponse

Best Java code snippets using org.jboss.resteasy.client.core.BaseClientResponse.getStreamFactory (Showing top 8 results out of 315)

origin: org.jboss.resteasy/resteasy-legacy

  @SuppressWarnings("unchecked")
  public void clientErrorHandling(BaseClientResponse clientResponse, RuntimeException e)
  {
   for (ClientErrorInterceptor handler : interceptors)
   {
     try
     {
      // attempt to reset the stream in order to provide a fresh stream
      // to each ClientErrorInterceptor -- failing to reset the stream
      // could mean that an unusable stream will be passed to the
      // interceptor
      InputStream stream = clientResponse.getStreamFactory().getInputStream();
      if (stream != null)
      {
        stream.reset();
      }
     }
     catch (IOException e1)
     {
      // eat this exception since it's not really relevant for the client
      // response
     }
     handler.handle(clientResponse);
   }
   throw e;
  }
}
origin: org.jboss.resteasy/resteasy-jaxrs-20

  @SuppressWarnings("unchecked")
  public void clientErrorHandling(BaseClientResponse clientResponse, RuntimeException e)
  {
   for (ClientErrorInterceptor handler : interceptors)
   {
     try
     {
      // attempt to reset the stream in order to provide a fresh stream
      // to each ClientErrorInterceptor -- failing to reset the stream
      // could mean that an unusable stream will be passed to the
      // interceptor
      InputStream stream = clientResponse.getStreamFactory().getInputStream();
      if (stream != null)
      {
        stream.reset();
      }
     }
     catch (IOException e1)
     {
      // eat this exception since it's not really relevant for the client
      // response
     }
     handler.handle(clientResponse);
   }
   throw e;
  }
}
origin: org.ow2.bonita/bonita-server

@Override
public void handle(final ClientResponse<?> response) throws RuntimeException {
 try {
  final BaseClientResponse<?> r = (BaseClientResponse<?>) response;
  final InputStream stream = r.getStreamFactory().getInputStream();
  stream.reset();
  final Object entity = response.getEntity(Object.class);
  if (entity instanceof RuntimeException) {
   final RuntimeException exception = (RuntimeException) entity;
   throw exception;
  }
  if (entity instanceof Exception) {
   final Exception exception = (Exception) entity;
   throw new RESTBonitaRuntimeExceptionWrapper(exception);
  }
  if (Status.FORBIDDEN.getStatusCode() == response.getResponseStatus().getStatusCode()) {
   throw new BonitaRuntimeException("Forbidden returned");
  }
 } catch (final IOException e) {
  new BonitaRuntimeException("Error while reading client response", e);
 }
 // RESTEasy will throw the original ClientResponseFailure
}
origin: org.ow2.bonita/bonita-client

@Override
public void handle(final ClientResponse<?> response) throws RuntimeException {
 try {
  final BaseClientResponse<?> r = (BaseClientResponse<?>) response;
  final InputStream stream = r.getStreamFactory().getInputStream();
  stream.reset();
  final Object entity = response.getEntity(Object.class);
  if (entity instanceof RuntimeException) {
   final RuntimeException exception = (RuntimeException) entity;
   throw exception;
  }
  if (entity instanceof Exception) {
   final Exception exception = (Exception) entity;
   throw new RESTBonitaRuntimeExceptionWrapper(exception);
  }
  if (Status.FORBIDDEN.getStatusCode() == response.getResponseStatus().getStatusCode()) {
   throw new BonitaRuntimeException("Forbidden returned");
  }
 } catch (final IOException e) {
  new BonitaRuntimeException("Error while reading client response", e);
 }
 // RESTEasy will throw the original ClientResponseFailure
}
origin: org.jboss.resteasy/resteasy-jaxrs-20

public ClientResponse cacheIfPossible(ClientRequest request, BaseClientResponse response) throws Exception
{
 String cc = (String) response.getResponseHeaders().getFirst(HttpHeaders.CACHE_CONTROL);
 String exp = (String) response.getResponseHeaders().getFirst(HttpHeaders.EXPIRES);
 int expires = -1;
 if (cc != null)
 {
   CacheControl cacheControl = CacheControl.valueOf(cc);
   if (cacheControl.isNoCache()) return response;
   expires = cacheControl.getMaxAge();
 }
 else if (exp != null)
 {
   Date date = DateUtil.parseDate(exp);
   expires = (int) ((date.getTime() - System.currentTimeMillis()) / 1000);
 }
 String lastModified = (String) response.getResponseHeaders().getFirst(HttpHeaders.LAST_MODIFIED);
 String etag = (String) response.getResponseHeaders().getFirst(HttpHeaders.ETAG);
 String contentType = (String) response.getResponseHeaders().getFirst(HttpHeaders.CONTENT_TYPE);
 byte[] cached = ReadFromStream.readFromStream(1024, response.getStreamFactory().getInputStream());
 response.getStreamFactory().performReleaseConnection();
 MediaType mediaType = MediaType.valueOf(contentType);
 final BrowserCache.Entry entry = cache.put(request.getUri(), mediaType,
     response.getResponseHeaders(), cached, expires, etag, lastModified);
 response.setStreamFactory(new CachedStreamFactory(entry));
 return response;
}
origin: org.jboss.resteasy/resteasy-legacy

public ClientResponse cacheIfPossible(ClientRequest request, BaseClientResponse response) throws Exception
{
 String cc = (String) response.getResponseHeaders().getFirst(HttpHeaders.CACHE_CONTROL);
 String exp = (String) response.getResponseHeaders().getFirst(HttpHeaders.EXPIRES);
 int expires = -1;
 if (cc != null)
 {
   CacheControl cacheControl = CacheControl.valueOf(cc);
   if (cacheControl.isNoCache()) return response;
   expires = cacheControl.getMaxAge();
 }
 else if (exp != null)
 {
   Date date = DateUtil.parseDate(exp);
   expires = (int) ((date.getTime() - System.currentTimeMillis()) / 1000);
 }
 String lastModified = (String) response.getResponseHeaders().getFirst(HttpHeaders.LAST_MODIFIED);
 String etag = (String) response.getResponseHeaders().getFirst(HttpHeaders.ETAG);
 String contentType = (String) response.getResponseHeaders().getFirst(HttpHeaders.CONTENT_TYPE);
 byte[] cached = ReadFromStream.readFromStream(1024, response.getStreamFactory().getInputStream());
 response.getStreamFactory().performReleaseConnection();
 MediaType mediaType = MediaType.valueOf(contentType);
 final BrowserCache.Entry entry = cache.put(request.getUri(), mediaType,
     response.getResponseHeaders(), cached, expires, etag, lastModified);
 response.setStreamFactory(new CachedStreamFactory(entry));
 return response;
}
origin: org.uberfire/uberfire-security-management-keycloak

InputStream stream = r.getStreamFactory().getInputStream();
stream.reset();
origin: kiegroup/appformer

InputStream stream = r.getStreamFactory().getInputStream();
stream.reset();
org.jboss.resteasy.client.coreBaseClientResponsegetStreamFactory

Popular methods of BaseClientResponse

  • setReturnType
  • getEntity
  • getMetadata
  • getStatus
  • <init>
  • setAnnotations
  • setAttributeExceptionsTo
  • setHeaders
  • setProviderFactory
  • setStatus
  • checkFailureStatus
  • copyFromError
    Store entity within a byte array input stream because we want to release the connection if a ClientR
  • checkFailureStatus,
  • copyFromError,
  • createResponseFailure,
  • getAnnotations,
  • getLinkHeader,
  • getLocationLink,
  • getMediaType,
  • getResponseHeader,
  • getResponseHeaders

Popular in Java

  • Creating JSON documents from java classes using gson
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • setRequestProperty (URLConnection)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Runner (org.openjdk.jmh.runner)
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now