Giter Club home page Giter Club logo

Comments (5)

mschrag avatar mschrag commented on September 14, 2024

my original version did and IIRC (it's been a couple years) i ran into problems because everything claims to accept HTML and XML, so it was never clear wtf they ACTUALLY wanted back ... if they say they accept html, do you route them to html page? at the end of the day, it ended up just being way less error prone to just use the file extension. i'm not opposed to supporting accepts headers if it's well-behaved across all the browsers, though.

from wonder.

pascalrobert avatar pascalrobert commented on September 14, 2024

About .html vs the other formats, I guess that if the query was made with XMLHttpRequest (X-Requested-With: XMLHttpRequest), it will not be HTML (unless people want to send HTML fragments?). But I agree that it can be a PITA because of the browsers.

For Content-Type, I did it with:

        if (type == null) {
            String contentType = request().headerForKey("Content-Type");
            if (contentType != null) {
                String[] types = contentType.split("/");
                if (types.length == 2) {
                    type = types[1];
                }
            }
        }

from wonder.

mschrag avatar mschrag commented on September 14, 2024

I think formatNamed will return for both the mime type and the file extension ... it's sort of a weird dictionary.

also, does this let file extensions file if you define them? i'd be fine with this, then -- backwards compatible, etc.

from wonder.

pascalrobert avatar pascalrobert commented on September 14, 2024

Yes, the content-type stuff is done if the file extension was not specified. I added this because I'm playing with JBoss's RestEasy to consume REST services and it's using Content-Type instead of Accept, which is kind of crazy.

from wonder.

paulhoadley avatar paulhoadley commented on September 14, 2024

Closing as an ancient ticket: if someone wants to adopt this idea, by all means re-open this ticket.

from wonder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.