Include multiple parameters inside SAML RelayState parameter - url

Basically have an issue when I set the RelayState parameter to /test/example?key=value&key1=value1 , key1=value1 is being split away from the RelayState parameter instead of being included in it like "/test/example?key=value&key1=value1". I would be grateful for any assistance. Thanks

I resolved this myself, basically when you build the page reference in apex code, you should only use the base url in the constructor, no parameters. Then, you add the parameters to the Page Reference's parameter map variable. That way the parameter is not split. Thanks!

Related

Changing ParameterAware to HttpParametersAware

I'm upgrading my project from Struts 2.3.1 to 2.5.12.
Since ParametersAware is deprecated in 2.5.12. I want to change ParametersAware to HttpParametersAware.
But setParameter() method is entirely different in both.
setParameters(HttpParameters parameters) (struts 2.5.12)
setParameters(Map<String,String[]> parameters) (Struts 2.3.1)
How to do this?
Change Map<String,String[]> to HttpParameters. The later class implements a Map<String,Parameter>, so you can use
this to get/put parameters to the map.
The most interesting is a Parameter interface that has implementations
Parameter.Empty, Parameter.File, Parameter.Request.
The last one is used to retrieve request parameters.
This answer How could I get a parameter in JSP will throw a light on a typical usage of request parameters if you want to manipulate parameters manually.
Another approach (which is not recommended) is to get request parameters from the request itself. See Interceptors use in login in Struts 2.0.

What does Database.AddInParameter() method do?

I was debugging datahandler for an mvc4 application, and I came across the
AddInParameter(DbCommand, String, DbType);
and I looked for the same in MSDN, but there its mentioned as retired content and there is not much documentation. So please anybody help me to understand what it does?
1st Parameter, DbCommand - is the command you want to execute on your database, e.g. StoredProc, SqlString etc.
2nd Parameter, Parameter Name - is the name of your parameter
3rd DbType, DbType - is the type of your parameter e.g. String
Basically this will add an Input parameter which can be used in your DbCommand. The AddInParmeter method works similarly like the SqlCommand.Parameters.Add() of the System.Data.SqlClient namespace.

T4MVC: What are MVC.Controller.ActionParams are for?

I've found properties corresponding to each action named like this: MVC.<Controller>.<Action>Params, they contain parameter names for each action. What are they for and how they can be used?
There were some edge scenarios where it was interesting to pass the parameter name as a constant. I can't instantly recall what that person was doing, but I could see this being useful is calls to AddRouteValue. In the end, it's all about never to have to use a literal string that refers to a C# object, whether it's a class, method, or param.

Accessing user session from a custom routing class

Is there some way to acces the user object from a custom routing class?
I'd like to add a parameter when generating a url, and that parameter is inside the user session, so I need to access it.
The only way I found to access is using the sfContext::getInstance()->getUser(), but it's known to be inefficient.
Thanks!
I'd write it the way you mention - I've used that method in similar situations and never had an issue performance wise, and suspect you will be the same.
Also, never heard this mentioned as inefficient, but it is a little bit frowned upon because it couples the route to the context. An alternative that would overcome this would be to pass the variable to the route as you would any other parameter (or the user object if you need the whole thing). If you need to do this a lot, you can always make a custom url helper that wraps the existing url_for method, adding this param to any other details passed.
A workaround I have implemented (for now), is getting some data from somewhere (not ideal, I'm willing to access the user session yet), and set a new parameter inside $params, in the generate method of the custom routing class.
Hope it helps...

OpenRasta - Pass parameters to custom Codec

I've created a new custom JSON codec for OpenRasta which works fine.
I need to pass arguments to the codec's write method when the handler is executed but cannot find any documentation on how to do it.
I notice in the implemented WriteTo method, there is a string[] codecParameters parameter, however no idea how to pass them in.
Anyone come accross this problem before? Thanks
the codec parameters are per-request. They're intended to be used together with (for example) the PathSegmentAsParameterUriDecorator.
For example, if you enable that decorator, the path /resource;segment will be treated as /resource by openrasta, and a parameter will be created with the "segment" value, and passed to the codec.
If you wish to pass information to the codec from the handler, there's nothing there, as architecturally it goes against the design of OpenRasta, which specifically prevents handlers and codecs from talking to each others.
If you wish to pass configuration data to your codec, you use the Configuration property from the ICodec interface, which will be filled with whatever object you have provided at configuration time.
You provide the configuration object either through the paramter in the .TranscodedBy(object configuration) method, or if you do custom registration using the configuration metamodel, bu adding the configuration to your Configuration property on CodecModel (which incidently is used in the ResourceModel object created by the fluent API).
Do you have a specific scenario I can help with?

Resources