Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 2 (11.1.2.1.0)
E17488-02


oracle.adf.view.rich.datatransfer
Class MarshallingService

java.lang.Object
  extended by oracle.adf.view.rich.datatransfer.MarshallingService


public final class MarshallingService
extends java.lang.Object

Service class for Marshalling and unmarshalling data between the client and the server. One instance of the MarshallingService is maintained per application to ensure safe operation in a shared class loader.

The current instance may bet retrieved by calling MarshallingService.getCurrentInstance(ExternalContext).

To configure the MarshallingService for the current application, create a org.apache.myfaces.trinidad.config.Configurator subclass and override init like this: public void init(ExternalContext externalContext) { super.init(externalContext); MarshallingService marshaller = MarshallingService.getCurrentInstance(externalContext); // register a JSDecoder marshaller.registerJSDecoder("jsObject", "string", StringArrayJSDecoder.getInstance()); Then register your Configurator subclass in the META-INF/services/org.apache.myfaces.trinidad.config.Configurator file.

See Also:
Configurator.init(javax.faces.context.ExternalContext)

Method Summary
static MarshallingService getCurrentInstance(javax.faces.context.ExternalContext eContext)
          Returns the current instance of the Marshalling service
 java.util.Collection<ClientFlavorDecoder<?>> getJSDecoders(javax.faces.context.FacesContext context, java.lang.String jsDataFlavorKind, java.lang.String jsDataFlavorDiscriminant)
          Returns the Collection of JavaScript ClientFlavorDecoders for the specified client flavor kind and discriminant.
 DataFlavor<?> getServerDataFlavor(java.lang.String clientDataFlavor)
          Returns the server DataFlavor that the client data flavor is equivalent to.
 void registerClientDataFlavorAlias(java.lang.String clientDataFlavor, DataFlavor<?> dataFlavor)
          Registers a mapping between a client data flavor and the equivalent server DataFlavor.
 void registerJSDecoder(java.lang.String jsDataFlavorKind, java.lang.String jsDataFlavorDiscriminant, ClientFlavorDecoder<?> decoder)
          Registeres a ClientFlavorDecoder for the specified flavor kind and discrimiant.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

getCurrentInstance

public static MarshallingService getCurrentInstance(javax.faces.context.ExternalContext eContext)
Returns the current instance of the Marshalling service
Parameters:
eContext - the ExternalContext.
Returns:
the current instance of the Marshalling service

registerClientDataFlavorAlias

public final void registerClientDataFlavorAlias(java.lang.String clientDataFlavor,
                                                DataFlavor<?> dataFlavor)
Registers a mapping between a client data flavor and the equivalent server DataFlavor. This is useful in cases where the server's default marshalling has already correctly unmarshalled the result
Parameters:
clientDataFlavor -
dataFlavor -
Throws:
java.lang.IllegalStateException - if a DataFlavor has already been registered for this clientDataFlavor
See Also:
getServerDataFlavor(java.lang.String)

getServerDataFlavor

public final DataFlavor<?> getServerDataFlavor(java.lang.String clientDataFlavor)
Returns the server DataFlavor that the client data flavor is equivalent to. This is used in cases in which the default marshalling service has already correctly unmarshalled the client type
Parameters:
clientDataFlavor -
Returns:
The equivalent DataFlavor, or null if no mapping is registered

registerJSDecoder

public void registerJSDecoder(java.lang.String jsDataFlavorKind,
                              java.lang.String jsDataFlavorDiscriminant,
                              ClientFlavorDecoder<?> decoder)
Registeres a ClientFlavorDecoder for the specified flavor kind and discrimiant. A ClientFlavorDecoder registered with no discriminant applies to all discriminants.
Parameters:
jsDataFlavorKind - Client flavor kind to retrieve decoders for
jsDataFlavorDiscriminant - Client flavor discriminant, if any to retrieve decoders for.
decoder - ClientFlavorDecoder to register

getJSDecoders

public java.util.Collection<ClientFlavorDecoder<?>> getJSDecoders(javax.faces.context.FacesContext context,
                                                                  java.lang.String jsDataFlavorKind,
                                                                  java.lang.String jsDataFlavorDiscriminant)
Returns the Collection of JavaScript ClientFlavorDecoders for the specified client flavor kind and discriminant.

A ClientFlavorDecoder registered with no discriminant applies to all discriminants.

Parameters:
context - Current FacesContext
jsDataFlavorKind - Client flavor kind to retrieve decoders for
jsDataFlavorDiscriminant - Client flavor discriminant, if any to retrieve decoders for.
Returns:
Collection of ClientsFlavorDecoders

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Faces
11g Release 2 (11.1.2.1.0)
E17488-02


Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.