public Response toResponse (final SMPNotFoundException e) { return Response.status (Status.NOT_FOUND) .entity (e.getMessage ()) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
@Nonnull @Nonempty public String getMimeTypeAsString () { return m_aMimeType.getAsString (); }
@Nonnull public MockHttpServletRequest setContentType (@Nullable final IMimeType aContentType) { return setContentType (aContentType == null ? null : aContentType.getAsString ()); }
@Nonnull @Nonempty public String getMimeTypeAsString () { return m_aMimeType.getAsString (); }
public Response toResponse (final SMPUnknownUserException e) { return Response.status (Status.FORBIDDEN) .entity (e.getMessage ()) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
@Nonnull public final IMPLTYPE setAccept (@Nullable final IMimeType aAccept) { return setAccept (aAccept == null ? null : aAccept.getAsString ()); }
public Response toResponse (final RuntimeException ex) { final String sText = StackTraceHelper.getStackAsString (ex); return Response.status (Status.INTERNAL_SERVER_ERROR) .entity (sText) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
public Response toResponse (final SMPUnauthorizedException e) { return Response.status (Status.FORBIDDEN) .entity (e.getMessage ()) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
@Nonnull public Response toResponse (@Nonnull final SMPBadRequestException ex) { if (SMPServerConfiguration.isRESTLogExceptions ()) LOGGER.error ("Bad Request", ex); return Response.status (Status.BAD_REQUEST) .entity (getResponseEntityWithoutStackTrace (ex)) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
@Nonnull public Response toResponse (@Nonnull final SMPUnknownUserException ex) { if (SMPServerConfiguration.isRESTLogExceptions ()) LOGGER.error ("Unknown user", ex); return Response.status (Status.FORBIDDEN) .entity (getResponseEntityWithoutStackTrace (ex)) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
@Nonnull public Response toResponse (@Nonnull final SMPUnauthorizedException ex) { if (SMPServerConfiguration.isRESTLogExceptions ()) LOGGER.error ("Unauthorized", ex); return Response.status (Status.FORBIDDEN) .entity (getResponseEntityWithoutStackTrace (ex)) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
@Nonnull public Response toResponse (@Nonnull final RuntimeException ex) { if (SMPServerConfiguration.isRESTLogExceptions ()) LOGGER.error ("RuntimeException", ex); // The stack trace may be beneficial here return Response.status (Status.INTERNAL_SERVER_ERROR) .entity (getResponseEntityWithStackTrace (ex)) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
@Nonnull public Response toResponse (@Nonnull final SMPNotFoundException ex) { if (SMPServerConfiguration.isRESTLogExceptions ()) LOGGER.error ("Not Found", ex); return Response.status (Status.NOT_FOUND) .entity (getResponseEntityWithoutStackTrace (ex)) .type (CMimeType.TEXT_PLAIN.getAsString ()) .build (); } }
public AsicOutputStream (@Nonnull final OutputStream aOS) throws IOException { super (aOS); setComment ("mimetype=" + AsicUtils.MIMETYPE_ASICE.getAsString ()); _putMimeTypeAsFirstEntry (AsicUtils.MIMETYPE_ASICE); }
private void _putMimeTypeAsFirstEntry (@Nonnull final IMimeType aMimeType) throws IOException { final String sMimeType = aMimeType.getAsString (); final ZipEntry aZipEntry = new ZipEntry (AsicInputStream.ZIPENTRY_NAME_MIMETYPE); aZipEntry.setComment ("mimetype=" + sMimeType); aZipEntry.setMethod (ZipEntry.STORED); final byte [] aContentBytes = sMimeType.getBytes (StandardCharsets.ISO_8859_1); aZipEntry.setSize (aContentBytes.length); final CRC32 aCrc = new CRC32 (); aCrc.update (aContentBytes); aZipEntry.setCrc (aCrc.getValue ()); writeZipEntry (aZipEntry, aContentBytes); }
public void add (@Nonnull final String sPath, @Nonnull final IMimeType aMimeType) { final FileEntry fileEntry = new FileEntry (); fileEntry.setMediaType (aMimeType.getAsString ()); fileEntry.setFullPath (sPath); m_aManifest.getFileEntry ().add (fileEntry); }
public HttpXMLEntity (@Nonnull final Node aNode, @Nonnull final ESOAPVersion eSoapVersion) { super (AS4XMLHelper.serializeXML (aNode), AS4XMLHelper.XWS.getCharset ()); // Required for AS4.NET setContentType (eSoapVersion.getMimeType ().getAsString ()); } }
public SoapMimeMultipart (@Nonnull final ESOAPVersion eSOAPVersion, @Nonnull final Charset aCharset) throws ParseException { super ("related"); // type parameter is essential for Axis to work! // But no charset! RFC 2387, section 3.4 has a special definition final ContentType aContentType = new ContentType (contentType); aContentType.setParameter ("type", eSOAPVersion.getMimeType ().getAsString ()); aContentType.setParameter ("charset", aCharset.name ()); contentType = aContentType.toString (); } }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); aElement.setAttribute (CHTMLAttributes.TYPE, m_aType.getAsString ()); if (hasAnyMedia ()) aElement.setAttribute (CHTMLAttributes.MEDIA, m_aMediaList.getMediaString ()); setInlineStyle (aElement, m_sContent, m_eMode); }
@Override protected void fillMicroElement (final IMicroElement aElement, final IHCConversionSettingsToNode aConversionSettings) { super.fillMicroElement (aElement, aConversionSettings); aElement.setAttribute (CHTMLAttributes.TYPE, m_aType.getAsString ()); if (StringHelper.hasText (m_sCharset)) aElement.setAttribute (CHTMLAttributes.CHARSET, m_sCharset); if (m_eCrossOrigin != null) aElement.setAttribute (CHTMLAttributes.CROSSORIGIN, m_eCrossOrigin); if (StringHelper.hasText (m_sIntegrity)) aElement.setAttribute (CHTMLAttributes.INTEGRITY, m_sIntegrity); }