Codota Logo
HttpUtils$Worker.work
Code IndexAdd Codota to your IDE (free)

How to use
work
method
in
org.deegree.commons.utils.net.HttpUtils$Worker

Best Java code snippets using org.deegree.commons.utils.net.HttpUtils$Worker.work (Showing top 11 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: deegree/deegree3

/**
 * Performs an HTTP-Get request and provides typed access to the response.
 * 
 * @param <T>
 * @param worker
 * @param url
 * @param postBody
 * @param headers
 *            may be null
 * @return some object from the url
 * @throws IOException
 */
public static <T> T post( Worker<T> worker, String url, InputStream postBody, Map<String, String> headers )
            throws IOException {
  DURL u = new DURL( url );
  DefaultHttpClient client = enableProxyUsage( new DefaultHttpClient(), u );
  HttpPost post = new HttpPost( url );
  post.setEntity( new InputStreamEntity( postBody, -1 ) );
  if ( headers != null ) {
    for ( String key : headers.keySet() ) {
      post.addHeader( key, headers.get( key ) );
    }
  }
  return worker.work( client.execute( post ).getEntity().getContent() );
}
origin: deegree/deegree3

return worker.work( entity.getContent() );
origin: deegree/deegree3

HttpEntity entity = resp.getEntity();
LOG.debug( "Received response with content type {}", entity.getContentType() );
return new Pair<T, HttpResponse>( worker.work( entity.getContent() ), resp );
origin: deegree/deegree3

/**
 * @param <T>
 * @param worker
 * @param url
 *            must be valid
 * @return some object from the url
 * @throws IOException
 */
public static <T> T retrieve( Worker<T> worker, DURL url )
            throws IOException {
  return worker.work( url.openStream() );
}
origin: deegree/deegree3

/**
 * Returns the tile as an image.
 * 
 * @return image, never <code>null</code>
 * @throws IOException
 * @throws XMLStreamException
 * @throws OWSExceptionReport
 */
public BufferedImage getAsImage()
            throws IOException, OWSExceptionReport, XMLStreamException {
  rawResponse.assertNoXmlContentTypeAndExceptionReport();
  BufferedImage image = null;
  try {
    InputStream is = rawResponse.getAsBinaryStream();
    image = HttpUtils.IMAGE.work( is );
  } finally {
    rawResponse.close();
  }
  return image;
}
origin: deegree/deegree3

public static <T> Pair<T, HttpResponse> getFullResponse( Worker<T> worker, String url, Map<String, String> headers,
                             String user, String pass, final int readTimeout )
            throws IOException {
  DURL u = new DURL( url );
  if ( !u.valid() ) {
    return null;
  }
  DefaultHttpClient client = enableProxyUsage( new DefaultHttpClient(), u );
  client.setKeepAliveStrategy( new DefaultConnectionKeepAliveStrategy() {
    @Override
    public long getKeepAliveDuration( HttpResponse response, HttpContext context ) {
      long keepAlive = super.getKeepAliveDuration( response, context );
      if ( keepAlive == -1 ) {
        keepAlive = readTimeout * 1000;
      }
      return keepAlive;
    }
  } );
  if ( user != null && pass != null ) {
    authenticate( client, user, pass, u );
  }
  HttpGet get = new HttpGet( url );
  if ( headers != null ) {
    for ( String key : headers.keySet() ) {
      get.addHeader( key, headers.get( key ) );
    }
  }
  HttpResponse response = client.execute( get );
  return new Pair<T, HttpResponse>( worker.work( response.getEntity().getContent() ), response );
}
origin: deegree/deegree3

  /**
   * 
   * @param url
   * @return a {@link Pair} of {@link BufferedImage} and {@link String}. In case the WPVS returns an image the former
   *         will be used, otherwise an XML response ( as a String ) will be returned in the second value.
   * @throws IOException
   */
  public synchronized Pair<BufferedImage, String> getView( URL url )
              throws IOException {
    Pair<BufferedImage, String> res = new Pair<BufferedImage, String>();
    InputStream inStream = url.openStream();
    res.first = IMAGE.work( inStream );
    // rb: the following will never happen (I guess)
    if ( res.first == null ) {
      res.second = XmlHttpUtils.XML.work( url.openStream() ).toString();
    }
    inStream.close();

    return res;
  }
}
origin: deegree/deegree3

return new Pair<T, HttpResponse>( worker.work( response.getEntity().getContent() ), response );
origin: deegree/deegree3

  return worker.work( u.getURL().openStream() );
return worker.work( client.execute( get ).getEntity().getContent() );
origin: deegree/deegree3

  res.first = IMAGE.work( conn.getInputStream() );
} else if ( conn.getContentType() != null
      && conn.getContentType().startsWith( "application/vnd.ogc.se_xml" ) ) {
  res.second = XmlHttpUtils.XML.work( conn.getInputStream() ).toString();
} else { // try and find out the hard way
  res.first = IMAGE.work( conn.getInputStream() );
  if ( res.first == null ) {
    conn = theUrl.openConnection();
    res.second = XmlHttpUtils.XML.work( conn.getInputStream() ).toString();
origin: deegree/deegree3

return worker.work( client.execute( post ).getEntity().getContent() );
org.deegree.commons.utils.netHttpUtils$Workerwork

Popular methods of HttpUtils$Worker

    Popular in Java

    • Making http requests using okhttp
    • getSystemService (Context)
    • getResourceAsStream (ClassLoader)
      Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
    • startActivity (Activity)
    • Path (java.nio.file)
    • Semaphore (java.util.concurrent)
      A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
    • JButton (javax.swing)
    • Table (org.hibernate.mapping)
      A relational table
    • Reflections (org.reflections)
      Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
    • Logger (org.slf4j)
      The main user interface to logging. It is expected that logging takes place through concrete impleme
    Codota Logo
    • Products

      Search for Java codeSearch for JavaScript codeEnterprise
    • IDE Plugins

      IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Codota for your IDE now