5

Is it possible to access localstorage object using Java directly? If yes how?

Update: I am aware that localstorage is client side and java is server side but I read on net that GWT have api that allow to read localstorage.

4
  • 1
    You're talking about a Java applet? Commented Nov 4, 2012 at 9:38
  • For which scenario you are talking ? Commented Nov 4, 2012 at 9:51
  • I want to read localstorage from servlet filter, we are storing some Id in that. Commented Nov 4, 2012 at 11:48
  • @Dev G are you able to handle it. I also need to do same. Commented Apr 29, 2020 at 3:06

2 Answers 2

13

The local storage, as its name indicates, stores information locally, which means in the browser, at client-side. The servlet filter executes at server-side. There is no way to access the local storage at server-side.

If you need to access some ID stored in the local storage from a servlet filter, then retrieve this ID from the local storage in JavaSCript, and send a request containing this ID to the server.

Sign up to request clarification or add additional context in comments.

3 Comments

that is last option for me, but I was reading on net google GWT provides a API that allow to read the localstorage, what's that?
GWT allows writing applications in Java, that are compiled to JavaScript and executed in the browser. It doesn't have anything to do with servlet filters.
There is also the security requirement of localStorage not to share its data with any other system, including a development API (Java). The information is not sent from Client to Server.
0

Localstorage is better alternative thamn Cookie. So, I am waiting JAVA support without external library for accessing local web storage, too. Now I am using sellenium support. Please, look at https://gist.github.com/dariodiaz/5079695

1 Comment

How can I use this local storage class to set and get the values, any example will helpful

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.