javax.xml.bind.annotation.XmlMimeType Java Examples

The following examples show how to use javax.xml.bind.annotation.XmlMimeType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Util.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                    ModelBuilder builder ) {
    XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
    if(xmt==null)
        return null;

    try {
        return new MimeType(xmt.value());
    } catch (MimeTypeParseException e) {
        builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
            xmt
        ));
        return null;
    }
}
 
Example #2
Source File: DocumentService.java    From document-management-system with GNU General Public License v2.0 6 votes vote down vote up
@WebMethod
public Document createSimple(@WebParam(name = "token") String token, @WebParam(name = "docPath") String docPath,
                             @WebParam(name = "content") @XmlMimeType("application/octet-stream") DataHandler content) throws IOException,
		UnsupportedMimeTypeException, FileSizeExceededException, UserQuotaExceededException, VirusDetectedException,
		ItemExistsException, PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, ExtensionException,
		AutomationException {
	log.debug("createSimple({})", docPath);
	DocumentModule dm = ModuleManager.getDocumentModule();
	InputStream bais = content.getInputStream();
	Document doc = new Document();
	doc.setPath(docPath);
	Document newDocument = dm.create(token, doc, bais);
	bais.close();
	log.debug("createSimple: {}", newDocument);
	return newDocument;
}
 
Example #3
Source File: Util.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                    ModelBuilder builder ) {
    XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
    if(xmt==null)
        return null;

    try {
        return new MimeType(xmt.value());
    } catch (MimeTypeParseException e) {
        builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
            xmt
        ));
        return null;
    }
}
 
Example #4
Source File: Util.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                    ModelBuilder builder ) {
    XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
    if(xmt==null)
        return null;

    try {
        return new MimeType(xmt.value());
    } catch (MimeTypeParseException e) {
        builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
            xmt
        ));
        return null;
    }
}
 
Example #5
Source File: WrapperUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static List<Annotation> getJaxbAnnotations(Method method) {
    List<Annotation> jaxbAnnotation = new ArrayList<>();
    Annotation ann = method.getAnnotation(XmlAttachmentRef.class);
    if (ann != null) {
        jaxbAnnotation.add(ann);
    }
    ann = method.getAnnotation(XmlMimeType.class);
    if (ann != null) {
        jaxbAnnotation.add(ann);
    }
    ann = method.getAnnotation(XmlJavaTypeAdapter.class);
    if (ann != null) {
        jaxbAnnotation.add(ann);
    }
    ann = method.getAnnotation(XmlList.class);
    if (ann != null) {
        jaxbAnnotation.add(ann);
    }
    return jaxbAnnotation;
}
 
Example #6
Source File: Util.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                    ModelBuilder builder ) {
    XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
    if(xmt==null)
        return null;

    try {
        return new MimeType(xmt.value());
    } catch (MimeTypeParseException e) {
        builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
            xmt
        ));
        return null;
    }
}
 
Example #7
Source File: WrapperUtil.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static List<Annotation> getJaxbAnnotations(Method method, int idx) {
    List<Annotation> jaxbAnnotation = new ArrayList<>();
    Annotation[][] anns = method.getParameterAnnotations();
    for (int i = 0; i < method.getParameterTypes().length; i++) {
        if (i == idx) {
            for (Annotation ann : anns[i]) {
                if (ann.annotationType() == XmlAttachmentRef.class
                    || ann.annotationType() == XmlMimeType.class
                    || ann.annotationType() == XmlJavaTypeAdapter.class
                    || ann.annotationType() == XmlList.class
                    || ann.annotationType() == XmlElement.class) {
                    jaxbAnnotation.add(ann);
                }
            }
        }
    }
    return jaxbAnnotation;
}
 
Example #8
Source File: WrapperClassGenerator.java    From cxf with Apache License 2.0 6 votes vote down vote up
private List<Annotation> getJaxbAnnos(MessagePartInfo mpi) {
    List<Annotation> list = new java.util.concurrent.CopyOnWriteArrayList<>();
    Annotation[] anns = getMethodParameterAnnotations(mpi);
    if (anns != null) {
        for (Annotation anno : anns) {
            if (anno.annotationType() == XmlList.class
                || anno.annotationType() == XmlAttachmentRef.class
                || anno.annotationType() == XmlJavaTypeAdapter.class
                || anno.annotationType() == XmlMimeType.class
                || anno.annotationType() == XmlElement.class
                || anno.annotationType() == XmlElementWrapper.class) {
                list.add(anno);
            }
        }
    }
    return list;
}
 
Example #9
Source File: Util.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                    ModelBuilder builder ) {
    XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
    if(xmt==null)
        return null;

    try {
        return new MimeType(xmt.value());
    } catch (MimeTypeParseException e) {
        builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
            xmt
        ));
        return null;
    }
}
 
Example #10
Source File: Util.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                    ModelBuilder builder ) {
    XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
    if(xmt==null)
        return null;

    try {
        return new MimeType(xmt.value());
    } catch (MimeTypeParseException e) {
        builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
            xmt
        ));
        return null;
    }
}
 
Example #11
Source File: Util.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                    ModelBuilder builder ) {
    XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
    if(xmt==null)
        return null;

    try {
        return new MimeType(xmt.value());
    } catch (MimeTypeParseException e) {
        builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
            xmt
        ));
        return null;
    }
}
 
Example #12
Source File: Util.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static MimeType calcExpectedMediaType(AnnotationSource primarySource,
                    ModelBuilder builder ) {
    XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class);
    if(xmt==null)
        return null;

    try {
        return new MimeType(xmt.value());
    } catch (MimeTypeParseException e) {
        builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()),
            xmt
        ));
        return null;
    }
}
 
Example #13
Source File: ServiceInterface.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
@WebMethod(action = "checkinInitiatedAsync")
Long checkinInitiatedAsync(
	@WebParam(name = "topicId", partName = "checkinInitiated.topicId") Long topicId,
	@WebParam(name = "poid", partName = "checkinInitiated.poid") Long poid,
	@WebParam(name = "comment", partName = "checkinInitiated.comment") String comment,
	@WebParam(name = "deserializerOid", partName = "checkinInitiated.deserializerOid") Long deserializerOid,
	@WebParam(name = "fileSize", partName = "checkinInitiated.fileSize") Long fileSize,
	@WebParam(name = "fileName", partName = "checkinInitiated.fileName") String fileName,
	@WebParam(name = "data", partName = "checkinInitiated.data") @XmlMimeType("application/octet-stream") DataHandler data,
	@WebParam(name = "merge", partName = "checkinInitiated.merge") Boolean merge) throws ServerException, UserException;
 
Example #14
Source File: ReflectionServiceFactoryBean.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void addMimeType(final XmlSchemaElement element, final Annotation[] annotations) {
    if (annotations != null) {
        for (Annotation annotation : annotations) {
            if (annotation instanceof XmlMimeType) {
                MimeAttribute attr = new MimeAttribute();
                attr.setValue(((XmlMimeType)annotation).value());
                element.addMetaInfo(MimeAttribute.MIME_QNAME, attr);
            }
        }
    }
}
 
Example #15
Source File: ServiceInterface.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
@WebMethod(action = "checkinAsync")
Long checkinAsync(
	@WebParam(name = "poid", partName = "checkin.poid") Long poid,
	@WebParam(name = "comment", partName = "checkin.comment") String comment,
	@WebParam(name = "deserializerOid", partName = "checkin.deserializerOid") Long deserializerOid,
	@WebParam(name = "fileSize", partName = "checkin.fileSize") Long fileSize,
	@WebParam(name = "fileName", partName = "checkin.fileName") String fileName,
	@WebParam(name = "data", partName = "checkin.data") @XmlMimeType("application/octet-stream") DataHandler data,
	@WebParam(name = "merge", partName = "checkin.merge") Boolean merge) throws ServerException, UserException;
 
Example #16
Source File: DocumentService.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
@WebMethod
public Version checkin(@WebParam(name = "token") String token, @WebParam(name = "docPath") String docPath,
                       @WebParam(name = "content") @XmlMimeType("application/octet-stream") DataHandler content,
                       @WebParam(name = "comment") String comment) throws FileSizeExceededException, UserQuotaExceededException,
		VirusDetectedException, LockException, VersionException, PathNotFoundException, AccessDeniedException, RepositoryException,
		IOException, DatabaseException, ExtensionException, AutomationException {
	log.debug("checkin({}, {} ,{})", new Object[]{token, docPath, comment});
	DocumentModule dm = ModuleManager.getDocumentModule();
	InputStream bais = content.getInputStream();
	Version version = dm.checkin(token, docPath, bais, comment);
	log.debug("checkin: {}", version);
	return version;
}
 
Example #17
Source File: DocumentService.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
@WebMethod
public
@XmlMimeType("application/octet-stream")
DataHandler getContentByVersion(@WebParam(name = "token") String token, @WebParam(name = "docPath") String docPath,
                                @WebParam(name = "versionId") String versionId) throws RepositoryException, IOException, AccessDeniedException,
		PathNotFoundException, DatabaseException {
	log.debug("getContentByVersion({}, {}, {})", new Object[]{token, docPath, versionId});
	DocumentModule dm = ModuleManager.getDocumentModule();
	InputStream is = dm.getContentByVersion(token, docPath, versionId);
	DataHandler data = new DataHandler(new DhDatasource(is, null, docPath));
	log.debug("getContentByVersion: {}", data);
	return data;
}
 
Example #18
Source File: ServiceInterface.java    From BIMserver with GNU Affero General Public License v3.0 5 votes vote down vote up
@WebMethod(action = "checkinInitiatedSync")
SLongCheckinActionState checkinInitiatedSync(
	@WebParam(name = "topicId", partName = "checkinInitiated.topicId") Long topicId,
	@WebParam(name = "poid", partName = "checkinInitiated.poid") Long poid,
	@WebParam(name = "comment", partName = "checkinInitiated.comment") String comment,
	@WebParam(name = "deserializerOid", partName = "checkinInitiated.deserializerOid") Long deserializerOid,
	@WebParam(name = "fileSize", partName = "checkinInitiated.fileSize") Long fileSize,
	@WebParam(name = "fileName", partName = "checkinInitiated.fileName") String fileName,
	@WebParam(name = "data", partName = "checkinInitiated.data") @XmlMimeType("application/octet-stream") DataHandler data,
	@WebParam(name = "merge", partName = "checkinInitiated.merge") Boolean merge) throws ServerException, UserException;
 
Example #19
Source File: DocumentService.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
@WebMethod
public
@XmlMimeType("application/octet-stream")
DataHandler getContent(@WebParam(name = "token") String token, @WebParam(name = "docPath") String docPath,
                       @WebParam(name = "checkout") boolean checkout) throws RepositoryException, IOException, PathNotFoundException,
		AccessDeniedException, DatabaseException {
	log.debug("getContent({}, {}, {})", new Object[]{token, docPath, checkout});
	DocumentModule dm = ModuleManager.getDocumentModule();
	InputStream is = dm.getContent(token, docPath, checkout);
	DataHandler data = new DataHandler(new DhDatasource(is, null, docPath));
	log.debug("getContent: {}", data);
	return data;
}
 
Example #20
Source File: DocumentService.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
@WebMethod
public Document create(@WebParam(name = "token") String token, @WebParam(name = "doc") Document doc,
                       @WebParam(name = "content") @XmlMimeType("application/octet-stream") DataHandler content) throws IOException,
		UnsupportedMimeTypeException, FileSizeExceededException, UserQuotaExceededException, VirusDetectedException,
		ItemExistsException, PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException, ExtensionException,
		AutomationException {
	log.debug("create({})", doc);
	DocumentModule dm = ModuleManager.getDocumentModule();
	InputStream bais = content.getInputStream();
	Document newDocument = dm.create(token, doc, bais);
	bais.close();
	log.debug("create: {}", newDocument);
	return newDocument;
}
 
Example #21
Source File: ImageSender.java    From cxf with Apache License 2.0 4 votes vote down vote up
public void sendImage(@XmlMimeType("image/png") Image photo) {
    // empty
}
 
Example #22
Source File: SKCEReturnObject.java    From fido2 with GNU Lesser General Public License v2.1 4 votes vote down vote up
public @XmlMimeType("application/octet-stream")
DataHandler getOutDataHandler() {
    return outDataHandler;
}
 
Example #23
Source File: PropertyInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
    this.seed = spi;
    this.parent = parent;

    if(parent==null)
        /*
            Various people reported a bug where this parameter is somehow null.
            In an attempt to catch the error better, let's do an explicit check here.

            http://forums.java.net/jive/thread.jspa?threadID=18479
            http://forums.java.net/jive/thread.jspa?messageID=165946
         */
        throw new AssertionError();

    MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
    if(mt!=null && !kind().canHaveXmlMimeType) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
            seed.readAnnotation(XmlMimeType.class)
        ));
        mt = null;
    }
    this.expectedMimeType = mt;
    this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);

    T t = seed.getRawType();

    // check if there's an adapter applicable to the whole property
    XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
    if(xjta!=null) {
        isCollection = false;
        adapter = new Adapter<T,C>(xjta,reader(),nav());
    } else {
        // check if the adapter is applicable to the individual item in the property

        this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
                         || nav().isArrayButNotByteArray(t);

        xjta = getApplicableAdapter(getIndividualType());
        if(xjta==null) {
            // ugly ugly hack, but we implement swaRef as adapter
            XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
            if(xsa!=null) {
                parent.builder.hasSwaRef = true;
                adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
            } else {
                adapter = null;

                // if this field has adapter annotation but not applicable,
                // that must be an error of the user
                xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
                if(xjta!=null) {
                    T ad = reader().getClassValue(xjta,"value");
                    parent.builder.reportError(new IllegalAnnotationException(
                        Messages.UNMATCHABLE_ADAPTER.format(
                                nav().getTypeName(ad), nav().getTypeName(t)),
                        xjta
                    ));
                }
            }
        } else {
            adapter = new Adapter<T,C>(xjta,reader(),nav());
        }
    }

    this.id = calcId();
    this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
            getIndividualType(),this);
}
 
Example #24
Source File: PropertyInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
    this.seed = spi;
    this.parent = parent;

    if(parent==null)
        /*
            Various people reported a bug where this parameter is somehow null.
            In an attempt to catch the error better, let's do an explicit check here.

            http://forums.java.net/jive/thread.jspa?threadID=18479
            http://forums.java.net/jive/thread.jspa?messageID=165946
         */
        throw new AssertionError();

    MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
    if(mt!=null && !kind().canHaveXmlMimeType) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
            seed.readAnnotation(XmlMimeType.class)
        ));
        mt = null;
    }
    this.expectedMimeType = mt;
    this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);

    T t = seed.getRawType();

    // check if there's an adapter applicable to the whole property
    XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
    if(xjta!=null) {
        isCollection = false;
        adapter = new Adapter<T,C>(xjta,reader(),nav());
    } else {
        // check if the adapter is applicable to the individual item in the property

        this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
                         || nav().isArrayButNotByteArray(t);

        xjta = getApplicableAdapter(getIndividualType());
        if(xjta==null) {
            // ugly ugly hack, but we implement swaRef as adapter
            XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
            if(xsa!=null) {
                parent.builder.hasSwaRef = true;
                adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
            } else {
                adapter = null;

                // if this field has adapter annotation but not applicable,
                // that must be an error of the user
                xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
                if(xjta!=null) {
                    T ad = reader().getClassValue(xjta,"value");
                    parent.builder.reportError(new IllegalAnnotationException(
                        Messages.UNMATCHABLE_ADAPTER.format(
                                nav().getTypeName(ad), nav().getTypeName(t)),
                        xjta
                    ));
                }
            }
        } else {
            adapter = new Adapter<T,C>(xjta,reader(),nav());
        }
    }

    this.id = calcId();
    this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
            getIndividualType(),this);
}
 
Example #25
Source File: PluginInterface.java    From BIMserver with GNU Affero General Public License v3.0 4 votes vote down vote up
@WebMethod(action = "installPluginBundleFromFile")
void installPluginBundleFromFile(
	@WebParam(name = "data", partName = "installPluginBundleFromFile.data") @XmlMimeType("application/octet-stream") DataHandler data,
	@WebParam(name = "installAllPluginsForAllUsers", partName = "installPluginBundleFromFile.installAllPluginsForAllUsers") Boolean installAllPluginsForAllUsers, 
	@WebParam(name = "installAllPluginsForNewUsers", partName = "installPluginBundleFromFile.installAllPluginsForNewUsers") Boolean installAllPluginsForNewUsers) throws UserException, ServerException;
 
Example #26
Source File: PropertyInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
    this.seed = spi;
    this.parent = parent;

    if(parent==null)
        /*
            Various people reported a bug where this parameter is somehow null.
            In an attempt to catch the error better, let's do an explicit check here.

            http://forums.java.net/jive/thread.jspa?threadID=18479
            http://forums.java.net/jive/thread.jspa?messageID=165946
         */
        throw new AssertionError();

    MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
    if(mt!=null && !kind().canHaveXmlMimeType) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
            seed.readAnnotation(XmlMimeType.class)
        ));
        mt = null;
    }
    this.expectedMimeType = mt;
    this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);

    T t = seed.getRawType();

    // check if there's an adapter applicable to the whole property
    XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
    if(xjta!=null) {
        isCollection = false;
        adapter = new Adapter<T,C>(xjta,reader(),nav());
    } else {
        // check if the adapter is applicable to the individual item in the property

        this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
                         || nav().isArrayButNotByteArray(t);

        xjta = getApplicableAdapter(getIndividualType());
        if(xjta==null) {
            // ugly ugly hack, but we implement swaRef as adapter
            XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
            if(xsa!=null) {
                parent.builder.hasSwaRef = true;
                adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
            } else {
                adapter = null;

                // if this field has adapter annotation but not applicable,
                // that must be an error of the user
                xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
                if(xjta!=null) {
                    T ad = reader().getClassValue(xjta,"value");
                    parent.builder.reportError(new IllegalAnnotationException(
                        Messages.UNMATCHABLE_ADAPTER.format(
                                nav().getTypeName(ad), nav().getTypeName(t)),
                        xjta
                    ));
                }
            }
        } else {
            adapter = new Adapter<T,C>(xjta,reader(),nav());
        }
    }

    this.id = calcId();
    this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
            getIndividualType(),this);
}
 
Example #27
Source File: MtoMParameterBeanWithDataHandler.java    From cxf with Apache License 2.0 4 votes vote down vote up
@XmlMimeType("text/plain;charset=utf-8")
public DataHandler getNotXml10() {
    return notXml10;
}
 
Example #28
Source File: MtoMParameterBeanNoDataHandler.java    From cxf with Apache License 2.0 4 votes vote down vote up
@XmlMimeType("text/plain;charset=utf-8")
public byte[] getNotXml10() throws UnsupportedEncodingException {
    return notXml10.getBytes("utf-8");
}
 
Example #29
Source File: PropertyInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected PropertyInfoImpl(ClassInfoImpl<T,C,F,M> parent, PropertySeed<T,C,F,M> spi) {
    this.seed = spi;
    this.parent = parent;

    if(parent==null)
        /*
            Various people reported a bug where this parameter is somehow null.
            In an attempt to catch the error better, let's do an explicit check here.

            http://forums.java.net/jive/thread.jspa?threadID=18479
            http://forums.java.net/jive/thread.jspa?messageID=165946
         */
        throw new AssertionError();

    MimeType mt = Util.calcExpectedMediaType(seed,parent.builder);
    if(mt!=null && !kind().canHaveXmlMimeType) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()),
            seed.readAnnotation(XmlMimeType.class)
        ));
        mt = null;
    }
    this.expectedMimeType = mt;
    this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class);

    T t = seed.getRawType();

    // check if there's an adapter applicable to the whole property
    XmlJavaTypeAdapter xjta = getApplicableAdapter(t);
    if(xjta!=null) {
        isCollection = false;
        adapter = new Adapter<T,C>(xjta,reader(),nav());
    } else {
        // check if the adapter is applicable to the individual item in the property

        this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class))
                         || nav().isArrayButNotByteArray(t);

        xjta = getApplicableAdapter(getIndividualType());
        if(xjta==null) {
            // ugly ugly hack, but we implement swaRef as adapter
            XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class);
            if(xsa!=null) {
                parent.builder.hasSwaRef = true;
                adapter = new Adapter<T,C>(nav().asDecl(SwaRefAdapter.class),nav());
            } else {
                adapter = null;

                // if this field has adapter annotation but not applicable,
                // that must be an error of the user
                xjta = seed.readAnnotation(XmlJavaTypeAdapter.class);
                if(xjta!=null) {
                    T ad = reader().getClassValue(xjta,"value");
                    parent.builder.reportError(new IllegalAnnotationException(
                        Messages.UNMATCHABLE_ADAPTER.format(
                                nav().getTypeName(ad), nav().getTypeName(t)),
                        xjta
                    ));
                }
            }
        } else {
            adapter = new Adapter<T,C>(xjta,reader(),nav());
        }
    }

    this.id = calcId();
    this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz,
            getIndividualType(),this);
}
 
Example #30
Source File: ImageSender.java    From cxf with Apache License 2.0 4 votes vote down vote up
@XmlMimeType("image/png")
public Image getImage(String key) {
    return null;
}