How to use both struts2 ssl plugin and json plugin - json

I've encountered a problem when using struts2.
I want to use both struts2 json plugin and ssl plugin.
But in the struts.xml they need to extend default packages.
<package name="myPackage1" extends="json-default">
<package name="myPackage1" extends="ssl-default">
How can I use both of the plugins?
Thanks!!

When declaring a package you must declare both extensions together, instead of declaring a package two times.
Try using
<package name="myPackage1" extends="json-default,ssl-default">

Related

gdx-pay amazon integration

I'm trying to implement gdx-pay for Amazon, but I can't find any info for that.
First problem is when I try to register receiver on manifest fileI get this error :
Unresolved class 'ResponseReceiver'
here is my full code:
<receiver android:name="com.amazon.device.iap.ResponseReceiver">
<intent-filter>
<action
android:name="com.amazon.inapp.purchasing.NOTIFY"
android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>
In my gradle file I use this dependencies : Configure dependencies using Gradle
Second, when I try to register store I don't know what key should I pass here:
purchaseManagerConfig.addStoreParam(PurchaseManagerConfig.STORE_NAME_ANDROID_AMAZON, "key_here?");
Is there any working simple for gdx-pay Amazon store integration?
Thanks
An example app was added and is linked in the main readme.

PhpStorm unable to resolve symbol 'doctrine.orm.entity_manager'

When I open the services.xml in PhpStorm with Symfony Plugin enabled, it's able to resolve all the services, I can Ctrl+Click and go the Service Definition , except doctrine.orm.entity_manager.
It says unable to resolve symbol 'doctrine.orm.entity_manager'
Here is the services.xml file
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="example_manager" class="Vendor\XysBundle\Manager\ExampleManager">
<argument type="service" id="doctrine.orm.entity_manager" />
</service>
</services>
</container>
PhpStorm Details:
PhpStorm 2016.3.1
Build #PS-163.9735.1, built on December 6, 2016
JRE: 1.8.0_112-release-408-b2 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
appDevDebugProjectContainer.xml file exists in the app/cache directory .
How can I get get this working ?
I have the same issue. If you open up the vendor\doctrine\doctrine-bundle\Resources\config\orm.xml file where doctrine services are defined, you can see, there is no service with the id "doctrine.orm.entity_manager" but only "doctrine.orm.entity_manager.abstract"
The definition looks like:
<service id="doctrine.orm.entity_manager.abstract" class="%doctrine.orm.entity_manager.class%" abstract="true" />
As you can see the abstract attribute is set to true. This means this service can serve as a parent of other services, and when you define child services with this abstract parent you don't have to define the method calls or the parameters injected into the constructor for example, instead these definitions will be inherited from the parent.
If you investigate a bit deeper you will find that %doctrine.orm.entity_manager.class% is defined in the same file as a parameter that actually references to the Doctrine Entity Manager:
<parameter key="doctrine.orm.entity_manager.class">Doctrine\ORM\EntityManager</parameter>
So I guess we should use doctrine.orm.entity_manager.abstract, however doctrine.orm.entity_manager is recognised as well, although I don't know how.
For further explanation of abstract service definitions have a look at this Symfony doc page: https://symfony.com/doc/current/service_container/parent_services.html

Bean missing error when deploying SnappyData-0.5 pulse.war

I am trying to deploy the Pulse Web Application to an external Tomcat. I get this error when deploying. How should I fix this?
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'org.springframework.security.authenticationManager' is
defined: Did you forget to add a gobal
element to your configuration (with child
elements)? Alternatively you can use the authentication-manager-ref
attribute on your and elements.
OK. This is fixed. To everyone also experiencing this... you must set the Spring Profile "pulse.authentication.default" or it will not load the AuthenticationManager Bean.
The overall issue is with the RowStore's documentation, which says this is OPTIONAL, when in fact it is required.
http://rowstore.docs.snappydata.io/docs/manage_guide/pulse/quickstart.html#topic_795C97B46B9843528961A094EE520782
It says at Step 4.) that configuring security is Optional when in fact you have to pass a Spring Profile. Also, again in the section "Authenticating Pulse Users", it says this is not a requirement.
To fix the issue I had to pass the Spring Profile "pulse.authentication.default" to activate the Bean in spring-security.xml and deploy pulse.war properly.
A better way for SnappyData pulse.war to do this in the future might be to use "!pulse.authentication.custom", which would always load the default AuthenticationManager bean as long as a custom one was not configured.
Example change for future to make it truly optional:
<beans:beans profile="!pulse.authentication.custom" >
<authentication-manager>
<authentication-provider>
<user-service>
<user name="admin" password="admin" authorities="ROLE_USER" />
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
Which version of Tomcat are you using?
Here is another thread on the same issue with TC authentication.
Else, can you just try Pulse in the "embedded mode" ?
Which version of SnappyData you are using ?
You need to mention a pulse.properties file in the classpath . For details you can check http://rowstore.docs.snappydata.io/docs/manage_guide/pulse/quickstart.html#topic_795C97B46B9843528961A094EE520782.
Let us know if you any problems further.

checkstyle - prohibit initializing object of type

suppose I have an external library with a class called Foo. I can't change Foo to have a private constructor, but I have a FooFactory class that I wrote.
So I have FooFactory.getAFoo() but I want checkstyle to catch any new Foo() in the rest of my code, to force using the factory.
I have this:
<module name="IllegalTokenText">
<property name="tokens" value="LITERAL_NEW"/>
<property name="format" value="Foo"/>
</module>
but this doesn't seem to detect a new Foo().
I could use a regex but this is much cleaner.
I had a similar problem with preventing extending a class:
<module name="IllegalTokenText">
<property name="tokens" value="EXTENDS_CLAUSE"/>
<property name="format" value="AndroidTestCase"/>
</module>
Neither of these checkstyle module seem to do anything at all.
What am I doing wrong?
IllegalTokenText checks for illegal text on the token itself, not on subsequent IDENT tokens or some such. So that is why it seems to do nothing in your case.
In your case, you may want to try using the SevNTU Checkstyle extension, which offers a check called ForbidInstantiation which might solve your problem. They have no documentation that I am aware of, so I am linking the source code with Javadoc. When you use SevNTU Checkstyle, be sure to use the right versions of regular Checkstyle and SevNTU Checkstyle, because not all combinations are compatible (overview).
If that does not help, you will have to roll your own.

webAPI OData v4 Function Registration

Having setup my WebAPI OData endpoint by doing this ...
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/create-an-odata-v4-endpoint
I then tried adding a function as per the "Example:Adding a function" section at the bottom of this ...
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/odata-actions-and-functions
I hit a bit of a problem as the method call "builder.EntityType()" does not exist but everything else is up and running fine.
Is there some special dependency I don't know about?
I'm using version 5.6.0 (latest stable) of the OData v4 package from nuget and compiling against .Net 4.6.
EDIT:
I tried updating the reference to the 5.7.0-rc build of the OData package, but that did solve it either, here's the bit we care about from my packages.config ...
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net46" />
<package id="Microsoft.AspNet.OData" version="5.7.0-rc" targetFramework="net46" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net46" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Cors" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net46" />
<package id="Microsoft.Data.Edm" version="5.6.4" targetFramework="net46" />
<package id="Microsoft.Data.OData" version="5.6.4" targetFramework="net46" />
<package id="Microsoft.OData.Core" version="6.13.0" targetFramework="net46" />
<package id="Microsoft.OData.Edm" version="6.13.0" targetFramework="net46" />
<package id="Microsoft.Spatial" version="6.13.0" targetFramework="net46" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net46" />
</packages>
I'm using a few other things like ninject to do some DI stuff but I have not included those here to keep the question short.
Ok it turns out for some reason there was version 5.5.1.0 of the package in my bin folder which it was choosing to pick up despite an assembly binding to tell it to use the later 5.7.0.0 version.
Also to really mess with my head Microsoft have moved a bunch of stuff around and some using statements had to be changed in my class (possibly why my code was using an older version) ...
Old usings:
using Microsoft.Data.Edm;
using System.Web.Http.OData.Builder;
New usings:
using Microsoft.OData.Edm;
using System.Web.OData.Builder;
using System.Web.OData.Extensions;
It's probably worth noting that as the walkthrough makes no mention of usings or version numbers, it just says "we used OData v4" ... helpful as ever!
I had to dig through the source on codeplex to find the answer but essentially that walkthrough is based on 5.7.0.0 or later of the package.