Changeset 83a7c4e in murachi for murachi


Ignore:
Timestamp:
May 5, 2015, 5:51:53 PM (9 years ago)
Author:
antonioaraujob <antonioaraujob@…>
Branches:
master
Children:
9ab4eef
Parents:
be74e78
Message:

Agregadas clases MurachiExceptionHandler? y MurachiException? para excepciones. Se inicia el proceso de captura de excepciones.

Location:
murachi
Files:
7 added
4 edited

Legend:

Unmodified
Added
Removed
  • murachi/.classpath

    rbe74e78 r83a7c4e  
    2626                <attributes>
    2727                        <attribute name="maven.pomderived" value="true"/>
     28                        <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
    2829                </attributes>
    2930        </classpathentry>
    30         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/activation-1.1.1.jar"/>
    31         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/api-ldap-client-api-1.0.0-M28.jar"/>
    32         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/api-ldap-model-1.0.0-M28.jar"/>
    33         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/asm-5.0.3.jar"/>
    34         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/bcmail-jdk15on-1.51.jar"/>
    35         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/bcpkix-jdk15on-1.51.jar"/>
    36         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/bcprov-jdk15on-1.51.jar"/>
    37         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-cli-1.2.jar"/>
    38         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-codec-1.10.jar"/>
    39         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-compiler-2.6.1.jar"/>
    40         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-compress-1.3.jar"/>
    41         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-dbcp2-2.0.1.jar"/>
    42         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-io-2.4.jar"/>
    43         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-lang-2.6.jar"/>
    44         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-logging-1.1.3.jar"/>
    45         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/commons-pool2-2.2.jar"/>
    46         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/digidoc4j-0.2.9.LOCAL_BUILD.jar"/>
    47         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/dss-common-4.3.0-RC.jar"/>
    48         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/dss-document-4.3.0-RC.jar"/>
    49         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/dss-service-4.3.0-RC.jar"/>
    50         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/dss-spi-4.3.0-RC.jar"/>
    51         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/fest-assert-1.4.jar"/>
    52         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/fest-util-1.2.5.jar"/>
    53         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/fontbox-0.1.0.jar"/>
    54         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/hamcrest-core-1.3.jar"/>
    55         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/hamcrest-library-1.3.jar"/>
    56         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/hsqldb-1.8.0.10.jar"/>
    57         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/httpclient-4.3.6.jar"/>
    58         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/httpcore-4.3.3.jar"/>
    59         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/jacocoagent.jar"/>
    60         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/jacocoant.jar"/>
    61         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/janino-2.6.1.jar"/>
    62         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/jaxb-api-2.1.jar"/>
    63         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/jaxb-impl-2.1.17.jar"/>
    64         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/jcl-over-slf4j-1.7.7.jar"/>
    65         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/jdigidoc-3.10.1424.BETA.jar"/>
    66         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/jempbox-1.8.8.jar"/>
    67         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/jul-to-slf4j-1.6.6.jar"/>
    68         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/junit-4.11.jar"/>
    69         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/log4j-1.2.17.jar"/>
    70         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/logback-classic-1.1.3.jar"/>
    71         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/logback-core-1.1.3.jar"/>
    72         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/mina-core-2.0.9.jar"/>
    73         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/mockito-all-1.10.19.jar"/>
    74         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/pdfbox-1.8.8.jar"/>
    75         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/serializer-2.7.2.jar"/>
    76         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/slf4j-api-1.7.12.jar"/>
    77         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/snakeyaml-1.14.jar"/>
    78         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/stax2-api-3.1.4.jar"/>
    79         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/stax-api-1.0.1.jar"/>
    80         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/system-rules-1.5.0.jar"/>
    81         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/testcerts.jar"/>
    82         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/woodstox-core-asl-4.4.1.jar"/>
    83         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/xalan-2.7.2.jar"/>
    84         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/xercesImpl-2.11.0.jar"/>
    85         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/xml-apis-1.4.01.jar"/>
    86         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/xmlsec-2.0.3.jar"/>
    87         <classpathentry kind="lib" path="/home/aaraujo/desarrollo/2015/servicioVerificacion/src/murachi/murachi/WebContent/WEB-INF/lib/xmlunit-1.5.jar"/>
     31        <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
     32        <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
     33        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/activation-1.1.1.jar"/>
     34        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/api-ldap-client-api-1.0.0-M28.jar"/>
     35        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/api-ldap-model-1.0.0-M28.jar"/>
     36        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/asm-5.0.3.jar"/>
     37        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/bcmail-jdk15on-1.51.jar"/>
     38        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/bcpkix-jdk15on-1.51.jar"/>
     39        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/bcprov-jdk15on-1.51.jar"/>
     40        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-cli-1.2.jar"/>
     41        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-codec-1.10.jar"/>
     42        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-compiler-2.6.1.jar"/>
     43        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-compress-1.3.jar"/>
     44        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-dbcp2-2.0.1.jar"/>
     45        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-io-2.4.jar"/>
     46        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-lang-2.6.jar"/>
     47        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-logging-1.1.3.jar"/>
     48        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/commons-pool2-2.2.jar"/>
     49        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/digidoc4j-0.2.9.LOCAL_BUILD.jar"/>
     50        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/dss-common-4.3.0-RC.jar"/>
     51        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/dss-document-4.3.0-RC.jar"/>
     52        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/dss-service-4.3.0-RC.jar"/>
     53        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/dss-spi-4.3.0-RC.jar"/>
     54        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/fest-assert-1.4.jar"/>
     55        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/fest-util-1.2.5.jar"/>
     56        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/fontbox-0.1.0.jar"/>
     57        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/hamcrest-core-1.3.jar"/>
     58        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/hamcrest-library-1.3.jar"/>
     59        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/hsqldb-1.8.0.10.jar"/>
     60        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/httpclient-4.3.6.jar"/>
     61        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/httpcore-4.3.3.jar"/>
     62        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jacocoagent.jar"/>
     63        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jacocoant.jar"/>
     64        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/janino-2.6.1.jar"/>
     65        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jaxb-api-2.1.jar"/>
     66        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jaxb-impl-2.1.17.jar"/>
     67        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jcl-over-slf4j-1.7.7.jar"/>
     68        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jdigidoc-3.10.1424.BETA.jar"/>
     69        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jempbox-1.8.8.jar"/>
     70        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/jul-to-slf4j-1.6.6.jar"/>
     71        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/junit-4.11.jar"/>
     72        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/log4j-1.2.17.jar"/>
     73        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/logback-classic-1.1.3.jar"/>
     74        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/logback-core-1.1.3.jar"/>
     75        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/mina-core-2.0.9.jar"/>
     76        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/mockito-all-1.10.19.jar"/>
     77        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/pdfbox-1.8.8.jar"/>
     78        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/serializer-2.7.2.jar"/>
     79        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/slf4j-api-1.7.12.jar"/>
     80        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/snakeyaml-1.14.jar"/>
     81        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/stax-api-1.0.1.jar"/>
     82        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/stax2-api-3.1.4.jar"/>
     83        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/system-rules-1.5.0.jar"/>
     84        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/testcerts.jar"/>
     85        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/woodstox-core-asl-4.4.1.jar"/>
     86        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/xalan-2.7.2.jar"/>
     87        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/xercesImpl-2.11.0.jar"/>
     88        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/xml-apis-1.4.01.jar"/>
     89        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/xmlsec-2.0.3.jar"/>
     90        <classpathentry kind="lib" path="WebContent/WEB-INF/lib/xmlunit-1.5.jar"/>
    8891        <classpathentry kind="output" path="target/classes"/>
    8992</classpath>
  • murachi/.project

    rbe74e78 r83a7c4e  
    66        </projects>
    77        <buildSpec>
     8                <buildCommand>
     9                        <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
     10                        <arguments>
     11                        </arguments>
     12                </buildCommand>
     13                <buildCommand>
     14                        <name>org.eclipse.wst.common.project.facet.core.builder</name>
     15                        <arguments>
     16                        </arguments>
     17                </buildCommand>
    818                <buildCommand>
    919                        <name>org.eclipse.jdt.core.javabuilder</name>
     
    1626                        </arguments>
    1727                </buildCommand>
     28                <buildCommand>
     29                        <name>org.eclipse.wst.validation.validationbuilder</name>
     30                        <arguments>
     31                        </arguments>
     32                </buildCommand>
    1833        </buildSpec>
    1934        <natures>
     35                <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
     36                <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
    2037                <nature>org.eclipse.jdt.core.javanature</nature>
    2138                <nature>org.eclipse.m2e.core.maven2Nature</nature>
     39                <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
     40                <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    2241        </natures>
    2342</projectDescription>
  • murachi/.settings/org.eclipse.jdt.core.prefs

    rbe74e78 r83a7c4e  
    11eclipse.preferences.version=1
    2 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
    3 org.eclipse.jdt.core.compiler.compliance=1.5
     2org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
     3org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
     4org.eclipse.jdt.core.compiler.compliance=1.7
     5org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
     6org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
    47org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
    5 org.eclipse.jdt.core.compiler.source=1.5
     8org.eclipse.jdt.core.compiler.source=1.7
  • murachi/src/main/java/ve/gob/cenditel/murachi/MurachiRESTWS.java

    rbe74e78 r83a7c4e  
    88import java.io.File;
    99import java.io.FileInputStream;
    10 import java.io.FileNotFoundException;
    1110import java.io.FileOutputStream;
    1211import java.io.IOException;
     
    110109import org.digidoc4j.signers.PKCS12Signer;
    111110
    112 
     111import ve.gob.cenditel.murachi.MurachiException;
    113112
    114113@Path("/archivos")
     
    139138         * @param fileDetails datos del archivo
    140139         * @return
    141          */
    142 /*     
     140         * @throws MurachiException
     141         */
     142       
    143143        @POST
    144144        @Path("/")
     
    147147        public Response uploadFile(
    148148                        @FormDataParam("upload") InputStream uploadedInputStream,
    149                         @FormDataParam("upload") FormDataContentDisposition fileDetails) {
     149                        @FormDataParam("upload") FormDataContentDisposition fileDetails) throws MurachiException {
    150150               
    151151                //TODO manejar las excepciones correctamente
    152152                if (uploadedInputStream == null) {
    153153                        System.out.println("uploadedInputStream == null");
     154                        throw new MurachiException("uploadedInputStream != null. datos recibidos del formulario son nulos.");
    154155                }
    155156               
    156157                if (fileDetails == null) {
    157158                        System.out.println("fileDetails == null");
     159                        throw new MurachiException("fileDetails == null. datos recibidos del formulario son nulos.");
    158160                }
    159161                               
     
    166168                        uploadedInputStream.close();
    167169                } catch (IOException e) {
    168                         // TODO Auto-generated catch block
    169                         e.printStackTrace();
     170                        e.printStackTrace();
     171                        throw new MurachiException(e.getMessage());
    170172                }
    171173               
     
    178180                return Response.status(200).entity(result).build();
    179181        }
    180 */
     182
    181183       
    182184        /**
    183185         * Carga un archivo pasado a través de un formulario y retorna
    184          * un json con el id del archivo en el servidor para futuras consultas
     186         * un json con la informacion de la(s) firma(s) del archivo
     187         * en caso de que este firmado
    185188         *
    186189         * @param uploadedInputStream stream para obtener el archivo
    187190         * @param fileDetails datos del archivo
    188191         * @return
     192         * @throws MurachiException
    189193         */
    190194        @POST
    191         @Path("/")
     195        @Path("/firmados")
    192196        @Consumes(MediaType.MULTIPART_FORM_DATA)
    193197        @Produces(MediaType.APPLICATION_JSON)
    194198        public Response uploadFileAndVerify(
    195199                        @FormDataParam("upload") InputStream uploadedInputStream,
    196                         @FormDataParam("upload") FormDataContentDisposition fileDetails) {
    197                
    198                 //TODO manejar las excepciones correctamente
     200                        @FormDataParam("upload") FormDataContentDisposition fileDetails) throws MurachiException {
     201               
    199202                if (uploadedInputStream == null) {
    200203                        System.out.println("uploadedInputStream == null");
     204                        throw new MurachiException("uploadedInputStream != null. datos recibidos del formulario son nulos.");
    201205                }
    202206               
    203207                if (fileDetails == null) {
    204208                        System.out.println("fileDetails == null");
     209                        throw new MurachiException("fileDetails == null. datos recibidos del formulario son nulos.");
    205210                }
    206211                               
     
    213218                        uploadedInputStream.close();
    214219                } catch (IOException e) {
    215                         // TODO Auto-generated catch block
    216                         e.printStackTrace();
     220                        e.printStackTrace();
     221                        throw new MurachiException(e.getMessage());
    217222                }
    218223               
     
    231236         * @param fileDetails
    232237         * @param fileId identificador unico del archivo de acuerdo a UUIDs
    233          */
    234         private void saveToDisk(InputStream uploadedInputStream, FormDataContentDisposition fileDetails, String fileId) {
     238         * @throws MurachiException
     239         */
     240        private void saveToDisk(InputStream uploadedInputStream, FormDataContentDisposition fileDetails, String fileId) throws MurachiException {
    235241               
    236242                String uploadedFileLocation = SERVER_UPLOAD_LOCATION_FOLDER + /*fileDetails.getFileName()*/ fileId;
     
    253259                catch(IOException e) {
    254260                        e.printStackTrace();
     261                        throw new MurachiException(e.getMessage());
    255262                }
    256263        }
     
    262269         * @param idFile identificador del archivo a verificar
    263270         * @return JSON con informacion de las firmas
     271         * @throws MurachiException
    264272         */
    265273        @GET
    266274        @Path("/{idFile}")
    267275        @Produces("application/json")
    268         public Response verifyAFile(@PathParam("idFile") String idFile) {
    269                
     276        public Response verifyAFile(@PathParam("idFile") String idFile) throws MurachiException {
     277/*             
    270278                System.out.println("/{idFile}");
    271279               
     
    303311                result = jsonObject.toString();
    304312                return Response.status(200).entity(result).build();
    305         }
    306        
    307         /**
    308          * Verifica si un archivo local posee firmas electronicas y retorna informacion
    309          * de las mismas en un json.
    310          *
    311          * @param idFile identificador del archivo a verificar
    312          * @return JSONObject con informacion de las firmas
    313          */
    314         public JSONObject verifyALocalFile(String idFile) {
    315                
    316                 System.out.println("verifyALocalFile: " + idFile);
     313*/
     314                System.out.println("/{idFile}");
    317315               
    318316                String file = SERVER_UPLOAD_LOCATION_FOLDER + idFile;
     
    351349                        }
    352350                }
     351                String result = jsonObject.toString();
     352                return Response.status(200).entity(result).build();
     353               
     354               
     355        }
     356       
     357        /**
     358         * Verifica si un archivo local posee firmas electronicas y retorna informacion
     359         * de las mismas en un json.
     360         *
     361         * @param idFile identificador del archivo a verificar
     362         * @return JSONObject con informacion de las firmas
     363         * @throws MurachiException
     364         */
     365        public JSONObject verifyALocalFile(String idFile) throws MurachiException {
     366               
     367                System.out.println("verifyALocalFile: " + idFile);
     368               
     369                String file = SERVER_UPLOAD_LOCATION_FOLDER + idFile;
     370               
     371                File tmpFile = new File(file);
     372               
     373                JSONObject jsonObject = new JSONObject();
     374               
     375                if (!tmpFile.exists()) {
     376                        System.out.println("File : " + file + " does not exists.");
     377                        jsonObject.put("fileExist", "false");
     378                       
     379                }else{
     380                        System.out.println("File : " + file + " exists.");
     381                        jsonObject.put("fileExist", "true");
     382                       
     383                        String mime = getMimeType(file);
     384                        System.out.println("mimetype : " + mime);
     385                       
     386                        if (mime.equals("application/pdf")){
     387                                System.out.println(" PDF ");
     388                               
     389                                jsonObject = verifySignaturesInPdf(file);
     390                               
     391                        //}else if (mime.equals("application/vnd.etsi.asic-e+zip")){
     392                        }else if (mime.equals("application/zip") ){
     393                                System.out.println("BDOC");                             
     394                                //jsonObject.put("formato", "BDOC");
     395                                //jsonObject.put("resultado", "NO IMPLEMENTADO");
     396                               
     397                                jsonObject = verifySignaturesInBdoc(file);
     398                        }else{
     399                                System.out.println("extension no reconocida");
     400                                jsonObject.put("fileExist", "true");
     401                                jsonObject.put("error", "extension not supported");                             
     402                        }
     403                }
    353404                return jsonObject;
    354405        }
     
    359410         * @param pdfFile archivo pdf a verificar
    360411         * @return JSON con informacion de las firmas del documento PDF
    361          */
    362         private JSONObject verifySignaturesInPdf(String pdfFile) {
     412         * @throws MurachiException
     413         */
     414        private JSONObject verifySignaturesInPdf(String pdfFile) throws MurachiException {
    363415               
    364416                JSONObject jsonSignatures = new JSONObject();
     
    397449                } catch (IOException e) {               
    398450                        e.printStackTrace();
     451                        throw new MurachiException(e.getMessage());
    399452                } catch (GeneralSecurityException e) {
    400                         // TODO Auto-generated catch block
    401                         e.printStackTrace();
     453                        e.printStackTrace();
     454                        throw new MurachiException(e.getMessage());
    402455                }
    403456                               
     
    410463         * @param name nombre de la firma
    411464         * @return HashMap con campos de informacion de la firma electronica
     465         * @throws GeneralSecurityException falla en
     466         * @throws IOException cuando ca
    412467         */
    413468        public HashMap<String, String> verifySignature(AcroFields fields, String name) throws GeneralSecurityException, IOException {
     
    10311086                                System.out.println(" dataFiles:  == 0");
    10321087                        }
    1033 
    1034                        
     1088               
    10351089                        jsonSignatures.put("numberOfSignatures", numberOfSignatures);
    10361090                       
Note: See TracChangeset for help on using the changeset viewer.