Tabnine Logo
ContentTypes$InvalidContentTypeException
Code IndexAdd Tabnine to your IDE (free)

How to use
ContentTypes$InvalidContentTypeException
in
org.apache.shindig.protocol

Best Java code snippets using org.apache.shindig.protocol.ContentTypes$InvalidContentTypeException (Showing top 18 results out of 315)

origin: com.lmco.shindig/shindig-common

public static void checkContentTypes(Set<String> allowedContentTypes,
  String contentType) throws InvalidContentTypeException {
 if (StringUtils.isEmpty(contentType)) {
  throw new InvalidContentTypeException(
    "No Content-Type specified. One of "
      + StringUtils.join(allowedContentTypes, ", ") + " is required");
 }
 contentType = ContentTypes.extractMimePart(contentType);
 if (ContentTypes.FORBIDDEN_CONTENT_TYPES.contains(contentType)) {
  throw new InvalidContentTypeException(
    "Cannot use disallowed Content-Type " + contentType);
 }
 if (allowedContentTypes.contains(contentType)) {
  return;
 }
 throw new InvalidContentTypeException(
   "Unsupported Content-Type "
     + contentType
     + ". One of "
     + StringUtils.join(allowedContentTypes, ", ")
     + " is required");
}
origin: org.wso2.org.apache.shindig/shindig-common

public static void checkContentTypes(Set<String> allowedContentTypes,
  String contentType) throws InvalidContentTypeException {
 if (Strings.isNullOrEmpty(contentType)) {
  throw new InvalidContentTypeException(
    "No Content-Type specified. One of "
      + Joiner.on(", ").join(allowedContentTypes) + " is required");
 }
 contentType = ContentTypes.extractMimePart(contentType);
 if (ContentTypes.FORBIDDEN_CONTENT_TYPES.contains(contentType)) {
  throw new InvalidContentTypeException(
    "Cannot use disallowed Content-Type " + contentType);
 }
 if (allowedContentTypes.contains(contentType)) {
  return;
 }
 throw new InvalidContentTypeException(
   "Unsupported Content-Type "
     + contentType
     + ". One of "
     + Joiner.on(", ").join(allowedContentTypes)
     + " is required");
}
origin: org.gatein.shindig/shindig-common

public static void checkContentTypes(Set<String> allowedContentTypes,
  String contentType) throws InvalidContentTypeException {
 if (StringUtils.isEmpty(contentType)) {
  throw new InvalidContentTypeException(
    "No Content-Type specified. One of "
      + StringUtils.join(allowedContentTypes, ", ") + " is required");
 }
 contentType = ContentTypes.extractMimePart(contentType);
 if (ContentTypes.FORBIDDEN_CONTENT_TYPES.contains(contentType)) {
  throw new InvalidContentTypeException(
    "Cannot use disallowed Content-Type " + contentType);
 }
 if (allowedContentTypes.contains(contentType)) {
  return;
 }
 throw new InvalidContentTypeException(
   "Unsupported Content-Type "
     + contentType
     + ". One of "
     + StringUtils.join(allowedContentTypes, ", ")
     + " is required");
}
origin: apache/shindig

public static void checkContentTypes(Set<String> allowedContentTypes,
  String contentType) throws InvalidContentTypeException {
 if (Strings.isNullOrEmpty(contentType)) {
  throw new InvalidContentTypeException(
    "No Content-Type specified. One of "
      + Joiner.on(", ").join(allowedContentTypes) + " is required");
 }
 contentType = ContentTypes.extractMimePart(contentType);
 if (ContentTypes.FORBIDDEN_CONTENT_TYPES.contains(contentType)) {
  throw new InvalidContentTypeException(
    "Cannot use disallowed Content-Type " + contentType);
 }
 if (allowedContentTypes.contains(contentType)) {
  return;
 }
 throw new InvalidContentTypeException(
   "Unsupported Content-Type "
     + contentType
     + ". One of "
     + Joiner.on(", ").join(allowedContentTypes)
     + " is required");
}
origin: org.apache.shindig/shindig-common

public static void checkContentTypes(Set<String> allowedContentTypes,
  String contentType) throws InvalidContentTypeException {
 if (Strings.isNullOrEmpty(contentType)) {
  throw new InvalidContentTypeException(
    "No Content-Type specified. One of "
      + Joiner.on(", ").join(allowedContentTypes) + " is required");
 }
 contentType = ContentTypes.extractMimePart(contentType);
 if (ContentTypes.FORBIDDEN_CONTENT_TYPES.contains(contentType)) {
  throw new InvalidContentTypeException(
    "Cannot use disallowed Content-Type " + contentType);
 }
 if (allowedContentTypes.contains(contentType)) {
  return;
 }
 throw new InvalidContentTypeException(
   "Unsupported Content-Type "
     + contentType
     + ". One of "
     + Joiner.on(", ").join(allowedContentTypes)
     + " is required");
}
origin: apache/shindig

/**
 * Extract the mime part from an Http Content-Type header
 */
public static String extractMimePart(String contentType) throws InvalidContentTypeException {
 if (Strings.isNullOrEmpty(contentType)) {
  throw new InvalidContentTypeException("No Content-Type specified.");
 }
 contentType = contentType.trim();
 int separator = contentType.indexOf(';');
 if (separator != -1) {
  contentType = contentType.substring(0, separator);
 }
 return contentType.trim().toLowerCase();
}
origin: org.wso2.org.apache.shindig/shindig-common

/**
 * Extract the mime part from an Http Content-Type header
 */
public static String extractMimePart(String contentType) throws InvalidContentTypeException {
 if (Strings.isNullOrEmpty(contentType)) {
  throw new InvalidContentTypeException("No Content-Type specified.");
 }
 contentType = contentType.trim();
 int separator = contentType.indexOf(';');
 if (separator != -1) {
  contentType = contentType.substring(0, separator);
 }
 return contentType.trim().toLowerCase();
}
origin: org.apache.shindig/shindig-common

/**
 * Extract the mime part from an Http Content-Type header
 */
public static String extractMimePart(String contentType) throws InvalidContentTypeException {
 if (Strings.isNullOrEmpty(contentType)) {
  throw new InvalidContentTypeException("No Content-Type specified.");
 }
 contentType = contentType.trim();
 int separator = contentType.indexOf(';');
 if (separator != -1) {
  contentType = contentType.substring(0, separator);
 }
 return contentType.trim().toLowerCase();
}
origin: apache/shindig

@Override
protected void doPost(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: org.apache.shindig/shindig-common

@Override
protected void doPost(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: org.apache.shindig/shindig-common

@Override
protected void doPut(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: com.lmco.shindig/shindig-common

@Override
protected void doPost(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: org.wso2.org.apache.shindig/shindig-common

@Override
protected void doPut(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: org.gatein.shindig/shindig-common

@Override
protected void doPut(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: apache/shindig

@Override
protected void doPut(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: com.lmco.shindig/shindig-common

@Override
protected void doPut(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: org.wso2.org.apache.shindig/shindig-common

@Override
protected void doPost(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
origin: org.gatein.shindig/shindig-common

@Override
protected void doPost(HttpServletRequest servletRequest,
  HttpServletResponse servletResponse)
  throws ServletException, IOException {
 try {
  ContentTypes.checkContentTypes(ALLOWED_CONTENT_TYPES, servletRequest.getContentType());
  executeRequest(servletRequest, servletResponse);
 } catch (ContentTypes.InvalidContentTypeException icte) {
  sendError(servletResponse,
    new ResponseItem(HttpServletResponse.SC_BAD_REQUEST, icte.getMessage()));
 }
}
org.apache.shindig.protocolContentTypes$InvalidContentTypeException

Most used methods

  • <init>
  • getMessage

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • JList (javax.swing)
  • Best IntelliJ plugins
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