• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/21

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

21 Cards in this Set

  • Front
  • Back
What is JPDA ?
The Java Platform Debugger Architecture (JPDA) provides the infrastructure you need to build end-user debugger applications for the Java Platform
How to bnd an HTTP parameter to a Java method parameter?
Just declare method parameters with the same name as the HTTP parameters.
How to redirect to an action?
Just call the corresponding Java method and play will generate the correct HTTP “Redirect” response.

public static void show(Long id) {
Article article = Article.findById(id);
render(article);
}


public static void edit(Long id, String title) {
Article article = Article.findById(id);
article.title = title;
article.save();
show(id);
}
What is JPA?
Java Persistence API

Persistence in this context covers three areas:

* the API itself, defined in the javax.persistence package
* the Java Persistence Query Language (JPQL)
* object/relational metadata
What is REST?
REST states a few key design principles:

* Application functionality is divided into resources
* Every resource is uniquely addressable using an URI
* All resources share a uniform interface for the transfer of state between client and resource.
How does the router works?
The conf/routes file is the configuration file used by the Router. This file list all the routes needed by the application. Each route consists of an HTTP method + URI pattern associated to a Java call.

Let’s see what a route definition looks like:

GET /clients/{id} Clients.show
What HTTP methods are there?
* GET
* POST
* PUT
* DELETE
* HEAD
Give examples for dynamic URI
/clients/{id}

or

/clients/{id}/accounts/{accountId}
What is needed to map a controller to an URI?
An URI is mapped to a method of a controller

A Controller class must be defined in the controllers package and must be a subclass of play.mvc.Controller.

The mapping is done in the router file with:
GET /admin admin.Dashboard.index
What is the controller?
a glue between the domain model objects (from the database) and the transport layer events (from the webbrowser)
What is an URI?
Uniform Resource Identifier (URI) is a string of characters used to identify or name a resource on the Internet. Such identification enables interaction with representations of the resource over a network (typically the World Wide Web) using specific protocols.
How can data be retrieved from an HTTP request?
* The URI path: in /clients/1541, 1541 is dynamic part of the URI Pattern.
* The Query String: /clients?id=1541.
* The request body: if the request was sent from an HTML form, the request body contains the form data encoded as x-www-urlform-encoded.
What is the domain object model?
. It’s the domain-specific representation of the information on which the application operates.

Martin fowler defines it as:

Responsible for representing concepts of the business, information about the business situation, and business rules. State that reflects the business situation is controlled and used here, even though the technical details of storing it are delegated to the infrastructure. This layer is the heart of business software.
What is LightTPD?
ighttpd (usually pronounced "Light-TPD", abbreviated "Lighty") is a web server designed to be secure, fast, standards-compliant, and flexible while being optimized for speed-critical environments.
How do you create a new project?
play new [project]
What is the directory structure of the webapp?
app/ contains the core of the application, split between models, controllers and views directories. It can contains other Java package as well. This is the directory where *.java source files live.

conf/ contains all the configuration files of the application, especially the main application.conf file, the routes definition files and the messages files used for internationalization.

lib/ contains all optional Java libraries packaged as standard .jar files.

public/ contains all the publicly available resources, which includes Javascript files, stylesheets and images directories.

test/ contains all the application tests. Tests are either written either as Java JUnit tests or as Selenium tests.
How do you run a play application?
play run [project]
What is the default function of a controller?
public static void index() {
render();
}
What is the most common way to generate an HTTP response?
Render a template from a controller: Using a template is the most common way (but not the only one) to generate the HTTP response.
What are templates?
Templates are simple text files that live in the /app/views directory. Because we didn’t specify a template, the default one for this action will be used: Application/index.html

To see how the template looks like, open the /yabe/app/views/Application/index.html file:

#{extends 'main.html' /}
#{set title:'Home' /}

#{welcome /}

The template content seems pretty light. In fact, all you see are play tags. Play tags are very close to JSP taglib. This is the #{welcome /} tag that generates the welcome message you’ve seen in the browser.
How can I connect to a database?
A database (either in memory or written to the filesystem) can be added by a line in the conf/application.conf file