Skip to main content

Posts

Showing posts from July, 2019

Modifying Servlet Filters Request/ Response

  Modifying Servlet Filters Request/ Response Extending custom HttpRequest class with HttpServletRequestWrapper serves many purposes: Modiying request body. Modiying request headers. Modiying response body. Modiying response codes. Convert GET to POST/PUT or vice-versa. public class CustomHttpRequest extends HttpServletRequestWrapper{ // TODO // Code goes here // Methods implemented here } public class CustomHttpResponse extends HttpServletResponseWrapper{ // TODO // Code goes here // Methods implemented here } ** For more detailed solutions, do leave a comment.

Access any Service created in Thingworx using GET Method

    Access any Service created in Thingworx using GET Method As developers must be aware that Ptc based Thingworx has certain limitations when it comes to creation of REST Web-Services. Accessing created Services using GETmethod is one of them. Second being, modifying the response codes. However, a workaround for the same is possible. It can be achieved using Java Servlet Filters.Steps to implement the same is as follows: Create a filter entry in web.xml inside Thingworx (web application). Create a Custom filter class with expected url-patterns in filter entries. Create a custom request-response wrapper to modify request/ response. Modify Response code in the Response Wrapper.