Primefaces upgrade 8 getScriptsToExecute equivalent - primefaces

Upgraded application from primefaces 5.3.6 to primefaces 8 version.What would be the equivalent of
getScriptsToExecute method from RequestContext in PrimeFaces.current() instance.
Code in bean class:
final List<String> scriptsToExecute = RequestContext.getCurrentInstance().getScriptsToExecute();
scriptsToExecute.add("script1();");
scriptsToExecute.add("script2();");
scriptsToExecute.add("script3();");

PrimeFaces.current().executeScript("script3();");
Please check the documentation next time: https://primefaces.github.io/primefaces/8_0/#/core/javaAPI and the migration guide: https://github.com/primefaces/primefaces/wiki/Migration-Guide

Related

Jersey Migration from 1.x to 2.x

We are migrating our project from jersey 1.X version to 2.X .
public static Filter buildFilter(String s) throws Exception {
JSONJAXBContext context = new JSONJAXBContext(JSONConfiguration.natural().build(),FilterModel.class);
JSONUnmarshaller unmarshaller = context.createJSONUnmarshaller();
FilterModel model = unmarshaller.unmarshalFromJSON(new StringReader(s),
FilterModel.class);
return model.build();
}
So my question is how we can do the changes and compatible the above code to Jersey 2.X ?
Thanks advance.

Microsoft.EntityFrameworkCore 2.1-rc with MySql.Data.EntityFrameworkCore

I'm trying to use mysql with Microsoft.EntityFrameworkCore 2.1-rc-final and MySql.Data.EntityFrameworkCore 8.0.11 as provider. But when I'm trying to execute the mugrations command i get this exception:
System.MissingMethodException: Method not found: 'Void Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommandBuilderFactory..ctor(Microsoft.EntityFrameworkCore.Diagnostics.IDiagnosticsLogger`1, Microsoft.EntityFrameworkCore.Storage.IRelationalTypeMapper)'.
This is my IDesignTimeDbContextFactory code implementation:
public class DesignLocationFactory:IDesignTimeDbContextFactory<LocationDbContext>
{
public LocationDbContext CreateDbContext(string[] args)
{
var builder = new DbContextOptionsBuilder<LocationDbContext>();
builder.UseMySQL("server=localhost;port=3306;user=***;passsword=***;database=locationdb");
return new LocationDbContext(builder.Options);
}
}
Please how can I fix this or at least some sample of how to use with another providers
Finally, with this provider Pomelo.EntityFrameworkCore.MySql version 2.1.0-rc1-final everything works perfect.
To install it execute the command:
Install-Package Pomelo.EntityFrameworkCore.MySql -Version 2.1.0-rc1-final
I can confirm that 2.1.0-rc1-final resolves this issue. Also, take note of Pomelo's case sensitivity vs Microsoft.EntityFrameworkCore.
Pomelo = UseMySql (Sql)
EntityFrameworkCore = UseMySQL (SQL)
Using Core 2.1
Id Versions
-- --------
Microsoft.AspNetCore.App {2.1.0}
Microsoft.VisualStudio.Web.CodeGeneration.Design {2.1.0}
Microsoft.EntityFrameworkCore.Tools {2.1.0}
Microsoft.NETCore.App {2.1.0}
MySql.Data.EntityFrameworkCore.Design {8.0.11}
MySql.Data.EntityFrameworkCore {8.0.11}
Pomelo.EntityFrameworkCore.MySql {2.1.0-rc1-final}

MySql EntityFrameworkCore System.TypeLoadException

I am trying to connect my web API to MySql database with this code:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
string conn_string = "server=server;database=database;uid=uid;pwd=pwd;";
MySqlConnection conn = new MySqlConnection(conn_string);
services.AddDbContext<TaskContext>(options =>
{
options.UseMySQL(conn);
});
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseMvc();
}
}
But I always recieve a System.TypeLoadException with this description:
System.TypeLoadException : 'Method 'Clone' in type
'MySQL.Data.EntityFrameworkCore.Infraestructure.Internal.MySQLOptionsExtension'
from assembly 'MySql.Data.EntityFrameworkCore, Version=8.0.8.0,
Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an
implementation.'
I am using Microsoft Visual Studio Community 2017 Preview (2) and my projet is in .NET Core 2.0. I also use MySql.Data.EntityFrameworkCore.dll and Microsoft.AspNetCore.All (2.0.0-preview2-final). I have changed many times of librairy for MySql but without success.
Any idea why this always happen? What could be the cause?
Well, it turns out that you can't use MySql.Data.EntityFrameworkCore for .Net Core 2.0(for now). I had to go back to .Net Core 1.3 to make it work... We may be able to use it in a near futur tho!
Use Pomelo.EntityFrameworkCore.MySql 2.0.0.
Works fine for me with .NET Core 2.0
Add "Pomelo.EntityFrameworkCore.MySql" package.
in Stertup.cs & appsettings.json & DbContext :
services.AddDbContext<mvccoreContext>(options =>
options.UseMySql(Configuration.GetConnectionString("DefaultConnection")
));
{
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Database=mvccore;User=root;Password=;"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseMySql("");
}
}
MySql.Data.EntityFrameworkCore supports (and is only compatible with) EF Core 2.1. Using mismatched EF Core and DB provider libraries will result in errors similar to the one you reported.
If you need a MySQL EF Core provider that's compatible with EF Core 3.0, your only option right now is the 3.0.0-rc1 version of https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql (see the compatibility table at https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#compatibility)! ).
Otherwise, if you want to stick with MySql.Data.EntityFrameworkCore you'll need to roll back to EF Core 2.1.

securesocial 3.0 doesn't work with play framework 2.3

1.When i upgrade my play framework from 2.2.6 to 2.3.8 and securesocial from 2.1.4 to 3.0-M3. I got the following error. How to fix it?
[error] /Work/test.scala:81: not found: value SecuredAction
[error] def findStats = SecuredAction {
2.The following line used to work but now it gets an error message:trait SecureSocial takes type parameters.How to fix this?
object ToolbarHandler extends Controller with SecureSocial with CookieLang{
3.Request needs a parameter.How to add the parameter though?
def findStats = SecuredAction {
implicit request =>
You have to use the snapshot version.
As stated here : http://securesocial.ws/guide/getting-started.html
add:
resolvers += "Sonatype OSS Snapshots" at "https://repo.typesafe.com/typesafe/snapshots/"
then add the library dependency:
"ws.securesocial" % "securesocial_2.11" % "master-SNAPSHOT"
Hope that helps.

How to configure Tomcat to support primefaces-push (atmosphere)

I'm working with liferay 6.2 (Tomcat 7) and Primefaces 5.0.
I tryed to execute the counter example but not worked. More precisely, I downloaded the showcase 5.0 war from primefaces site.
I read that I have to enable NIO Connector. So, according this reply, I added the connector:
<Connector connectionTimeout="20000" port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
But primefaces push still doesn't work.
What I have to enable in Tomcat in order to make work primefaces push?
I don't know if it is the undocumented specification or it is a bug, but the #PushEndpoint class needs #OnOpen and #OnClose function, even if they are empty.
Add these lines to the #PushEndpoint annotated class:
#OnOpen
public void onOpen( RemoteEndpoint r, EventBus e ) {
}
#OnClose
public void onClose( RemoteEndpoint r, EventBus e ) {
}
For me this was the solution.
It worked for me brother with Prifaces 5, Tomcat 7 and import atmosphere-runtime-2.2.3.jar
without any configuration in web.xml
<h:form>
<p:socket onMessage="bien" channel="/messageDetail" />
</h:form>
<script type="text/javascript">
function bien(data) {
alert("boneo");
//$('.display').html(data);
}
</script>