generování XML vycpávkového článku
authorFrantišek Kučera <franta-hg@frantovo.cz>
Mon, 05 Apr 2010 22:30:08 +0200
changeset 900967d5e3b470
parent 89 59ba044de164
child 91 936ad9853a30
generování XML vycpávkového článku
java/nekurak.net-rest/nbproject/build-impl.xml
java/nekurak.net-rest/nbproject/genfiles.properties
java/nekurak.net-rest/nbproject/project.properties
java/nekurak.net-rest/nbproject/project.xml
java/nekurak.net-rest/src/java/cz/frantovo/nekurak/rest/ClankyREST.java
     1.1 --- a/java/nekurak.net-rest/nbproject/build-impl.xml	Mon Apr 05 22:21:01 2010 +0200
     1.2 +++ b/java/nekurak.net-rest/nbproject/build-impl.xml	Mon Apr 05 22:30:08 2010 +0200
     1.3 @@ -391,8 +391,16 @@
     1.4      <!--
     1.5                  COMPILATION SECTION
     1.6              -->
     1.7 -    <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps"/>
     1.8 -    <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps"/>
     1.9 +    <target depends="init" if="no.dist.ear.dir" name="deps-module-jar" unless="no.deps">
    1.10 +        <ant antfile="${project.nekurak_net-lib}/build.xml" inheritall="false" target="jar">
    1.11 +            <property name="deploy.on.save" value="false"/>
    1.12 +        </ant>
    1.13 +    </target>
    1.14 +    <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps">
    1.15 +        <ant antfile="${project.nekurak_net-lib}/build.xml" inheritall="false" target="jar">
    1.16 +            <property name="deploy.on.save" value="false"/>
    1.17 +        </ant>
    1.18 +    </target>
    1.19      <target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/>
    1.20      <target depends="init,deps-jar,generate-rest-config" name="-pre-pre-compile">
    1.21          <mkdir dir="${build.classes.dir}"/>
    1.22 @@ -528,10 +536,13 @@
    1.23      </target>
    1.24      <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
    1.25      <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
    1.26 +        <copyfiles files="${reference.nekurak_net-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
    1.27          <mkdir dir="${build.web.dir}/META-INF"/>
    1.28          <manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
    1.29      </target>
    1.30 -    <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir"/>
    1.31 +    <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
    1.32 +        <copyfiles files="${reference.nekurak_net-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
    1.33 +    </target>
    1.34      <target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
    1.35          <delete dir="${build.web.dir}/WEB-INF/lib"/>
    1.36      </target>
    1.37 @@ -827,7 +838,9 @@
    1.38                  
    1.39                  CLEANUP SECTION
    1.40              -->
    1.41 -    <target depends="init" if="no.dist.ear.dir" name="deps-clean" unless="no.deps"/>
    1.42 +    <target depends="init" if="no.dist.ear.dir" name="deps-clean" unless="no.deps">
    1.43 +        <ant antfile="${project.nekurak_net-lib}/build.xml" inheritall="false" target="clean"/>
    1.44 +    </target>
    1.45      <target depends="init" name="do-clean">
    1.46          <condition property="build.dir.to.clean" value="${build.web.dir}">
    1.47              <isset property="dist.ear.dir"/>
     2.1 --- a/java/nekurak.net-rest/nbproject/genfiles.properties	Mon Apr 05 22:21:01 2010 +0200
     2.2 +++ b/java/nekurak.net-rest/nbproject/genfiles.properties	Mon Apr 05 22:30:08 2010 +0200
     2.3 @@ -1,10 +1,10 @@
     2.4 -build.xml.data.CRC32=27a024ad
     2.5 +build.xml.data.CRC32=35b9fabc
     2.6  build.xml.script.CRC32=fb1b7f84
     2.7  build.xml.stylesheet.CRC32=c0ebde35@1.21.2.1
     2.8  # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
     2.9  # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
    2.10 -nbproject/build-impl.xml.data.CRC32=27a024ad
    2.11 -nbproject/build-impl.xml.script.CRC32=f658df40
    2.12 +nbproject/build-impl.xml.data.CRC32=35b9fabc
    2.13 +nbproject/build-impl.xml.script.CRC32=41eb3ef9
    2.14  nbproject/build-impl.xml.stylesheet.CRC32=b139b33b@1.21.2.1
    2.15  nbproject/rest-build.xml.data.CRC32=d32e8880
    2.16  nbproject/rest-build.xml.script.CRC32=23da2c77
     3.1 --- a/java/nekurak.net-rest/nbproject/project.properties	Mon Apr 05 22:21:01 2010 +0200
     3.2 +++ b/java/nekurak.net-rest/nbproject/project.properties	Mon Apr 05 22:30:08 2010 +0200
     3.3 @@ -26,7 +26,8 @@
     3.4  j2ee.platform=1.6-web
     3.5  j2ee.server.type=gfv3ee6
     3.6  jar.compress=false
     3.7 -javac.classpath=
     3.8 +javac.classpath=\
     3.9 +    ${reference.nekurak_net-lib.jar}
    3.10  # Space-separated list of extra javac options
    3.11  javac.compilerargs=
    3.12  javac.debug=true
    3.13 @@ -54,6 +55,8 @@
    3.14  lib.dir=${web.docbase.dir}/WEB-INF/lib
    3.15  persistence.xml.dir=${conf.dir}
    3.16  platform.active=default_platform
    3.17 +project.nekurak_net-lib=../nekurak.net-lib
    3.18 +reference.nekurak_net-lib.jar=${project.nekurak_net-lib}/dist/nekurak.net-lib.jar
    3.19  resource.dir=setup
    3.20  rest.config.type=dd
    3.21  rest.support.on=true
     4.1 --- a/java/nekurak.net-rest/nbproject/project.xml	Mon Apr 05 22:21:01 2010 +0200
     4.2 +++ b/java/nekurak.net-rest/nbproject/project.xml	Mon Apr 05 22:30:08 2010 +0200
     4.3 @@ -10,7 +10,12 @@
     4.4          <data xmlns="http://www.netbeans.org/ns/web-project/3">
     4.5              <name>nekurak.net-rest</name>
     4.6              <minimum-ant-version>1.6.5</minimum-ant-version>
     4.7 -            <web-module-libraries/>
     4.8 +            <web-module-libraries>
     4.9 +                <library dirs="200">
    4.10 +                    <file>${reference.nekurak_net-lib.jar}</file>
    4.11 +                    <path-in-war>WEB-INF/lib</path-in-war>
    4.12 +                </library>
    4.13 +            </web-module-libraries>
    4.14              <web-module-additional-libraries/>
    4.15              <source-roots>
    4.16                  <root id="src.dir"/>
    4.17 @@ -19,5 +24,15 @@
    4.18                  <root id="test.src.dir"/>
    4.19              </test-roots>
    4.20          </data>
    4.21 +        <references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
    4.22 +            <reference>
    4.23 +                <foreign-project>nekurak_net-lib</foreign-project>
    4.24 +                <artifact-type>jar</artifact-type>
    4.25 +                <script>build.xml</script>
    4.26 +                <target>jar</target>
    4.27 +                <clean-target>clean</clean-target>
    4.28 +                <id>jar</id>
    4.29 +            </reference>
    4.30 +        </references>
    4.31      </configuration>
    4.32  </project>
     5.1 --- a/java/nekurak.net-rest/src/java/cz/frantovo/nekurak/rest/ClankyREST.java	Mon Apr 05 22:21:01 2010 +0200
     5.2 +++ b/java/nekurak.net-rest/src/java/cz/frantovo/nekurak/rest/ClankyREST.java	Mon Apr 05 22:30:08 2010 +0200
     5.3 @@ -1,5 +1,7 @@
     5.4  package cz.frantovo.nekurak.rest;
     5.5  
     5.6 +import cz.frantovo.nekurak.dto.Clanek;
     5.7 +import cz.frantovo.nekurak.xml.ClanekXML;
     5.8  import javax.ws.rs.Consumes;
     5.9  import javax.ws.rs.DELETE;
    5.10  import javax.ws.rs.GET;
    5.11 @@ -25,10 +27,13 @@
    5.12      /** Získáme konkrétní článek */
    5.13      @GET
    5.14      @Path("/{id}")
    5.15 -    @Produces("text/plain")
    5.16 -    //@Produces(MIME_XML)
    5.17 -    public String ziskej(@PathParam("id") int id) {
    5.18 -	return "jeden článek: " + id;
    5.19 +    @Produces(MIME_XML)
    5.20 +    public ClanekXML ziskej(@PathParam("id") int id) {
    5.21 +	Clanek c = new Clanek();
    5.22 +	c.setId(id);
    5.23 +	c.setNadpis("Nadpis článku");
    5.24 +	c.setText("nějaký pěkný text");
    5.25 +	return new ClanekXML(c);
    5.26      }
    5.27  
    5.28      /**