1 23 24 package org.apache.webdav.lib.methods; 25 26 import org.apache.webdav.lib.util.XMLPrinter; 27 28 52 public class UnbindMethod 53 extends XMLResponseMethodBase { 54 55 56 public static final String NAME = "UNBIND"; 57 58 private String segment = null; 59 60 62 63 66 public UnbindMethod() { 67 } 68 69 public UnbindMethod(String binding) { 70 super(binding.substring(0, binding.lastIndexOf('/'))); 71 this.segment = binding.substring(binding.lastIndexOf('/') + 1); 72 } 73 74 public String getName() { 75 return NAME; 76 } 77 78 84 protected String generateRequestBody() { 85 86 if (segment == null) 87 throw new IllegalStateException 88 ("Segment must be set before calling this function."); 89 90 XMLPrinter printer = new XMLPrinter(); 91 92 printer.writeXMLHeader(); 93 printer.writeElement("D", "DAV:", "unbind", XMLPrinter.OPENING); 94 printer.writeElement("D", "segment", XMLPrinter.OPENING); 95 printer.writeText(segment); 96 printer.writeElement("D", "segment", XMLPrinter.CLOSING); 97 printer.writeElement("D", "unbind", XMLPrinter.CLOSING); 98 99 return printer.toString(); 100 } 101 102 105 public String getSegment() { 106 return segment; 107 } 108 109 112 public void setSegment(String segment) { 113 this.segment = segment; 114 } 115 116 } 117 118 | Popular Tags |