Package org.openxri.util

Examples of org.openxri.util.ResolvedHttpResponse


  public void testCacheControlMaxAge()
  {
    // Cache-Control: max-age=3000 (no xrd-expires, no http-expires)
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "max-age=\"3000\"");
      }
    };
View Full Code Here


 
  public void testCacheControlSMaxAge()
  {
    // Cache-Control: s-maxage=3000 (no xrd-expires, no http-expires)
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "s-maxage=3000");
      }
    };
View Full Code Here

  public void testCacheControlMaxAgeBoth1()
  {
    // Cache-Control: differing max-age and s-maxage (no xrd-expires, no http-expires)
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "max-age=3000");
        resp.addHeader("Cache-Control", "s-maxage=600");
      }
View Full Code Here

 
  public void testCacheControlMaxAgeBoth2()
  {
    // Cache-Control: differing max-age and s-maxage (no xrd-expires, no http-expires)
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "max-age=3000");
        resp.addHeader("Cache-Control", "s-maxage=6000");
      }
View Full Code Here

    // Cache-Control: differing max-age and http expires (max-age should override)
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    final Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MINUTE, 61);

    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "max-age=4004");
      }
    };
View Full Code Here

    // Cache-Control: public, max-age=3000, xrd-expires expired, http-expires expired
    // max-age should override
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    final Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MINUTE, -60);
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "public,max-age=1800");
        resp.addHeader("Expires", dfm.format(cal.getTime()));
      }
View Full Code Here

 
  public void testCacheControlMaxAgeBoth2()
  {
    // Cache-Control: differing max-age and s-maxage (no xrd-expires, no http-expires)
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "max-age=3000");
        resp.addHeader("Cache-Control", "s-maxage=6000");
      }
View Full Code Here

    // Cache-Control: differing max-age and http expires (max-age should override)
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    final Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MINUTE, 61);

    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "max-age=4004");
      }
    };
View Full Code Here

    // Cache-Control: public, max-age=3000, xrd-expires expired, http-expires expired
    // max-age should override
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    final Calendar cal = Calendar.getInstance();
    cal.add(Calendar.MINUTE, -60);
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "public,max-age=1800");
        resp.addHeader("Expires", dfm.format(cal.getTime()));
      }
View Full Code Here

    }
    catch (java.net.URISyntaxException oEx) {
      throw makeResolutionException(xrdsOut, query, Status.AUTH_RES_ERROR, "Invalid URI for authority resolution service");
    }

    ResolvedHttpResponse resp = null;
    XRDS tmpXRDS = null;
    // now that we've constructed the new URI, try to return the stream from it
    try {
      resp = getDataFromURI(newURI, segment.toString(), flags, state);
      InputStream in = resp.getInputStream();
      tmpXRDS = readXRDS(in);
      log.debug("fetchAuthXRDS - got XRDS = " + tmpXRDS.serializeDescriptorDOM(false, true));
    } catch (IOException e) {
      log.trace("fetchAuthXRDS - got IOException from URI " + newURI);
      throw makeResolutionException(xrdsOut, query, Status.NETWORK_ERROR, "Networking error encountered");
View Full Code Here

TOP

Related Classes of org.openxri.util.ResolvedHttpResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.