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; } }
@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; }
@XmlMimeType("text/plain") public DataHandler namespace(@XmlMimeType("text/plain") DataHandler data) { try { String name = (String)getContent(data); String type = (String)data.getContentType(); log.info("User " + name + " requested namespace with content type ["+ type +"]"); return new DataHandler("Hello " + name, "text/plain"); } catch (IOException e) { throw new WebServiceException(e); } }
@WebMethod @XmlMimeType("text/plain") public DataHandler parameterAnnotation(@XmlMimeType("text/plain") DataHandler data) { try { System.out.println("Recv " + data.getContentType()); Object dataContent = data.getContent(); System.out.println("Got " + dataContent); if ( dataContent instanceof InputStream ) { ((InputStream)dataContent).close(); } return new DataHandler("Server data", "text/plain"); } catch (IOException e) { throw new WebServiceException(e); } }
private List<Annotation> getJaxbAnnos(MessagePartInfo mpi) { List<Annotation> list = new java.util.concurrent.CopyOnWriteArrayList<Annotation>(); 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; }
@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; }
@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; }
@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; }
@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; }
public @WebResult(name = "protocoloCorrecaoProva") String corrigirProvasAsyncRequest( @XmlMimeType("application/xml") @WebParam(name="arquivoGabarito") DataHandler arquivoGabarito, @WebParam(name="paginasDigitalizadas") List<PageImageVO> paginasDigitalizadas);
public List<QuestionResultVO> corrigirProvas( @XmlMimeType("application/xml") @WebParam(name="arquivoGabarito") DataHandler arquivoGabarito, @WebParam(name="paginasDigitalizadas") List<PageImageVO> paginasDigitalizadas);
/** * */ public java.util.List<QuestionResultVO> corrigirProvas( @XmlMimeType("application/xml") @WebParam DataHandler arquivoGabarito, @WebParam(name="pageImages") List<PageImageVO> pageImages) { EventVO eventVO = getEventoVO(arquivoGabarito); List<BufferedImage> images = new ArrayList<BufferedImage>(pageImages.size()); for (PageImageVO pageImageVO2 : pageImages) { images.add(pageImageVO2.getPageImage()); } List<QuestionResultVO> questionResults; try { questionResults = jazzOMRImageParser.parseImage(images, eventVO); } catch (JazzOMRException e) { throw new JazzOMRRuntimeException("Erro ao tentar processar as imagens enviadas! "+e.getMessage(),e); } return questionResults ; }
@WebMethod(action = "checkinInitiated") Long checkinInitiated( @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, @WebParam(name = "sync", partName = "checkinInitiated.sync") Boolean sync) throws ServerException, UserException;
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); }
@WebMethod @XmlMimeType("application/octet-stream") DataHandler simulate(String inputFileName, String problem, double startTime, double stopTime, int numberOfIntervals, double outputInterval, String method, double tolerance, double fixedstepsize, String resultsFileName, @XmlMimeType("application/octet-stream") DataHandler data);
@XmlMimeType("text/plain") public DataHandler getDataHandler() { return dataHandler; }
@XmlMimeType("text/plain") public DataHandler namespace(@XmlMimeType("text/plain") DataHandler data);
@XmlMimeType("*/*") public DataHandler getImage() { return image; }
@WebMethod boolean transferFile(String fileName, @XmlMimeType("application/octet-stream") DataHandler contents);
@XmlMimeType("*/*") public DataHandler getContent() { return content; }
@WebMethod @XmlMimeType("text/plain") DataHandler parameterAnnotation(@XmlMimeType("text/plain") DataHandler data);
@XmlMimeType("image/jpeg") public DataHandler getDataHandler() { return dataHandler; }