Tabnine Logo
MimeType
Code IndexAdd Tabnine to your IDE (free)

How to use
MimeType
in
com.helger.commons.mime

Best Java code snippets using com.helger.commons.mime.MimeType (Showing top 12 results out of 315)

origin: com.helger/ph-as4-lib

/**
 * Get the mime type of this SOAP version with the passed charset.
 *
 * @param aCharset
 *        The charset to be used. May not be <code>null</code>.
 * @return Never <code>null</code>.
 */
@Nonnull
@ReturnsMutableCopy
public MimeType getMimeType (@Nonnull final Charset aCharset)
{
 return new MimeType (m_aMimeType).addParameter (CMimeType.PARAMETER_NAME_CHARSET, aCharset.name ());
}
origin: com.helger/ph-smtp

new MimeType (CMimeType.TEXT_HTML).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                         aCharset.name ())
                 .getAsString ());
origin: com.helger/ph-http

 @Nullable
 public static IMimeType safeParseMimeType (@Nullable final String sMimeType)
 {
  try
  {
   return MimeTypeParser.parseMimeType (sMimeType);
  }
  catch (final MimeTypeParserException ex)
  {
   if ("*".equals (sMimeType))
    return new MimeType (EMimeContentType._STAR, "*");
  }
  if (LOGGER.isWarnEnabled ())
   LOGGER.warn ("Unparsable MIME type '" + sMimeType + "'");
  return null;
 }
}
origin: phax/ph-css

m_aMimeType = ((MimeType) aMimeType.getClone ()).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                                aCharset.name ());
origin: com.helger/ph-as4-servlet

final ICommonsList <WSS4JAttachment> aIncomingAttachments = new CommonsArrayList <> ();
final IMimeType aPlainContentType = aContentType.getCopyWithoutParameters ();
if (aPlainContentType.equals (MT_MULTIPART_RELATED))
  LOGGER.info ("Received MIME message");
 final String sBoundary = aContentType.getParameterValueWithName ("boundary");
 if (StringHelper.hasNoText (sBoundary))
                          .getCopyWithoutParameters ();
  LOGGER.info ("Received plain message with Content-Type " + aContentType.getAsString ());
origin: com.helger/ph-as4-lib

final SoapMimeMultipart aMimeMultipart = new SoapMimeMultipart (eSOAPVersion, aCharset);
final EContentTransferEncoding eCTE = EContentTransferEncoding.BINARY;
final String sContentType = eSOAPVersion.getMimeType (aCharset).getAsString ();
  final String s = aBAOS.getAsString (StandardCharsets.UTF_8);
  if (s.length () > 0)
   System.out.println (s);
origin: com.helger/ph-oton-core

/**
 * Get the HTML MIME type to use
 *
 * @param aRequestScope
 *        The request scope. May be <code>null</code>-
 * @return Never <code>null</code>.
 */
@Nonnull
public static IMimeType getMimeType (@Nullable final IRequestWebScopeWithoutResponse aRequestScope)
{
 // Add the charset to the MIME type
 return new MimeType (CMimeType.TEXT_HTML).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                             HCSettings.getHTMLCharset ().name ());
}
origin: com.helger/ph-oton-core

public void xml (@Nullable final String sXML, @Nonnull final Charset aCharset)
{
 setContentAndCharset (StringHelper.getNotNull (sXML), aCharset);
 setMimeType (new MimeType (CMimeType.APPLICATION_XML).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                                   aCharset.name ()));
}
origin: com.helger/ph-oton-core

public void json (@Nullable final IJson aValue)
{
 // Ensure it is valid JSON
 final String sResponse = aValue != null ? aValue.getAsJsonString () : "{}";
 final Charset aCharset = StandardCharsets.UTF_8;
 setContentAndCharset (sResponse, aCharset);
 setMimeType (new MimeType (CMimeType.APPLICATION_JSON).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                                    aCharset.name ()));
}
origin: com.helger/peppol-smp-server-webapp

 public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
               @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception
 {
  if (LOGGER.isDebugEnabled ())
   LOGGER.debug ("Status information requested");

  // Build data to provide
  IJsonObject aStatusData;
  if (SMPServerConfiguration.isStatusEnabled ())
   aStatusData = getDefaultStatusData ();
  else
  {
   // Status is disabled in the configuration
   aStatusData = new JsonObject ();
   aStatusData.add ("status.enabled", false);
  }

  // Put JSON on response
  aUnifiedResponse.disableCaching ();
  aUnifiedResponse.setMimeType (new MimeType (CMimeType.APPLICATION_JSON).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                                             CHARSET.name ()));
  aUnifiedResponse.setContentAndCharset (aStatusData.getAsJsonString (), CHARSET);
 }
}
origin: phax/peppol-smp-server

 public void handleRequest (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
               @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception
 {
  if (LOGGER.isDebugEnabled ())
   LOGGER.debug ("Status information requested");

  // Build data to provide
  IJsonObject aStatusData;
  if (SMPServerConfiguration.isStatusEnabled ())
   aStatusData = getDefaultStatusData ();
  else
  {
   // Status is disabled in the configuration
   aStatusData = new JsonObject ();
   aStatusData.add ("status.enabled", false);
  }

  // Put JSON on response
  aUnifiedResponse.disableCaching ();
  aUnifiedResponse.setMimeType (new MimeType (CMimeType.APPLICATION_JSON).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                                             CHARSET.name ()));
  aUnifiedResponse.setContentAndCharset (aStatusData.getAsJsonString (), CHARSET);
 }
}
origin: com.helger/ph-webctrls

 public void execute (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
            @Nonnull final UnifiedResponse aUnifiedResponse) throws Exception
 {
  // Resolve language
  final String sLanguage = aRequestScope.getAttributeAsString (LANGUAGE_ID);
  Locale aLanguage = LocaleCache.getLocale (sLanguage);
  if (aLanguage == null)
  {
   // None or invalid locale specified - use default from constructor
   aLanguage = m_aDefaultLocale;
  }

  // Main action
  final IJsonObject aData = DataTables.createLanguageJson (aLanguage);

  // Fill HTTP response
  final Charset aCharset = CHTMLCharset.CHARSET_HTML_OBJ;
  aUnifiedResponse.setContentAndCharset (aData.getAsString (), aCharset)
          .setMimeType (new MimeType (CMimeType.APPLICATION_JSON).addParameter (CMimeType.PARAMETER_NAME_CHARSET,
                                             aCharset.name ()))
          .enableCaching (ResponseHelperSettings.getExpirationSeconds ());
 }
}
com.helger.commons.mimeMimeType

Most used methods

  • <init>
  • addParameter
  • getAsString
  • getCopyWithoutParameters
  • getParameterValueWithName

Popular in Java

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • BoxLayout (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now