掲示板

Embeeding applet in Liferay portlet

9年前 に Marko Perić によって更新されました。

Embeeding applet in Liferay portlet

Junior Member 投稿: 52 参加年月日: 14/09/03 最新の投稿
Hello guys,

I'm trying to embeed my authentication applet to portlet for sign-in purposes, but I have stuck at the beginning. This is my code snippet:


    	<applet code="applet.SelCertAf" archive="smartauth.jar" width="500px" height="200px">
            <param name="SubmitFunction" value="Submit">
                    <param name="Name" value="CName">
                    <param name="Surname" value="CSurname">
        </applet>


But, I'm getting error in the browser all the time saying it can't find SelCertAf class. I've tried to put smartauth.jar on many places, in Tomcat/lib/ext, in lib folder of portlet, etc. but I'm getting this error all the time.

So, I tried to embeed portlet without Liferay, on clean Tomcat installation:
1) Eclipse - When I tried in Eclipse (added smartauth.jar in lib folder) it still didn't work,

2) Then I tried in Netbeans, same jsp, and added smartauth.jar to Libraries folder (right-click->add JAR ), and it have started without any problem.

I'm struggling with that for 10 hours now, and I'm confused and losing ideas. I suppose that problem is with Eclipse organizing added libraries, in Netbeans is much easier because there is just one Libraries folder. Can you tell me where I have to put my smartauth.jar so it can be found? Or maybe some other thing?

P.S. I tried with codebase attribute also, but it worked in Netbeans without it. "applet" in applet.SelCertAf is name of a package.
.

添付ファイル:

9年前 に Marko Perić によって更新されました。

RE: Embeeding applet in Liferay portlet

Junior Member 投稿: 52 参加年月日: 14/09/03 最新の投稿
Hi,

I managed to solve problem in Eclipse (without Liferay, just clean Tomcat and "dynamic web project") by addding smartauth.jar in WebContent folder and by adding "." (dot) in codebase attribute:


       <applet code="applet.SelCertAf" codebase="." archive="smartauth.jar" width="500px" height="200px">
            <param name="SubmitFunction" value="Submit">
                    <param name="Name" value="CName">
                    <param name="Surname" value="CSurname">
        </applet>


Now, I've got working applet (on clean Tomcat) in my browser, but I can't manage to solve problem on Liferay because it has different folder structure. I put jar in docroot folder but it doesn't works. Also, I tried put jar in folder "applet" and codebase="/applet", doesn't work also.

Any idea?
9年前 に Marko Perić によって更新されました。

RE: Embeeding applet in Liferay portlet

Junior Member 投稿: 52 参加年月日: 14/09/03 最新の投稿
Solved!

Maybe it will be useful for somebody in the future, it isn't enough to put just codebase=".", after I put:
 codebase="${pageContext.request.contextPath}"

applet showed up, finally...
6年前 に Yidnekachew Worku によって更新されました。

RE: Embeeding applet in Liferay portlet

New Member 投稿: 8 参加年月日: 15/03/25 最新の投稿
Hello Boss,
I'm facing the same problem now, (Im glad you already solved it) and I cannot even figure out how you solved it.
May I ask where you put your .jar file(s)
here is my applet tag
<applet code="com.futronictech.ScanDemoJApplet"
codebase="./${pageContext.request.contextPath}/views" width="500px"
archive="FtrScanApplet.jar"
height="200px"> </applet>
I put the jar almost everywhere, no luck.
I need your advice
Thanks
6年前 に Yidnekachew Worku によって更新されました。

RE: Embeeding applet in Liferay portlet

New Member 投稿: 8 参加年月日: 15/03/25 最新の投稿
anyone please, Im having a trouble to get an applet running in my JSF portlet,
any direction is appreciated
Regards
thumbnail
6年前 に Andrew Jardine によって更新されました。

RE: Embeeding applet in Liferay portlet

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Did you try using just ..

codebase="${pageContext.request.contextPath}"


.. without any dots or slashes? From the original thread, this is how I understood the original poster solved the problem.
6年前 に Yidnekachew Worku によって更新されました。

RE: Embeeding applet in Liferay portlet

New Member 投稿: 8 参加年月日: 15/03/25 最新の投稿
Thank you Andrew, for your quick reply,
But I have tried that, and doesn't work,
where can I find some kind of tutorial or guiding document about JSF (xhtml) portlet and applet integration?
I need to integrate a fingerprint machine with my portlet
Thank you sir
thumbnail
6年前 に Andrew Jardine によって更新されました。

RE: Embeeding applet in Liferay portlet

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Hi Yidnekachew,

But I have tried that, and doesn't work,


Shoot -- was hoping it was just a poorly worded answer. I don't have any applets to try anything out so I was just hoping that I had read the response differently and you and found something in the text that you hadn't.

where can I find some kind of tutorial or guiding document about JSF (xhtml) portlet and applet integration?
I need to integrate a fingerprint machine with my portlet


I have no idea, and I doubt it exists in the official documentation. I have been working with Liferay for quite some time now and I have never come across a situation where an applet was needed. Given that both Firefox and Chrome have dropped support (some time ago no less) for running java in the browser, I suspect that you are in the minority for what you are trying to do.

You might try the Liferay Community Slack channel. There is a #faces channel that is dedicated to JSF -- the guys in there might be able to help you. Check out: https://communitychat.liferay.com/
6年前 に Yidnekachew Worku によって更新されました。

RE: Embeeding applet in Liferay portlet

New Member 投稿: 8 参加年月日: 15/03/25 最新の投稿
You are right Andrew, applet are going down, but the question is how do they plan to access some devices (like fingerprints) from browsers, what is the plan or existing reality to replace Applets.
per your advice, Im trying to communicate with the slack guys, thank you
but is it possible to find the person who starts this thread, I think he has the solution, since I only need the file structure where I put the jar file.
some kind of email or chat session (excuse me, i didn't use this forum and I don't know how you address questions to the person directly)
Regards
thumbnail
6年前 に Andrew Jardine によって更新されました。

RE: Embeeding applet in Liferay portlet

Liferay Legend 投稿: 2416 参加年月日: 10/12/22 最新の投稿
Your chances of reaching him directly are pretty small I think. Since he started this thread, he should be receiving emails to notify him of the messages you and I have going back and forth. You would have to cross your fingers that he comes back to help out emoticon

As for the answer for applets, I don't have that one for you and I couldn't even have a conversation, an intelligent one anyway, without understanding more about the whole solution including limitations. Either way, to retire the applet sounds like for sure it would involve more than just a few hours of work. With that said, Applets have been a dying animal from years now, so I would say shame on the solution provider for not seeing the writing on the wall and planning for this day emoticon
6年前 に Yidnekachew Worku によって更新されました。

RE: Embeeding applet in Liferay portlet

New Member 投稿: 8 参加年月日: 15/03/25 最新の投稿
Thank you man,
let me hope someone will appear from the heavens to help me
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: Embeeding applet in Liferay portlet

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
In order to launch an applet, the applet needs access to the jar.

That's going to be the key to your problem. The codebase example the guys have posted is a dynamic path, I'd check to see what it evaluates to, but also you need to have your jar in that path so it can be pulled.

So assuming the ${pageContext.request.contextPath} evaluates to your web context such as /o/my-portlet, then for your applet to work you should be able to go to /o/my-portlet/smartauth.jar and it should download to your browser.

If you cannot put the URL in the browser and get the jar as a response, then your applet is not going to work. Once you can download the jar this way, then you have the effective values you need to use for the codebase.

Often times this can be made easier by serving the jar from apache httpd. Create the /applet dir in your apache httpd html directory and drop the smartauth.jar in that folder. Then JkUnmount /applet and /applet/*, and your codebase becomes "http://example.com/applet" and everything is fairly simple.








Come meet me at Devcon 2017 or 2017 LSNA!
thumbnail
6年前 に Neil Griffin によって更新されました。

RE: Embeeding applet in Liferay portlet

Liferay Legend 投稿: 2655 参加年月日: 05/07/27 最新の投稿
I recommend that you try this expression:
codebase="${facesContext.externalContext.requestContextPath}"


For more information, see the Javadoc for ExternalContext.getRequestContextPath().