I am using "javax.portlet.PortletRequest" and able to get the values from the portal request using
request.getParameter("test").
I want to change values in the request object based on some conditions and pass it to some other functions.
request.setParameter("test", "abcd").
please help me out...
You can't modify the Parameters on the PortletRequest Object. Also I suspect the existence of such setter method for parameter.
You can use request.setAttribute() to pass parameters via request Object. As you are using Spring MVC, you can make use of Model to pass/hold the Objects throughout the lifetime of the request.
Related
Let's say my controller is taking an object parameter without [FromBody], how do I post the data using Postman? I tried this way but it doesn't reach the endpoint.
I think in this case, since you're not using [fromBody] your object should be in the URL and not in the Request Body.
in Postman, this can be done using the Query Params as the screenshot shows.
Yet, I don't think you could pass an object in the query params like that. I think you should instead turn it into a query string like this format
"User=abc&Pass=abc"
Multiple ways to achieve this can be found here
If your controller is taking an object parameter without [FromBody] then you must send the data as URL parameter:
POST http://localhost:44364/login?object={"User":"abc","Pass":"abc"}
Note: replace "object" by the name of the parameter in your controller. Also you have to know that Postman should converts special characters { " : , to %XX format and you have to manage that in your service.
If you want to send it in the body, then include [FromBody]
Is it possible to use variables in the description of a request in Postman?
I have created a collection, and want to use a variable in the description.
My main goal is to create json schemas for defining object types, so I thought I would store global variables with the json schema, and reference those types in the description of a request or collection. Is that possible?
At the moment it isn't possible to use variables in the description of a collection. You can always submit a feature request here:
https://community.getpostman.com/c/feature-requests?order=views
I didn't see a current request for that particular feature, perhaps others would be interested as well.
I was wondering, In a RemoteAction function in an apex class can or should this be able to access the current force.com site page? I would like to access and write to cookie parameters from within my static remote method but I'm guessing this may not be possible?
If not, any suggestions on how to get around this would be useful.
Thanks in advance.
Remote Action method runs in an.asynchronous mode.Hence accessing values from url parameter will get you null values.If you need any static values for your apex class to process use the parameters.pass from page to your apex method using parameter .
There is one way that i recently discovered to do this
Pass them in from the script on the page using {!$currentpage.parameters.something}
You still need to check for nulls in the code because it might legitimately be null
I am trying to do authorization in away that only owners of the objects can edit them.
How can i get the ids of the objects being edited in the post call in my authorization method?
Eg: If someone PUTs to the url /api/v1/resource_name/1, I want to get '1'
Also, tastypie allows a collection of objects to be edited at one go. (http://django-tastypie.readthedocs.org/en/latest/interacting.html#updating-a-whole-collection-of-resources-put)
Is there a way for me to get a list of the objects being edited in any call?
Thanks!
I have been struggling with this as well. Right now, I determine the object by parsing request.path. I believe a more direct method (via the object parameter in Authorization() for example) will become available in 0.9.12 and beyond.
You might watch this question as well: How can I pass a detail object to custom authorization in tastypie?.
Good luck.
I am trying to develop SOAP based webservice using CXF. My requirement is to accept any XML data structure as method parameter and then the logic to parse/handle this data would be internally taken care by webservice (A generic webservice for accepting request).
Hence I want to declare the method parameter as either org.w3c.dom.Element or org.w3c.dom.Document. I tried declaring method with these types but it gave an error.
Can anyone please let me know how, I can achieve this? I dont want to use REST approach.
Would a Provider based service work? Alternatively, make the method param a DOMSource or just Source. That may work better.