当前位置: 首页>>代码示例>>Java>>正文


Java Jaxb2Marshaller类代码示例

本文整理汇总了Java中org.springframework.oxm.jaxb.Jaxb2Marshaller的典型用法代码示例。如果您正苦于以下问题:Java Jaxb2Marshaller类的具体用法?Java Jaxb2Marshaller怎么用?Java Jaxb2Marshaller使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Jaxb2Marshaller类属于org.springframework.oxm.jaxb包,在下文中一共展示了Jaxb2Marshaller类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: lukeMooselikeharvestsExportJaxbMarshaller

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Bean(name = "lukeMooselikeharvestsExportMarshaller")
public Jaxb2Marshaller lukeMooselikeharvestsExportJaxbMarshaller() {
    final Jaxb2Marshaller marshaller = new Jaxb2Marshaller();

    marshaller.setMarshallerProperties(getMarshallerDefaultProperties());
    marshaller.setContextPath("fi.riista.integration.luke_export.mooselikeharvests");
    marshaller.setSchema(new ClassPathResource("/xsd/luke/export-mooselikeharvests-v1.xsd"));

    return activateLoggingValidation(marshaller);
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:11,代码来源:JaxbConfig.java

示例2: jaxb2Marshaller

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Bean
public Jaxb2Marshaller jaxb2Marshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(
            com.marklogic.spring.batch.core.AdaptedJobExecution.class,
            com.marklogic.spring.batch.core.AdaptedJobInstance.class,
            com.marklogic.spring.batch.core.AdaptedJobParameters.class,
            com.marklogic.spring.batch.core.AdaptedStepExecution.class,
            com.marklogic.spring.batch.core.AdaptedExecutionContext.class);
    marshaller.setAdapters(
            new ExecutionContextAdapter(),
            new JobExecutionAdapter(),
            new JobInstanceAdapter(),
            new JobParametersAdapter(),
            new StepExecutionAdapter());
    //marshaller.setMarshallerProperties(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    return marshaller;
}
 
开发者ID:marklogic-community,项目名称:marklogic-spring-batch,代码行数:19,代码来源:JaxbConfiguration.java

示例3: activateLoggingValidation

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
private static Jaxb2Marshaller activateLoggingValidation(final Jaxb2Marshaller marshaller) {
    // activate
    try {
        // need to call this to really activate validation
        marshaller.afterPropertiesSet();
    } catch (Exception e) {
        LOG.error("Exception when creating marshaller", e);
    }

    // log validation message
    marshaller.setValidationEventHandler(event -> {
        LOG.info(event.getMessage());
        return true;
    });
    return marshaller;
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-web,代码行数:17,代码来源:JaxbConfig.java

示例4: init

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@PostConstruct
private void init() {
	interceptors.add(loggingInterceptor);
	interceptors.add(faultInterceptor);
	setInterceptors(interceptors.toArray(new ClientInterceptor[0]));
	marshaller = new Jaxb2Marshaller();
       marshaller.setContextPath(OTAPingRQ.class.getPackage().getName());
       setMarshaller(marshaller);
       setUnmarshaller(marshaller);
}
 
开发者ID:SabreDevStudio,项目名称:SACS-Java,代码行数:11,代码来源:OTAPingWrapper.java

示例5: responseBodyArgMismatch

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Test
public void responseBodyArgMismatch() throws ServletException, IOException {
	initServlet(new ApplicationContextInitializer<GenericWebApplicationContext>() {
		@Override
		public void initialize(GenericWebApplicationContext wac) {
			Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
			marshaller.setClassesToBeBound(A.class, B.class);
			try {
				marshaller.afterPropertiesSet();
			}
			catch (Exception ex) {
				throw new BeanCreationException(ex.getMessage(), ex);
			}
			MarshallingHttpMessageConverter messageConverter = new MarshallingHttpMessageConverter(marshaller);

			RootBeanDefinition adapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
			adapterDef.getPropertyValues().add("messageConverters", messageConverter);
			wac.registerBeanDefinition("handlerAdapter", adapterDef);
		}
	}, RequestBodyArgMismatchController.class);

	MockHttpServletRequest request = new MockHttpServletRequest("PUT", "/something");
	String requestBody = "<b/>";
	request.setContent(requestBody.getBytes("UTF-8"));
	request.addHeader("Content-Type", "application/xml; charset=utf-8");
	MockHttpServletResponse response = new MockHttpServletResponse();
	getServlet().service(request, response);
	assertEquals(400, response.getStatus());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:ServletAnnotationControllerHandlerMethodTests.java

示例6: castorMarshaller

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Bean
public Jaxb2Marshaller castorMarshaller() {
    Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    jaxb2Marshaller.setPackagesToScan("org.sitenv.service.ccda.smartscorecard.cofiguration");
    Map<String,Object> map = new HashMap<>();
    map.put("jaxb.formatted.output", true);
    jaxb2Marshaller.setMarshallerProperties(map);
    return jaxb2Marshaller;
}
 
开发者ID:siteadmin,项目名称:CCDA-Score-CARD,代码行数:10,代码来源:PersistanceConfiguration.java

示例7: getMarshaller

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Bean
public Jaxb2Marshaller getMarshaller() {
	Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
	jaxb2Marshaller.setClassesToBeBound(Kml.class);

	final Map<String,Object> map = new HashMap<>();
	map.put("jaxb.formatted.output", true);

	jaxb2Marshaller.setMarshallerProperties(map);
	return jaxb2Marshaller;
}
 
开发者ID:ghillert,项目名称:gps-vehicle-simulator,代码行数:12,代码来源:GpsSimulatorApplication.java

示例8: GOClient

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Builder
private GOClient(
		@NonNull final GOClientConfig config,
		final GOClientLogger goClientLogger)
{
	this.config = config;
	this.goClientLogger = goClientLogger != null ? goClientLogger : SLF4JGOClientLogger.instance;

	final HttpComponentsMessageSender messageSender = createMessageSender(config.getAuthUsername(), config.getAuthPassword());

	final Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
	marshaller.setPackagesToScan(de.metas.shipper.gateway.go.schema.ObjectFactory.class.getPackage().getName());

	webServiceTemplate = new WebServiceTemplate();
	webServiceTemplate.setDefaultUri(config.getUrl());
	webServiceTemplate.setMessageSender(messageSender);
	webServiceTemplate.setMarshaller(marshaller);
	webServiceTemplate.setUnmarshaller(marshaller);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:20,代码来源:GOClient.java

示例9: webServiceTemplate

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
/**
 * Instancia un nuevo bean del Tipo {@link WebServiceTemplate}, utilizado
 * para realizar llamadas del tipo SOAP.
 * 
 * @return {@link WebServiceTemplate} para realizar llamadas
 */
@Bean
public WebServiceTemplate webServiceTemplate() {

	if (!isEnabled()) {
		return null;
	}

	final WebServiceTemplate wst = new WebServiceTemplate();
	Jaxb2Marshaller marshaller = getJaxb2Marshaller();
	wst.setMarshaller(marshaller);
	wst.setUnmarshaller(marshaller);
	wst.setFaultMessageResolver(new KarakuFaultMessageResolver(marshaller));
	return wst;

}
 
开发者ID:fpuna-cia,项目名称:karaku,代码行数:22,代码来源:KarakuWSClientConfiguration.java

示例10: getJaxb2Marshaller

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
private Jaxb2Marshaller getJaxb2Marshaller() {

		if (!isEnabled()) {
			return null;
		}
		Pattern pattern = Pattern.compile(properties.get(
				KARAKU_WS_CLIENT_PACKAGES_TO_SCAN,
				DEFAULT_PACKAGES_TO_SCAN_EXPRESSION));

		Package[] packages = Package.getPackages();
		List<String> packagesFound = new ArrayList<String>();
		for (Package pa : packages) {
			Matcher matcher = pattern.matcher(pa.getName());
			if (matcher.matches()) {
				log.trace("Found a package to add to the marshaller: "
						+ pa.getName());
				packagesFound.add(pa.getName());
			}
		}

		addSpecificPackages(packagesFound);

		return instanciateMarshaller(packagesFound);
	}
 
开发者ID:fpuna-cia,项目名称:karaku,代码行数:25,代码来源:KarakuWSClientConfiguration.java

示例11: testExceptionSimple

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testExceptionSimple() throws Throwable
{
    // Cannot use configured because of aspects.
    Jaxb2Marshaller exceptionMarshaller = new Jaxb2Marshaller();
    exceptionMarshaller.setPackagesToScan(new String[] { "com.genologics.ri.exception" });
    exceptionMarshaller.setMarshallerProperties(context.getBean("genologicsJaxbMarshallerProperties", Map.class));

    Jaxb2Marshaller original = marshaller;
    try
    {
        marshaller = exceptionMarshaller;
        fetchMarshalAndCompare(com.genologics.ri.exception.Exception.class);
    }
    finally
    {
        marshaller = original;
    }
}
 
开发者ID:crukci-bioinformatics,项目名称:clarityclient,代码行数:21,代码来源:JaxbAnnotationTest.java

示例12: testExceptionSimple

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testExceptionSimple() throws Throwable
{
    // Cannot use configured because of aspects.
    Jaxb2Marshaller exceptionMarshaller = new Jaxb2Marshaller();
    exceptionMarshaller.setPackagesToScan(new String[] { "com.genologics.ri.exception" });
    exceptionMarshaller.setMarshallerProperties(context.getBean("genologicsJaxbMarshallerProperties", Map.class));

    Jaxb2Marshaller original = marshaller;
    try
    {
        marshaller = exceptionMarshaller;
        fetchMarshalAndSerialize(com.genologics.ri.exception.Exception.class);
    }
    finally
    {
        marshaller = original;
    }
}
 
开发者ID:crukci-bioinformatics,项目名称:clarityclient,代码行数:21,代码来源:SerializationTest.java

示例13: GenologicsAPIPaginatedBatchTest

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
public GenologicsAPIPaginatedBatchTest() throws MalformedURLException
{
    pageFiles = new File[] {
            new File("src/test/xml/multipagefetch-1.xml"),
            new File("src/test/xml/multipagefetch-2.xml"),
            new File("src/test/xml/multipagefetch-3.xml")
    };

    context = new ClassPathXmlApplicationContext("/org/cruk/genologics/api/genologics-client-context.xml");

    marshaller = context.getBean("genologicsJaxbMarshaller", Jaxb2Marshaller.class);


    Samples page1 = (Samples)marshaller.unmarshal(new StreamSource(pageFiles[0]));
    response1 = new ResponseEntity<Samples>(page1, HttpStatus.OK);
    Samples page2 = (Samples)marshaller.unmarshal(new StreamSource(pageFiles[1]));
    response2 = new ResponseEntity<Samples>(page2, HttpStatus.OK);
    Samples page3 = (Samples)marshaller.unmarshal(new StreamSource(pageFiles[2]));
    response3 = new ResponseEntity<Samples>(page3, HttpStatus.OK);
}
 
开发者ID:crukci-bioinformatics,项目名称:clarityclient,代码行数:21,代码来源:GenologicsAPIPaginatedBatchTest.java

示例14: getMessaging

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
/**
 * Enten returnerer denne et Messaging objekt, eller så kaster den en RuntimeException
 */
public static Messaging getMessaging(final Jaxb2Marshaller jaxb2Marshaller, final WebServiceMessage message) {

    SoapHeader soapHeader = ((SoapMessage) message).getSoapHeader();
    if (soapHeader == null) {
        throw new RuntimeException("The ebMS header is missing (no SOAP header found in SOAP request)");
    }

    Iterator<SoapHeaderElement> soapHeaderElementIterator = soapHeader.examineHeaderElements(MESSAGING_QNAME);
    if (!soapHeaderElementIterator.hasNext()) {
        throw new RuntimeException("The ebMS header is missing in SOAP header");
    }

    SoapHeaderElement incomingSoapHeaderElement = soapHeaderElementIterator.next();
    try {
        return (Messaging) jaxb2Marshaller.unmarshal(incomingSoapHeaderElement.getSource());
    } catch (Exception e) {
        throw new RuntimeException("The ebMs header failed to unmarshall");
    }

}
 
开发者ID:digipost,项目名称:sdp-shared,代码行数:24,代码来源:MessagingMarshalling.java

示例15: xmlWriter

import org.springframework.oxm.jaxb.Jaxb2Marshaller; //导入依赖的package包/类
@Bean("writer2")
public ItemWriter<Permanent> xmlWriter() {
       StaxEventItemWriter<Permanent> xmlFileWriter = new StaxEventItemWriter<>();

       String exportFilePath = "./src/main/resources/emps.xml";
       xmlFileWriter.setResource(new FileSystemResource(exportFilePath));
       xmlFileWriter.setRootTagName("employees");

       Jaxb2Marshaller empMarshaller = new Jaxb2Marshaller();
       empMarshaller.setClassesToBeBound(Permanent.class);
       xmlFileWriter.setMarshaller(empMarshaller);
       System.out.println("marshalling");;
       return xmlFileWriter;
   }
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:15,代码来源:BatchConfig.java


注:本文中的org.springframework.oxm.jaxb.Jaxb2Marshaller类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。