Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errant “accept anything” handling of providers #162

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ protected boolean hasMatchingMediaType(MediaType mediaType)
return CBORMediaTypes.APPLICATION_JACKSON_CBOR_TYPE.getSubtype().equalsIgnoreCase(subtype) ||
"cbor".equalsIgnoreCase(subtype) || subtype.endsWith("+cbor");
}
/* Not sure if this can happen; but it seems reasonable
* that we can at least produce CBOR without media type?
*/
return true;
// Without a media type, let JAX-RS deal with mapping if it can.
return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ protected boolean hasMatchingMediaType(MediaType mediaType)
|| "x-json".equals(subtype) // [Issue#40]
;
}
// Not sure if this can happen; but it seems reasonable
// that we can at least produce JSON without media type?
return true;
// Without a media type, let JAX-RS deal with mapping if it can.
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,8 @@ protected boolean hasMatchingMediaType(MediaType mediaType)
return SmileMediaTypes.APPLICATION_JACKSON_SMILE_TYPE.getSubtype().equalsIgnoreCase(subtype) ||
"smile".equalsIgnoreCase(subtype) || subtype.endsWith("+smile");
}
/* Not sure if this can happen; but it seems reasonable
* that we can at least produce smile without media type?
*/
return true;
// Without a media type, let JAX-RS deal with mapping if it can.
return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,8 @@ protected boolean hasMatchingMediaType(MediaType mediaType)
String subtype = mediaType.getSubtype();
return "xml".equalsIgnoreCase(subtype) || subtype.endsWith("+xml");
}
/* Not sure if this can happen; but it seems reasonable
* that we can at least produce XML without media type?
*/
return true;
// Without a media type, let JAX-RS deal with mapping if it can.
return false;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.StreamingOutput;

import tools.jackson.jaxrs.xml.JacksonXMLProvider;

/**
* Unit tests for verifying that certain JDK base types will be
* ignored by default Jackson JAX-RS conversion provider.
Expand All @@ -20,7 +18,7 @@ public class TestUntouchables
* remains overridable.
*/
public static class MyJacksonProvider extends JacksonXMLProvider {
// ensure isJsonType remains "protected" this is a compile-time check.
// ensure isJsonType remains "protected" this is a compile-time check.
// Some users of JacksonJsonProvider override this method;
// changing to "private" would regress them.
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,8 @@ protected boolean hasMatchingMediaType(MediaType mediaType) {
return "yaml".equalsIgnoreCase(subtype) || subtype.endsWith("+yaml");
//tarik: apparently there is not a standard for yaml types, should be discussed
}
/* Not sure if this can happen; but it seems reasonable
* that we can at least produce yaml without media type?
*/
return true;
// Without a media type, let JAX-RS deal with mapping if it can.
return false;
}

/**
Expand Down