Skip to content

Can formatTypes be extended to have a CSV type? #3

Description

@seismopaul

I am confused if the formatTypes are restricted to those in the list defined in the documentation, namely the ones included below. Is it possible to add a type of CSV?

When i put format=csv and have a handler that returns CSV data for our web service, the browser barfs with the error shown below:

This page contains the following errors:
error on line 1 at column 1: Document is empty
Below is a rendering of the page up to the first error.

even if I map CSV to text/plain the browser doesn't recognize the return from the WSS. Do I need to spoof the return of csv files somehow so they are sent to files instead? If so, how do I manage that with the WSS and my handler?

Note that my web service if used with wget or curl returns the CSV files just fine and if in the browser I say "View Source" on the given page, I see the CSV. There is something in the return headers that just isn't working for the browser to see it or send it to a file. What am I missing.

I currently have the following settings in my service.cfg file:

formatTypes - specifies a list of "formatType: mediaType" pairs

query.formatTypes =
xml: application/xml,
csv: text/plain,
text: text/plain,
json: application/json

Content-Disposition overrides for respective media types "text" and "miniseed"

#query.formatDispositions= \

text: inline; filename="mypart_${appName}_${UTC}.txt", \

miniseed: attachment; filename="a_miniseed_file.mseed"

query.formatDispositions=
text: attachment; filename="${appName}${UTC}.csv",
csv: attachment; filename="${appName}
${UTC}.csv",
zip: attachment; filename="data.zip"

List of "allowed?" format types extracted from HandlerRequirements.md write up:
formatType Media type
xml application/xml
mseed application/vnd.fdsn.mseed
text text/plain
texttree text/plain
json application/json
binary application/octet-stream

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions