Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » [RAP] Obtaining URL Parameters and open outline with page
icon3.gif  [RAP] Obtaining URL Parameters and open outline with page [message #1397078] Wed, 09 July 2014 07:00 Go to next message
A N is currently offline A NFriend
Messages: 25
Registered: July 2014
Junior Member
Hello,

first I want to thank you guys for the great work you did with creating Scout. I have been using it for roughly a month now and think it is awesome.

However I can not figure out how I can access URL (HTTP GET) parameters when using the RAP UI. The only thing I was able to do so far was accessing those parameters by overriding the "afterHttpRequest" method in StandaloneRwtEnvironment the class and then calling "RWT.getRequest().getParameter(name)".

But I could not figure a proper way to open a specific outline / page based on the parameter content.

What I basically want to archieve is the possibility to have direct links to certain pages of my application just like a link to this thread for example.

Can anyone give me a hint how to realize that?

Best regards,
A.N.
Re: [RAP] Obtaining URL Parameters and open outline with page [message #1397355 is a reply to message #1397078] Wed, 09 July 2014 15:53 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Hi,

Thank you for writing on this forum.

I will try to find someone that knows RAP-UI better than me to give you a better answer.

You are right, for web application URL is really important. If we take the mini-crm Demo application as example, it is absolutely natural to be able to create deep link into the web-application:

http://localhost:8082/web/StandardOutline/Company/
http://localhost:8082/web/StandardOutline/Person/

And even: http://localhost:8082/web/StandardOutline/Company/BSIAG/ to open the edit CompanyForm as dialog (as if the user has clicked on Edit)

index.php/fa/18508/0/

I am afraid that for the moment there is no possibility to achieve this out-of-the box with scout.

I think a workaround is to work with Scout Bookmarks, but I never did it, so I am not sure.

.
  • Attachment: mini_crm.png
    (Size: 56.25KB, Downloaded 750 times)

[Updated on: Wed, 09 July 2014 15:59]

Report message to a moderator

Re: [RAP] Obtaining URL Parameters and open outline with page [message #1397990 is a reply to message #1397355] Thu, 10 July 2014 12:55 Go to previous messageGo to next message
A N is currently offline A NFriend
Messages: 25
Registered: July 2014
Junior Member
Thanks for your quick response. I tried using bookmarks but the problem there was that I can not properly open those from the rap.ui Plugin where I got the access to the parameters

Maybe I can do some digging and implement this myself but currently I am not even sure what the proper entry point (StandaloneRwtEnvironment probably isn't?!) for intercepting the parameters is.

I am open for any hints if someone got an idea.

[Updated on: Thu, 10 July 2014 12:55]

Report message to a moderator

Re: [RAP] Obtaining URL Parameters and open outline with page [message #1420638 is a reply to message #1397990] Wed, 10 September 2014 08:55 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 256
Registered: March 2010
Senior Member
Hi

You were on the right track, StandaloneRwtEnvironment is the class where you can intercept the parameters. Have a look at the following snippet:

public class StandaloneRwtEnvironment extends AbstractStandaloneRwtEnvironment {

  public StandaloneRwtEnvironment() {
    super(Activator.getDefault().getBundle(), ClientSession.class);
  }

  @Override
  protected synchronized void init(Runnable additionalInitCallback) throws CoreException {
    super.init(additionalInitCallback);

    String parameter = RWT.getRequest().getParameter("create");
    if ("person".equals(parameter)) {
      Runnable job = new Runnable() {
        @Override
        public void run() {
          PersonForm form;
          try {
            form = new PersonForm();
            form.start();
          }
          catch (ProcessingException e) {
            SERVICES.getService(IExceptionHandlerService.class).handleException(e);
          }
        }
      };
      invokeScoutLater(job, 5000);
    }
  }
}


With this you can open the url http://localhost:8082/web?create=person and the PersonForm should be displayed.

The important thing is to wrap your client logic with a client job and schedule it to the client job queue which is done with invokeScoutLater.

Hope it helps
Claudio
Re: [RAP] Obtaining URL Parameters and open outline with page [message #1420708 is a reply to message #1397078] Wed, 10 September 2014 10:59 Go to previous messageGo to next message
A N is currently offline A NFriend
Messages: 25
Registered: July 2014
Junior Member
Thank you! I will try this as soon as possible and report. It looks promising.
Re: [RAP] Obtaining URL Parameters and open outline with page [message #1429521 is a reply to message #1420638] Tue, 23 September 2014 10:41 Go to previous messageGo to next message
A N is currently offline A NFriend
Messages: 25
Registered: July 2014
Junior Member
Hello,

I checked the solution Claudio posted and it worked. However I had to add
 javax.servlet
as required Bundle in the ui.rap project since it is indrectly referenced by
RWT.getRequest()
. This is only working with my local jetty server. When I try to deploy this to my tomcat server it will not work until I remove the required bundle (and also the RWT.getRequest line) from the MANIFEST.MF again. Is there any way I can avoid this problem?
Re: [RAP] Obtaining URL Parameters and open outline with page [message #1429651 is a reply to message #1429521] Tue, 23 September 2014 14:31 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
A N wrote on Tue, 23 September 2014 12:41
When I try to deploy this to my tomcat server it will not work until I remove the required bundle (and also the RWT.getRequest line) from the MANIFEST.MF again. Is there any way I can avoid this problem?


I assume you build and deploy the application defined in a product file like this one:
\helloworld.ui.rap\products\production\helloworld-rap-client.product


When you have added the new dependency in the Manifest, have you checked if the product still validates?

(I have tried to provied an overview of concepts like target-platform, target-definition, product file... in an other thread)

When you start your application in Tomcat, have you error-log entries?

.

[Updated on: Tue, 23 September 2014 14:31]

Report message to a moderator

Re: [RAP] Obtaining URL Parameters and open outline with page [message #1429655 is a reply to message #1429651] Tue, 23 September 2014 14:39 Go to previous message
A N is currently offline A NFriend
Messages: 25
Registered: July 2014
Junior Member
Never mind. I forgot to update the product. Thanks for your help. Everything is working as expected now.
Previous Topic:Item specific Context Menu in TreeField
Next Topic:AbstractTextField and ITextField
Goto Forum:
  


Current Time: Fri Apr 26 19:31:31 GMT 2024

Powered by FUDForum. Page generated in 0.03599 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top