Tabnine Logo
Response.getMimeType
Code IndexAdd Tabnine to your IDE (free)

How to use
getMimeType
method
in
org.geoserver.ows.Response

Best Java code snippets using org.geoserver.ows.Response.getMimeType (Showing top 5 results out of 315)

origin: geoserver/geoserver

public String getMimeType(Object value, Operation operation) throws ServiceException {
  return delegate.getMimeType(value, operation);
}
origin: geoserver/geoserver

/**
 * Get a name for a Content-Disposition attachment filename. The mimetype should match the file
 * extension. The default implementation will use the mimetype and operation id to attempt to
 * build a name.
 *
 * @param value The value that will be serialized
 * @param operation The operation being performed
 * @return null or a filename such as result.txt or map.tiff
 */
public String getAttachmentFileName(Object value, Operation operation) {
  String mimeType = getMimeType(value, operation);
  String opName = operation.getId();
  String name = null;
  if (mimeType != null) {
    name = "geoserver";
    if (opName != null) {
      name = name + "-" + opName;
    }
    String[] typeParts = mimeType.split(";");
    name = name + "." + typeParts[0].split("/")[0];
  }
  return name;
}
origin: geoserver/geoserver

String mimeType = response.getMimeType(result, opDescriptor);
origin: org.geoserver/gs-wfs

@Override
public Response responseDispatched(
    Request request, Operation operation, Object result, Response response) {
  Service service = operation.getService();
  if (service == null
      || service.getId() == null
      || !service.getId().equalsIgnoreCase("wfs")) {
    // not a WFS service so we are not interested in it
    return response;
  }
  String responseMimeType = response.getMimeType(result, operation);
  if (!isGmlBased(responseMimeType)) {
    // no a GML based response
    return response;
  }
  WFSInfo wfs = geoserver.getService(WFSInfo.class);
  GMLInfo gmlInfo =
      wfs.getGML().get(WFSInfo.Version.negotiate(service.getVersion().toString()));
  if (gmlInfo == null || !gmlInfo.getMimeTypeToForce().isPresent()) {
    // we don't need to force any specific MIME type
    return response;
  }
  // enforce the configured MIME type
  String mimeType = gmlInfo.getMimeTypeToForce().get();
  LOGGER.info(
      String.format(
          "Overriding MIME type '%s' with '%s' for WFS operation '%s'.",
          responseMimeType, mimeType, operation.getId()));
  return new ResponseWrapper(response, mimeType);
}
origin: org.geoserver.community/gs-wfs3

@Override
public Response responseDispatched(
    Request request, Operation operation, Object result, Response response) {
  // is this a feature response we are about to encode?
  if (result instanceof FeatureCollectionResponse) {
    HttpServletResponse httpResponse = request.getHttpResponse();
    FeatureCollectionResponse fcr = (FeatureCollectionResponse) result;
    String contentType = response.getMimeType(result, operation);
    if (fcr.getPrevious() != null) {
      addLink(httpResponse, "prev", contentType, fcr.getPrevious());
    }
    if (fcr.getNext() != null) {
      addLink(httpResponse, "next", contentType, fcr.getNext());
    }
  }
  return response;
}
org.geoserver.owsResponsegetMimeType

Javadoc

Returns the mime type to be uses when writing the response.

Popular methods of Response

  • getBinding
  • canHandle
  • getOutputFormats
  • write
  • getAttachmentFileName
  • getCharset
  • getHeaders
  • getPreferredDisposition

Popular in Java

  • Making http requests using okhttp
  • getSystemService (Context)
  • onCreateOptionsMenu (Activity)
  • addToBackStack (FragmentTransaction)
  • String (java.lang)
  • Path (java.nio.file)
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Runner (org.openjdk.jmh.runner)
  • From CI to AI: The AI layer in your organization
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