Hello I'm in a bit of a jam here.
I'm trying to activate json calbacks (jsonp) on Alfresco 4.0.b following these directives.
http://wiki.alfresco.com/wiki/Web_Scripts#JSON_Callbacks
If I understand correctly for me to activate this feature for webscripts I need to modify this file /Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/web-scripts-application-context.xml and add a property
<property name="allowCallbacks"><value>true</value></property>
to any bean definition I want json callbacks on.
Now from what I read everywhere you should never ever modify files inside alfresco.war or share.war. So here is my question:
How would I go about modifying this file outside of the alfresco war?
I tried copying the file to /Alfresco/tomcat/shared/classes/alfresco/web-scripts-application-context.xml and adding the propertie to the webscripts.container bean and the webscripts.authenticator.basic bean but both my script and the basic authentication script are not returning my results wrappped in my my_function when I use alf_callback=my_function
Any help would be greatly appreciated.
Thanks
Just placing a customized copy in shared/classes/alfresco does not work as beans still resolve from alfresco/WEB-INFO/classes/alfresco.
Try putting your customizations in shared/classes/alfresco/extension/whatever-context.xml.
The order of the imports is defined in alfresco/WEB-INF/classes/alfresco/application-context.xml - the last definition overrides and "wins".
Related
I'm building a suite of REST micro-services using .Net Core 3.0 Preview 6. All these services will have the same start up logic. So, I'm trying to place all the code in a .Net Standard library.
The goal is to have the IHostBuilder:CreateHostBuilder method, as well as the Startup:Configure and Startup:ConfigureServices class and methods in the library. The library will also contain error handling logic, customized http response messages, etc.
However, I can't seem to find the correct package that contains the ConfigureWebHostDefaults method. I tried adding the Microsoft.AspNetCore package 2.2.0, but that didn't resolve the issue.
I added the Microsoft.Extensions.Hosting (3.0.0-preview-6) package, that also doesn't resolve the issue.
Is what I'm attempting even possible?
Thanks
-marc
I resolved it, not the best way, but it works. I decided to make the library targeted specifically for .NET Core 3.0. So, I changed the targetframework in the project file. That change automatically resolved my other issue.
Import the Microsoft.AspNetCore package, and use WebHost.CreateDefaultBuilder() instead. According to the code it is built from, both CreateDefaultBuilder() and ConfigureWebHostDefaults() call the same internal method: ConfigureWebDefaults().
The only downside of this is that the returned host will be an IWebHost instead of an IHost.
I have studied these 2 sources, but none of those works for me.
http://www.yiiframework.com/doc-2.0/guide-concept-autoloading.html
Yii2 - How do I AutoLoad a custom class?
I have created custom helper class which I want to include in every model, controller and view in my application. I am using Yii2 advanced app version 2.0.11, IDE I am using is PHPStorm
QUESTION:
What I want to achieve is to not use use keyword at the beggining of every class but still be able to simply call AppHelper::myMethod() in models, controllers and views.
How is that possible?
Closest I got it working was using this solution https://stackoverflow.com/a/35160997/5395463
All other solutions did not work for me. I am getting errors like:
PHP Fatal Error – yii\base\ErrorException
Class 'frontend\controllers\AppHelper' not found
when I simply dont include use commons\commands\AppHelper;
or when not using namespace as they suggest there with other settings:
Fatal error: Uncaught exception 'yii\base\UnknownClassException'
with message 'Unable to find 'common\commands\AppHelper'
in file: C:\xampp\htdocs\domain.com\web\common/commands/AppHelper.php.
Namespace missing?' in ...
SOLUTION:
Thanks for your responses, I got it working finaly. https://stackoverflow.com/a/42330631/5395463 solution works best for me.
So I removed namespace from that class, but left it in common\commands folder, added require to frontend/web/index.php and backend/web/index.php files (not sure if I should add it to yii file in root too, I didnt, so far it is working good anyways), and changed calls of class from AppHelper::myMethod() to \AppHelper::myMethod() looks like eveything is working now.
In Yii2 You can use an explicit way adding \ to full namespaced name
\frontend\controllers\AppHelper
so you can sue your method
\frontend\controllers\AppHelper::yourMethod();
Solution for not lazy coders:
create component with your class so you can use it like \Yii::$app->my_component
if even this is too much and your IDE is better than Windows Notepad prepare macro that will print this for you
Solution for lazy coders:
Save your class in single PHP file without namespace.
Modify you entry script to include this class - i.e. for Basic Project Template it's /web/index.php; add there
require(__DIR__ . '/path/to/MyClass.php');
For Advanced Project Template modify it properly.
Now you can use your class by calling it like \MyClass (yes, \ is required and yes, your IDE probably will modify it anyway to MyClass with use MyClass; added at the beginning.
While working through a tutorial to start learning Grails, I made a mistake and ran:
grails create-domain-class com.FooBar
instead of:
grails create-domain-class com.acme.FooBar
It was immediately obvious I had made an error so I tried the following:
Searched for a function that reverses the create-domain-class command, it seems there isn't one.
Searched for advice on the web and the consensus is that you can delete a domain class file, any associated views and tests, then to be safe run a text search for your class name in your project directory for any references you may have missed. I have done all this.
Then I ran the correct command to create com.acme.FooBar, which worked.
After this the app fails to run and reports the following error:
org.hibernate.DuplicateMappingException: duplicate import: FooBar refers to both com.acme.FooBar and com.FooBar (try using auto-import="false")
After adding the following code to com.acme.FooBar:
...
static mapping = {
autoImport false
}
...
The app now runs as expected.
However as an experienced Java developer who occasionally does refactor a package I would like to understand how to do that without causing a DuplicateMappingException or resorting to the "autoImport false" solution.
Thanks.
You shouldn't be doing
static mapping = {
autoImport false
}
As, by doing this you said that don't check for domain just by name and look up for package as well. Hence, once you do that you will have to use Fully qualified name of the class in your queries / hqls which may itch sometimes.
You should be removing the Domain completely i.e.
remove the Domain
remove the view folder creating by default with very same name and so do the controller
Now, do grails clean-all(Make it a thumb rule to use grails clean-all first for any issue unexpectedly occuring).
To be more accurate do remove target directory from your project and then do run grails run-app.
I had done very same thing many times and got it resolved by above steps.
Hope it helps.
Can any one help me ?
In my project, I need to pares some schema files, and need to generate xml files base on these schemas. Now ,I want to user MOXy to generate empty xml files base on these schemas dynamicly.But exception happened.
Internal Exception: com.sun.istack.SAXParseException2: "file:/F:/workspace/test/src/custom2.xsd" is not a part of this compilation. Is this a mistake for "file:/F:/workspace/test/src/custom.xsd"?
at org.eclipse.persistence.exceptions.JAXBException.errorCreatingDynamicJAXBContext(JAXBException.java:586)
at org.eclipse.persistence.jaxb.dynamic.metadata.SchemaMetadata$XJCErrorListener.error(SchemaMetadata.java:235)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.error(SchemaCompilerImpl.java:316)
at com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:628)
at com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:619)
at com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalizer.java:262)
at com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalizer.java:391)
at com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:146)
at com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:108)
at com.sun.tools.xjc.reader.internalizer.DOMForest.transform(DOMForest.java:442)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:230)
at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:94)
at org.eclipse.persistence.jaxb.dynamic.metadata.SchemaMetadata.getJavaModelInput(SchemaMetadata.java:138)
at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext.initializeFromMetadata(DynamicJAXBContext.java:209)
at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromXSD(DynamicJAXBContextFactory.java:345)
... 2 more
I think the reason is the redefine element, because when I use import or include,it's ok. Please help me. Can't upload attachement to stackoverflow?
I have a block of XAML of which i'm trying to deserialize. For arguments sake lets say it looks like below.
<NS:SomeObject>
<NS:SomeObject.SomeProperty>
<NS:SomeDifferentObject SomeOtherProp="a value"/>
</NS:SomeObject.SomeProperty>
</NS:SomeObject>
Of which i deserialise using the following code.
XamlReader.Load(File.OpenRead(#"c:\SomeFile.xaml"))
I have 2 solutions, one i use Unit Testing, and another i have for my web application. When i'm using the unit testing solution, it deserializes fine and works as expected. However, when i try to deserialize using my other project i keep getting an exception like the following.
'NameSpace.SomeObject' value cannot be assigned to property 'SomeProperty' of object 'NameSpace.SomeObject'. Object of Type 'NameSpace.SomeObject' cannot be converted to type 'NameSpace.SomeObject'.
It's as if it is getting confused or instantiating 2 different types of objects? Note, i do not have similarly named classes or any sort of namespace conflict. The same codes executes fine in one solution and not the other. The same project files are referenced in both.
Please help!
Resetting IIS seemed to have fixed the problem. XAML must have been using a shadow copy of the DLL's sigh