Overriding Zuul Filter SendErrorFilter - spring-cloud

The class org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter handles error responses.
I would like to override this filter to do a custom response instead of the ZuulException while forwarding etc.
How can I replace this with my own version?
Just write and register? Would that do it or is there something else needed?

property name is changed to "zuul.SendErrorFilter.error.disable"

all you need to do is create a ZuulFilter and expose it as an #Bean. It needs to be in order before SendErrorFilter which is set to 0. You might need to remove "error.status_code" from the RequestContext so SendErrorFilter doesn't run.

You will need to disable a default SendErrorFilter by adding zuul.SendErrorFilter.post.disable: true to your application.properties. After this you can create your own.

Related

backpack for laravel: how to customize routes?

We need to change every <anything>/show routes to something localized.
How can we customize the show string in something like dettagli ?
You can do in two way:
By creating a custom operation, starting from the default Show operation. Copy-paste the code of the ShowOperation.php in your project, and change the route. Then throughout your project use your ShowOperation, instead of the one provided by Backpack.
By overriding the protected function setupShowRoutes($segment, $routeName, $controller) in your CrudController. If you have that method in your ProductCrudController for example, your method will be run instead of the one in the ShowOperation trait. However, this needs to be done in all CrudControllers individually, so it's less DRY.

Problem when passing a singleton to another viewmodel using self.VM.Navigate

In the public part of my app the user starts with a link to a VM (IndexBookingPage) with DVM params. An action looks up the publicbookingpage object from Id, and if found navigate to Eventlist. This part works. But in the Eventlist self is null. Why?
IndexBookingPage
EventList
Don't set self inside a viewmodel.
Instead, use OneSession.oclSingleton by itself. Use a let statement if you think it's too bulky in text to repeat OneSession.oclSingleton.
Why do you have "Requires root" on the IndexBookingPage at all?
I have change to OneSession.oclSingleton instead, and now it works. Is there a rule when to use self or Class.oclSingleton?
I just tried different solutions, thats why I checked required root.

How to get an NPP instance in a Firebreath plugin?

From within a class derived from FB::PluginCore (or FB::JSAPIAuto), for example in onPluginReady() or a JS method handler, I'd like to have access to the NPP instance. What is the best practice for getting this pointer?
The underlying goal is to be able to call NPN_SetValueForURL, to set cookies.
You can call any of the NPN functions on the NpapiBrowserHost object, which is what the BrowserHost actually is.
FB::Npapi::NpapiBrowserHostPtr npapiHost = FB::ptr_cast<FB::Npapi::NpapiBrowserHost>(m_host);
I think it has SetValueForURL on it, but if it's missing you can always add it and submit a pull request; I'll accept it as long as it's reasonable.

How to load data into Ext.tree.TreePanel (not through ajax)

in example here
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.tree.TreePanel
i can see property dataUrl: 'get-nodes.php',
but how i can change data from inside my code? there is no store property or setSource method
EDIT:
as i found, one of the possibilities is to create my own Ext.tree.TreeLoader that would have setSource method and use it instead of default
maybe there is more variants?
EDIT:
seems there is already a solution for this
http://www.sencha.com/forum/showthread.php?4595-Creating-Ext.tree.TreePanel-from-static-JSON-data-in-one-shot
seems there is already a solution for this
http://www.sencha.com/forum/showthread.php?4595-Creating-Ext.tree.TreePanel-from-static-JSON-data-in-one-shot

Programatic property injection with Microsoft Unity

I use contructor injection in my solution, but this one class has a property that i do not want to pass in the constructor where i have the invariant dependencies.
Let's say i got an ILogger and it has a FileName property i want to set, while still having it set the dependancies in the contructor.
How do i go about registering the type, and at the same time pass the defaunt connection string.
I hope there is an easy way to do it - preferably without decorating the property with an attribute, but if the setup is easier with the attribute i guess that's cool :)
So the question is, how do i inject a property value on an object that also uses contructor injection - with Unity.
UPDATE: I mentioned it in the title, but i forgot to elaborate in the body of the text - i want to set these dependencies up manually (in code) as opposed to in a config file.
Ok i guess it helped to ask the question, i found out - here it is.
container.Configure<InjectedMembers>().ConfigureInjectionFor<BasicLogger>(
new InjectionProperty("FileName", #"C:\test.log")
);
If you are injecting properties you have to use [Dependency] or else manually inject that dependency.
You usually want an IConfiguration interface to be injected. This would probably have a LogFile property that you can read.
The Configuration implimentation is usually just a simple wrapper to read items from the config file.