Liferay6 : Jsr168Dispatcher Struts2 class - liferay-6

I am using Liferay 6 and Struts 2 , and assume that this is Liferay 6 is according to JSR 268 complaint
org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher
I have seen a example of Liferay6 and Struts2 on to net in which the portlet.xml consists of this .
<portlet>
<portlet-name>TestPortlet</portlet-name>
<display-name>TestPortlet</display-name>
<portlet-class>org.apache.struts2.portlet.dispatcher.Jsr168Dispatcher</portlet-class>
</portlet>
This example works fine , but still i want to know if we would misss any of the features ??
PLease tell me if this portlet.xml is valid as it specificies jsr 168 version of Struts classs ??
Or should we use jsr 268 struts2 Portlet class ??

Use org.apache.struts2.portlet.dispatcher.Jsr286Dispatcher:
http://struts.apache.org/2.3.1/struts2-plugins/struts2-portlet-plugin/apidocs/org/apache/struts2/portlet/dispatcher/Jsr286Dispatcher.html
It extends Jsr168Dispatcher with Portlet 2 (JSR286) specific features - resources serving, events handling etc.
Though if you don't need those you could stick with Jsr168Dispatcher - your web.xml would remain valid. It's just you would miss our JSR286 features.

Related

Problem using fdpf in joomla4 : class not found

I'm converting a Joomla 3 component to make it compatible with Joomla 4.
I'm having an issue when trying to use fpdf.
In joomla 3, the fpdf file was included like this at the top of the model : include('./components/com_mycomp/libraries/fpdf/morepagestable.php');
Then the pdf class was called this way in a function : $pdf=new PDF('P','mm','A4');
I did the same in Joomla 4 but got the following error : Class 'Mycomp\Component\Mycomp\Administrator\Model\PDF' not found
Still haven't found the correct way to include the class
Thanks in advance for your help

How to generate validators file only for message that contains validate rules?

How to generate validator file only for message that contains validates rules ?
In the example below, actually sbt compilation generates 4 scala classes: one for protobufA, one for protobufB and one validator message for both.
int32 id = 1;
string action = 2 [(validate.rules).string = {in: ["tonic", "gin", "martini"]}];
}
message protobufB {
option (scalapb.message).annotations = "#JsonNaming(classOf[SnakeCaseStrategy])";
int32 id = 1;
string name = 2 ;
}
I would like to generate only three classes : one for protobufA, one for protobufB and the last for protobufA validator classes.
I have version 0.1.3 of scalapb-validate-codegen.
There is currently (as of version 0.2.1 of scalapb-validate) no way to suppress the generation of validation classes once you add the validation plugin. The only way, right now to do that would be to separate the messages you don't want to have validators for to separate SBT subprojects which doesn't have the validator plugin turned on.
Feel free to start a github issue on scalapb-validate github to discuss this as a feature request, and include also the motivation for a change like this. This would require some thought since messages that have validators require all the message that they transitively reference to have validators as well, so the plugin would have to detect this situation when disabling generation.

AEM 6.1 configuration for Search Sugesstion and StopWords

We are using AEM6.1 and implementing OOTB search functionality. The requirement is that we have to implement StopWords(will not user to search common words such as like,for,is) and Spellcheck(Did you mean ?) features as part of this implementation.Can anyone suggest as the best way to achieve this requirement.
Thanks
You can configure stopwords in your oak index definition.
-fulltextIndex
- jcr:primaryType = "oak:QueryIndexDefinition"
- compatVersion = 2
- type = "lucene"
- async = "async"
+ analyzers
+ default
- class = "org.apache.lucene.analysis.standard.StandardAnalyzer"
- luceneMatchVersion = "LUCENE_47" (optional)
+ stopwords (nt:file)
Please check the following documentation on Oak[1].
To see more details on this it is better to follow the JIRA story on the Jackrabbit Oak Jira[2]. This was part of Oak1.1.2 and since AEM6.1 comes with Oak1.2.2, you should be able to configure the stop words directly.
[1] - https://jackrabbit.apache.org/oak/docs/query/lucene.html
[2] - https://issues.apache.org/jira/browse/OAK-2177

JASIG Central Authentication Service 4, custom authentication and custom exception

i upgrading CAS from 3.5.2 to 4.
In version 3.5.2, i create a CustomAuthentication class extends AbstractJdbcUsernamePasswordAuthenticationHandler to do my custom authentication and throw exception based i needs
example:
throw new BadCredentialsAuthenticationException("error.accountNotExist");
so in message.properties i just add error.accountNotExist=Account not exist.
then the front end will return the string above.
how ever in CAS version 4, AbstractJdbcUsernamePasswordAuthenticationHandler has changed. not support BadCredentialsAuthenticationException anymore. So how to do it in cas version 4 in order to return any custom string that i want?
since no 1 answer, and i try find out by my own.
steps to add custom exceptions
1 create new exceptions class extends LoginException
2 in messages.properties add corresponding message for new added exceptions
3 in login-webflow.xml --> handleAuthenticationFailure action-state add <transition on="<yourCustomExcception>" to="generateLoginTicket"/>
4 create a CustomAuthenticationExceptionHandler.java, copy original source code, and add new exception into DEFAULT_ERROR_LIST
5 in cas-servlet.xml replace authenticationExceptionHandler to your CustomAuthenticationExceptionHandler

zend + doctrine 2 doctrine manager, where is it?

i see everyone using this:
Doctrine_Manager::getInstance()
when i do this, its error is:
Class 'Doctrine_Manager' not found
how do i load this ?so that i can start get instances from doctrine manager?
i want to load this:
$con = Doctrine_Manager::getInstance()->connection();
$st = $con->execute("...............");
$result = $st->fetchAll();
where can autoload this , so i can call the getInstance() function from anywhere?
thanks...
Doctrine_Manager is part of version 1.2, not 2. If you are actually using 1.2, you need to let the autoloader know to load classes under the Doctrine_ prefix.
To do so, add this to your application configuration file...
autoloaderNamespaces.Doctrine = "Doctrine_"
You also need to ensure the doctrine classes can be found on the include path. If they aren't in your "library" folder or otherwise part of the include_path directive, add this...
includePaths.Doctrine = "/path/to/Doctrine-1.2/lib"
I think you might be looking for the EntityManager?
If so, here you can find a tutorial how to configure.
Also there is a library call Bisna for integrating ZF+Doctrine2, here is a good tutorial video for configuring it