Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to access the request parameters?(request parameter)
How to access the request parameters? [message #1843005] Sat, 10 July 2021 16:12 Go to next message
Cho HyunJong is currently offline Cho HyunJongFriend
Messages: 107
Registered: July 2009
Location: korea
Senior Member

Hello

I would like to use the request parameters from the RAP FAQ (https://wiki.eclipse.org/RAP/FAQ#How_to_access_the_request_parameters.3F )

When it is called directly from the browser, it performs normal.

However, calling Curl, HTTP Client, or RestClient does not produce results. What should I do?
Please help me.

Test code
try {
			HttpClient httpclient = HttpClients.createDefault();
			HttpPost httpget = new HttpPost("http://127.0.0.1:8080/main/?testUID=402baba0-2683-49fc-9881-5e038972d48a&&method=PreferenceInitialize");
			httpget.setHeader("Accept", "application/json");
			httpget.setHeader("Content-type", "application/json");			
			httpget.setHeader("Cache-Control", "no-cache");
			httpget.setHeader("Content-type", "no-store");
			httpget.setHeader("Content-type", "private");
			httpget.setHeader("Pragma", "no-chache");

			// Request parameters and other properties.
			List<NameValuePair> params = new ArrayList<NameValuePair>(2);
			params.add(new BasicNameValuePair("testUID", "402baba0-2683-49fc-9881-5e038972d48a"));
			params.add(new BasicNameValuePair("method", "PreferenceInitialize"));
			httpget.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
	
			//Execute and get the response.
			HttpResponse response = httpclient.execute(httpget);
			HttpEntity entity = response.getEntity();
	
			if (entity != null) {
			  InputStream instream = entity.getContent();
			  try {
			    // do something useful
			  } finally {
			    instream.close();
			  }
			}
		 } catch(Exception e) {
			 e.printStackTrace();
		 }

[Updated on: Sat, 10 July 2021 16:16]

Report message to a moderator

Re: How to access the request parameters? [message #1843057 is a reply to message #1843005] Tue, 13 July 2021 16:50 Go to previous messageGo to next message
Cho HyunJong is currently offline Cho HyunJongFriend
Messages: 107
Registered: July 2009
Location: korea
Senior Member

help me~
Re: How to access the request parameters? [message #1843091 is a reply to message #1843057] Thu, 15 July 2021 08:11 Go to previous messageGo to next message
Sebastian Habenicht is currently offline Sebastian HabenichtFriend
Messages: 42
Registered: January 2013
Member
Hello Cho,

I think it is not possible to access parameters that way when calling the application via a REST client or similar. As far as I understand, passing these startup parameters to the application' entry point is done in Javascript when the client side rwt.widgets.Display is initialized. The display is not created when using REST clients.

Maybe you can use a servlet filter [1]; a filter will receive the passed parameters from a REST client.

Regards,
Sebastian

[1] https://docs.oracle.com/cd/B14099_19/web.1012/b14017/filters.htm
Re: How to access the request parameters? [message #1843111 is a reply to message #1843091] Fri, 16 July 2021 04:19 Go to previous messageGo to next message
Cho HyunJong is currently offline Cho HyunJongFriend
Messages: 107
Registered: July 2009
Location: korea
Senior Member

Thanks @Sebastian HabenichtFriend

Any other anseers?
Re: How to access the request parameters? [message #1843258 is a reply to message #1843111] Wed, 21 July 2021 15:41 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,

RAP provides org.eclipse.rap.rwt.client.service.StartupParameters client service.

Best regards,
Ivan
Re: How to access the request parameters? [message #1843259 is a reply to message #1843258] Wed, 21 July 2021 15:52 Go to previous message
Cho HyunJong is currently offline Cho HyunJongFriend
Messages: 107
Registered: July 2009
Location: korea
Senior Member

Hi.

I know StartupParameters client service. I'm using it well.
My question is, for example

1. Server is http://localhost:10082
2. Calling http://localhost:10082/?param=value in the chrome address bar works fine.
But, calling http://localhost:10082/?param=value with CURL or HttpClient, it is not called.

I don't know what the difference is.
I want to call parameters with HttpClient.(Same thins RestClient tool)

Thanks.
Previous Topic:How to deploy RAP. Is there an up to date description available
Next Topic:Property to make ServiceManager.getServiceHandlerUrl() return relative URLs
Goto Forum:
  


Current Time: Fri Jun 14 00:45:42 GMT 2024

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

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

Back to the top