0,0 → 1,69 |
/* |
* Copyright 2011 Brian Rosenberger (Brutex Network) |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
|
package net.brutex.xservices.types.ant; |
|
import java.io.File; |
import java.io.IOException; |
|
import javax.activation.DataHandler; |
import javax.xml.bind.annotation.XmlMimeType; |
|
import net.brutex.xservices.util.BrutexNamespaces; |
|
import org.apache.cxf.aegis.type.java5.XmlElement; |
import org.apache.cxf.aegis.type.java5.XmlType; |
|
|
/** |
* Represents a single file based attachment type. |
* @author Brian Rosenberger, bru@brutex.de |
* @since 0.4.0 |
*/ |
@XmlType(name=AttachmentType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES) |
public class AttachmentType { |
|
public static final String XML_NAME="attachment"; |
private DataHandler content; |
private String filename = null; |
|
@XmlMimeType("application/octet-stream") |
@XmlElement(minOccurs="1") |
public void setContent(DataHandler content) { |
this.content = content; |
} |
|
public DataHandler getContent() { |
return content; |
} |
|
public String getFilename() { |
if(filename==null || filename.equals("")) { |
try { |
filename = File.createTempFile("XServices_", ".tmp").getPath(); |
} catch (IOException e) { |
// TODO Auto-generated catch block |
e.printStackTrace(); |
} |
} |
return filename; |
} |
|
public void setFilename(String filename) { |
this.filename = filename; |
} |
|
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |