Where to keep the response of web services? [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I send request to web services and receive the results, then I need to allow users to sort the results. My question is that after retrieving the results where should I keep them to be able to sort them upon user's request without sending a new request using web services?

why again sending the request to web services i think no need of sending of request again once you received the result just store them in the type what ever they are and sort it mean while and get displayed to the users

You have two choices:
Let the server sort the results before returning them to the user.
Give the client the capability to sort the results on the client side without having to make another web service call.

This is a little bit tricky as there are several choices and you should use the one, depending on your need. You can store the data temporarily in cache or cookie if you don't require any permanent storage. Otherwise, you can use memory or database.
You can also check this link:
http://blog.mafr.de/2009/01/04/session-data-in-webapps/
It highlights some possible solutions.

Related

How to add correlation ID to the java program? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I am new to the logging things. So, i want to learn anything about logging. Can someone tell me how to add correlation ID to java program. I am just learning about log4j and add it on my simple java program like logger.info("bla") and i want to add correlation ID, but still not pretty understand what is Correlation ID?, How to add correlation ID?, What does the function of using it?
I already tried to find some source and the code example but the explanation is not really helped me
I want to know the simple code example if u can give me.
What is Correlation ID?
A correlation ID normally is meant to group log messages of related requests to multiple applications/microservices, i.e. if service A calls service B within some user request you want to know which of the log messages from both services belong to the same request.
How to add correlation ID?
You'd add it as a header to the http requests which is normally called X-Correlation-ID.
In most cases your point of entry would be some webserver like Apache Httpd or Nginx - so those would generate and populate the header.
You'd then put a filter/interceptor in front of your services to extract the correlation ID from that header and put it into Log4J's Thread Context. You'd also configure your log pattern to get the correlation ID from the Thread Context and display it in all log messages.

I was wondering whether my structure is fine for the application i made [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
Basically, i used react.js for the front end and node.js/express.js as backend to be able to store and access data from my database(mySQL). I also used JAVA springboot to create my own api to fetch data from external sources such as JIRA with basic authentication. I was wondering if this is a good ‘structure’ in order to fetch data from jira, display it in a table and store it in my database. Now my other queston is, i run 3 local host servers to make this function, if i want to deploy and put all this in a web server would it make me need 3 servers running ? I’ve never deployed anything so my main concern is that. Thank you
I think you can put things simple and easy for you by choosing one language/framework for all your back-end process. Between NodeJs/Express and Java/Spring you can choose what you really like and are more comfortable with. Because definitely what you can do with one you can almost do it with the other. It is just a question of choice if there is no requirement.
About the second question, do you mean 3 physical servers ? It is possible to run all your three apps on the same physical server. You just have to set a specific port for each one.

Broadcast a popup message to all online users Java,Jsp [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
i wish to add a functionality to my website that is to send a pop up message which i've typed, to all online users . i am able to get user id's of all online users. how could i send message in a jquery pop up to all users. Any one please give me an idea..
The solution to this requires 3 components:
First you need to make sure that whatever is typed is sent to the server. The easiest way is just via an Ajax call whenever you're done typing (or hit a button)
Secondly, you'll have to store the message(s) on the server including what users you've already distributed the message to. This can be just in memory on the server or in a database or file.
Lastly, each of the participating users will have to have a mechanism for retrieving the messages. The easiest way is just to have an Ajax call every 10 seconds for instance which asks the server if there are new messages. If there are they are returned and displayed in a popup.
The server can then mark the message as being sent to that user as well as keep a list of users that are active.
Note both the Ajax communications could be replaced with websocket connections if you want ultimate performance, but they are somewhat harder to set up, so I'd only recommend that if you have many users or many messages.
You can simply write an asynchronous script, that runs in the background, requesting from an API, and if it gets some valid response from API, you can popover a message via jQuery!

How to sequentially download data on android [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
i am using rest services on my server with json response. In my android map i am using retrofit with gson to pull that data and store it in my custom list view. My question is what is the best way download data from my server sequentially, eg. first 10 items from the server and then when i refresh it by pulling the screen after those 10 items it downloads next 10.
It sounds like you're looking for pagination. This has more to do with your server than your client.
A typical way to implement pagination, is to have your server accept offset and limit parameters for a collection resource.
So for example, say you had a collection of items on your server that you could retrieve with
GET myapi/items
You would introduce the offset and limit query parameters to specify which page you wanted out of your collection.
GET myapi/items?offset=50&limit=25
Then you would program your API client accordingly to make use of the values.
You can roll your own paging mechanism on the server, or you can use something that fits with the language and / or framework you're using, which is probably a better way to go about this (best not to re-invent the wheel). For example, I'm using Spring, so use the paging features of spring-data.
This video has a fairly good explanation of paging starting at 53:00
https://www.youtube.com/watch?v=hdSrT4yjS1g

Can you recommend a way to present many multiple pages of data on the web sortable [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a report generated from a database containing about 100,000 entries, each entry contains about 10 columns, the data is stored on Amazon S3 and is generated monthly. I'm looking for some pointers on a way you recommend a way to present this many multiple pages of data on, and I want it to be sortable and because however I sort it it wont suit all users, ideally it should be searchable as well.
Is it possible to do purely client-side or is that unfeasible, do I need go back to the server. I don't have the database available but if needs be, the website is backed by a java servlet application running on Tomcat. A self contained library for doing this would be very useful.
To paraphrase the discussion above.
Providing search/paging in Javascript is not sensible because this would still require the user to download all the data in one go, and representing that amount of data in html is not going to work well.
So either have to provide a server backend and provide a mechanism for searching and paging. Or provide the data in a spreadsheet format then the user can use the capabilities of their spreadsheet tool, which is well suited to dealing with large volumes of data.
Im going to try the spreadsheet idea.

Categories

Resources