Enhancing data transfer efficiency through Google cloud endpoints

Transferring a group of items from the Google App Engine (Java) to JavaScript via Google Cloud Endpoints.

Item:

public class Item implements Serializable { 

    private String item1;   
    private Integer item2;
    private String item3;   
    //(...) item (4-39)
    private String item40;  

   //Constructor, Getters, setters, +functions

}

When receiving data in JavaScript, each Item has this structure:

{item1:"v1",item2:"v2"}

However, there seems to be extra data attached to each object that is unclear why it is being sent.

The '?' data appears to be related to Serializable object functions, though the reason for its inclusion is puzzling.

To minimize data size, I aim to send data in the format: {"v1","v2"} instead of

{item1:"v1",item2:"v2", a lot of functions}
.

One potential solution could be sending the data as a List<String> in Java. However, this might prove challenging due to certain properties of the Item object being structured objects.

Is there a method within Google Cloud Endpoints to achieve this type of data transmission?

Are there ways to configure endpoints to only transmit essential data?

Answer №1

While I personally advise against it, there is a way to utilize transformers in order to control the serialization of objects. However, this method may result in generated client libraries only interpreting data as lists of strings. Endpoints typically handle gzipping automatically, which can greatly reduce bandwidth usage. It's recommended to conduct measurements comparing full lists of 5000 items to determine the exact amount of bandwidth being saved. Additionally, keep in mind that Endpoints will not transmit empty properties, further contributing to bandwidth efficiency.

For more information on how to use transformers, refer to this page. Essentially, you'll need a

class ItemTransformer implements Transformer<Item, List<String>>
with the necessary annotations.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Validation for column schemas is not present

I have been struggling with a major issue for the past two days. I am trying to establish a new relationship between two entities: User and UserType. Specifically, I want to create a @OneToMany relationship, so I added the following code snippet to the Use ...

Unable to locate and interact with a specific element within a dropdown menu while utilizing Protractor

I am currently facing an issue with selecting a checkbox from a dropdown in jq widgets. The code seems to work fine when the element is visible on the screen, but fails otherwise. I have tried various methods such as executeScript and scrollIntoView to bri ...

Send the user to a customized dashboard depending on their user role permissions using Vue.js

Currently, I am developing a system that involves handling multiple role-permissions for users. To provide some context, there are 3 distinct users in this scenario: User1 (customer), User2 (employee), and User3 (admin). For each of these user types, I ha ...

Problem with Next.js router language settings

I have configured different locales for our application including uk and us. For the blog section, we can use either us/blog or just /blog for the uk locale. After switching to the us locale like this: (locale = "us") const updateRoute = (locale ...

Transform a JavaScript object into JSON format and send it to a server-side function

To efficiently manage our client side data using JavaScript, we can utilize a dictionary-like object as shown in the code snippet below: var Person = {}; Person["EmployeeID"] = "201"; Person["Name"] = "Keith"; Person["Department"] = "Sales"; Person["Salar ...

Enhance React-D3-Graph ViewBox

I have a dataset named actors storing nodes and links called scratch. The structure is as follows... { "nodes": [ { "id": "Guardians of the Galaxy" }, { "id": "Chris Pratt" }, ...

"The challenge of achieving a transparent background with a PointMaterial texture in ThreeJS

When creating a set of particles with THREE.Points and using a THREE.PointMaterial with texture, I noticed that the transparency of the particles is working only partially. The textures are stroke rectangles created with canvas. Here is what my particles ...

Handling undefined properties by defaulting to an empty array in ES6

In the code snippet below, I am attempting to extract barNames from an object named bar: const {[id]: {'name': fooName} = []} = foo || {}; const {'keywords': {[fooName]: barNames}} = bar || []; Please note that although fooName exi ...

Fade in elements as you scroll using Jquery

I'm currently working on a timeline feature for my website, and I want each element with the class '.event' to fade in as the user scrolls through the timeline. However, I'm running into an issue where all elements fade in simultaneousl ...

Expanding the size of select dropdown in Material UI to accommodate more options

Is there a way to increase the width of the drop down to 400px? I tried adding inline styles, but it didn't work. Upon debugging, I realized that the width is being overridden by this class. I'm not sure how to overwrite it. Could you please prov ...

store array data in a JSON file without using a key

In order to create a JSON file that follows a specific format, the contents should look like this: xyz.json [ { "imagelist": "/oracle/public/oel6", "label": "test_higgs", "shape": "small", "name" : "/Compute-computecli ...

What is the best way to incorporate an environmental variable in my AngularJS controller?

My API Key is securely stored in my '.env' file to keep it hidden from Git. Here's a snippet of my .env file: API_TOKEN=secrettokengibberish When working on my Angular controller, I need to retrieve this variable for my AJAX call. This i ...

Unable to display Apexcharts bar chart in Vue.js application

Struggling to incorporate Apexcharts into my Vue.js site, but unfortunately, the chart isn't appearing as expected. -For more guidance on Apexcharts, check out their documentation Here HTML <div class="section sec2"> <div id="chart" ...

Tips for including a pre-existing Web Element into another Web Element using Selenium in Java

Is there a way to append one WebElement into another WebElement? For example: Let's say I have a web element obtained with the following code WebElement reviewList = driver.findElement(By.id("review-list")); And I also have a container obtained us ...

Utilizing JavaScript to dynamically alter the animation property within CSS

How can I adjust the number of steps in an animation property set within a CSS file? This is the CSS code I am using: #ManSprite{ overflow:hidden; width:200px; height:200px; position:absolute; top:280px; left:140px; background ...

Can I create interactive stacked shapes with CSS and/or JavaScript?

Trying to explain this may be a challenge, so please bear with me. I need to create an "upvote" feature for a website. The number of upvotes is adjustable in the system settings. The upvote controls should resemble green chevrons pointing upwards. For exa ...

How to Align Text on a RadioButton?

I'm struggling to get text aligned properly next to a RadioButton in my Android Studio project. This is what I currently have... Screenshot of the Application Does anyone have any suggestions on how to fix this alignment issue? ...

Is there a way to restrict input in my field to only numbers along with one comma and a maximum of two digits after the comma?

I have implemented an input field that only accepts numbers and one decimal point. $('.number').keypress(function(event) { var $this = $(this); if ((event.which != 46 || $this.val().indexOf('.') != -1) && ((event.which ...

Utilizing a Function Across Controllers in AngularJS: A Guide

When developing my angularjs application, I decided to create two separate modules - 'home' and 'templates'. I am now faced with the challenge of utilizing functions from one module in the other. Here's how I approached it: Modu ...

Struggling to eliminate placeholders using regular expressions in JavaScript

In my dynamically generated table, I have some placeholders that need to be removed. These placeholders are in the format of {firm[i][j]}, where i and j are numbers. I attempted to use a regular expression in JavaScript to remove them, but it didn't ...