Skip to content

Commit

Permalink
Fix some EOL characters
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermocalvo committed May 2, 2024
1 parent 5b4062f commit 5e865f5
Show file tree
Hide file tree
Showing 10 changed files with 1,669 additions and 1,669 deletions.
876 changes: 438 additions & 438 deletions grails-encoder/src/main/groovy/org/grails/buffer/StreamByteBuffer.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
/*
* Copyright 2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.grails.encoder.impl;

import groovy.transform.CompileStatic
import org.grails.encoder.CodecFactory
import org.grails.encoder.CodecIdentifier
import org.grails.encoder.Decoder
import org.grails.encoder.DefaultCodecIdentifier
import org.grails.encoder.Encoder

/**
* Implements the 'www-form-urlencoded' encoding scheme, also misleadingly known as URL encoding.
*
* @see <a href="http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1">Chapter 17.13.4 Form content types</a>
* of the <a href="http://www.w3.org/TR/html4/">HTML 4.01 Specification</a>
*
* @since 2.4
*/
@CompileStatic
public class URLCodecFactory implements CodecFactory {
static final CodecIdentifier URL_CODEC_IDENTIFIER = new DefaultCodecIdentifier("URL");

Encoder encoder = new Encoder() {
@Override
public CodecIdentifier getCodecIdentifier() {
URL_CODEC_IDENTIFIER;
}

public Object encode(Object o) {
if(o==null) return o;
URLEncoder.encode(String.valueOf(o), resolveEncoding());
}

public boolean isApplyToSafelyEncoded() {
true;
}

public boolean isSafe() {
true;
}

public void markEncoded(CharSequence string) {

}
};

Decoder decoder = new Decoder() {
public CodecIdentifier getCodecIdentifier() {
URL_CODEC_IDENTIFIER;
}

@Override
public Object decode(Object o) {
if(o==null) return o;
URLDecoder.decode(String.valueOf(o), resolveEncoding());
}
};

protected String resolveEncoding() {
'UTF-8'
}
}
/*
* Copyright 2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.grails.encoder.impl;

import groovy.transform.CompileStatic
import org.grails.encoder.CodecFactory
import org.grails.encoder.CodecIdentifier
import org.grails.encoder.Decoder
import org.grails.encoder.DefaultCodecIdentifier
import org.grails.encoder.Encoder

/**
* Implements the 'www-form-urlencoded' encoding scheme, also misleadingly known as URL encoding.
*
* @see <a href="http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1">Chapter 17.13.4 Form content types</a>
* of the <a href="http://www.w3.org/TR/html4/">HTML 4.01 Specification</a>
*
* @since 2.4
*/
@CompileStatic
public class URLCodecFactory implements CodecFactory {
static final CodecIdentifier URL_CODEC_IDENTIFIER = new DefaultCodecIdentifier("URL");

Encoder encoder = new Encoder() {
@Override
public CodecIdentifier getCodecIdentifier() {
URL_CODEC_IDENTIFIER;
}

public Object encode(Object o) {
if(o==null) return o;
URLEncoder.encode(String.valueOf(o), resolveEncoding());
}

public boolean isApplyToSafelyEncoded() {
true;
}

public boolean isSafe() {
true;
}

public void markEncoded(CharSequence string) {

}
};

Decoder decoder = new Decoder() {
public CodecIdentifier getCodecIdentifier() {
URL_CODEC_IDENTIFIER;
}

@Override
public Object decode(Object o) {
if(o==null) return o;
URLDecoder.decode(String.valueOf(o), resolveEncoding());
}
};

protected String resolveEncoding() {
'UTF-8'
}
}
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
/*
* Copyright 2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.grails.commons;

import grails.core.ArtefactHandlerAdapter;
import org.grails.core.artefact.DomainClassArtefactHandler;

/**
* @author Marc Palmer ([email protected])
*/
public class CodecArtefactHandler extends ArtefactHandlerAdapter {

public static final String TYPE = "Codec";

public CodecArtefactHandler() {
super(TYPE, GrailsCodecClass.class, DefaultGrailsCodecClass.class, TYPE);
}

@Override
public boolean isArtefactClass(@SuppressWarnings("rawtypes") Class clazz) {
if (clazz == null) return false;

return clazz.getName().endsWith(DefaultGrailsCodecClass.CODEC) && !DomainClassArtefactHandler.isDomainClass(clazz);
}
}
/*
* Copyright 2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.grails.commons;

import grails.core.ArtefactHandlerAdapter;
import org.grails.core.artefact.DomainClassArtefactHandler;

/**
* @author Marc Palmer ([email protected])
*/
public class CodecArtefactHandler extends ArtefactHandlerAdapter {

public static final String TYPE = "Codec";

public CodecArtefactHandler() {
super(TYPE, GrailsCodecClass.class, DefaultGrailsCodecClass.class, TYPE);
}

@Override
public boolean isArtefactClass(@SuppressWarnings("rawtypes") Class clazz) {
if (clazz == null) return false;

return clazz.getName().endsWith(DefaultGrailsCodecClass.CODEC) && !DomainClassArtefactHandler.isDomainClass(clazz);
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
/*
* Copyright 2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.grails.plugins.codecs

import org.grails.encoder.impl.URLCodecFactory
import org.springframework.web.context.request.RequestContextHolder

/**
* A codec that encodes and decodes Objects to and from URL encoded strings.
*
* @author Marc Palmer
* @since 0.5
*/
class URLCodec extends URLCodecFactory {
protected String resolveEncoding() {
RequestContextHolder.getRequestAttributes()?.request?.characterEncoding ?: 'UTF-8'
}
}
/*
* Copyright 2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.grails.plugins.codecs

import org.grails.encoder.impl.URLCodecFactory
import org.springframework.web.context.request.RequestContextHolder

/**
* A codec that encodes and decodes Objects to and from URL encoded strings.
*
* @author Marc Palmer
* @since 0.5
*/
class URLCodec extends URLCodecFactory {
protected String resolveEncoding() {
RequestContextHolder.getRequestAttributes()?.request?.characterEncoding ?: 'UTF-8'
}
}
Loading

0 comments on commit 5e865f5

Please sign in to comment.