1 / 10

XML and XSLT and other TLA's

XML and XSLT and other TLA's. XML: more than buzzword compliancy Future of information interchange Leverages Internet and TCP/IP Readable by humans and machines What does XSLT do? Transform XML to: HTML, XML, … Programming Language How to use these? With Java (or other languages) With IE.

Télécharger la présentation

XML and XSLT and other TLA's

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML and XSLT and other TLA's • XML: more than buzzword compliancy • Future of information interchange • Leverages Internet and TCP/IP • Readable by humans and machines • What does XSLT do? • Transform XML to: HTML, XML, … • Programming Language • How to use these? • With Java (or other languages) • With IE

  2. Design Patterns: Abstract Factory • Provide an interface for creating families of related or dependent objects without specifying their concrete classes. • System is independent of how its products are created, composed, represented • Configured with one of multiple families of products • Family of products designed to be used together, this constraint should be enforced • Provide library, but reveal interfaces, not implementations • Makes exchanging product families simple • Supporting new products is difficult

  3. Design Patterns: Decorator • Attach additional responsibilities to an object dynamically. Decorators provide an alternative to subclassing • Add responsibilities dynamically and transparently, without affecting other objects • Withdraw responsibilities • Extension by subclass might be impractical • Decorate a component so that the component and the decorator (container) share the same interface • Lots of little objects that look alike, easy to customize if you understand, but hard to learn

  4. How Java works • The java compiler takes a .java file and generates a .class file • The .class file contains Java bytecodes, the assembler language for Java programs • Bytecodes are executed in a JVM (java virtual machine), the valid bytecodes are specified by Sun • What if third parties create platform/OS specific codes? • IBM has Jikes, a lightning fast compiler, others? • The JVM interprets the bytecodes • JVM is platform/OS specific, must ultimately run the code • Different JVMs will have different performance • Sun has HotSpot, previously the big thing was JITs • Adaptive compilation vs. compile when executed

  5. From JITs to Deoptimization • JITs compile bytecodes when first executed • If we can cache translated code we can avoid re-translating the same bytecode sequence • Spend time compiling things that aren’t frequently executed (optimistic optimization?) • Errors indicate “compiled code” rather than line number • Sun’s HotSpot VM uses a different strategy for performance • Adaptive compilation: save time over JIT, compile “hotspots” rather than everything, uses less memory, starts program faster, … • No method inlining, but uses dynamic deoptimization • Program loads new subclass, compiled code invalid, so …? • What does the class loader do?

  6. Loading .class files • The bytecode verifier “proves theorems” about the bytecodes being loaded into the JVM • These bytecodes may come from a non-Java source, e.g., compile Ada into bytecodes (why?) • This verification is a static analysis of properties such as: • .class file format (including magic number 0xCAFEBABE) • Methods/instances used properly, parameters correct • Stack doesn’t underflow/overflow • … • Verification is done by the JVM, not changeable • Contrast ClassLoader, which is changeable, can modify classes before they’re loaded into the JVM http://securingjava.com http://java.sun.com/sfaq/verifier.html

  7. The ClassLoader • The “boot strap” loader is built-in to the JVM • Sometimes called the “default” loader, but it’s not extensible or customizable the way other loaders are • Loads classes from the platform on which the JVM runs (what are loader and JVM written in?) • Applet class loader, RMI class loader, user loaders • Load .class files from URLs, from other areas of platform on which JVM runs • A class knows how it was loaded and new instances will use the same loader • Why implement a custom loader? • Work at Duke with JOIE

  8. Applications and Applets • An applet is a program delivered via the web • security issues, sandbox model • where does code/images/etc come from? How is it delivered? • what browsers support JDK 2.0 out-of-the box? • Use IE/Netscape with plugin, use Opera as is, use appletviewer for debugging, testing • Possible to wrap up lots of classes in a .jar file • java archive, similar to a tar file, possible to include .class files, .au, .gif, etc, so all code transferred at once

  9. CGI: Common Gateway Interface • http://hoohoo.ncsa.uiuc.edu/cgi/overview.html • How do programs running on the server communicate with clients over the web? • Can do simple UI stuff in HTML: textfield, buttons, radio buttons, select/choicebox, checkbox, … • Communicate choices to client program via “parameters” • The communication is done by encoding text in a string that’s passed to program running on server • Server program can be written in Perl, C, C++, Java, … • Two forms of communication: get and post • Post is more robust, no limit on size of string sent

  10. Setting up CGI programs • http://www.oit.duke.edu/sa/cgi/ • Request a CGI key • Create a directory and give cgi.ola rliw permission • Put code in the directory, html pages can live anywhere • Debugging is tricky, probably want to debug from the command-line rather than over the web • Be sure to send appropriate header to start HTML page from server program when sending to client/browser • Missing header causes “internal server” or other error • See code examples and HTML sample for details • Server must parse arguments • Replace “+” with “ “, look for %xx args, replace them

More Related