HIP-HOP od THE YELLOW SPORT SHOES , 57.0 x 57.0 cm, oil timber , 2009
Thursday, December 31, 2009
Sunday, December 27, 2009
Home Phone Service Providers Ontario
Scala Scala Servlets
A nice example of how familiar Java programming "feels" in Scala are Servlets :
Within
The structure of the web application corresponding to the JavaEE standard:
of the Scala compiler produces Java byte code ends up in
To compile the servlet class must have the servlet API on the build path (class path) are located. This can be done servlet example from the Tomcat installation directory
Now we improve the first Scala Servlet and separate display and control each other a little better:
for a "full" web application is missing a form. Here we go:
A nice example of how familiar Java programming "feels" in Scala are Servlets :
package com.muchsoft.scala.servletsThe looks around as Java, right? Not quite: When importing we can make Redefinitions that
import javax.servlet.http.HttpServlet import javax.servlet.http
. HttpServletRequest {=> Request, HttpServletResponse
=> Response}
MeinErstesScalaServlet class extends HttpServlet {override def
doGet (request: Request, response: response) {
val output =
\u0026lt;html>
\u0026lt; head> Scala \u0026lt;title> Hello \u0026lt;/ title> \u0026lt;/ head>
\u0026lt;body>
\u0026lt;h1> Scala Hello World \u0026lt;/ h1>
\u0026lt;/ body>
\u0026lt;/ html>
response.getWriter (). Print (output)
}}
override before the method definition is mandatory, also a key word and no annotation. The return type of method doGet ()
is not specified and thus corresponds to the Java
void. For Scala we had before the opening curly Clamp methods : Unit =
can write. doGet Within
()
we put the issue on XML literal
(as non-modifiable value
val; with var
scale variables, one tries to avoid in functional languages). This XML literal, we write as usual in the output stream of the Response object. The type of output
is scala.xml.Elem
. The structure of the web application corresponding to the JavaEE standard:
of the Scala compiler produces Java byte code ends up in
WEB-INF/classes
. The Scala standard library scala-library.jar
be delivered (from the Scala installation directory) must be in WEB-INF/lib
with. In WEB-INF/web.xml
we map the class
com.muchsoft.scala.servlets.MeinErstesScalaServlet to the URL "hallo.scala. After you deploy (deployment), for example in Tomcat or GlassFish the servlet in the Web browser will be invoked with the URL http://localhost:8080/halloscala/hallo.scala . To compile the servlet class must have the servlet API on the build path (class path) are located. This can be done servlet example from the Tomcat installation directory
-api.jar
or from the GlassFish directory javaee.jar
embed as an external library. Now we improve the first Scala Servlet and separate display and control each other a little better:
MeinZweitesScalaServlet class extends HttpServlet {
def output =
\u0026lt;html>
\u0026lt;head> \u0026lt;title> Scala Hello \u0026lt;/ title> !; \u0026lt;/ head>
\u0026lt;body>
\u0026lt;h1> Scala Hello World \u0026lt;/ h1>
\u0026lt;p> time on the server: {now} \u0026lt;/ p>
\u0026lt;/ body>
\u0026lt;/ html>
def now = new java.util.Date
override def doGet (request: Request, response: response) {.
response.getWriter () print (output)
}}
output
is now a function outside of doGet ()
, which relies on the function now
to output a current time stamp. Both functions are defined without parameters brackets and must be called without parentheses. If we had defined the parameters of functions with empty parentheses, we could have chosen it when you call us not if we write down the brackets or. It has been the convention developed to omit the brackets in the definition, if a function, no side effects (side effects) has. for a "full" web application is missing a form. Here we go:
MeinDrittesScalaServlet class extends HttpServlet {JSF, Wicket
def output (username: String) =
\u0026lt;html>
\u0026lt;head> \u0026lt;title> Scala Hello World \u0026lt;/ title> \u0026lt;/ head>
\u0026lt;body> ;
\u0026lt;h1> Hello {username} \u0026lt;/ h1>
\u0026lt;p> time on the Server: {now} \u0026lt;/ p>
\u0026lt;form method="get" action="hallo3.scala">
\u0026lt;p> What's your name?
\u0026lt;input name="benutzer"
/> \u0026lt;input type="submit" value="Submit"
/> \u0026lt;/ p>
\u0026lt;/ form>
\u0026lt;/ body>
\u0026lt; / html>
def now = new java.util.Date
override def doGet (request: Request, response: response) {val
param = getParameter request "user"
val = username
if ((param == null) is mapped in web.xml
to the URL "hallo3.scala" may be the call in the local application server with
http://localhost:8080/halloscala/hallo3.scala?benutzer=Thomas
.
In practice, you probably do not servlets programming more direct, but a framework like Struts
,
etc. . Insert We see here but well, how easy it into existing Java-Scala (web) applications can integrate. And if you want to develop web applications really functional, you can use the Scala Lift
framework.
Saturday, December 12, 2009
My Mom Blocked Number
ECMAScript 5
Until a few years ago you had to regularly point out, that Java
not
this is definitely different for some time. JavaScript is accepted in the front end, and there are no serious discussions over whether to disable it in the browser.
RIA is not without JavaScript. A week ago, now the specification of ECMAScript 5 , the official standard for JavaScript was released. The new ECMAScript version was released almost exactly ten years after the last release, ECMAScript 3 (Version 4 was omitted). Besides many small improvements and a "strict" mode is now JSON
Until a few years ago you had to regularly point out, that Java
not
JavaScript, and JavaScript as the programming language has been - despite Objektbasierung and functional aspects - not taken seriously. With Web 2.0
and Ajax this is definitely different for some time. JavaScript is accepted in the front end, and there are no serious discussions over whether to disable it in the browser.
RIA is not without JavaScript. A week ago, now the specification of ECMAScript 5 , the official standard for JavaScript was released. The new ECMAScript version was released almost exactly ten years after the last release, ECMAScript 3 (Version 4 was omitted). Besides many small improvements and a "strict" mode is now JSON
included in the standard. With this data format can compact JavaScript objects are transmitted through the network.
me for ECMAScript is interesting in that it is now over ten years ago that I used for the web browser iCab a JavaScript engine (interpreter), first based on ECMAScript 2, after 1999, then developed based on ECMAScript 3 had. iCab has its rendering engine (and thus the JavaScript runtime environment) but now switched to Apple's WebKit , but the implementation of such a core browser component gave a great insight behind the scenes look at the technical, like the Web up to (and even) now works. How time flies ...
Thursday, December 10, 2009
Pinewood Derby Car Star Wars Templates
Hello Java EE 6! Galileo
Three and a half years after the Sun Java EE 5 has announced the final specification of Java EE released six
. Part of which include the specifications for EJB 3.1, JPA 2.0 and JSF 2.0.
The download of the Java EE 6 SDK contains the Application Server GlassFish v3 as a reference implementation (in addition to examples with documentation).
is also available at the JEE 6 and GlassFish v3 custom development environment NetBeans 6.8
. Eclipse users find the appropriate plugin.
who already Java enterprise projects developed on the basis of JEE 5, the conversion should not go to the new version too difficult - if the application server used
Three and a half years after the Sun Java EE 5 has announced the final specification of Java EE released six
. Part of which include the specifications for EJB 3.1, JPA 2.0 and JSF 2.0.
The download of the Java EE 6 SDK contains the Application Server GlassFish v3 as a reference implementation (in addition to examples with documentation).
is also available at the JEE 6 and GlassFish v3 custom development environment NetBeans 6.8
. Eclipse users find the appropriate plugin.
who already Java enterprise projects developed on the basis of JEE 5, the conversion should not go to the new version too difficult - if the application server used
compatible with the new specification.
A three-part introduction to Java EE 6 Sun published here. Tuesday, December 8, 2009
Uncommon Wedding Readings
Eclipse 3.5, software updates, and proxy connections as
Depending on the network environment with Eclipse, there are always problems when you install plug-ins (via the menu Help> Install New Software ... ) and the automatic updating of installed extensions (via Help> Check for Updates
). Reason usually are proxies of the Eclipse did not support use protocols, and spend firewalls that separate certificates for https connections.
If you have the certificate of the firewall (usually a file with the extension *. cer ), you can import it into the keystore of the Java installation. Which Java Installation of Eclipse is used, you can find under About Eclipse> installation details> Configuration
. Under Windows, the call of the
keytool command line command such as
C: \\ \\ Program Files \\ Java jre6 \\ bin \\ import keytool-v
-file PfadZumZertifikat
Another problem is posed
following line:
Depending on the network environment with Eclipse, there are always problems when you install plug-ins (via the menu Help> Install New Software ... ) and the automatic updating of installed extensions (via Help> Check for Updates
). Reason usually are proxies of the Eclipse did not support use protocols, and spend firewalls that separate certificates for https connections.
If you have the certificate of the firewall (usually a file with the extension *. cer ), you can import it into the keystore of the Java installation. Which Java Installation of Eclipse is used, you can find under About Eclipse> installation details> Configuration
. Under Windows, the call of the
keytool command line command such as
C: \\ \\ Program Files \\ Java jre6 \\ bin \\ import keytool-v
-file PfadZumZertifikat
-keystore C: \\ Program Files \\ Java \\ jre6 \\ lib \\ security \\ cacerts Enter the keystore password: changeit
"changeit is the default password of the keystore, if you have not changed. Another problem is posed
NTLMv2 proxy server, since the Eclipse 3.5 can not be directly supported. In addition to the proper setup to add the proxy address and authentication data
under Preferences> General> Network Connections in the file must eclipse.ini (in the Eclipse program directory) at the end
following line:
-Dorge . eclipse.ecf.provider.filetransfer.excludeContributors = org.eclipse.ecf.provider.filetransfer.httpclient it was in Eclipse 3.5 in the above Preferences page also necessary in the "Active provider" set to "Native". In Eclipse 3.5.1 works set to "Manual".
Subscribe to:
Posts (Atom)