Redirect POST url on Payara 4.1 or 5 Server - http-post

In Payara Server, version 4.1 or 5, is it possible to redirect a POST url?
I know that it is possible with a GET url (in Configuration > HTTP Service > Virtual Servers > server), but I want to do the same with a POST method.

You can do this with a JAX-RS class wich maps your POST URL and returns a Response with a re-direct (HTTP status 307). This is already answered here: Send redirect from a JAX-RS service:
You can use either of the following:
Response.temporaryRedirect(URI)
or:
Response.seeOther(URI)
"Temporary Redirect" returns a 307 status code while "See Other" returns 303.
This is independent of the Payara version and part of the JAX-RS specification.

Related

KeyCloak returns HTTP 204 on HTTP OPTIONS Request

I have a JSF Application running on JBoss EAP 7.2, secured by the KC Java Adapter. The initial login flow works perfectly fine (browser asks for website, adapter intercepts and redirects to KC, user logs in with KC and is being redirected back to the website).
Now, if the user has been logged out (e.g. in KC directly), clicking anywhere on the website (JSF) triggers a POST request to the application, which is being intercepted by the KC Adapter and redirected (302) to KC. This would be fine, but the problem is, the browser then performs a HTTP OPTIONS call to KC instead of HTTP GET, and the KC just returns 204 without any further information.
I also noticed that the KC Server always replies with an empty 204 to a HTTP OPTIONS call, even if there is nothing else in the request.
Is there any way to configure the handling of the OPTIONS requests in KC? Alternatively, is it possible to configure the adapter to send a 303 and thereby force the browser to perform a GET request? I've been searching for hours, and couldn't find anything. Still, I can't imagine being the only person trying to protect a JSF application behind the KC Java adapter, and then having a session timeout.
Thank you!

How to find the URL of a OSB proxy service which do not have wsdl associated

I have a proxy service which accepts text as request and gives text as response. I have a routed node which invokes another business service. I have to make this way because I need to add soap headers to the input before i invoke the business service. Now everything is working fine and i am able to launch test console of the proxy and get it tested. But I am not able to find the direct url to access the proxy service to share it to the customer.
My proxy uri is for eg, /testWS/TestProxy and if i try to give http://:/testWS/TestProxy?wsdl it returns 404 error. I understand this is because there is no wsdl associated to this proxy. But how will i get this working atleast in soap ui?
Regards
Murali
Go into /sbonsole/
Navigate to Project Explorer and find the proxy
Go to Configuration Details tab (the default tab)
the Endpoint URI field has the path details.
(If you weren't sure, the hostname and port are found in /console/ -> environment -> servers - there are Listen Port fields etc)
As far as SoapUI goes, you can either treat the service as a REST service, or you can create the project without a WSDL and add stuff manually (for instance, there's a HTTP Test Request test step that you can use instead of a SOAP test request)
To receive the response in JSON format, you must set the Accept header as application/json

Spring MVC: Reject request coming from other domain/web pages

I have a spring web application. I have some GET & POST request mapper in spring controller. How can i restrict my appliation to accept request making from my site pages only.
i.e if it gets request /insert from example.com pages it should accept this but if it get any request other than www.example.com it should reject. e.g any request from www.xyz.com localhost:8084 should be rejected.
I want to restrict anyone from making GET POST request to my app except if it is from my own domain page.
You can make use of org.springframework.web.servlet.HandlerInterceptor. Implement the logic to check the domain of request in preHandle method via getRequestURL API.

DNS name appended with 445 port in URL

I have a problem in request and responses in a Spring MVC application.
When I hit https://test.abc.com/AppName/security.do in a browser. response url is coming like https://test.abc.com:455/AppName/security.do
In Response Headers Content-Location: https://test.abc.com:455/AppName/security.do
Because of the port appended, application is not accessable. At what stage I can remove or redirect test.abc.com:445 to test.abc.com.
Application is hosted Oracle Server and uses Apache Webserver before that request will travel through content switch.
Thanks
Sunny
The solution is, I think, to set UseCanoncalName variable in Apache config to Off.

SVC WebService works over HTTP, fails over HTTPS

One of my colleagues is having a problem with an AJAX call to a .NET WebService. The call works under HTTP, but the same call is having a problem under HTTPS. The webservice is written in .NET 4.0 with C# on an IIS 7 server.
The secure website is at https://sql.data-rx.com/grouppharmdrugsearch/. There is an unsecured version at http://sql.data-rx.com/grouppharmdrugsearch/. There isn't any sensitive information on the page itself. It is embedded (I believe in a frame) on a client's website that does use HTTPS, and our page needs to be in HTTPS so browsers don't give a mixed secured/unsecured elements present message.
To test the problem on the site you first have to enter a zip code in the second textbox (I have been using 90210 for testing) and then you can enter the first few letters of a drug into the third textbox. After waiting a second or so for additional letters the page calls the webservice to populate a drop down list of possible drug choices beginning with the supplied letters. The secure webservice call is to https://sql.data-rx.com/grouppharmdrugsearch/Service/drugNameAutocomplete.svc/GetDrugList with POST data for 'prefixText' and 'count'. Under HTTP the service call succeeds and populates the drop down; under HTTPS the call gets a 404 error. The HTTPS web service is reachable if you point a browser to https://sql.data-rx.com/grouppharmdrugsearch/Service/drugNameAutocomplete.svc, but the method isn't recognized when it is appended to the service.
I have been using Firefox's Tamper Data addon to compare the service calls and they appear to be exactly the same, except one is to the HTTPS site and one is to the HTTP site, with the referrers changing appropriately. The HTTPS call receives the 404 error, while the HTTP call receives the JSON data.
I believe there may either be something missing from the webservice that would allow the call to function under HTTPS (though I can't think of anything that should matter in this case), or the HTTPS web site itself was misconfigured when it was setup. Any help would be appreciated.
We finally figured out the solution from this site. Basically the binding was only configured for HTTP, not HTTPS, and we need to create a custom binding to allow the webservice to function over HTTPS.

Resources