uri parameter

Hi All,

I am not too familiar with vaadin 7 and I can not figure out this. I tried to use google but no useful result.

My question is very simple. How can I get the request url parameters in my UI class?

For example, my url is http://localhost:8080/myDemo/?code=AQAfKPsCvPLUM

The url parameter comes from facebook after user logged in (OAuth).


I tried to do these:

@PreserveOnRefresh
public class AdminUi extends UI
{
@Override
protected void init(VaadinRequest request)
{
System.out.println( request.getPathInfo());
System.out.println( request.getRemoteHost());
System.out.println( request.getParameterMap().size());
System.out.println( request.getAttribute(“code”) );
System.out.println( request.getParameter(“code”) );
}
}


Result:

request.getAttribute(“code”): null
request.getParameter(“code”): null

I realized that getParameterMap() has a “v-loc” parameter. But if I use it variable I have to write some code to get url parameter from this variable:


v-loc: http://localhost:80880/myDemo/?code=AQAfKPsCvPLUM…

theme: reindeer
v-rtzo: -600
v-dston: false

I think, it is not too nice solution.
Could you help me to find out the right way?

Thank you.

Is there any ideas?
How can I get request url parameters in vaadin7 UI class?

I really need your help.

Thank you.

Many people suggest use WrappedRequest object for get the original HttpServletRequest class.
But I can not see WrappedRequest class in the API.

Where is this class?

request.getParameter(“code”) should work. Try a simple sample application and verify.

Thank you for your answer.

Yes, this code should work. This wiki page describes everything very well:
https://vaadin.com/wiki/-/wiki/Main/Using%20URI%20or%20parameters%20or%20screen%20size%20when%20initializing%20an%20application

I spent many hours to solve my problem and I realized what is my problem. But I can not solve it yet. I am using Embedding UI mode and I think this the problem.

If I do not use Embedding UI mode than request.getParameter(“code”) is working.

Please read this conversation:
http://stackoverflow.com/questions/16493773/vaadin-7-url-parameter

Thank you.

If you know what is the wrong with my code, please do not hesitate tell me :slight_smile:

Solution: http://stackoverflow.com/questions/16493773/vaadin-7-url-parameter