Package org.sonatype.plexus.rest.representation

Examples of org.sonatype.plexus.rest.representation.XStreamRepresentation


  private SearchNGResponse doNGSearchFor(Map<String, String> queryArgs, String repositoryId, SearchType searchType)
      throws IOException
  {
    String entityText = doNGSearchForR(queryArgs, repositoryId, searchType);

    XStreamRepresentation representation =
        new XStreamRepresentation(xstream, entityText, MediaType.APPLICATION_XML);

    SearchNGResponse searchResponse = (SearchNGResponse) representation.getPayload(new SearchNGResponse());

    return searchResponse;
  }
View Full Code Here


      serviceURI = serviceURI + "versionHint=" + versionIdHint + "&";
    }

    String entityText = RequestFacade.doGetForText(serviceURI);

    XStreamRepresentation re =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), entityText, MediaType.APPLICATION_XML);

    IndexBrowserTreeViewResponseDTO resourceResponse =
        (IndexBrowserTreeViewResponseDTO) re.getPayload(new IndexBrowserTreeViewResponseDTO());

    return resourceResponse;
  }
View Full Code Here

  }

  public Response sendMessage(Method method, PrivilegeResource resource, String id)
      throws IOException
  {
    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType);

    String privId = (method == Method.POST) ? "" : "/" + id;
    String serviceURI = "service/local/privileges" + privId;

    if (method == Method.POST) {
      serviceURI += "_target";
    }

    if (method == Method.POST || method == Method.PUT) // adding put so we can check for the 405, without a
    // resource you get a 400
    {
      PrivilegeResourceRequest requestResponse = new PrivilegeResourceRequest();
      requestResponse.setData(resource);

      // now set the payload
      representation.setPayload(requestResponse);
      log.debug(method.getName() + ": " + representation.getText());
    }

    return RequestFacade.sendMessage(serviceURI, method, representation);
  }
View Full Code Here

    // accepted return codes: OK or redirect
    final String responseText = RequestFacade.doGetForText(SERVICE_PART + "/" + repoId, not(inError()));
    LOG.debug("responseText: \n" + responseText);

    // this should use call to: getResourceFromResponse
    XStreamRepresentation representation =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), responseText, MediaType.APPLICATION_XML);

    RepositoryResourceResponse resourceResponse =
        (RepositoryResourceResponse) representation.getPayload(new RepositoryResourceResponse());

    return resourceResponse.getData();
  }
View Full Code Here

   * IMPORTANT: Make sure to release the Response in a finally block when you are done with it.
   */
  public Response sendMessage(Method method, RepositoryRouteResource resource)
      throws IOException
  {
    XStreamRepresentation representation = new XStreamRepresentation(xstream, "", mediaType);

    String resourceId = (resource.getId() == null) ? "" : "/" + resource.getId();
    String serviceURI = "service/local/repo_routes" + resourceId;

    if (method != Method.GET || method != Method.DELETE) {
      RepositoryRouteResourceResponse requestResponse = new RepositoryRouteResourceResponse();
      requestResponse.setData(resource);

      // now set the payload
      representation.setPayload(requestResponse);
    }

    return RequestFacade.sendMessage(serviceURI, method, representation);
  }
View Full Code Here

    return getResourceFromText(responseString);
  }

  public RepositoryRouteResource getResourceFromText(String responseString) {
    assertThat(responseString, not(IsEmptyString.isEmptyOrNullString()));
    XStreamRepresentation representation = new XStreamRepresentation(xstream, responseString, mediaType);

    RepositoryRouteResourceResponse resourceResponse =
        (RepositoryRouteResourceResponse) representation.getPayload(new RepositoryRouteResourceResponse());

    return resourceResponse.getData();
  }
View Full Code Here

      throws IOException
  {
    String serviceURI = "service/local/repo_routes";

    String entityText = RequestFacade.doGetForText(serviceURI);
    XStreamRepresentation representation =
        new XStreamRepresentation(XStreamFactory.getXmlXStream(), entityText,
            MediaType.APPLICATION_XML);

    RepositoryRouteListResourceResponse resourceResponse =
        (RepositoryRouteListResourceResponse) representation.getPayload(new RepositoryRouteListResourceResponse());

    return resourceResponse.getData();
  }
View Full Code Here

    LdapServerRequest serverRequest = getDefaultServerRequest();

    XStream xstream = this.getXMLXStream();
    String responseText =
        RequestFacade.doPutForText(RequestFacade.SERVICE_LOCAL + "ldap/test_user_conf",
            new XStreamRepresentation(xstream,
                xstream.toXML(serverRequest),
                MediaType.APPLICATION_XML),
            respondsWithStatusCode(200));

    LdapUserListResponse listResponse = this.getFromResponse(LdapUserListResponse.class, xstream,
View Full Code Here

    LdapServerRequest serverRequest = getDefaultServerRequest();

    XStream xstream = this.getXMLXStream();
    String responseText =
        RequestFacade.doPutForText(RequestFacade.SERVICE_LOCAL + "ldap/test_user_conf",
            new XStreamRepresentation(xstream,
                xstream.toXML(serverRequest),
                MediaType.APPLICATION_XML),
            respondsWithStatusCode(400));

    ErrorResponse errorResponse = this.getFromResponse(ErrorResponse.class, xstream, responseText);
View Full Code Here

    Response response = null;
    try {
      response = RequestFacade.sendMessage(
          RequestFacade.SERVICE_LOCAL + "ldap/logintest",
          Method.PUT,
          new XStreamRepresentation(
              xstream,
              xstream.toXML(ldapServerLoginTestRequest),
              MediaType.APPLICATION_XML));

      String responseText = response.getEntity().getText();
View Full Code Here

TOP

Related Classes of org.sonatype.plexus.rest.representation.XStreamRepresentation

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.