-
-
Save nixn/9509e2d87acb924c150a92c4ecfdb675 to your computer and use it in GitHub Desktop.
appserver HelloWorld Servlet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// file /opt/appserver/webapps/hello/WEB-INF/classes/nix/Hello/Servlet.php | |
namespace nix\Hello; | |
use AppserverIo\Psr\Servlet\Annotations\Route; | |
use AppserverIo\Psr\Servlet\Http\HttpServlet; | |
use AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface as Request; | |
use AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface as Response; | |
/** | |
* @Route(name="hi", urlPattern={"/hi.do"}) | |
*/ | |
class Servlet extends HttpServlet | |
{ | |
public function doGet(Request $request, Response $response) | |
{ | |
$response->appendBodyStream("Hello from servlet!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
error: appserver stderr | [2018-12-26 18:38:13] - 1fe5dbbb9d3f (error): exception 'Doctrine\Common\Annotations\AnnotationException' with message '[Semantical Error] The annotation "@AppserverIo\Psr\Servlet\Annotations\Route" in class nix\Hello\Servlet does not exist, or could not be auto-loaded.' in /opt/appserver/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54