java


Does ResponseBuilder work with GET request but not POST?


I'm trying to make a response that contains some content as well as adds a bunch of response headers. The desired response headers are stored in a map. I have both a #GET method and a #POST method that call this same success method. The code compiles and runs without errors but when I use Postman to check the response for POST I get "could not get any response". It works fine for GET though.
public static Response success(String content, Map<String, String> httpHeaders) {
TestResponse skeletonRsponse = response(content, httpHeaders);
return buildResponse(skeletonRsponse, httpHeaders);
}
public static Response buildResponse(SmartTestResponse skeletonRsponse, Map<String, String> httpHeaders){
ResponseBuilder responseBuilder = Response.status(Status.OK);
for (Map.Entry<String, String> header : httpHeaders.entrySet()) {
responseBuilder.header(header.getKey(), header.getValue());
}
return responseBuilder.type(MediaType.APPLICATION_JSON)
.entity(skeletonRsponse.getContent()).build();
}
If I just try to return a response without using the ResponseBuilder (and thus without the appended response headers) it works fine for both GET and POST:
public static Response success(String content, Map<String, String> httpHeaders) {
TestResponse skeletonRsponse = response(content, httpHeaders);
return buildResponse(skeletonRsponse);
}
public static Response buildResponse(TestResponse skeletonRsponse){
Response re = Response.status(Status.OK).type(MediaType.APPLICATION_JSON)
.entity(skeletonRsponse.getContent()).build();
return re;
}
Any idea why ResponseBuilder isn't working with POST? Thanks for the help!

Related Links

How to receive object in java socket programming?
java > store large amounts of data [duplicate]
Sending a PluginMessage from BungeeCord to a SpigotServer
Sending e-mail with Google App Engine
Java Double error [closed]
HTTP Status 404 when running java SendMail
Passing ArrayList object as parameter to Copy.copyIn() in CopyManager postgres jdbc
HTTP ERROR: 404 in accessing to kura web ui
Using while loop to determine amount of chars to be created
JFrame low performance
ORA-00917: missing comma - Insert query failed
Iterate over List of array objects
Read excel data depending on one column and feed to java class
How to update a variable in one class from another class
Amount to Words jar file working in ireport designer 5.6.0 but when integrated into a project its not working
When does HttpUrlConnection.usingProxy() return true?

Categories

HOME
xamarin
gitlab
deployment
mediawiki
analysis
installshield
ojdbc
multiple-records
append
apache-cayenne
circular-dependency
vb.net-2010
apache-metamodel
reactcsstransitiongroup
database-replication
google-pagespeed
introduction
facebook-instant-articles
dxf
kannel
applozic
maxmind
buck
quote
preg-match
key-value-observing
twilio-api
phpfreechat
openoffice.org
swift3.0.2
objectlistview
hue
ws-security
node-gyp
pebble-watch
return-value
windows-iot-core-10
iso8601
root-framework
ableton-live
color-picker
azure-sdk
savon
sts-springsourcetoolsuite
file-writing
etsy
websitepanel
uid
prerequisites
responsive-images
event-bubbling
dundas
bigbluebutton
system.reflection
website-monitoring
typekit
oxwall
issuu
phpthumb
expected-exception
cloud-connect
typo3-neos
ms-project-server-2010
opcache
gwt-rpc
seed
plasma
sharp-repository
referrer
tinn-r
pvrtc
simba
mt
nsnetservice
broken-links
javaspaces
errai
buildr
removeclass
transactionscope
xdomainrequest
table-footer
netbeans-7.1
gdlib
wise
nhibernate.search
temporal-database

Resources

Encrypt Message