Unsubscribe newsletter

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Unsubscribe newsletter

Postby Ardito » 19 Nov 2022, 13:01

Hi,
I have a newsletter system, I want to insert an unsubscribe button in the email, how can I make an HTML GET or POST request that can communicate with SFS2X?

Best regards
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unsubscribe newsletter

Postby Lapo » 20 Nov 2022, 07:32

Hi,
you can check this article --> https://smartfoxserver.com/blog/integra ... xtensions/

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 21 Nov 2022, 09:57

I don't think the documentation you sent reflects my question.

I have to put an Unscribe button in the email that users of my newsletters receive, in the documentation you provide it can be done from the client or from the server.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unsubscribe newsletter

Postby Lapo » 21 Nov 2022, 14:25

Sorry, wrong article indeed.
Please refer to this tutorial --> https://smartfoxserver.com/blog/http-re ... tegration/

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 21 Nov 2022, 22:20

Thank you!!
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 22 Nov 2022, 16:17

I copied the guide perfectly, but I keep getting this error:

Code: Select all

GRAVE: Allocate exception for servlet [ExtensionTest]
java.lang.ClassNotFoundException: sfs2x.test.http.ExtensionHTTPFacade
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1407)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1215)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:538)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:519)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:149)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1070)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:788)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:128)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
        at sfs2x.ws.tomcat.shared.WSUpgradeFilter.invoke(WSUpgradeFilter.java:75)
        at org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:555)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:829)

My setup:
Eclipse Packages:
Eclipse Packages.png
(3.79 KiB) Not downloaded yet

SFS2X:
SFS2X.png
(31.7 KiB) Not downloaded yet

Folder www:
Folder www.png
(7.09 KiB) Not downloaded yet

web.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<web-app
   xmlns="http://xmlns.jcp.org/xml/ns/javaee"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
   metadata-complete="false"
   version="3.1">
    <display-name>SFS2X Test</display-name>
    <servlet>
        <servlet-name>ExtensionTest</servlet-name>
        <servlet-class>sfs2x.test.http.ExtensionHTTPFacade</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ExtensionTest</servlet-name>
        <url-pattern>/ExtensionTest</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
</web-app>
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 23 Nov 2022, 11:28

Is it possible to get support?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unsubscribe newsletter

Postby Lapo » 23 Nov 2022, 14:14

The servlet is not deployed correctly.
Please check the screenshot in the article, it shows exactly how the structure of the .war should be.

From what I can see you have deployed a jar file under the package structure, which is incorrect.
Also I don't think it's a good idea to keep the classes in the same project in your IDE because one file must be deployed as a normal .jar library (Extension) and the other as .war file with its servlet structure.

Two separate projects is probably better.

Thanks
p.s. = from the screenshot it looks like you're still using the old Flash AdminTool with the latest SFS2X 2.18.x
I would highly recommend to switch to the native HTML AdminTool, as you're missing many features that have been added since 2.14
Lapo

--

gotoAndPlay()

...addicted to flash games
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 24 Nov 2022, 12:40

Thanks for the information, it's very valuable to me.

I have questions:
1) Is the structure right now?
Servlet.png
(9.73 KiB) Not downloaded yet

2) I have exported the whole project in .WAR, now what should I do with this file?
File_WAR.png
(2.63 KiB) Not downloaded yet

3) If I understood correctly the "SimpleSumExtension" class must be in the main project of the server and distributed in the server as .jar extension, while "ExtensionHTTPFacade" must be in another project and distributed under the "www" folder as .war, it's correct?
3) How do I use the native HTML AdminTool?
4) What should I put inside the "ext" folder? All my main server project .jar extensions or just the "SimpleSumExtension" extension?

Thanks for the support, it's vital for me
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Unsubscribe newsletter

Postby Lapo » 24 Nov 2022, 15:16

Hi,
1) Under WEB-INF/ you need a folder called classes/ which will contain your Java packages.
Also you're missing the web.xml file in the archive.
In other words:

Code: Select all

WEB-INF/
    classes/
        ... your package(s) here ...
       
    web.xml

If you check the article I've linked you can see exactly how the folders are organized.
https://smartfoxserver.com/blog/http-re ... tegration/

2)
Check the article under the "Putting it all together" section.

3)
Yes

How do I use the native HTML AdminTool?

Point your browser to your server's IP or domain ---> Example: http://my.domain:8080/admin
Also check the docs:
http://docs2x.smartfoxserver.com/Gettin ... /admintool

4) What should I put inside the "ext" folder? All my main server project .jar extensions or just the "SimpleSumExtension" extension?

What is the "ext" folder? Do you mean the SFS2X/extension/ folder?
If so, yes only the Extension code.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 25 Nov 2022, 12:23

Thanks, you cleared up a lot of my doubts.

My new Eclipse setup is this:
Exlipse.png
(99.96 KiB) Not downloaded yet


In your guide I see an "ext" folder, but I don't understand what goes inside
screen guide.png
(38.82 KiB) Not downloaded yet


What should I do with the .war file?

In your documentation I see "ExtensionHTTPFacade.class", but how do I export to .class?
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 25 Nov 2022, 14:15

Updates:

This is my structure on Eclipse: (The .dlls are inside the "classes" folder)
Eclipse.png
(86.07 KiB) Not downloaded yet


This is my web.xml file
web.png
(18.1 KiB) Not downloaded yet

The extension in the server loaded successfully, but when I try the link: http://localhost:8080/ExtensionTest/Ext ... ,50,112,88

I get: HTTP Status 404 - Not Found
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 28 Nov 2022, 12:30

Is it possible to get support?
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 28 Nov 2022, 14:34

I figured out how to use the .war file, just put it in the WWW folder, anyways I get this error:

Code: Select all

nov 28, 2022 3:41:16 PM org.apache.catalina.core.ApplicationContext log
INFORMAZIONI: Marking servlet [ExtensionTest] as unavailable
nov 28, 2022 3:41:16 PM org.apache.catalina.core.StandardWrapperValve invoke
GRAVE: Allocate exception for servlet [ExtensionTest]
java.lang.ClassNotFoundException: sfs2x.test.http.ExtensionHTTPFacade
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1407)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1215)
        at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:538)
        at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:519)
        at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:149)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1070)
        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:788)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:128)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
        at sfs2x.ws.tomcat.shared.WSUpgradeFilter.invoke(WSUpgradeFilter.java:75)
        at org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:555)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
        at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.base/java.lang.Thread.run(Thread.java:829)


But my code and struct I think are correct
Ardito
Posts: 128
Joined: 12 Sep 2016, 11:26
Location: Italy

Re: Unsubscribe newsletter

Postby Ardito » 28 Nov 2022, 15:14

i solved!!
My class packages were in the wrong location, I should have placed them in "Java Resources" and not in the http folder!!

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 60 guests