L'agile Tour, un des grands rendez-vous autour des démarches de développement agile, se produit sur Lille le 10 novembre 2011.
Pour plus d'information, consultez le programme
Pour s'inscrire c'est par ici
L'agile Tour, un des grands rendez-vous autour des démarches de développement agile, se produit sur Lille le 10 novembre 2011.
Pour plus d'information, consultez le programme
Pour s'inscrire c'est par ici
Petite astuce pour utiliser Git à travers un proxy: positionner une variable d'environnement http_proxy (ou https_proxy dans mon cas) de la manière suivante:
$> export http_proxy="http://proxy.host.dom:1234"
et pour l'HTTPS:
$> export https_proxy="https://proxy.host.dom:1234"
Le clonage devient tout de suite plus simple
$> git clone http[s]://[username@]forge.host.dom/mon/repo.git
Voilà!
configure.sh situé dans le dossier MW_HOME pour le faire utiliser /bin/bash en lieu et place de /bin/sh/var/local/wlsdomains/localdomain en utilisant l'interface graphique via le script $MW_HOME/wlserver/common/bin/config.sh$JAVA_HOME/bin/jvisualvm, ou alors utiliser JConsole présent depuis la JDK 1.5 dans $JAVA_HOME/bin/jconsole
GET http://www.google.com/
Accept: application/xml, application/json, text/plain
HTTP/1.1 200 OK
<html>
...
</html>
Content-Type: text/html
http://people.host.ext/user/guillaume.wallet/messages/20110101
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.sample.jersy</groupId>
<artifactId>jersey-sample</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<inceptionYear>2011</inceptionYear>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.8</version>
<configuration>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6</classpathContainer>
</classpathContainers>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>${tomcat.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<tomcat.version>7.0.12</tomcat.version>
</properties>
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
</project>
package org.sample.jersey.rest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
/**
* Une ressource polie.
*/
@Path( "/hello/{world}" )
public class HelloWorldResource
{
@GET
@Produces("text/plain")
public String greet(@PathParam("world") String world)
{
return "Hello " + world;
}
}
package org.sample.jersey.rest;
import javax.ws.rs.ApplicationPath;
import com.sun.jersey.api.core.PackagesResourceConfig;
/**
* La racine de l'application REST.
*/
@ApplicationPath( "/resources" )
public class SampleRESTApplication
extends PackagesResourceConfig
{
/**
* On explique à JERSEY que les Resources sont dans le paquet org.sample.jersey.rest.
*/
public SampleRESTApplication()
{
super( "org.sample.jersey.rest" );
}
}
http://localhost:8080/<nom>/resources/hello/World
package org.sample.jersey.rest;
import java.util.HashMap;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.json.simple.JSONObject;
/**
* Gestion des gens.
*/
@Path( "/users/{username}" )
public class PeopleResource
{
@GET
@Produces( "application/json" )
public String showUserAsJSON( @PathParam( "username" ) String username )
{
User user = findUserByUsername( username );
return user.toJSON();
}
@GET
@Produces( "text/plain" )
public String showUserAsTextPlain( @PathParam("username") String username )
{
User user = findUserByUsername( username );
return user.toString();
}
public PeopleResource()
{
users.put( "guillaume.wallet", new User( "guillaume.wallet", "Guillaume", "Wallet" ) );
users.put( "linus.torvalds", new User( "linus.torvalds", "Linus", "Torvalds" ) );
}
private User findUserByUsername( String username )
{
User user = users.get( username );
return user;
}
/* Une vraie BDD. */
private HashMap users = new HashMap();
/**
* Euh, ... un utilisateur quoi!
*/
private static class User
{
private String username;
private String firstname;
private String lastname;
public User( String username, String firstname, String lastname )
{
super();
this.username = username;
this.firstname = firstname;
this.lastname = lastname;
}
@SuppressWarnings( "unchecked" )
public String toJSON()
{
JSONObject me = new JSONObject();
me.put( "username", username );
me.put( "firstname", firstname );
me.put( "lastname", lastname );
return me.toJSONString();
}
@Override
public String toString()
{
return String.format( "%1s %2s", firstname, lastname );
}
}
}
$> wget --header "Accept: application/json" http://localhost:8080/<nom>/resources/users/guillaume.wallet
$> wget --header "Accept: text/plain" http://localhost:8080/<nom>/resources/users/guillaume.wallet