- Timestamp:
- Sep 9, 2015, 10:43:28 AM (9 years ago)
- Branches:
- master
- Children:
- 5dcf8b7
- Parents:
- d732178
- Location:
- murachi/src/main/java/ve/gob/cenditel/murachi
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
murachi/src/main/java/ve/gob/cenditel/murachi/MurachiRESTWS.java
rd732178 r1489193 45 45 import javax.ws.rs.FormParam; 46 46 import javax.ws.rs.GET; 47 import javax.ws.rs.NameBinding; 47 48 import javax.ws.rs.POST; 48 49 import javax.ws.rs.Path; … … 180 181 * 181 182 * @apiExample Example usage: 182 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/version 183 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/version -H "Authorization: Basic YWRtaW46YWRtaW4=" 183 184 * 184 185 * @apiSuccess {String} murachiVersion Versión del API … … 187 188 @GET 188 189 @Produces(MediaType.APPLICATION_JSON) 190 @Authenticator 189 191 public Response returnVersion() { 190 192 logger.info("/version: Murachi Version: " + API_VERSION); … … 224 226 * contentType: false, 225 227 * processData: false, 228 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 226 229 * success: function(response) { 227 230 * //identificador del archivo en el servidor … … 239 242 * "error": "datos recibidos del formulario son nulos" 240 243 * } 244 * HTTP/1.1 401 Unauthorized 245 * { 246 * "error": "acceso no autorizado" 247 * } 241 248 * 242 249 * HTTP/1.1 500 … … 252 259 @Consumes(MediaType.MULTIPART_FORM_DATA) 253 260 @Produces(MediaType.APPLICATION_JSON) 261 @Authenticator 254 262 public Response uploadFile( 255 263 @FormDataParam("upload") InputStream uploadedInputStream, … … 534 542 * contentType: false, 535 543 * processData: false, 544 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 536 545 * success: function(response) { 537 546 * var json = JSON.stringify(response); … … 551 560 * } 552 561 * 562 * HTTP/1.1 401 Unauthorized 563 * { 564 * "error": "acceso no autorizado" 565 * } 553 566 * 554 567 * HTTP/1.1 500 … … 562 575 @Consumes(MediaType.MULTIPART_FORM_DATA) 563 576 @Produces(MediaType.APPLICATION_JSON) 577 @Authenticator 564 578 public Response uploadFileAndVerify( 565 579 @FormDataParam("upload") InputStream uploadedInputStream, … … 714 728 * 715 729 * @apiExample Example usage: 716 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee 730 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee -H "Authorization: Basic YWRtaW46YWRtaW4=" 717 731 * 718 732 * @apiErrorExample {json} Error-Response: 733 * HTTP/1.1 401 Unauthorized 734 * { 735 * "error": "acceso no autorizado" 736 * } 737 * 719 738 * HTTP/1.1 404 Bad Request 720 739 * { … … 780 799 @Path("/{idFile}") 781 800 @Produces("application/json") 801 @Authenticator 782 802 public Response verifyAFile(@PathParam("idFile") String idFile) throws MurachiException { 783 803 … … 1364 1384 * data: parameters, 1365 1385 * contentType: "application/json", 1386 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 1366 1387 * success: function(data, textStatus, jqXHR){ 1367 1388 * var json_x = data; … … 1386 1407 * } 1387 1408 * 1409 * HTTP/1.1 401 Unauthorized 1410 * { 1411 * "error": "acceso no autorizado" 1412 * } 1413 * 1388 1414 * HTTP/1.1 500 Internal Server Error 1389 1415 * { … … 1398 1424 @Consumes(MediaType.APPLICATION_JSON) 1399 1425 @Produces(MediaType.APPLICATION_JSON) 1426 @Authenticator 1400 1427 //public PresignHash presignPdf(PresignParameters presignPar, @Context HttpServletRequest req) { 1401 1428 public Response presignPdf(PresignParameters presignPar, @Context HttpServletRequest req) throws MurachiException { … … 1713 1740 * data: JSON.stringify({"signature":signature.hex}), 1714 1741 * contentType: "application/json", 1742 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 1715 1743 * success: function(data, textStatus, jqXHR){ 1716 1744 * alert('Archivo firmado correctamente: ' + data['signedFileId']); … … 1724 1752 * 1725 1753 * @apiErrorExample {json} Error-Response: 1754 * HTTP/1.1 401 Unauthorized 1755 * { 1756 * "error": "acceso no autorizado" 1757 * } 1758 * 1726 1759 * HTTP/1.1 500 Internal Server Error 1727 1760 * { … … 1733 1766 @Path("/pdfs/resenas") 1734 1767 @Consumes(MediaType.APPLICATION_JSON) 1735 @Produces(MediaType.APPLICATION_JSON) 1768 @Produces(MediaType.APPLICATION_JSON) 1769 @Authenticator 1736 1770 public Response postsignPdf(PostsignParameters postsignPar, @Context HttpServletRequest req) throws IOException, MurachiException { 1737 1771 … … 1867 1901 @GET 1868 1902 @Path("/pdfs/{idFile}") 1903 @Authenticator 1869 1904 public Response getPdfSigned(@PathParam("idFile") String idFile) { 1870 1905 logger.info("/pdfs/{idFile}"); … … 2352 2387 * data: parameters, 2353 2388 * contentType: "application/json", 2389 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 2354 2390 * success: function(data, textStatus, jqXHR){ 2355 2391 * var json_x = data; … … 2368 2404 * 2369 2405 * @apiErrorExample {json} Error-Response: 2406 * HTTP/1.1 401 Unauthorized 2407 * { 2408 * "error": "acceso no autorizado" 2409 * } 2410 * 2370 2411 * HTTP/1.1 500 Internal Server Error 2371 2412 * { … … 2380 2421 @Consumes(MediaType.APPLICATION_JSON) 2381 2422 @Produces(MediaType.APPLICATION_JSON) 2423 @Authenticator 2382 2424 public Response presignBdoc(PresignParametersBdoc presignPar, @Context HttpServletRequest req) throws MurachiException { 2383 2425 … … 2552 2594 * data: JSON.stringify({"signature":signature.hex}), 2553 2595 * contentType: "application/json", 2596 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 2554 2597 * success: function(data, textStatus, jqXHR){ 2555 2598 * alert('Archivo firmado correctamente: ' + data['signedFileId']); … … 2563 2606 * 2564 2607 * @apiErrorExample {json} Error-Response: 2608 * HTTP/1.1 401 Unauthorized 2609 * { 2610 * "error": "acceso no autorizado" 2611 * } 2612 * 2565 2613 * HTTP/1.1 500 Internal Server Error 2566 2614 * { … … 2572 2620 @Path("/bdocs/resenas") 2573 2621 @Consumes(MediaType.APPLICATION_JSON) 2574 @Produces(MediaType.APPLICATION_JSON) 2622 @Produces(MediaType.APPLICATION_JSON) 2623 @Authenticator 2575 2624 public Response postsignBdoc(PostsignParameters postsignPar, @Context HttpServletRequest req) throws IOException, MurachiException { 2576 2625 … … 2660 2709 * @apiSuccess {String} containerId Identificador único del contenedor BDOC creado. 2661 2710 * 2711 * @apiExample Example usage: 2712 * 2713 * var formData = new FormData(); 2714 * var fileInput = document.getElementById("file-sign"); 2715 * var list = fileInput.files; 2716 * for (var i=0; i<list.length; i++){ 2717 * formData.append("upload", $("#file-sign")[0].files[i]); 2718 * } 2719 * 2720 * $.ajax({ 2721 * url: "https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/cargas", 2722 * type: "post", 2723 * dataType: "json", 2724 * data: formData, 2725 * cache: false, 2726 * contentType: false, 2727 * processData: false, 2728 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 2729 * success: function(response) { 2730 * var fileId = response.containerId.toString(); 2731 * }, 2732 * error: function(jqXHR, textStatus, errorThrown){ 2733 * alert('ajax error function: ' + jqXHR.responseText); 2734 * } 2735 * }); 2736 * 2662 2737 * @apiErrorExample {json} Error-Response: 2738 * HTTP/1.1 401 Unauthorized 2739 * { 2740 * "error": "acceso no autorizado" 2741 * } 2742 * 2663 2743 * HTTP/1.1 500 Internal Server Error 2664 2744 * { … … 2671 2751 @Consumes(MediaType.MULTIPART_FORM_DATA) 2672 2752 @Produces(MediaType.APPLICATION_JSON) 2753 @Authenticator 2673 2754 public Response uploadFilesToBDOC(FormDataMultiPart formParams) throws MurachiException { 2674 2755 … … 2786 2867 * 2787 2868 * @apiErrorExample {json} Error-Response: 2869 * HTTP/1.1 401 Unauthorized 2870 * { 2871 * "error": "acceso no autorizado" 2872 * } 2873 * 2788 2874 * HTTP/1.1 500 Internal Server Error 2789 2875 * { … … 2796 2882 @Consumes(MediaType.MULTIPART_FORM_DATA) 2797 2883 @Produces(MediaType.APPLICATION_JSON) 2884 @Authenticator 2798 2885 public Response appendFilesToBDOC(FormDataMultiPart formParams, @PathParam("containerId") String containerId) throws MurachiException { 2799 2886 … … 2953 3040 * @apiSuccess {String} dataFileNumber Número de archivos que se encuentran en el contendor BDOC. 2954 3041 * 3042 * @apiExample Example usage: 3043 * 3044 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/archivos/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee -k -H "Authorization: Basic YWRtaW46YWRtaW4=" 3045 * 3046 * 2955 3047 * @apiErrorExample {json} Error-Response: 3048 * HTTP/1.1 401 Unauthorized 3049 * { 3050 * "error": "acceso no autorizado" 3051 * } 3052 * 3053 * HTTP/1.1 404 Not Found 3054 * { 3055 * "error": "el contenedor con identificador containerId no existe ." 3056 * } 3057 * 2956 3058 * HTTP/1.1 500 Internal Server Error 2957 3059 * { 2958 3060 * "error": "error interno al leer el contenedor." 2959 3061 * } 3062 * 2960 3063 * HTTP/1.1 500 Internal Server Error 2961 3064 * { 2962 3065 * "error": "no se pudo leer el contenedor." 2963 3066 * } 2964 * HTTP/1.1 404 Not Found2965 * {2966 * "error": "el contenedor con identificador containerId no existe ."2967 * }2968 3067 * 2969 3068 */ … … 2971 3070 @Path("/bdocs/archivos/{containerId}") 2972 3071 @Produces(MediaType.APPLICATION_JSON) 3072 @Authenticator 2973 3073 public Response getDataFileNumber(@PathParam("containerId") String containerId) { 2974 3074 logger.info("recurso /bdocs/archivos/"+containerId); … … 3051 3151 * 3052 3152 * @apiExample Example usage: 3053 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/archivos/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee/0 3153 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/archivos/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee/0 -H "Authorization: Basic YWRtaW46YWRtaW4=" 3054 3154 * 3055 3155 * 3056 3156 * @apiErrorExample {json} Error-Response: 3157 * HTTP/1.1 401 Unauthorized 3158 * { 3159 * "error": "acceso no autorizado" 3160 * } 3161 * 3057 3162 * HTTP/1.1 404 Not Found 3058 3163 * { … … 3072 3177 @Path("/bdocs/archivos/{containerId}/{dataFileId}") 3073 3178 @Produces(MediaType.APPLICATION_OCTET_STREAM) 3179 @Authenticator 3074 3180 public Response downloadDataFileFromBDOC(@PathParam("containerId") String containerId, @PathParam("dataFileId") int dataFileId) { 3075 3181 logger.info("recurso /bdocs/archivos/"+containerId+"/"+Integer.toString(dataFileId)); … … 3164 3270 * 3165 3271 * @apiExample Example usage: 3166 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/archivos/papelera/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee/0 3272 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/archivos/papelera/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee/0 -H "Authorization: Basic YWRtaW46YWRtaW4=" 3167 3273 * 3168 3274 * 3169 3275 * @apiErrorExample {json} Error-Response: 3276 * HTTP/1.1 401 Unauthorized 3277 * { 3278 * "error": "acceso no autorizado" 3279 * } 3280 * 3170 3281 * HTTP/1.1 404 Not Found 3171 3282 * { 3172 3283 * "fileExist": false 3173 3284 * } 3285 * 3174 3286 * HTTP/1.1 500 Internal server Error 3175 3287 * { … … 3181 3293 @Path("/bdocs/archivos/papelera/{containerId}/{dataFileId}") 3182 3294 @Produces(MediaType.APPLICATION_JSON) 3295 @Authenticator 3183 3296 public Response removeDataFile(@PathParam("containerId") String containerId, @PathParam("dataFileId") int dataFileId) { 3184 3297 logger.info("recurso /bdocs/archivos/papelera/"+containerId+"/"+Integer.toString(dataFileId)); … … 3291 3404 * 3292 3405 * @apiExample Example usage: 3293 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/archivos/lista/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee 3406 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/archivos/lista/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee -H "Authorization: Basic YWRtaW46YWRtaW4=" 3294 3407 * 3295 3408 * 3296 3409 * @apiErrorExample {json} Error-Response: 3410 * HTTP/1.1 401 Unauthorized 3411 * { 3412 * "error": "acceso no autorizado" 3413 * } 3414 * 3297 3415 * HTTP/1.1 404 Not Found 3298 3416 * { 3299 3417 * "error": "El contenedor con identificador containerId no existe." 3300 3418 * } 3419 * 3301 3420 * HTTP/1.1 500 Internal server Error 3302 3421 * { 3303 3422 * "error": "no se pudo leer el contenido del contenedor." 3304 3423 * } 3424 * 3305 3425 * HTTP/1.1 500 Internal server Error 3306 3426 * { … … 3312 3432 @Path("/bdocs/archivos/lista/{containerId}") 3313 3433 @Produces(MediaType.APPLICATION_JSON) 3434 @Authenticator 3314 3435 public Response getDataFileList(@PathParam("containerId") String containerId) { 3315 3436 … … 3412 3533 * @apiDescription Retorna el número de firmas del contendor BDOC. 3413 3534 * 3535 * @apiExample Example usage: 3536 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/firmas/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee -H "Authorization: Basic YWRtaW46YWRtaW4=" 3537 * 3414 3538 * @apiSuccess {String} signatureNumber Número de firmas del contendor BDOC. 3415 3539 * 3416 3540 * @apiErrorExample {json} Error-Response: 3541 * HTTP/1.1 401 Unauthorized 3542 * { 3543 * "error": "acceso no autorizado" 3544 * } 3545 * 3546 * HTTP/1.1 404 Not Found 3547 * { 3548 * "error": "el contenedor con identificador containerId no existe ." 3549 * } 3550 * 3417 3551 * HTTP/1.1 500 Internal Server Error 3418 3552 * { 3419 3553 * "error": "error interno al leer el contenedor." 3420 3554 * } 3421 * HTTP/1.1 404 Not Found 3422 * { 3423 * "error": "el contenedor con identificador containerId no existe ." 3424 * } 3555 3425 3556 */ 3426 3557 @GET 3427 3558 @Path("/bdocs/firmas/{containerId}") 3428 3559 @Produces(MediaType.APPLICATION_JSON) 3560 @Authenticator 3429 3561 public Response getSignatureNumber(@PathParam("containerId") String containerId) { 3430 3562 logger.info("/bdocs/firmas/"+containerId); … … 3488 3620 * @return identificador del contenedor. 3489 3621 * 3490 * * @api {get} /Murachi/0.1/archivos/bdocs/firmas/papelera {containerId}/{signatureId} Elimina una firma de un contenedor.3622 * * @api {get} /Murachi/0.1/archivos/bdocs/firmas/papelera/{containerId}/{signatureId} Elimina una firma de un contenedor. 3491 3623 * @apiName BDocEliminaFirmas 3492 3624 * @apiGroup BDOCS … … 3497 3629 * 3498 3630 * @apiDescription Elimina una firma del contendor BDOC. 3499 * 3631 * 3632 * @apiExample Example usage: 3633 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/firmas/papelera/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee -H "Authorization: Basic YWRtaW46YWRtaW4=" 3634 * 3500 3635 * @apiSuccess {String} mensaje firma eliminada correctamente 3501 3636 * 3502 3637 * @apiErrorExample {json} Error-Response: 3638 * HTTP/1.1 401 Unauthorized 3639 * { 3640 * "error": "acceso no autorizado" 3641 * } 3642 * 3643 * HTTP/1.1 404 Not Found 3644 * { 3645 * "error": "el contenedor con identificador containerId no existe ." 3646 * } 3647 * 3503 3648 * HTTP/1.1 500 Internal Server Error 3504 3649 * { 3505 3650 * "error": "no se pudo leer el contenido del contenedor." 3506 3651 * } 3507 * HTTP/1.1 404 Not Found3508 * {3509 * "error": "el contenedor con identificador containerId no existe ."3510 * }3511 3652 * 3512 3653 */ … … 3514 3655 @Path("/bdocs/firmas/papelera/{containerId}/{signatureId}") 3515 3656 @Produces(MediaType.APPLICATION_JSON) 3657 @Authenticator 3516 3658 public Response removeSignature(@PathParam("containerId") String containerId, @PathParam("signatureId") int signatureId) { 3517 3659 logger.info("recurso /bdocs/firmas/papelera/"+containerId+"/"+Integer.toString(signatureId)); … … 3632 3774 * @apiSuccess {String} signatures.signerCertificateIssuer Emisor del certificado firmante. 3633 3775 * @apiSuccess {String} signatures.signatureCountry País donde se realiza la firma. 3776 * 3777 * @apiExample Example usage: 3778 * curl -i https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/bdocs/firmas/lista/f011ff87-f0d0-4a5e-a0b9-a64eb70661ee -H "Authorization: Basic YWRtaW46YWRtaW4=" 3634 3779 * 3635 3780 * @apiSuccess {Boolean} containerValidation: Especifica si el contenedor posee una estructura válida. 3636 3637 3781 * 3638 3782 * @apiErrorExample {json} Error-Response: 3783 * HTTP/1.1 401 Unauthorized 3784 * { 3785 * "error": "acceso no autorizado" 3786 * } 3787 * 3788 * HTTP/1.1 404 Not Found 3789 * { 3790 * "error": "el contenedor con identificador containerId no existe ." 3791 * } 3792 * 3639 3793 * HTTP/1.1 500 Internal Server Error 3640 3794 * { 3641 3795 * "error": "error interno al leer el contenedor." 3642 3796 * } 3797 * 3643 3798 * HTTP/1.1 500 Internal Server Error 3644 3799 * { 3645 3800 * "error": "El contenedor tiene un número menor que cero de firmas" 3646 3801 * } 3647 3648 * HTTP/1.1 404 Not Found 3649 * { 3650 * "error": "el contenedor con identificador containerId no existe ." 3651 * } 3802 * 3652 3803 */ 3653 3804 @GET 3654 3805 @Path("/bdocs/firmas/lista/{containerId}") 3655 3806 @Produces(MediaType.APPLICATION_JSON) 3807 @Authenticator 3656 3808 public Response getSignaturesList(@PathParam("containerId") String containerId) { 3657 3809 logger.info("/bdocs/firmas/lista/"+containerId); … … 3776 3928 * data: parameters, 3777 3929 * contentType: "application/json", 3930 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 3778 3931 * success: function(data, textStatus, jqXHR){ 3779 3932 * var json_x = data; … … 3792 3945 * 3793 3946 * @apiErrorExample {json} Error-Response: 3947 * HTTP/1.1 401 Unauthorized 3948 * { 3949 * "error": "acceso no autorizado" 3950 * } 3951 * 3952 * HTTP/1.1 404 Not Found 3953 * { 3954 * "error": "el contenedor con identificador containerId no existe ." 3955 * } 3956 * 3794 3957 * HTTP/1.1 500 Internal Server Error 3795 3958 * { 3796 3959 * "hash": "", 3797 3960 * "error": "Error en el certificado del firmante" 3798 * } 3799 * HTTP/1.1 404 Not Found 3800 * { 3801 * "error": "el contenedor con identificador containerId no existe ." 3802 * } 3803 * 3961 * } 3804 3962 * 3805 3963 */ … … 3808 3966 @Consumes(MediaType.APPLICATION_JSON) 3809 3967 @Produces(MediaType.APPLICATION_JSON) 3968 @Authenticator 3810 3969 public Response presignBDOCContainer(PresignParametersBdoc presignPar) throws MurachiException { 3811 3970 … … 4040 4199 * }), 4041 4200 * contentType: "application/json", 4201 * headers: {"Authorization":"Basic YWRtaW46YWRtaW4="}, 4042 4202 * success: function(data, textStatus, jqXHR){ 4043 4203 * alert('Archivo firmado correctamente: ' + data['signedFileId']); … … 4051 4211 * 4052 4212 * @apiErrorExample {json} Error-Response: 4213 * HTTP/1.1 401 Unauthorized 4214 * { 4215 * "error": "acceso no autorizado" 4216 * } 4217 * 4218 * HTTP/1.1 404 Not Found 4219 * { 4220 * "error": "el contenedor con identificador containerId no existe ." 4221 * } 4222 * 4053 4223 * HTTP/1.1 500 Internal Server Error 4054 4224 * { 4055 4225 * "error": "Error en proceso de deserialización y completación de firma" 4056 4226 * } 4057 * HTTP/1.1 404 Not Found 4058 * { 4059 * "error": "el contenedor con identificador containerId no existe ." 4060 * } 4227 4061 4228 * 4062 4229 */ … … 4065 4232 @Consumes(MediaType.APPLICATION_JSON) 4066 4233 @Produces(MediaType.APPLICATION_JSON) 4234 @Authenticator 4067 4235 public Response postsignBDOCContainer(PostsignParameters postsignPar) throws IOException, MurachiException { 4068 4236
Note: See TracChangeset
for help on using the changeset viewer.