vbHelloServlet.vb
' Copyright (c) 1998-2005 Servertec. All Rights Reserved.
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'
' THIS NOTICE MUST NOT BE ALTERED NOR REMOVED.
'
' CopyrightVersion 1.0
Namespace iws.net.vb.examples
Public Class vbHelloServlet
Inherits BaseServlet
Public Overloads Overrides Sub service(ByVal _request As stec.iws.Request, ByVal _response As stec.iws.Response)
Dim writer As java.io.PrintWriter = _response.getWriter()
writer.println("")
writer.println("Visual Basic .NET Example Servlet")
writer.println("")
writer.println("Hello from VB .NET Servlet.
")
writer.println("")
writer.println("")
End Sub
End Class
End Namespace
==================================================
BaseServlet.vb
' Copyright (c) 1998-2005 Servertec. All Rights Reserved.
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program; if not, write to the Free Software
' Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'
' THIS NOTICE MUST NOT BE ALTERED NOR REMOVED.
'
' CopyrightVersion 1.0
Namespace iws.net.vb.examples
Public MustInherit Class BaseServlet
Inherits javax.servlet.http.HttpServlet
Public Overloads Overrides Sub service(ByVal _request As javax.servlet.http.HttpServletRequest, ByVal _response As javax.servlet.http.HttpServletResponse)
Dim request As stec.iws.Request = DirectCast(_request, stec.iws.Request)
Dim response As stec.iws.Response = DirectCast(_response, stec.iws.Response)
Dim charset As String = request.getCharset()
If charset Is Nothing Then
charset = stec.iws.iws.getDefaultCharset()
End If
Dim content_type As String = "text/html"
If Not (charset Is Nothing) Then
content_type = content_type + "; charset=" + charset
End If
_response.setContentType(content_type)
Dim language As String
Dim locale As java.util.Locale = request.getLocale()
If locale Is Nothing Then
language = stec.iws.iws.getDefaultLanguage()
Else
language = locale.ToString()
End If
If Not (language Is Nothing) Then
response.setHeader("Content-Language", Replace(language, "_", "-"))
End If
service(request, response)
End Sub
Public MustOverride Overloads Sub service(ByVal _request As stec.iws.Request, ByVal _response As stec.iws.Response)
End Class
End Namespace