marshalling

RestEasy Client Authentication and HTTP Put with Marshalling

两盒软妹~` 提交于 2019-12-22 08:08:40
问题 I want to test my REST-Service using the RestEasy Client Framework. In my application I am using Basic Authentication. According to the RestEasy documentation I am using the org.apache.http.impl.client.DefaultHttpClient to set the Credentials for Authentication. For an HTTP-GET Request this works fine, I am authorized and I get the result Response which I wanted. But what if I want to make a HTTP-Post/HTTP-Put with an Java Object (in XML) in the HTTP-Body of the Request? Is there a way to

Non-type template parameter… that's a template! (C++)

[亡魂溺海] 提交于 2019-12-22 06:33:09
问题 I'm basically looking to generate a wrapper for a generic C function without having to manually specify the types. So I have a callback with a fixed prototype but I'm going to need to do some special code in the wrapper based on the type of the wrapped function... So basically I'm thinking about using a static method in a class template to wrap my function to a conforming interface e.g.: // this is what we want the wrapped function to look like typedef void (*callback)(int); void foobar(

How to gracefully unload a child AppDomain that has threads running

南笙酒味 提交于 2019-12-22 05:05:16
问题 I have a service that loads a child AppDomain and then starts a thread running in it. It needs an AppDomain because it dynamically generates and loads some code and I need to be able to restart it without killing the whole service. So there is a thread running in an event loop in the child AppDomain, it gets events passed to it through a MarshalByRefObject that sticks stuff in a concurrent queue. I want to stop and unload the child AppDomain and create a new one. I can simply call Unload on

JAXB XML Object Marshalling without namespace prefixes

本小妞迷上赌 提交于 2019-12-22 03:24:46
问题 Im working on a java project where i need to read some objects from an XML file, do some processing which will alter the object´s atributes and then write the Object to another XML file. For that purpose, i am using JAXB with its marshalling and unmarshalling capabilities, each of them in a method, like this: private MyObject unmarshallXMLFile(String file) { MyObject t=null; try { jc = JAXBContext.newInstance("foo.bar"); Unmarshaller unmarshaller = jc.createUnmarshaller(); SchemaFactory sf =

Marshalling C++ pointer interface back though C# function call in a non default AppDomain

懵懂的女人 提交于 2019-12-21 20:44:18
问题 I have a working CLI interface between C++ and C# code. The code has a C++ abstract interface like: -------------C++ Interface--------------- namespace cppns { class cppInterface { public: virtual bool Start(const char *pcDir) = 0; }; } ------Implementation of abstract C++ interface in same dll--------- namespace cppns { class cppimp : public cppInterface private: gcroot<MyInternalCSharpClass^> mInternalClassAccess; public: cppimp::cppimp() { mInternalClassAccess = gcnew MyInternalCSharpClass

jaxb, can I use @XmlJavaTypeAdapter with @XmlElements?

[亡魂溺海] 提交于 2019-12-21 20:25:39
问题 Given the following annotations @XmlElements({ @XmlElement(name = "first", type = First.class), @XmlElement(name = "second", type = Second.class), @XmlElement(name = "third", type = Third.class), @XmlElement(name = "fourth", type = Fourth.class), @XmlElement(name = "fifth", type = Fifth.class), @XmlElement(name = "sixth", type = Sixth.class), @XmlElement(name = "seventh", type = Seventh.class)}) private List<Dimension> dimensions = new ArrayList<>(); And because of some funny legacy logic, I

How to tell Ruby not to serialize an attribute or how to overload marshal_dump properly?

混江龙づ霸主 提交于 2019-12-21 06:45:06
问题 I have an attribute in my AR:B that is not serializeable. o = Discussion.find(6) Marshal.dump(o) TypeError: no marshal_dump is defined for class Proc from (irb):10:in `dump' I know the culprit and what I want is to set this variable to nil before any serialization takes place. I can do this but I'm stuck with the proper way to override marshal_dump def marshal_dump @problem = nil # what is the right return here? end Or is there is way to tell Ruby or AR not to serialize an object? 回答1: Your

How do I unmarshal a ruby object in java?

耗尽温柔 提交于 2019-12-21 05:16:39
问题 I have a an object that I'd like to grab the contents of in java. The only problem is that is is currently in ruby. irb(main):050:0> blah => "BAh7ByIeYXV0aGVudGljYXRpb25fc3RyYXRlZ2llczAiCXVzZXJpBg%253D%253D-\ -0cdecf4edfaa5cbe4693c9fb83b204c1256a54a6" irb(main):049:0> Marshal.load(Base64.decode64(blah)) => {"authentication_strategies"=>nil, "user"=>1} I got the base64 portion allright -- so now everything is in bytes. How would i access that 2nd string? I presume something can be done with

Runtime callable wrapper (RCW) scope - process or application domain?

瘦欲@ 提交于 2019-12-21 04:42:11
问题 What is the scope of Runtime Callable Wrapper (RCW), when referencing unmanaged COM objects? According to the docs: The runtime creates exactly one RCW for each COM object, regardless of the number of references that exist on that object. If I had to "guess" - this explanation should mean "one per process", but is it really? Any additional documentation will be very welcome. My application runs in its own application domain (it is Outlook addin), and I would like to know what happens if I use

Marshalling a char** in C#

醉酒当歌 提交于 2019-12-20 19:39:46
问题 I am interfacing with code that takes a char** (that is, a pointer to a string): int DoSomething(Whatever* handle, char** error); Basically, it takes a handle to its state, and if something goes wrong, it returns an error code and optionally an error message (the memory is allocated externally and freed with a second function. That part I've figued out :) ). I, however, am unsure how to handle in in C#. What I have currently: [DllImport("mydll.dll", CallingConvention = CallingConvention.Cdecl