Spring Framework HttpRequestMethodNotSupportedException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework HttpRequestMethodNotSupportedException class.

This code example shows how to use the following methods:
	@Override 
	public void handleRequest(HttpServletRequest request, HttpServletResponse response) 
			throws ServletException, IOException { 
 
		if (!"POST".equals(request.getMethod())) { 
			throw new HttpRequestMethodNotSupportedException(request.getMethod(), 
					new String[] {"POST"}, "BurlapServiceExporter only supports POST requests"); 
		} 
 
		try { 
		  invoke(request.getInputStream(), response.getOutputStream()); 
		} 
		catch (Throwable ex) { 
		  throw new NestedServletException("Burlap skeleton invocation failed", ex); 
		} 
	} 
 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getSupportedHttpMethods, getSupportedMethods
    } 
 
    @Override 
    protected HttpHeaders createHeaders(HttpRequestMethodNotSupportedException ex, HttpServletRequest req) { 
 
        HttpHeaders headers = super.createHeaders(ex, req); 
 
        if (!isEmpty(ex.getSupportedMethods())) { 
            headers.setAllow(ex.getSupportedHttpMethods()); 
        } 
        return headers; 
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
		// Check whether we should support the request method. 
		String method = request.getMethod(); 
		if (this.supportedMethods != null && !this.supportedMethods.contains(method)) { 
			throw new HttpRequestMethodNotSupportedException( 
					method, StringUtils.toStringArray(this.supportedMethods)); 
		} 
 
		// Check whether a session is required. 
		if (this.requireSession) { 
			if (request.getSession(false) == null) { 
				throw new HttpSessionRequiredException("Pre-existing session required but none found"); 
			} 
		} 
 
		// Do declarative cache control. 
		// Revalidate if the controller supports last-modified. 
		applyCacheSeconds(response, cacheSeconds, lastModified); 
	} 
 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
    @HandleBeforeLinkSave 
    @PreAuthorize("hasRole('ROLE_ADMIN') or #workTime.employee.id == principal?.id") 
    public void checkUpdateLinkAuthority(WorkTime workTime, Object link) throws HttpRequestMethodNotSupportedException { 
        if(Employee.class.isAssignableFrom(link.getClass())) { 
            throw new HttpRequestMethodNotSupportedException("POST", new String[0]); 
        } 
        log.debug("Updating links {} in work time {}", link, workTime); 
    } 
 
    @HandleBeforeLinkDelete 
    @PreAuthorize("denyAll()") 
    public void checkDeleteLinkAuthority(WorkTime workTime) { 
        //deny all, cannot be called 
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        return storeMetadata(doi, xml, testMode, httpRequest); 
    } 
     
    @RequestMapping(value = "", method = RequestMethod.PUT) 
    public ResponseEntity putRoot() throws HttpRequestMethodNotSupportedException { 
        throw new HttpRequestMethodNotSupportedException("PUT"); 
    } 
 
    @RequestMapping(value = "**", method = RequestMethod.PUT) 
    public ResponseEntity<String> put(@RequestBody byte[] xml, 
                                             @RequestParam(required = false) Boolean testMode, 
                                             HttpServletRequest httpRequest) throws ValidationException, HandleException, SecurityException, UnsupportedEncodingException { 
        String doi = getDoiFromRequest(httpRequest); 
        return storeMetadata(doi, xml, testMode, httpRequest); 
    } 
 
    private ResponseEntity<String> storeMetadata(String doi, byte[] xml, Boolean testMode, HttpServletRequest httpRequest) throws ValidationException, HandleException, SecurityException, UnsupportedEncodingException { 
        String method = httpRequest.getMethod(); 
        if (testMode == null) 
            testMode = false; 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Spring Framework HttpRequestMethodNotSupportedException Methods: