Examples of DomRepresentation


Examples of org.restlet.ext.xml.DomRepresentation

   * @return
   * @throws IOException
   */
  @Get("xml")
  public Representation getXmlServicesList() throws IOException {
        DomRepresentation representation = new DomRepresentation(  
                MediaType.TEXT_XML);  
        // Generate a DOM document representing the item.  
        Document d = representation.getDocument();  
 
    Element rootItem = d.createElement(SERVICE_LIST_NODE_NAME);  
    d.appendChild(rootItem);  
    ServicePublisher publisher = new XmlResourcePublisher(rootItem, d);
View Full Code Here

Examples of org.restlet.ext.xml.DomRepresentation

   * @return
   * @throws IOException
   */
  @Get("xml")
  public Representation getXmlServicesList() throws IOException {
        DomRepresentation representation = new DomRepresentation(  
                MediaType.TEXT_XML);  
        // Generate a DOM document representing the item.  
        Document d = representation.getDocument();  
 
    Element rootItem = d.createElement(SERVICE_LIST_NODE_NAME);  
    d.appendChild(rootItem);  
    ServicePublisher publisher = new XmlResourcePublisher(rootItem, d);
View Full Code Here

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

Examples of org.restlet.resource.DomRepresentation

    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

Examples of org.restlet.resource.DomRepresentation

  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

Examples of org.restlet.resource.DomRepresentation

      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

Examples of org.restlet.resource.DomRepresentation

            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

Examples of org.restlet.resource.DomRepresentation

     *         {@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

Examples of org.restlet.resource.DomRepresentation

        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

Examples of org.restlet.resource.DomRepresentation

     *         {@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
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.