GSON

Hi all

Is it possible to use the library GSON on Blackberry?

JsonSerializer interface has a Serialize method that takes java.lang.reflect.Type as a parameter that is not supported in Blackberry.

Indications will be useful.

Kind regards

Abhijit chatelain

You aren't going to get to work on BlackBerry GSON. Its design is based on reflection, that does not exist in Java of BlackBerry. Most people use something like org.json or json me

Tags: BlackBerry Developers

Similar Questions

  • How to add a dependency to the library for the java service modules?

    Hello

    I try to add Google gson jar as a dependency of the sample of chassis (/ chassisRackVSphere-service) and I'm facing some problems with the installation of osgi.

    ////////////////////////////////////////////////////////////////////////////////////////

    Report of resolver:

    A Package Import could not be resolved. Resolver error data < Import-Package: com.google.gson; version = "0.0.0" >. Caused by the constraint missing bundled < com.vmware.samples.chassisrackvsphereservice_1.0.0 >

    constraint: Import-Package: com.google.gson; version = "0.0.0" >

    at org.eclipse.virgo.kernel.install.pipeline.stage.resolve.internal.QuasiResolveStage.process(QuasiResolveStage.java:46)

    at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessGraph(StandardPipeline.java:62)

    at org.eclipse.virgo.kernel.install.pipeline.internal.CompensatingPipeline.doProcessGraph(CompensatingPipeline.java:73)

    at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)

    at org.eclipse.virgo.kernel.install.pipeline.internal.StandardPipeline.doProcessGraph(StandardPipeline.java:62)

    at org.eclipse.virgo.kernel.install.pipeline.stage.AbstractPipelineStage.process(AbstractPipelineStage.java:41)

    at org.eclipse.virgo.kernel.deployer.core.internal.PipelinedApplicationDeployer.driveInstallPipeline(PipelinedApplicationDeployer.java:359)

    ////////////////////////////////////////////////////////////////////////////////////////

    Here are the things I did based on the addition of the gson - 2.2.4.jar to the list of libraries (which I'll use my service module).

    1 added gson - 2.2.4.jar to chassisRackVSphere-service\lib

    2. added gson - 2.2.4.jar to the list of libraries referenced in STS.

    3. fixed the ANT build file to add this jar to the classpath

    < target name = "java-compilation" depends = "clean" description = "do not select objective in-house." >

    < javac includeantruntime = 'false' destdir = fork "${CLASSES}" = "true" debug = "on" >

    < path src = "${basedir} / src/main/java" / >

    <!-< path src = "${basedir} / src/test/java" / > for future test-> files

    < classpath >

    <! - remove this if you are not using the SDK with java - >

    < pathelement path="${VSPHERE_SDK_HOME}/libs/vsphere-client-lib.jar"/ >

    < pathelement path="lib/commons-logging-1.1.1.jar"/ >

    < pathelement path="lib/gson-2.2.4.jar"/ >

    < / classpath >

    < / javac >

    < / target >

    4. fixed the manifest file to include the package gson

    /////////////////////////////////////////////////////////////////////////////////////////

    Import-Package: org.apache.commons.logging,.

    com.google.Gson,

    com VMware.vise.Data,

    com VMware.vise.Data.Query,

    com VMware.vise.Data.Uri,

    com VMware.vise.vim.Data

    /////////////////////////////////////////////////////////////////////////////////////////

    I don't know what I'm missing. How can I add third-party libraries for the service module (in this case chassisRackVSphere-service)? Any help is appreciated.

    Thank you

    Shankar

    You forgot a step described in the FAQ ""How to use 3rd party java libraries?', that is to make your available on the server gson library. "  An excerpt from the FAQ:

    Formatted as OSGI bundles libraries should be in a known location on the server:

    • In development mode you can copy in Server/repository/usr, one of the default directories for the loading of libraries (you must restart the server).
    • If the server is already running you can copy also in Server/Pick-up because the beams will be deployed hot (i.e. without having to restart, but this requires you to deploy your plugin after the library, see Note 2 below).
    • Finally, you can keep in their current location and add a path in server/configuration/com.springsource.repository.properties.
    • In production mode , that your plugin is installed as a plugin package, it is neither practical nor recommended to add libraries to server/Pick-up or Server/repository/usr on your production server. Instead you must include them in the directory plugins of your package and your .war and .jar packages. You will also need to list Bundle-SymbolicName of plugin libraries - package.xml.
  • Errors HRDemoRest

    Hello

    I'm following this page trying to get the work of the demo:

    Going Mobile with ADF - implementation of data caching and synchronization to work offline

    http://www.Ateam-Oracle.com/going-mobile-with-ADF-implementing-data-caching-and-syncing-for-working-offline/

    But I encounter errors when you try to run the demo HRDemoRest. The following are the errors:

    • Project: D:\downloads\Oracle\JDeveloper\HRDemoRest\Model\Model.jpr
      • D:\downloads\Oracle\JDeveloper\HRDemoRest\Model\src\davelaar\demo\model\service\HRServiceImpl.Java
        • Error (3.23): package com.google.gson does not exist
        • Error (325,13): cannot find class Gson
        • Error (327,5): could not find the class GsonBuilder
    • Project: D:\downloads\Oracle\JDeveloper\HRDemoRest\ViewController\ViewController.jpr
      • D:\downloads\Oracle\JDeveloper\HRDemoRest\ViewController\src\davelaar\demo\rest\RestXMLServiceProvider.Java
        • Error (3.42): package davelaar.demo.model.service.common does not exist
        • Error (54,11): could not find class HRService

    Anyone has any ideas please help.

    Thank you

    Raymond

    Raymond,

    The Gson library is included in the directory lib to the file HrDemoRest.zip.

    Steven.

  • ADF Mobile - ACS request for issuance of roles

    I developed an example of mobile application based on authentication and access control.

    Authentication works very well, but I set my authorization to point to my URL to access - control http://xxx.xxx.com/xxxACSRestApi/Jersey/authorize/getACS

    I set my filter to the roles of the user (role1, role2) list and my list of filters of privileges (priv1, priv2, priv3).

    When I run the application and try to auth returs:

    ACS failed: unsupported media Type

    Here's my REST method


    @POST
    @Path ("getACS")
    @Consumes (MediaType.APPLICATION_FORM_URLENCODED)
    @Produces("application/json")
    public String getACS (@FormParam ("userId"), String userId)
    {
    AcsObject obj = new AcsObject();
    Gson gson = new Gson();
    convert the java object in JSON format,
    and returned as JSON format string
    String json = gson.toJson (obj);
    return json;
    }

    The output is (just like the documentation of application):

    {"userId": "johnsmith", 'filterMask': ['role', 'Annie'], 'roleFilter': ["role1", "role2"], "privilegeFilter": ["priv1', 'priv2', 'priv3']}

    Remove the

    @Consumes (MediaType.APPLICATION_FORM_URLENCODED)

    Product the web form MediaType.APPLICATION_FORM_URLENCODED?

  • How to apply non-wsdl base URL in OEG

    How do register us a URL non-wsdl endpoint point based in OEG? We have had no problem in registration of a simple WSDL endpoint based on a server of the OEG. However, we are unable to find documentation on how to secure/register a RESTful or JSON - base URL of the service (SOAP, XML over HTTP-based service).

    This feature exist? Or are there best practices on what to do with OEG for these types of services?

    Our use case looks like:

    Akamai-> OEG-> OSB (WSDL, JSON type web services RESTful)-> .net service (WSDL, restful, JSON type web services)

    In the case of REST and other non-WSDL-based services, there is no SOAP/WSDL web service based like registration process, you would use OEG as proxy. You can receive requests REST based OEG, retrieve the settings (there are has filters of convenience available for functions in OEG, policy library, 'Extract REST request Attribute', 'Validate REST filter', 'Create demand REMAINS' related to recovery of the values of attributes and other types of REST etc - search REST upstairs using the strategy Studio) drag it from the canvas, and then click Help for docs on these filters) and make routing to services of real REST endpoint. You have the possibility to receive and use the SOAP message as a basis for the generation of the REST url.

    REST to SOAP - http://www.soatothecloud.com/2008/11/how-to-convert-from-rest-to-soap.html
    SOAP for REST - http://markoneill.sys-con.com/node/1989916

    Use with JSON: you can convert XML to JSON on the outbound side to serve as mobile clients etc. using conversions based on the script (standard XSLT) at the level of the bridge. Conversions in Java using google gson library is also an option.

    To register for a REST service, simply map the path (e.g. ' / MyRESTService ') policy that you use to process the query of REST.

    If you simply want to make a REST request via OEG (for example - OSB). You would create a policy (right click on 'Policies' and add it). Drag a "Static router" filter and place inside the host name and port of the host you want to route to (for example - OSB). Then right-click on it and choose "Set as starting point" so that it is the first thing that is processed for this request of REST. Then drag in a "Connection" and (with a green arrow) filter in the chain after the static router filter. The filter of "Connection" actually makes the connection to the backend host.

    Now, map the path (using 'add a relative path') service and this REMAINS the case request to ' / MyRESTService ' or ' / MyRESTService/something "comes in OEG, it is routed to the backend host.

    Deploy your strategy (using F6 or the "deploy" on the Studio policy toolbar button). Then send your request for REST.

    There is in fact already a simple configuration of service REMAINS on OEG, called 'check '. If you point a browser to http://

    If the REST of backend service returns JSON, JSON response will be simply sent through OEG.

Maybe you are looking for