Examples of Browsable


Examples of com.browseengine.bobo.api.Browsable

    factoryBean.setServiceInterface(Browsable.class);
    factoryBean.setServiceUrl("http://localhost:8888/bobo-service/services/BrowseService");
    factoryBean.afterPropertiesSet();

    final Browsable svc = (Browsable) (factoryBean.getObject());

    int numThreads = 1;
   
    Thread[] threads = new Thread[numThreads];
    for (int i = 0; i < threads.length; ++i)
    {
      threads[i] = new Thread()
      {
        public void run()
        {
          for (BrowseRequest req : reqs)
          {
            try
            {
              long start = System.currentTimeMillis();
              BrowseResult result = svc.browse(req);
              long end = System.currentTimeMillis();
 
              long time = result.getTime();
              System.out.println("took: (c):" + (end - start) + " / (s):" + time);
              Thread.sleep(200);
            }
            catch(Exception e)
            {
              e.printStackTrace();
            }
          }
        }
        public void run2()
        {
          while (true)
          {
            try
            {
              BrowseRequest req = new BrowseRequest();
              BrowseSelection sel = new BrowseSelection("color");
              sel.addValue("red");
              req.addSelection(sel);

              FacetSpec fspec = new FacetSpec();
              fspec.setExpandSelection(true);
              fspec.setMaxCount(10);
              fspec.setOrderBy(FacetSortSpec.OrderHitsDesc);

              req.setFacetSpec("color", fspec);
              req.setFacetSpec("category", fspec);
              req.setFacetSpec("makemodel", fspec);
              req.setFacetSpec("city", fspec);
              req.setFacetSpec("price", fspec);
              req.setFacetSpec("year", fspec);

              long start = System.currentTimeMillis();
              BrowseResult result = svc.browse(req);
              long end = System.currentTimeMillis();

              long time = result.getTime();
              System.out.println("took: (c):" + (end - start) + " / (s):" + time);
              Thread.sleep(200);
View Full Code Here

Examples of org.springframework.hateoas.client.Browsable

    // enable client to submit form when encountered
    agent.addSubmitFormAction(new SubmitFormAction("searchPerson", Args.of("personId", personId)));

    agent.setGoal(describedBy("http://example.com/doc#product").within(describedBy("http://example.com/doc#customer")));
    Browsable result = agent.browseForGoal();

    System.out.println("\n--- result ---");
    System.out.println(result.toString());
    System.out.println("--------------\n");
  }
View Full Code Here

Examples of org.springframework.hateoas.client.Browsable

    // enable client to submit forms
    // TODO: look into schema.org actions to see if they say something about required data for an action.
    agent.addSubmitFormAction(new SubmitFormAction("bankAccountForm", Args.of("accountNumber", fromAccount)));
    agent.addSubmitFormAction(new SubmitFormAction("moneyTransferForm", Args.of("amount", amount, "to", toAccount)));

    Browsable result = agent.browseForGoal();
    System.out.println("\n--- result ---");
    System.out.println(result.toString());
    System.out.println("--------------\n");
  }
View Full Code Here

Examples of org.springframework.hateoas.client.Browsable

    response.setEntity(entity);

    // expect
    when(navigatorRegistry.getBrowsable("text/xhtml")).thenReturn(expectedBrowsable);

    Browsable browsable = handler.handleResponse(response);
    assertSame(expectedBrowsable, browsable);
    verify(expectedBrowsable).process(Mockito.<InputStream> any(), Mockito.<HttpHeaders> any());
  }
View Full Code Here

Examples of org.springframework.hateoas.client.Browsable

    response.setEntity(entity);

    // expect
    when(navigatorRegistry.getBrowsable("application/xhtml+xml")).thenReturn(expectedBrowsable);

    Browsable navigator = handler.handleResponse(response);

    assertSame(expectedBrowsable, navigator);
    verify(expectedBrowsable).process(Mockito.<InputStream> any(), Mockito.<HttpHeaders> any());
  }
View Full Code Here

Examples of org.springframework.hateoas.client.Browsable

    when(searchForm.getFormRequest(Mockito.eq("people"), Mockito.<Args> any())).thenReturn(
        new FormRequest(HttpMethod.GET, new LinkedMultiValueMap<String, String>(), new URI("/"), "", "UTF-8"));

    browser.followRel("search").submitForm("people", Args.of("customerId", 1));

    Browsable currentResource = browser.getCurrentResource();

    assertSame(result, currentResource);
  }
View Full Code Here

Examples of org.springframework.hateoas.client.Browsable

  private Browsable followLink(Link target) {
    try {
      ResponseHandler<Browsable> responseHandler = new BrowsableResponseHandler();
      URI uri = new URI(target.getHref());
      HttpGet httpGet = createGet(uri);
      Browsable browsable = httpClient.execute(httpGet, responseHandler);
      setCurrentContext(uri);
      return browsable;
    } catch (Exception e) {
      throw Failure.asUnchecked(e);
    }
View Full Code Here

Examples of org.springframework.hateoas.client.Browsable

    if (elements.length != 1) {
      throw new IllegalArgumentException("more than one response mime type currently not supported");
    }
    String mimeType = elements[0].getName();

    Browsable browsable = browsableRegistry.getBrowsable(mimeType);

    // navigator.setURL(response.);

    HttpHeaders httpHeaders = toHttpHeaders(response.getAllHeaders());

    browsable.process(inputStream, httpHeaders);

    return browsable;

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.