spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Wildfly JAX-RS questiona about Produces


It's not so much a problem with JAX-RS as it is with cURL. If I run the command with the -v switch (verbose), I'll see the request headers

C:	empjbossquickstarthelloworld-rs>curl

                         -v
http://localhost:8080/wildfly-helloworld-rs/rest/ 
                         -H
'accept:application/xml'
* Adding handle: conn: 0x4b6208
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x4b6208) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8080 (#0)
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080
(#0)
> GET /wildfly-helloworld-rs/rest/ HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:8080
> Accept: */*
> 'accept:application/xml'
>
< HTTP/1.1 200 OK
< Connection: keep-alive
< X-Powered-By: Undertow/1
* Server WildFly/8 is not blacklisted
< Server: WildFly/8
< Content-Type: application/json
< Content-Length: 25
< Date: Sun, 23 Nov 2014 03:00:56 GMT
<
{"result":"Hello World!"}* Connection #0 to host
localhost left intact

C:	empjbossquickstarthelloworld-rs>

You can see I get JSON, when I used accept:application/xml

Take a look at the Accept header. It's */* (You can see the accept:application/xml below that isn't used. That being said, when the request is ambiguous, in terms of matchin our resource methods, the results are unpredictable. With me, I always get JSON.

I'm not a big cURL user, so I am not sure how the -H switch is supposed to work, and it's under-workings, but for me ' single quotes don't work, and accept doesn't automatically capitalize (should be Accept).

So use -H "Accept:application/json", it should work. Use the -v switch to see the headers.


Categories : Java

Related to : Wildfly JAX-RS questiona about Produces
wildfly-maven-plugin --> No plugin found for prefix 'wildfly'
Use the FQN (Fully Qualified Name) of the maven goal. mvn org.wildfly.plugins:wildfly-maven-plugin:deploy Should very explicitly start the wildfly deploy goal and use the configuration you have specified. The goal shortcuts only works in your configured pluginGroups in settings.xml, and as you can see it only checks 2 groups [org.apache.maven.plugins, org.codehaus.mojo]

Categories : Maven
URL rewrite in Wildfly?
You may also want to look at Rewrite, which will be the core of PrettyFaces 4. It's more dynamic and can intercept URLs if you require login. http://www.ocpsoft.org/java/migrating-from-prettyfaces-to-rewrite-simplicity-meets-power/ http://www.mastertheboss.com/javaee/servlet-30/rewrite-a-java-ee-url-rewriting-solution

Categories : JSF
migration to jboss wildfly
Your hibernate 3.6 conflicts with hibernate 4.3.8 from wildfly. If you are not using hibernate specified annotations and functions, would be better to migrate to JPA. Good solution, but not perfect, is migrate to hibernate 4.3.8. What variant is less painfull, depends on your application code and architecture.

Categories : Java
Rails .map produces unwanted [" "]
<%= @runnings_past.map do |f| %> <%= f.title %> <% end %> Should actually be <% @runnings_past.each do |f| %> <%= f.title %> <% end %> Notice the lack of = (in addition, I changed map to each because you're just iterating through the array) <%= means evaluate the code and insert the result into the html structure. So what you were doing was evalu

Categories : HTML
@Requestmapping("/") produces 404 with Spring MVC
Change the RequestMapping to below if you want it to hit only "/" @RequestMapping(method = RequestMethod.GET) Give that a go and let me know how it works out for you. Then if you want to add say index to the parameter add the value parameter: @RequestMapping(value = {"/","/index},method = RequestMethod.GET)

Categories : Spring
Recently Add
Android change order of cursor
How to enable Swagger UI? Tomcat, SpringMVC, REST
Decryption pad block corrupted
Is java toBinaryString Incorrect?
Why does JDBC not support Oracle Boolean type
Java RMI: Rejecting requests when saturation is reached
My random numbers are always zero?
Use DelimiterBasedFrameDecoder, StringEncoder, etc outside of pipeline in Netty
Play 2.x: Binding model which contains a list to the template
My activity is going to potentially hold a lot of fragments (5+) how should I create them?
How do I convert 16-bit char array to 8-bit char array and send to c code using JNA?
apache commons-validator alternative for new gTLDS
Wicket Panel inside of a Fragment
when to use constructor injection in spring?
Afterburner.fx fail load resource from object injected
Unable to run under Jetty from Eclipse: Unknown scope: debug
Drawing multiple lines (minimum 9x9) in JFrame
Can't solve "Java heap space" error in eclipse
generic signature to accept Map or Map
Value isn't being brought over
Integrating Selenium Test Suite (Eclipse) with TFS
Java - How to create a new class that extends JFrame and has all GUI components in it while another class has all functionality?
How to correctly use Apache Common BeanUtil's BeanComparator to benefit of introspection?
Java memory issue with animated gif frames
converting ArraList to JSON (in Java) and accessing it with Javascript
How to properly close threads and file handles in async object
TreeMap Element does not removed
Index out of bounds exception when trying to swap the colums of a matrix
How to fix ad to the screen while in scrollview?
Making CRUD in Liferay MVC
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.