Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>session in GWT is similar to session in servlet. The difference is in servlet you call <br><code>HTTPSession session = request.getSession();</code> <br></p> <p>in gwt you call <br><br> <code>HttpServletRequest request = this.getThreadLocalRequest();</code> to get request and then again <code>request.getSession();</code><br></p> <p>in your situation you should call RPC when click the button and manage the session on server the previous code and call another RPC when clicking another button and invalidate session. Here is example;</p> <pre><code>Button b1 = new Button("b1"); b1.addClickHandler(new ClickHandler) { // call RPC and // session = this.getThreadLocalRequest().getSession(); // session.setAtribute("b", "1"); } Button b2 = new Button("b2"); b1.addClickHandler(new ClickHandler) { // call RPC and // session = this.getThreadLocalRequest().getSession(); // session.invalidate(); // kill session } </code></pre> <p>This link maybe helpful to you <a href="http://developerlife.com/tutorials/?p=230" rel="noreferrer">Using Servlet Sessions in GWT</a></p> <p><strong>Edit :</strong></p> <p>If you want to test whether the session <code>isExist()</code> or not try this</p> <p>add to your interface <code>boolean test(String attr);</code> <br> add to your .async add <code>void test(String attr, AsyncCallback&lt;Boolean&gt; callback);</code> <br> add to your .impl </p> <pre><code>@Override public boolean test(String attr) { return session.getAttribute(attr) != null; } </code></pre> <p>and just call </p> <pre><code>Rpc.test(attribute, new AsyncCallback&lt;Boolean&gt;() { @Override public void onSuccess(Boolean result) { // here is the result if(result){ // yes the attribute was setted } } @Override public void onFailure(Throwable caught) { Window.alert(caught.getMessage()); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload