JSP Baidu Editor Configuration Integration Springmvc attention to detail

Source: Internet
Author: User

Baidu Configurator in the default processing action can handle a variety of requests do not need to write their own, try not to break the Baidu editor's own JSP demo we can directly use the parameter configuration

The configuration of the front and back ends is written in the backend (Php version config in Php/config.json), and when the editor is instantiated, asynchronously reads the backend configuration information, overwriting it in the configuration of the front-end.

The backend Gets the configuration item > instantiates the configuration entry for the incoming configuration item > ueditor.config.js file.

The part we need to configure is

1, the location of the entrance of Ueditor.config.js

        Server Unified Request interface path, if you directly use the JSP demo then here to write the access location in the demo,//We are here to do the action forwarding, through the action forwarded to Baidu provided by the demo JSP so configuration        , ServerURL: RootPath + "/common/baiduuploadenter"

  

2, in Config.json to configure the upload image of the access prefix, that is, the URL http:127.0.0.1/projectname image save path by default relative to the Web root directory.

Baidu configuration of the JSP processor inside the code can not be moved directly to the action can only be processed in the JSP

By looking at the source code discovery because Baidu provided the demo load configuration file method is not flexible enough, if in action is not loaded in the path of the Cofig.json file.

problems with SPRINGMVC integration

Uploaded files will be Springmvc file upload interceptor interception, packaging, so Baidu Editor after receiving the file does not recognize the file format,

So the spring default Commonsmultiparresolver

Replace it with the commonsmultiparresolver we wrote ourselves.

Configuration file Modification

<!--support uploading files--><bean id= "Multipartresolver" class= "Com.fusionzoom.common.utils.CommonsMultiparResolver" ></bean>

  

Custom Commonsmultiparresolver release Baidu Editor's request action

public class Commonsmultiparresolver extends Org.springframework.web.multipart.commons.CommonsMultipartResolver {       /**   * Used to filter the Baidu editor to block commonsmultipartresolver files when uploading files *   /    @Override public    Boolean Ismultipart (Javax.servlet.http.HttpServletRequest request) {               String uri = Request.getrequesturi ();        System.out.println (URI);      Filter using Baidu EmEditor URI        if (uri.indexof ("Common/baiduuploadenter") > 0) {         System.out.println (" Commonsmultipartresolver release ");          return false;        }        System.out.println ("commonsmultipartresolver interception");      return Super.ismultipart (Request);    }  }

  


JSP Baidu Editor Configuration Integration Springmvc attention to detail

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.