Package org.restlet.resource

Examples of org.restlet.resource.DomRepresentation


  public void populateHostNames() {
    try {
      Request request = new Request(Method.GET,"http://info.teragrid.org/web-apps/XML/ctss-resources-v1/");
      Client client = new Client(Protocol.HTTP);
      Response response = client.handle(request);
      DomRepresentation representation = response.getEntityAsDom();
      Document document = representation.getDocument();
      NodeList nodeList = document.getElementsByTagName("Resource");
      for(int i=0;i<nodeList.getLength();i++){
        this.hostNameItems.add(new SelectItem(nodeList.item(i).getAttributes().getNamedItem("UniqueID").getNodeValue()));
      }
    } catch(NullPointerException e){
View Full Code Here


    if(!hostName.isEmpty()){
    try{
      Request request = new Request(Method.GET,"http://info.teragrid.org/web-apps/xml/kit-services-v1/type/gridftp/");
      Client client = new Client(Protocol.HTTP);
      Response response = client.handle(request);
      DomRepresentation representation = response.getEntityAsDom();
      Document document = representation.getDocument();
      NodeList nodeList = document.getElementsByTagName("Service");
      for(int i=0;i<nodeList.getLength();i++){
        Node node = nodeList.item(i);
        if(node.getNodeType()==Node.ELEMENT_NODE) {
          Element element = (Element)node;
View Full Code Here

  public void populateServiceTypes() {
    try {
      Request request = new Request(Method.GET,"http://info.teragrid.org/restdemo/xml/tg/services");
      Client client = new Client(Protocol.HTTP);
      Response response = client.handle(request);
      DomRepresentation representation = response.getEntityAsDom();
      Document document = representation.getDocument();
      NodeList nodeList = document.getElementsByTagName("Service");
      for(int i=0;i<nodeList.getLength();i++){
        String type = nodeList.item(i).getAttributes().getNamedItem("Type").getNodeValue();
        // need to remove this in the future if all the service types have to be displayed
        if(type.equalsIgnoreCase("prews-gram") | type.equalsIgnoreCase("ws-gram") | type.equalsIgnoreCase("gram5")){
View Full Code Here

      while(iterator.hasNext()){
        try{
          Request request = new Request(Method.GET,"http://info.teragrid.org/restdemo/xml/tg/services/"+iterator.next());
          Client client = new Client(Protocol.HTTP);
          Response response = client.handle(request);
          DomRepresentation representation = response.getEntityAsDom();
          Document document = representation.getDocument();
          NodeList nodeList = document.getElementsByTagName("Service");
          String currentHostName = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("hostInfo:hostName");
          for(int i=0;i<nodeList.getLength();i++){
            String resource = nodeList.item(i).getAttributes().getNamedItem("ResourceID").getNodeValue();
            if(resource.equalsIgnoreCase(currentHostName)){
View Full Code Here

            throw new ParseException("invalid representation: "
                    + representation);
        }
        List<Post> posts = new ArrayList<Post>();
        try {
            NodeSet nodes = new DomRepresentation(representation)
                    .getNodes("/RDF/Post");
            for (Node node : nodes) {
                posts.add(getPost(node));
            }
        } catch (Exception e) {
View Full Code Here

     *         {@link org.restlet.resource.Representation} is parseable as a
     *         list of zero or more {@link Post}s
     */
    public boolean isValid(Representation representation) {
        return (representation != null)
                && (new DomRepresentation(representation).getNodes("/RDF/Post") != null);
    }
View Full Code Here

        List<Tag> tags = new ArrayList<Tag>();
        if (!isValid(representation)) {
            throw new ParseException("invalid representation");
        }
        try {
            NodeSet nodes = new DomRepresentation(representation)
                    .getNodes("/RDF/TagList/item");
            for (Node node : nodes) {
                tags.add(getTag(node));
            }
        } catch (Exception e) {
View Full Code Here

     *         {@link org.restlet.resource.Representation} is parseable as a
     *         list of zero or more {@link Tag}s
     */
    public boolean isValid(Representation representation) {
        return (representation != null)
                && (new DomRepresentation(representation)
                        .getNodes("/RDF/TagList/item") != null);
    }
View Full Code Here

        }
        if (!(isValid(representation))) {
            return Message.INVALID;
        }
        Message message = new Message();
        Node node = new DomRepresentation(representation)
                .getNode("/RDF/Response");
        Node firstChild = node.getFirstChild();
        while (firstChild.getNextSibling() != null) {
            String name = firstChild.getNodeName();
            String text = firstChild.getTextContent();
View Full Code Here

     * @return <code>true</code> if the representation can be parsed as an
     *         instance of a {@link Message}
     */
    public boolean isValid(Representation representation) {
        try {
            DomRepresentation dom = new DomRepresentation(representation);
            return (dom.getDocument() != null)
                    && (dom.getNode("/RDF/Response") != null);
        } catch (Exception e) {
            return false;
        }
    }
View Full Code Here

TOP

Related Classes of org.restlet.resource.DomRepresentation

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.