Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/17Franco/CulturarteWeb/llms.txt

Use this file to discover all available pages before exploring further.

The /GenerarConstancia servlet generates and streams a PDF collaboration certificate (known as a Constancia de Colaboración) directly to the client’s browser. It accepts the numeric ID of a collaboration, delegates PDF generation to the ControllerWS SOAP service via portU.generarPDF(idColaboracion), decodes the Base64-encoded result, and writes the raw bytes to the HTTP response as an inline PDF attachment. The SOAP endpoint is resolved at runtime from config.properties.

POST /GenerarConstancia

Generates a PDF certificate for the specified collaboration and streams it to the browser. Only doPost is implemented — GET requests to this endpoint will receive a 405 Method Not Allowed response.

Request parameters

idColaboracion
long
required
The numeric ID of the collaboration for which the certificate should be generated. Internally parsed with Long.parseLong(request.getParameter("idColaboracion")) and passed directly to portU.generarPDF(idColaboracion) on the SOAP service. Must correspond to a collaboration that has already been paid.

Behavior

  1. Reads WEB_SERVICES_HOST, WEB_SERVICES_PORT, and SERVICE from config.properties to build the WSDL URL dynamically.
  2. Instantiates ControllerWS_Service and obtains portU via service.getControllerWSPort().
  3. Parses idColaboracion from the request as a Long.
  4. Calls portU.generarPDF(idColaboracion), which returns a Base64-encoded string representation of the PDF.
  5. If the returned string is null or empty, responds with HTTP 500 and the message "Error al generar el PDF.".
  6. Decodes the Base64 string with Base64.getDecoder().decode(pdfFile) to obtain raw PDF bytes.
  7. Sets the following HTTP response headers:
HeaderValue
Content-Typeapplication/pdf
Content-Dispositioninline; filename = documento.pdf
Content-LengthLength of the decoded PDF byte array
  1. Writes the PDF bytes to response.getOutputStream() and flushes the stream.
  2. On any unhandled exception, responds with HTTP 500 and the message "Ocurrió un error al generar la constancia de pago.".

Example form POST

The certificate is typically requested from the preview modal embedded in Colaboraciones.jsp or directly from Constancia.jsp:
<form action="GenerarConstancia" method="post" target="_blank">
  <input type="hidden" name="idColaboracion" value="42" />
  <button type="submit" class="btn btn-primary">Generar PDF</button>
</form>
Or as a raw HTTP request:
POST /GenerarConstancia HTTP/1.1
Host: localhost:8080
Content-Type: application/x-www-form-urlencoded
Cookie: JSESSIONID=abc123

idColaboracion=42

Response on success

HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Disposition: inline; filename = documento.pdf
Content-Length: 18423

%PDF-1.4 ...
The browser will render the PDF inline (or prompt for download, depending on browser settings) because Content-Disposition is set to inline.

Response on error

HTTP/1.1 500 Internal Server Error
Content-Type: text/html

Error al generar el PDF.
The Constancia.jsp page provides a pre-built download form. It receives a DtoColaboracion object (set as the colaboracion request attribute by a preceding servlet) and renders a preview card — showing collaborator nick, proposal title, amount, return type, and creation date — with a “Generar PDF” button that POSTs idColaboracion to /GenerarConstancia. Linking users here first gives them a chance to confirm collaboration details before the PDF is generated.
Only paid collaborations can generate a certificate. A collaboration is considered paid when its DtoPago record is non-null (i.e., acreditarColaboracion has been successfully called via /PagarColaboracion). Attempting to generate a certificate for an unpaid collaboration will result in an error from the SOAP service, which the servlet catches and surfaces as an HTTP 500 response.

Build docs developers (and LLMs) love