Package org.openxri.util

Examples of org.openxri.util.ResolvedHttpResponse


  {
    // Cache-Control: no-cache
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    final Calendar cal = Calendar.getInstance();
    cal.add(Calendar.HOUR, 1);
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "no-cache");
      }
    };
View Full Code Here


  {
    // Cache-Control: private
    ByteArrayInputStream is = new ByteArrayInputStream("dummy".getBytes());
    final Calendar cal = Calendar.getInstance();
    cal.add(Calendar.HOUR, 1);
    ResolvedHttpResponse rresp = new ResolvedHttpResponse(is) {
      {
        resp = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
        resp.addHeader("Cache-Control", "private");
      }
    };
View Full Code Here

  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

                XRD xrd = new XRD();
                xrd.setQuery("!nonexistent");
                xrd.setStatus(new Status(Status.AUTH_RES_NOT_FOUND));
                XRDS xrds = new XRDS();
                xrds.add(xrd);
                return new ResolvedHttpResponse(new ByteArrayInputStream(xrds.toString().getBytes()));
            }

            XRDS oDescs = new XRDS();

            // just the same response always
            XRD oFoo = new XRD();
            oFoo.setQuery("!foo");
            oFoo.setStatus(new Status(Status.SUCCESS));
            oDescs.add(oFoo);

            XRD oBar = new XRD();
            oBar.setQuery("!bar");
            oBar.setStatus(new Status(Status.SUCCESS));
            oDescs.add(oBar);

            if (uri.getPath().indexOf("!baz") > 0) {
              XRD baz = new XRD();
              baz.setQuery("!baz");
              baz.setStatus(new Status(Status.AUTH_RES_NOT_FOUND, "Not found"));
                oDescs.add(baz);
            }
            return new ResolvedHttpResponse(new ByteArrayInputStream(oDescs.toString().getBytes()));

        } // getDataFromURI()
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.