Example usage for org.springframework.oxm.jaxb Jaxb2Marshaller setContextPath

List of usage examples for org.springframework.oxm.jaxb Jaxb2Marshaller setContextPath

Introduction

In this page you can find the example usage for org.springframework.oxm.jaxb Jaxb2Marshaller setContextPath.

Prototype

public void setContextPath(@Nullable String contextPath) 

Source Link

Document

Set a JAXB context path.

Usage

From source file:edu.unc.lib.dl.fedora.AccessClient.java

/**
 * Initializes this client bean, calling the initializers of dependencies.
 *
 * @throws Exception/* www  .j ava 2s. c o  m*/
 *            when initialization fails
 */
public void init() throws Exception {
    SaajSoapMessageFactory msgFactory = new SaajSoapMessageFactory();
    msgFactory.afterPropertiesSet();
    this.setMessageFactory(msgFactory);

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("edu.unc.lib.dl.fedora.types");
    marshaller.afterPropertiesSet();
    this.setMarshaller(marshaller);
    this.setUnmarshaller(marshaller);

    CommonsHttpMessageSender messageSender = new CommonsHttpMessageSender();
    UsernamePasswordCredentials creds = new UsernamePasswordCredentials(this.username, this.password);
    messageSender.setCredentials(creds);
    messageSender.afterPropertiesSet();
    this.setMessageSender(messageSender);

    // this.setFaultMessageResolver(new FedoraFaultMessageResolver());
    this.setDefaultUri(this.getFedoraContextUrl() + "/services/access");
    this.afterPropertiesSet();
}

From source file:io.gabbm.ticket_office.api.connector.RestConnector.java

/**
 * Method to get the marshaller defined for mapping XML REST Response and
 * their Java Objects//from w  ww . j a v a2s  .  co m
 * 
 * @return
 */
public Jaxb2Marshaller getJaxb2Marshaller() {
    Jaxb2Marshaller jaxbMarshallerCamel = null;

    try {
        jaxbMarshallerCamel = new Jaxb2Marshaller();
        jaxbMarshallerCamel.setContextPath(configurationService.getRestJaxbPath());
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }

    return jaxbMarshallerCamel;
}

From source file:edu.unc.lib.dl.fedora.ManagementClient.java

private void initializeConnections() throws Exception {
    SaajSoapMessageFactory msgFactory = new SaajSoapMessageFactory();
    msgFactory.afterPropertiesSet();//  w w  w.  j av a 2s  . c  o m
    this.setMessageFactory(msgFactory);

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("edu.unc.lib.dl.fedora.types");
    marshaller.afterPropertiesSet();
    this.setMarshaller(marshaller);
    this.setUnmarshaller(marshaller);

    CommonsHttpMessageSender messageSender = new CommonsHttpMessageSender();
    UsernamePasswordCredentials creds = new UsernamePasswordCredentials(this.getUsername(), this.getPassword());
    messageSender.setCredentials(creds);
    messageSender.setReadTimeout(300 * 1000);
    messageSender.afterPropertiesSet();
    this.setMessageSender(messageSender);

    // this.setFaultMessageResolver(new FedoraFaultMessageResolver());
    this.setDefaultUri(this.getFedoraContextUrl() + "/services/management");
    this.afterPropertiesSet();

    this.httpClient = HttpClientUtil.getAuthenticatedClient(this.getFedoraContextUrl(), this.getUsername(),
            this.getPassword(), this.httpManager);
}